Skip to content

Commit

Permalink
Bone mismatch fix
Browse files Browse the repository at this point in the history
The GLTF plugin in Blender appends a 'neutral_bone' sometimes when exporting to GLB and this can cause a bone 'mismatch' when trying to rebuild weighted PRIMs in RPKG.

This 'fix' just ignores the 'neutral_bone's when rebuilding the weighted PRIMs instead of giving a 'mismatch' error and stopping the rebuilding.

In cases where there is a true bone mismatch, the offending mismatched bone is now also displayed on the error message popup.

Also noted here:
https://wiki.redmodding.org/cyberpunk-2077-modding/for-mod-creators/3d-modelling/troubleshooting-your-mesh-edits#bone-neutral_bone-not-present-in-export-rig-s-import-mesh
  • Loading branch information
2kpr committed Jan 3, 2024
1 parent 45259a8 commit 4d89198
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/rebuild_prim_in.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -817,16 +817,20 @@ void rpkg_function::rebuild_prim_in(std::string& input_path, bool generate_rpkgs

for (uint32_t s = 0; s < temp_skin.jointIds.size(); s++) {
try {
glb_bone_indexes[s] = temp_prim.borg_bone_name_map.at(
document.nodes.Get(temp_skin.jointIds[s]).name);
std::string name = document.nodes.Get(temp_skin.jointIds[s]).name;

if (name == "neutral_bone")
continue;

glb_bone_indexes[s] = temp_prim.borg_bone_name_map.at(name);
}
catch (...) {
LOG("Error: " + glb_file_names.at(j) + "'s mesh " + temp_mesh.name +
" has mismatched bones compared to the original BORG file.");
" has a mismatched bone (" + document.nodes.Get(temp_skin.jointIds[s]).name + ") compared to the original BORG file.");

task_status_string =
"Error: " + glb_file_names.at(j) + "'s mesh " + temp_mesh.name +
" has mismatched bones compared to the original BORG file.";
" has a mismatched bone (" + document.nodes.Get(temp_skin.jointIds[s]).name + ") compared to the original BORG file.";

task_multiple_status = PRIM_REBUILD_MISMATCHED_BONES;

Expand Down

0 comments on commit 4d89198

Please sign in to comment.