Unique identifier for scene nodes

What do I use to uniquely reference a scene node?     Both name and label appear to be poor choices -- name is not enforced unique within the scene, and label can be freely changed by the user.     The node index within the scene also doesn't work becase because the indices shift when nodes are removed.

When I inspect the content of a DUF file the nodes array entries carry a field named "id", which appears to serve this purpose.    How do I get my hands on this value from within the SDK?

 

 

Comments

  • Richard HaseltineRichard Haseltine Posts: 101,482

    id is used only during loading. What are you needing to do? You can use DzElementData and its subclasses to add data to a unique node, will that do what you need?

  • shoei321shoei321 Posts: 113
    edited July 2017

    Hi Richard, I'm not looking to add data to a node.    I need to find a way to reference a node that will remain valid through scene save/load and creation/deletion of other nodes in the scene.     Essentially what I'm after is whatever DzNodeProperty is doing behind the scenes to maintain a persistent reference to the node it has selected.     

    I can't use node label because it is easily changeable by the user.    I can't use node name because it isn't enforced unique.   I can't use node index within the scene because it changes as other nodes are removed/added.   

    To put this in context, I've written a ui widget that lets a user make a selection of nodes within the scene.   I need to find a way to persist that selection so that when the ui dialog is brought up again, the same nodes can be shown as still selected.    

     

     

     

     

     

     

    Post edited by shoei321 on
  • Richard HaseltineRichard Haseltine Posts: 101,482

    Some derivative of DzElementData does what you want - it lets you give a unique identifier to a node which you can read off when populating the dialogue.

Sign In or Register to comment.