Forum: Poser Python Scripting


Subject: Simple code that works in normal script causing parser error in callback

3dcheapskate opened this issue on Sep 25, 2021 ยท 7 posts


3dcheapskate posted Sat, 25 September 2021 at 10:52 AM

Okay, I've tried again.

Am I missing something obvious here ?

The following script should, I believe, cause myUpdateCallback() to be called any time that the xTran dial on the BODY is changed, which will in turn cause the yRotate dial on the BODY parameter to be incremented.

However, if I change the xTran dial the yRotate value actually increases by between 3 and 5, which indicates to me that the callback is called that many times.

In addition, the same thing happens if I change yTran, zTran, xRotate, zRotate, Scale, etc. This script works on just about any figure - I tested it with La Femme.

The same code as inline text:

def myUpdateCallback(parm,value):

ac = poser.Scene().ActorByInternalName("BODY")

yrotval=ac.Parameter("yRotate").Value()

ac.SetParameter("yRotate",yrotval+1)

return value

#

def setup():

print "setup()..."

ac = poser.Scene().ActorByInternalName("BODY")

parm = ac.Parameter("xTran")

parm.SetUpdateCallback(myUpdateCallback)

print "...done."

setup()



The 3Dcheapskate (also available in DAZ and HiveWire3D flavours) 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.