Skip to content

Commit

Permalink
Fix axis reset of unmapped bones on retargeting
Browse files Browse the repository at this point in the history
  • Loading branch information
ydeltastar committed May 5, 2024
1 parent 7ebc866 commit 9cb0eed
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions editor/import/3d/post_import_plugin_skeleton_rest_fixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,13 +472,20 @@ void PostImportPluginSkeletonRestFixer::internal_process(InternalImportCategory
int prof_idx = profile->find_bone(src_bone_name);
if (prof_idx >= 0) {
tgt_rot = src_pg.inverse() * prof_skeleton->get_bone_global_rest(prof_idx).basis; // Mapped bone uses reference pose.
}
/*
// If there is rest-relative animation, this logic may be work fine, but currently not so...
} else {
// tgt_rot = src_pg.inverse() * old_skeleton_global_rest[src_idx].basis; // Non-Mapped bone keeps global rest.
bool has_mapped_child = false;
for (int i = 0; i < src_children.size(); i++) {
StringName child_bone_name = is_renamed ? StringName(src_skeleton->get_bone_name(src_children[i])) : bone_map->find_profile_bone_name(src_skeleton->get_bone_name(src_children[i]));
if (profile->has_bone(child_bone_name)) {
has_mapped_child = true;
break;
}
}

if (!has_mapped_child) {
tgt_rot = src_pg.inverse() * old_skeleton_global_rest[src_idx].basis; // Non-Mapped bone without mapped children keeps global rest.
}
}
*/
}

if (src_skeleton->get_bone_parent(src_idx) >= 0) {
Expand Down

0 comments on commit 9cb0eed

Please sign in to comment.