-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix doubly-reserved unique names in GLTF scene name assignment #80270
Fix doubly-reserved unique names in GLTF scene name assignment #80270
Conversation
Is there a reason for the name changes? Like Camera3D |
This comment was marked as resolved.
This comment was marked as resolved.
I don't have a strong opinion on the names, but it is a backwards compatibility change I think. It's not common to animate cameras or lights, but it's possible. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
I think the other changes are good, but we're discussing how to arrange the name change. |
be75fb1
to
da89753
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
- Name change from s to scene_dict (no operation / code cleaness)
- Remove _gen_unique_name on the gltf node name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (s.has("name") && !String(s["name"]).is_empty() && !((String)s["name"]).begins_with("Scene")) {
p_state->scene_name = _gen_unique_name(p_state, s["name"]);
} else {
p_state->scene_name = _gen_unique_name(p_state, p_state->filename);
}
This part has the _gen_unique_name
removed as it was a bug.
There is a rename from s
to scene_dict
and caching the gltf_node_name.
What's the impact on compatibility for scenes imported in 4.1, and with changes to the nodes which would get a rename? I already had to deal with such a compat breakage between 4.0 and 4.1 in gdquest-demos/godot-4-3d-third-person-controller#30, and that wasn't pretty. We should do our best to avoid breaking projects as far as possible. |
@akien-mga I actually tested on that exact project last week. Every node in every GLB file in that project is named, therefore there are no auto-generated names, therefore this PR does not affect that project at all. I think most people use GLB files exported from Blender, and Blender requires all nodes to have unique names, so this PR should not affect any GLB file exported from Blender. |
Thanks! |
This PR has 2 related but technically independent bugfixes. I could separate them but I figured I'd just make one PR. These fixes very slightly change behavior, so do not cherry-pick this to 4.1.x, but it's good for 4.2.
_assign_node_names
. Test file:Behavior in master:
Behavior in this PR:
_parse_scenes
reserving as priority over node names and breaking node names. Test file:Behavior in master:
Behavior in this PR:
Note: In the future I do want the scene name to be used as the root node name in some situations. However, in the current master this does not happen, and in the future when we do want this to happen, the current part of the code reserving the name is the wrong place to do it. We want to do it later on so that the actual nodes in the GLTF file have their names take priority, and the names of the nodes Godot generates are secondary.