When (what kind of circumstance) there can be more than 1 NodeReference with the same ReferenceRole?

Hi everyone,

I got confused when requiring a node using ReferenceRole.
As far as I know about the scene file, one NodeReferenceRole seems to appear only once in a node description.

How can we add the 2nd NodeReference into a node using the same ReferenceRole?
And when (at what kind of circumstance) should we call node.GetNumberOfNodeReferences(refRole)?

Thank you so much in advance!

not only node.GetNumberOfNodeReferences(refRole),
but also node.GetNthNodeReference(refRole, n).

If we get
node.GetNumberOfNodeReferences(refRole) > 1 == True, what would we get by calling

node.GetNodeReference(refRole)

Do we get just one node, or a list of nodes?

You can assign multiple nodes to the same reference role. For example, a model node node can have multiple display nodes, each using the “display” role.

Most commonly you can use convenience methods that get/set the first node for a role (such as SetNodeReferenceID, GetNodeReference). In case you may have multiple nodes for a role, you can use GetNumberOfNodeReferences/GetNthNodeReference.../SetNthNodeReference... methods.

1 Like