-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
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
Import/export GLTF extras to node->meta
and back
#86183
base: master
Are you sure you want to change the base?
Conversation
Please open a proposal to discuss the need and use cases for this feature |
Thanks, looks like there is one in godotengine/godot-proposals#8271, so I'll try to reuse that one |
I tested it with a sample scene and overall it works well but I noticed a few things:
|
acfb4fc
to
d26cf93
Compare
@noidexe I've uploaded new version
|
Part of my goal is that meta import and export is symmetrical for gltf. Let me know if thats too much or you agree. |
I was thinking the same thing. I wanted to add a test that creates a scene, serializes it to gltf, deserializes it and checks it has the right meta, but the fact the mesh re-generation is happening in ResourceImporterScene makes testing it hairy. I also don't understand github too much, so thought I was not including it in this PR, but somehow my in-progress stuff got attached - ignore it for now, I'll try to figure out. |
I feel bad for having you review this, apologies. I meant to say in my last comment that it needs more work - especially the test change, which I did not want to attach at all. I guess I should mark it as draft? |
5d47d41
to
e59dac2
Compare
I've added both import and export as discussed in #86183 (comment) and added a test it works as expected. I haven't found any import/export testing to take inspiration from - it might be my unfamiliarity with Godot, but the test has to instantiate way more of Godot that I would like - the whole import process is extremely intertwined with Editor/Engine (and their subsequent dependencies). It's also not possible to do this in-memory, so a number of files (.gltf, .bin, .scn) get written and subsequently read from disk during the test run, which I'm not happy about. Please take a look, cheers |
@demolke Please review the CI failure and resolve all issues until the CI turns green. Only then is it ready for human review. |
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.
@akien-mga Does the way the test case hooks into the editor look fine to you? Another option is to have the tests only use GLTFDocument/GLTFState, the same as the runtime import/export pipeline. However it seems like a good idea to allow test cases to test the editor's full import pipeline.
be806e3
to
cabba71
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.
Thank you for this! This looks good from the GLTF and import pipeline side of things.
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.
Reviewed on a call with fire. Looks good.
The only thing we need to fix is one case which looks like it may be use-after-free. we should reorganize that function to ensure the memdelete is after we copy meta from p_original_node
.
After thinking about it more, I agree that this is a good idea. If someone uses the .blend importer and that generates extras, the fact that the .blend file importer uses GLTF under the hood is an implementation detail, and the user ideally shouldn't know. So yeah, I like this PR as-is. |
Hmm, I am worried extras is not something I think most people will understand. (It is a technical term in the gltf spec...) |
In absence of other suggestions, I think The only other one I can see working is |
I do like that |
3f1b892
to
7e11089
Compare
429a345
to
26d15cb
Compare
This is useful for custom tagging of objects with properties (for example in Blender) and having this available in the editor for scripting. - Adds import logic to propagate the parsed GLTF extras all the way to the resulting Node->meta - Adds export logic to save Godot Object meta into GLTF extras - Supports `nodes`, `meshes` and `materials` (in GLTF sense of the words)
This is useful for custom tagging of objects with properties (for example in Blender) and having this available in the editor for scripting.
extras
all the way to the resulting Node->meta where it createsextras
dictionarymeta
/extras
dictionary into GLTFextras
nodes
,meshes
andmaterials
(in GLTF sense of the words)Closes: godotengine/godot-proposals#8271