Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Sep 18 2:50 am)
P5 lacks a method to just turn lights on and off without affecting the Intensity (SetLightOn(x) was introduced in P6).
I suspect that the only way to achieve what you want will be to write a pose file for the current light intensities, so that you can later restore them.
This is more complicated than what would be needed for P6 and above, so you may want to look at ockham's LightPanel script to see how that sort of thing is done.
I would write out the light values to a temp file , then you can read them back in later.
myfile = "c:templightvalues.txt"
fo = file("myfile,"w")
for light in lights:
write light.value + "n"
fo.close()
#reading a file
myfile = "c:templightvalues.txt"
fi = file(myfile,"r")
for line in fi :
fi.close()
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.
I am no longer sure, if it can be done with Poser5. I want to switch off
all lights of a given scene, without deleting nor changing the values and - optional -
to switch them on again.
here is a small script that does the job, but it's not exactly what I
envisioned. If I set all intensity values to 0, I cannot restore the original intensity
settings.
---8<---
Set Intensity of All Lights to 0
import poser
scene=poser.Scene()
lights=scene.Lights()
for light in lights:
actor = scene.Actor(light.Name())
print(actor)
for dials in actor.Parameters():
print (dials.Name())
actor.Parameter("Intensity").SetValue(0)
scene.DrawAll()
---8<---
I found the SetOnOff method, but for the lights it is not what I need.
It only switches the "faked" light objects on and off, but not the lights
themselves.
some tips appreciated :)