Provided a container interface for vrdObject
and vrdNode
child lists.
In VRED 2022.1, we have provided a consistent container interface for vrdObject
lists. This enables children of nodes to be accessed with node.children
. The returned collection can be used to add, remove, or search for child nodes.
See the following example code:
n = vrNodeService.findNode("Root")
box1 = vrdNode(createBox(10,10,10,3,3,3,1,1,0))
box1.setName("Box1")
box2 = vrdNode(createBox(10,10,10,3,3,3,1,1,0))
box2.setName("Box2")
box3 = vrdNode(createBox(10,10,10,3,3,3,1,1,0))
box3.setName("Box3")
group = vrdNode(createNode("Group"))
vrUndoService.beginUndo()
group.children.append(box1)
group.children.insert(0,box2)
group.children.remove(box1)
vrUndoService.endUndo()
print(group.children.size())
print(group.children[0].getName())
print(len(group.children))
if box1 in group.children:
print("box1 in children, OK")
if box3 not in group.children:
print("box3 not in children, OK")
for c in group.children:
print(c.getName())