Forum: Poser Python Scripting


Subject: Callback created using parm.SetUpdateCallback() not behaving as expected

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


3dcheapskate posted Mon, 27 September 2021 at 9:30 AM

Still trying to get to the bottom of this.

Here are two versions of an update callback for yRotate, one of them modifies the yRotate value (which is the intended use of a callback), the other modifies a DIFFERENT parameter (probably NOT the intended use, and thus the reason for the odd behaviour)

- The one on the left !CB-OK.PY simply increments the yRotate value. This one works 99% as expected - I believe that the other 1% may hold the key (see note after the image below)

- The one on the right !CB-WEIRD.PY simply increments the zTran value. This one does NOT work as expected - the zTran value increases by FIVE whenever ANY body parameter is changed... or when you do something on the Poser UI menu like "Edit > Preferences > Cancel"... or when you go to the Material room and back to the Pose room... or if you select a different body part and then reselect the Body... or... etc.


This is the 1% of running !CB-OK.PY that I think is key:

Open Poser (11) with a scene containing a single figure (I use the factory scene with La Femme).
Select the Body actor and verify that all translations/rotations are zero and all scales are 100%
Run !CB-OK.PY, verify that "setup()..." and "...done" are shown in the debug window, and again verify that all translations/rotations are zero and all scales are 100%.
Modify any of the BODY parameters EXCEPT yRotate.
Verify that all translations/rotations EXCEPT the one you modified are still zero or 100% as they should be...

They're not - while the ENTERED yRotate value is still zero, the DRIVEN yRotate value is now 1. 

So it appears to me that if, like me, you use yRotateParm.SetUpdateCallback(yRotateCallback) thinking that yRotateCallback() will ONLY be called if yRotate changes then you're going to be disappointed. It appears to be called whenever ANY parameter (on the same body part perhaps?) is changed, or when you do other UI-type things.

Also, since the callback in !CB-OK.PY will return the same value regardless of whether it's actually called once, twice, or however many times, I believe that the callback being called several times is probably normal too - you just don't usually see it.


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).