Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Sep 18 2:50 am)
Cut-and-pasting the script as posted (and correcting the forum-induced indent/tab errors) I can't get it to fail at all now in Poser 8 or 9 (although I'll keep trying - I know it did fail before!)
But in Poser 6 a pattern seems to be emerging:
Can anybody explain the Poser 6 effect, and (more importantly) how to get round it?
And if anybody else gets it to fail in Poser 8/9 can you let me know?
The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.
*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).
I think I've found the conditions for the "Poser 8/9 'Light Control' widget not updating unless I nudge something (e.g. camera trackball)" problem. It seems to occur if I call my Python script from a PP2 file, like this (which is the way I want to do it):
{
version
{
number 6
}
runPythonScript ":Runtime:Python:poserScripts:3DCheapskate:WorldBall:WorldBallSetup.py"
}
Calling it directly via File > Run Python Script the problem doesn't seem to occur. But can anybody suggest WHY this would be?
The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.
*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).
...btw, the "Poser 8/9 'Light Control' widget not updating unless I nudge something (e.g. camera trackball)" problem looks like it's only the ROTATIONS not updating - the colours and intensities seem correct.
The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.
*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).
Just found another clue for the Poser 6 problem - it only happens if I haven't yet done a render. So here's a summary - two distinct problems:
PROBLEM 1: Poser 6 (doesn't seem to happen in Poser 8/9)
If I haven't done a render and I haven't been to the Material room (It's actually a tiny bit more complex - see my second post) then the colour/intensity aren't updated (although script debug indicates they have been). Rotations are okay. This happens whether the script is run directly (File > Run Python Script) or from a PP2.
Workaround: Do a render (or go into the Material room with a prop/figure, but not one of the lights, selected and return to the Pose room) before running the script
PROBLEM 2: Poser 8/9 (doesn't seem to happen in Poser 6)
If I call my script directly (File > Run Python Script) it's fine, but if I call it from a PP2 the ROTATIONS aren't automatically updated on the Light Control widget (as mentioned in the two previous posts). Colour/intensity are okay, and rotations are actually correct - it's just the widget display
Workaround: Nudge the camera trackball and the Light Controls update
I'm still puzzled by the WHY? and would like to solve this within the script if possible, but with the workarounds mentioned above the problems are only minor irritations now.
The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.
*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).
criteria = False
poserversion = poser.AppVersion()
...
if criteria and int(poserversion[0]) < 9:
poser.DialogSimple.MessageBox("...workaround message here...")
if int(poserversion[0]) > 6:
poser.DialogSimple.MessageBox("...workaround message here...")
It's not an ideal solution, but if anybody else runs into apparently insoluble PoserPython problems it's an approach worth considering (screenshot of my two workaround dialogues attached).
P.S. I'm still very interested in the WHY? so if anybody has any ideas... A proper solution would be better than my workaround.
The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.
*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).
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.
If I create a simple scene with just two lights 'Light 1' and 'Light 2' and maybe a prop/figure the following script sometimes works (i.e. lights update correctly), sometimes partially works (i.e. light rotations update), and sometimes does nothing (haven't seen that recently, so maybe that's a red herring)
I've tried it in Poser 6, 8, and 9 and seem to get similar 'sometimes ok, sometimes not' problems. Poser 8/9 also has a problem with the 'Light Control' widget not updating unless I nudge something (e.g. camera trackball).
I'm sure I'm missing something obvious (as usual) but I can't see it for looking!
import poser
selcol = poser.DialogSimple.AskMenu('Set Lights','Select:',['Red','Green','Blue'])
if selcol == 'Red':
rgb=[1.0,0,0]
xyz=[90,0,0]
str=0.5
if selcol == 'Green':
rgb=[0,1.0,0]
xyz=[0,90,0]
str=1.0
if selcol == 'Blue':
rgb=[0,0,1.0]
xyz=[0,0,90]
str=1.5
actlist = poser.Scene().Actors()
for act in actlist:
if act.IsLight():
if act.Name() == "Light 1":
act.SetParameter("xRotate",xyz[0])
act.SetParameter("yRotate",xyz[1])
act.SetParameter("zRotate",xyz[2])
tree = act.Material("Preview").ShaderTree() tree.NodeByInternalName("Light").InputByInternalName("Color").SetColor(rgb[0],rgb[1],rgb[2])
tree.NodeByInternalName("Light").InputByInternalName("Intensity").SetFloat(str)
tree.UpdatePreview()
elif act.Name() == "Light 2":
act.SetParameter("xRotate",-xyz[0])
act.SetParameter("yRotate",-xyz[1])
act.SetParameter("zRotate",-xyz[2])
tree = act.Material("Preview").ShaderTree() tree.NodeByInternalName("Light").InputByInternalName("Color").SetColor(rgb[0],rgb[1],rgb[2])
tree.NodeByInternalName("Light").InputByInternalName("Intensity").SetFloat(str)
tree.UpdatePreview()
poser.Scene().DrawAll()
(and it's not bad indentation of the tree.NodeByInternalName lines, that's the forum)
I've reduced the problem I'm having to it's basics here - this is just a test script that simply allows the user to select one of three sets of parameters that define the colour, rotations and intensity for both lights.
The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.
*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).