Skip to content

Commit

Permalink
Merge pull request #53140 from V-Sekai/gltf_naming_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga authored Sep 28, 2021
2 parents 508a616 + c6387e5 commit dbe0e46
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions modules/gltf/gltf_document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,9 +598,9 @@ Error GLTFDocument::_parse_scenes(Ref<GLTFState> state) {
}

if (s.has("name") && !String(s["name"]).empty() && !((String)s["name"]).begins_with("Scene")) {
state->scene_name = _gen_unique_name(state, s["name"]);
state->scene_name = s["name"];
} else {
state->scene_name = _gen_unique_name(state, state->filename);
state->scene_name = state->filename;
}
}

Expand Down Expand Up @@ -4960,6 +4960,9 @@ void GLTFDocument::_assign_scene_names(Ref<GLTFState> state) {

n->set_name(_gen_unique_name(state, n->get_name()));
}

// Assign a unique name to the scene last to avoid naming conflicts with the root
state->scene_name = _gen_unique_name(state, state->scene_name);
}

BoneAttachment *GLTFDocument::_generate_bone_attachment(Ref<GLTFState> state, Skeleton *skeleton, const GLTFNodeIndex node_index, const GLTFNodeIndex bone_index) {
Expand Down

0 comments on commit dbe0e46

Please sign in to comment.