-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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 GLTF exporting invalid meshes and attempting to export gizmo meshes #87934
Fix GLTF exporting invalid meshes and attempting to export gizmo meshes #87934
Conversation
/** | ||
* Warns about `m_msg` only when verbose mode is enabled. | ||
*/ | ||
#define WARN_VERBOSE(m_msg) \ |
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.
I'm ok with this, but typically need an opinion from the core team about these additions to macros.
I'll try my test case from https://github.com/V-Sekai-fire/SK_skeleton_merge_cat_fire_merge_01/blob/main/SK_merge_tool_01/scenes/black_cat_fire_base_01.tscn when I have a animation attached to a vrm |
I lose the face blend shapes. https://github.com/V-Sekai/v-sekai-other-world/blob/main/tools/TOOL_godot_ik/ik_test.tscn I posted the project. Will try to see where it breaks and if it's related to this pr. Edit: It does seem to pass blender import without error so the pr does its stated goals. |
BUG: the animation that is in the scene isn't associated with the export. |
@fire The loss of blend shapes is happening during import due to a faulty property setter in vrm_secondary.gd (I see you have addons/vrm in your project). The property setter causes a gizmo to be added during the import process, as an internal child (INTERNAL_MODE_FRONT) which triggers a Godot bug in Node::replace_by since it keeps the internal index but does not forward data.internal_mode to add_child. Anyway, the bug you hit with the face which I describe above is during import and unrelated to this export PR. It just happens to have a similar cause. So this shouldn't block merging. |
Thanks! |
Cherry-picked for 4.2.2. |
This PR has 2 related but technically distinct bug fixes:
Fix GLTF exporting invalid meshes. In GLTF it is not allowed to have an empty mesh. The export code will now check for this and fail, instead of exporting something that did not comply to the glTF specification.
Fix GLTF exporting trying to export non-owned nodes in the editor. These are created by tool scripts, such as custom gizmo code. These nodes are temporary, usually for visualization purposes, they are not saved to the Godot scene and should not be saved in the GLTF file. In the event that somebody does want a tool script to save to the scene persistently and be exported to GLTF, you just need to set the owner to the scene root.
Note: This only affects the editor. User code at runtime is likely not using the owner system and therefore for runtime exports we should include all nodes like we have already been doing.
Note: This adds a new macro,
WARN_VERBOSE
, to only show a warning when in verbose mode. Lyuma was concerned about spamming warnings for valid workflows, which makes sense.