c1rcle opened this issue on Jun 08, 2003 ยท 6 posts
c1rcle posted Sun, 08 June 2003 at 1:51 PM
I'm getting right (insert swear words here) with Python today. I've managed to get a nice little script that selects each light in turn, but I can't work out how to have it set the ray trace shadows option. here's the script I have so far import poser scene=poser.Scene() lights=scene.Lights() for light in lights: actor = scene.Actor(light.Name()) scene.SelectActor(actor) scene.SetRayTraceShadows() doesn't work, what am I doing wrong?
c1rcle posted Sun, 08 June 2003 at 1:53 PM
ockham posted Sun, 08 June 2003 at 2:12 PM
First, you don't need to do the SelectActor step in this case. Second, the light functions need to be attached to the light variable, not to the Scene variable. Here's a script that works: for OneLight in scene.Lights(): # Go through all lights ~OneLight.SetRayTraceShadows(0) # turn off RayTrace This works on my P5, but remember that the new functions are only available in SR3.
ockham posted Sun, 08 June 2003 at 2:13 PM
I should add that, of course, you need the usual overhead stuff, but you know that part. import poser scene = poser.Scene() for OneLight in scene.Lights(): ~OneLight.SetRayTraceShadows(0)
c1rcle posted Sun, 08 June 2003 at 2:31 PM
I'm kicking myself right now :D thanks ockham, I had a feeling you'd be able to tell me where I was going wrong.
ockham posted Sun, 08 June 2003 at 2:42 PM
One general rule that might help: SelectActor and SelectFigure are just about useless. CurrentActor and CurrentFigure are very useful, because one common use of a script is to select a Figure or Actor by clicking in the display, then apply the script to whatever is already selected. But there's just not much reason to do the -selection- inside the script. The sole exception I can recall is in P4, where deletion involves calling SelectActor and then DeleteCurrentActor. But that's been cleaned up in P5 with a more direct Delete function. Other than that, I can't think of any good reason to use Select at the Python level.