WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   <node3d>.getChildren() subtleties (https://forum.worldviz.com/showthread.php?t=3960)

Enlil 10-11-2011 12:20 PM

<node3d>.getChildren() subtleties
 
I am trying to poll an object loaded from an ive file for it's children. The object always returns an empty list from getChildren(). However, if I use getChild('DVD') (one of the children), it returns a viznode. So I am wondering if there is some subtlety I am missing, possibly something to do with getChild searching deeper than immediate children?

So, the code looks something like:
Code:

obj = viz.add('ObjectsTest.ive')
print obj.getChildren()
(returns [])
print obj.getChild('DVD')
(returns viz.VizNode(35))

Christian

Jeff 10-11-2011 04:27 PM

The node3D.getChildren command will return a list of the immediate Vizard node3d objects that are below that node. It will not return a list of the underlying scene graph nodes.

When you use the node3D.getChild command a new node3d object is created.

You can use the .getNodeNames command to retrieve a list of names of the scene graph nodes underneath the Vizard node:
Code:

model = viz.addChild('gallery.ive')

print 'Model contains the following scene graph nodes:'
for name in model.getNodeNames():
        print ' ',name


Enlil 10-11-2011 05:26 PM

Thanks, that was just what I was looking for!

Christian


All times are GMT -7. The time now is 07:44 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC