Forum: Poser Python Scripting


Subject: Setting "shadow " parameter if a light

Anthony Appleyard opened this issue on Oct 21, 2012 · 6 posts


Anthony Appleyard posted Sun, 21 October 2012 at 7:21 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

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

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