Skip to content

Node.index attribute#2632

Draft
2frac wants to merge 3 commits into
KhronosGroup:mainfrom
2frac:node_index_attribute
Draft

Node.index attribute#2632
2frac wants to merge 3 commits into
KhronosGroup:mainfrom
2frac:node_index_attribute

Conversation

@2frac

@2frac 2frac commented Dec 25, 2025

Copy link
Copy Markdown
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant