PDA

View Full Version : how to enable node and all children


michaelrepucci
08-01-2008, 07:02 AM
I've created a number of on-the-fly objects (e.g., parent=viz.endlayer() and child=viz.endlayer() each with their own custom vertices), some of which I then link to each other with the command:

child.parent(parent)

I would then like to enable lighting for an object and all its children. I thought the command:

parent.enable(viz.LIGHTING)

would do this, but it didn't seem to work. So I tried:

parent.enable(viz.LIGHTING,'',viz.OP_TRAVERSE)
or
parent.enable(viz.LIGHTING,'',viz.OP_OVERRIDE)

but those also didn't work. I guess I misunderstand how to do this. Could someone please help?

farshizzo
08-01-2008, 11:06 AM
The following should work:parent.enable(viz.LIGHTING,op=viz.OP_ROOT|viz .OP_TRAVERSE)This will perform the operation to include all children Vizard nodes. You can also place all the objects underneath a group node, which will automatically perform all operations on its childeren, without needing to specify the op mode.

michaelrepucci
08-01-2008, 11:47 AM
Thanks! That works wonders, and the default behavior you described when objects are collected under a group node explains a subtlety I didn't previously understand: that enable(viz.LIGHTING) was changing all children in some of my objects (i.e., those in a group), but not for others (i.e., those not in a group).

I thought I'd read the documentation pretty thoroughly but I didn't see anything covering group nodes - I learned about them through another forum post. I would have liked to see this documentation in the "Reference"->"3D models" section. Can I suggest that this be added, or if I overlooked the discussion on group nodes, can you point me towards it? Thanks again and in advance!