Tue, Nov 19, 7:45 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 Sep 18 2:50 am)

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: Setting "shadow " parameter if a light


Anthony Appleyard ( ) posted Sun, 21 October 2012 at 7:21 AM · edited Tue, 19 November 2024 at 7:42 AM

import poser
import string
import aasubrs
reload(aasubrs)
scn = poser.Scene()
for a in scn.Actors():
    if a.IsLight():
        print "found light ",a.Name()
        a.SetShadow(1)
        a.Set??????????(0.5)
poser.ProcessCommand(1559)
#scn.DrawAll();

In this Python script, as run under Poser 7, what Poser Python function should I call to set the parameter called "Shadow" in a light's parameter box in Poser 7?


PhilC ( ) posted Sun, 21 October 2012 at 7:40 AM · edited Sun, 21 October 2012 at 7:42 AM

In Poser 7 I see the checkbox "Shadows".
The Python method is:-

SetShadow(1) #shadows off
SetShadow(0) #shadows off

The dials are set with:-

SetShadowBiasMax(value) # float value
SetShadowBiasMin(value) # float value
SetShadowBlurRadius(value) # float value

If I recall correctly the Properties panel will not update unless you manually force it by switching to the Parameters panel and back again.


Anthony Appleyard ( ) posted Sun, 21 October 2012 at 7:58 AM · edited Sun, 21 October 2012 at 7:59 AM

file_487865.jpg

I am trying to use Python to alter the parameter "Shadow" which is at the top of the list in this image. I usually use Poser 7.


Dizzi ( ) posted Sun, 21 October 2012 at 10:20 AM

p=a.ParameterByCode(poser.kParmCodeDEPTHMAPSTRENGTH)
p.SetValue(0.5)



markschum ( ) posted Sun, 21 October 2012 at 11:06 AM

In Poser 7 you can use lites = scn.Lights()  instead of getting and filtering the actors list.

 


Anthony Appleyard ( ) posted Sun, 21 October 2012 at 11:50 AM

Thanks. It works.

import poser
import string
import aasubrs
reload(aasubrs)
scn = poser.Scene()
for a in scn.Actors():
    if a.IsLight():
        print "found light ",a.Name()
        a.ParameterByCode(poser.kParmCodeDEPTHMAPSTRENGTH).SetValue(0.5)
        a.SetShadow(1)
poser.ProcessCommand(1559)
#scn.DrawAll


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.