Thu, Jan 9, 6:07 AM CST

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)

We now have a ProPack Section in the Poser FreeStuff.
Check out the new Poser Python Wish List thread. If you have an idea for a script, jot it down and maybe someone can write it. If you're looking to write a script, check out this thread for useful suggestions.

Also, check out the official Python site for interpreters, sample code, applications, cool links and debuggers. This is THE central site for Python.

You can now attach text files to your posts to pass around scripts. Just attach the script as a txt file like you would a jpg or gif. Since the forum will use a random name for the file in the link, you should give instructions on what the file name should be and where to install it. Its a good idea to usually put that info right in the script file as well.

Checkout the Renderosity MarketPlace - Your source for digital art content!



Subject: RayTraceShadows


c1rcle ( ) posted Sun, 08 June 2003 at 1:51 PM · edited Sat, 03 August 2024 at 8:26 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

file_61953.jpg

ps there are tabs in all the right places, here's the py file I have so far just in case.


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.

My python page
My ShareCG freebies


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)

My python page
My ShareCG freebies


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.

My python page
My ShareCG freebies


Privacy Notice

This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.