mirror of
https://github.com/godotengine/godot.git
synced 2024-12-27 11:24:59 +08:00
Merge pull request #77505 from lyuma/rest_fixer_skin_mutation
Avoid mutating the same Skin multiple times.
This commit is contained in:
commit
15b7a8e7f1
@ -609,8 +609,8 @@ void PostImportPluginSkeletonRestFixer::internal_process(InternalImportCategory
|
|||||||
if (is_rest_changed) {
|
if (is_rest_changed) {
|
||||||
// Fix skin.
|
// Fix skin.
|
||||||
{
|
{
|
||||||
|
HashSet<Ref<Skin>> mutated_skins;
|
||||||
TypedArray<Node> nodes = p_base_scene->find_children("*", "ImporterMeshInstance3D");
|
TypedArray<Node> nodes = p_base_scene->find_children("*", "ImporterMeshInstance3D");
|
||||||
int skin_idx = 0;
|
|
||||||
while (nodes.size()) {
|
while (nodes.size()) {
|
||||||
ImporterMeshInstance3D *mi = Object::cast_to<ImporterMeshInstance3D>(nodes.pop_back());
|
ImporterMeshInstance3D *mi = Object::cast_to<ImporterMeshInstance3D>(nodes.pop_back());
|
||||||
ERR_CONTINUE(!mi);
|
ERR_CONTINUE(!mi);
|
||||||
@ -619,6 +619,10 @@ void PostImportPluginSkeletonRestFixer::internal_process(InternalImportCategory
|
|||||||
if (skin.is_null()) {
|
if (skin.is_null()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (mutated_skins.has(skin)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
mutated_skins.insert(skin);
|
||||||
|
|
||||||
Node *node = mi->get_node(mi->get_skeleton_path());
|
Node *node = mi->get_node(mi->get_skeleton_path());
|
||||||
ERR_CONTINUE(!node);
|
ERR_CONTINUE(!node);
|
||||||
@ -638,8 +642,6 @@ void PostImportPluginSkeletonRestFixer::internal_process(InternalImportCategory
|
|||||||
skin->set_bind_pose(i, adjust_transform * skin->get_bind_pose(i));
|
skin->set_bind_pose(i, adjust_transform * skin->get_bind_pose(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
skin_idx++;
|
|
||||||
}
|
}
|
||||||
nodes = src_skeleton->get_children();
|
nodes = src_skeleton->get_children();
|
||||||
while (nodes.size()) {
|
while (nodes.size()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user