-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Change the way GLTFDocumentExtension classes are registered #66026
Conversation
We designed this in conversation in discord. Will review. Maybe @lyuma |
3efeffa
to
acf3894
Compare
9dd1e02
to
be0eada
Compare
We had further review with @lyuma and @aaronfranke today. Decisions discussed in newest order first.
|
be0eada
to
22c2e3d
Compare
EDIT: I also opened #66094 which is another subset of this PR. |
The starting message is now out of date and the pr needs rebase. Working on #66094 |
22c2e3d
to
4e9d5e4
Compare
4e9d5e4
to
5a9b7c4
Compare
I wasn't able to work on this this weekend. I'll see if I can get someone from our group to check. |
5a9b7c4
to
0975bf8
Compare
0975bf8
to
4bb926f
Compare
4bb926f
to
13824f6
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.
Thanks for splitting. It makes review better.
@@ -44,13 +45,13 @@ | |||
|
|||
class GLTFDocument : public Resource { | |||
GDCLASS(GLTFDocument, Resource); | |||
TypedArray<GLTFDocumentExtension> document_extensions; | |||
static Vector<Ref<GLTFDocumentExtension>> all_document_extensions; | |||
Vector<Ref<GLTFDocumentExtension>> document_extensions; |
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.
We devised this way to implement the two lists of extensions. Active vs all.
13824f6
to
1e4b558
Compare
I won't be the one to block this review over this since I'm not familiar enough with the usage of C++ elsewhere, but I would like to warn you against the use of a
The Godot pattern that I would suggest to use is to have a GLTFExtensionRegistry singleton, which is initialized in module init and destructed in module uninit, avoiding the use of complex static objects. |
@lyuma 's method is more robust. Can you investigate @aaronfranke ? |
@fire @lyuma I'm not familiar enough with that to be confident in any changes. If there is a better approach I'd want feedback from a core Godot dev like @reduz or @akien-mga before I do potentially unnecessary work that I'm unfamiliar with. Also, |
1e4b558
to
3cb3faa
Compare
4086127
to
196c8cc
Compare
I apologize for the delay, it's on reduz's review list. |
Also move GLTFDocumentExtension into the extensions folder
196c8cc
to
73c673a
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.
I think this is good. We've waited an extended period and reduced the scope.
Thanks! |
This PR changes the way GLTFDocumentExtension classes are registered. Previously the single extension was registered in GLTFDocument's constructor, which is not a good approach. This PR allows using GLTFDocumentExtension from GDScript or GDExtension unlike the old approach which only worked well for code directly in core.
There is now a static Vector
all_document_extensions
, and there is a method to add to this. This allows registering GLTFDocumentExtensions that can be used. Whether a GLTFDocumentExtension is actually used for a particular file import depends on the result of import_preflight, if it returns an error then the document extension will not be used (if it returns OK, it will be used, and we add the document extension to a non-static Vector per each instance of GLTFDocument).All GLTFDocumentExtension classes are assumed to be stateless.
This work was sponsored by The Mirror.