PDA

View Full Version : refs.dependents usage?


3rd Dimentia
04-25-2010, 06:00 AM
Hi I have a point3Script controller assigned to the diffuse color of a material. I want to be able to access the cylinder that this material is assigned to so that I can change the color of the material based on the height of the cylinder that it's assigned to. I'm going to be making a bunch of these cylinders each with their own uniquely named material. So no worry about the material being assigned to more than one object. The way that I have working right now is doing the job, but I can't help think there would be a more elegant way to go about it than this. Can anyone help?


daDependents = (refs.dependents this)
disObjects = for ref in daDependents where (superClassOf ref == GeometryClass) collect ( ref )
disObject = disObjects[1]



Cheers,
Cg.

denisT
04-25-2010, 07:27 AM
Hi I have a point3Script controller assigned to the diffuse color of a material. I want to be able to access the cylinder that this material is assigned to so that I can change the color of the material based on the height of the cylinder that it's assigned to. I'm going to be making a bunch of these cylinders each with their own uniquely named material. So no worry about the material being assigned to more than one object. The way that I have working right now is doing the job, but I can't help think there would be a more elegant way to go about it than this. Can anyone help?


daDependents = (refs.dependents this)
disObjects = for ref in daDependents where (superClassOf ref == GeometryClass) collect ( ref )
disObject = disObjects[1]



Cheers,
Cg.


-- if this is the material
theNode = refs.dependentNodes this firstOnly:on

CGTalk Moderation
04-25-2010, 07:27 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.