Page MenuHome

Cleanup: Add accessor for node index
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Dec 2 2022, 9:21 PM.

Details

Summary

Add bNode::index() to allow accessing node indices directly without manually
de-referencing the runtime struct. Also adds some asserts to make sure the access
is valid and to check the nodes runtime vector.

Eagerly maintain the node's index in the tree so it can be accessed without
relying on the topology cache.

Diff Detail

Repository
rB Blender

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Dec 2 2022, 9:21 PM
Hans Goudey (HooglyBoogly) created this revision.
Hans Goudey (HooglyBoogly) edited the summary of this revision. (Show Details)
Hans Goudey (HooglyBoogly) edited the summary of this revision. (Show Details)
source/blender/blenkernel/BKE_node_runtime.hh
471

Given that nodes_by_id is updated eagerly, maybe the node index should also be updated eagerly? Seems like that should happen in exactly the same places.

Hans Goudey (HooglyBoogly) planned changes to this revision.Dec 5 2022, 3:43 PM

Sure, I can look into that.

Hans Goudey (HooglyBoogly) edited the summary of this revision. (Show Details)

Using nodeUniqueID to set the index made that relatively straightforward.

This revision is now accepted and ready to land.Dec 11 2022, 9:31 PM
This revision was automatically updated to reflect the committed changes.