Node.index attribute#2632
Draft
2frac wants to merge 3 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uses #2577 (its easier to see impact with other parts being optimized, also actually uses some logic from), so this is draft.
Adds index attribute to Node, and uses it for GlTF2Exporter.__to_reference()'s search, which mean there is no need to iterate all existing nodes for every new added one.
Mostly affects files with instancing, but also can help with files with big number of nodes. Speeds up export a lot(for my example it changes time from ~88sec to ~8sec). Unused in import.
Should only work if Node object is used in only one export.
Now, this PR contradicts idea of data classes being generated with quicktype. So, maybe new code commentary is needed(along with others such).
(In my viewpoint it is better to have manually written classes(even if on top of current generated), and there is even potential for things to became slower in new quicktype versions - but this is just an assumption).
Also there is an option to store indices in GlTF2Exporter using name as key instead(considering name is unique), but that mean slightly more complex state management.
There is more classes which can use index logic - can add them too, but Node seems to be most used.
Blender version used for testing - 5.0.1 RC
File used for testing: big_instancing.zip