Forum: Poser Python Scripting


Subject: Poser Python Public Service Announcement: A Warning

Cage opened this issue on Mar 22, 2014 · 6 posts


Cage posted Sat, 22 March 2014 at 10:12 AM

I have a warning for my fellow Python scripters.  Be careful, when zipping through an actor's parameter dials and setting them.  If you have a script, for instance, to zero all rotations, translations, morphs, etc, and you just treat the default case as setting to zero... you can run into trouble.

Poser allows us to set certain internal dials that aren't supposed to be set.  These dials have no listed parameter codes, in the manual, but we can set them, intentionally or accidentally.

[quote]

    fig.Memorize()
    scales = [poser.kParmCodeXSCALE ... poser.kParmCodeASCALE]
    never_ever_set_these_internal_dials = [17,18,19,20,21,22,31,32,33,34,35,36] #Offset,TranB,_joint,_twist,_smoo parameters should not be set!
    for figact in fig.Actors():
        if not figact.IsBodyPart():
            continue        
        for parm in figact.Parameters():
            if parm.TypeCode() in never_ever_set_these_internal_dials:
                continue #Setting these can screw up your figure if the script crashes.
            if parm.IsMorphTarget() or parm.IsValueParameter():
                continue
            if parm.TypeCode() in scales:
                parm.SetValue(1.0)
            else:
                parm.SetValue(0.0)

.....

fig.Reset()

[/quote]

I had a script crash during testing, and I was unable to recover the figure settings after the crash.  The script had set the Offset, TranB, _joint, _twist, and _smoo internal cr2 dials to zero.  These dials had not been memorized by the script call to Memorize(), and could not be reset.  The figure went kablooie.

So be careful about how you set the paramter dials, is all.  These dials don't have TypeCode listings, but they will reveal their TypeCode values, so they can be screened when running any parameter-setting script.  The codes are:

never_ever_set_these_internal_dials = [17,18,19,20,21,22,31,32,33,34,35,36]

Because, you know.  The figure can go kablooie.  :scared:

===========================sigline======================================================

Cage can be an opinionated jerk who posts without thinking.  He apologizes for this.  He's honestly not trying to be a turkeyhead.

Cage had some freebies, compatible with Poser 11 and below.  His Python scripts were saved at archive.org, along with the rest of the Morphography site, where they were hosted.


structure posted Sat, 22 March 2014 at 10:19 AM Forum Coordinator

appreciate the warning - thanks

Locked Out


gishzida posted Sat, 22 March 2014 at 9:17 PM

Cage...

the links in your tag line point to a "default" apache / centos web server with no content or web pages... Not sure if Phandom3d has dumped the page by accident or there is something else wrong...

regards!

joel

a.k.a. gishzida


Cage posted Sat, 22 March 2014 at 10:07 PM

Yeah, thanks, gishzida.  :laugh:  My site went down months ago, and I have been in mourning over the community's loss of Phantom3D, so I haven't set up a new site anywhere.

Well, that's partially true.  Actually, I haven't gotten around to it.  I have an offer to host my site, but I and the new host haven't gotten together yet to set the thing up.  One of these days, hopefully.

Last time I tried to edit my sigline, Rosity got mad at me.  :lol:  I think it was during the long period when they were modifying the site, and my difficulties may have related to that.  :unsure:

===========================sigline======================================================

Cage can be an opinionated jerk who posts without thinking.  He apologizes for this.  He's honestly not trying to be a turkeyhead.

Cage had some freebies, compatible with Poser 11 and below.  His Python scripts were saved at archive.org, along with the rest of the Morphography site, where they were hosted.


3dcheapskate posted Wed, 02 April 2014 at 8:10 AM

I think you must have missed the relevant page in the PoserPython manual (page 13½ for Poser 6)...

kParmCodeKABAM
kParmCodeKABLOOIE
kParmCodeKABOOM
kParmCodeKERPLUNK
kParmCodeKERPLONK
kParmCodeKERSPLAT
...etc...

:blink:


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



Cage posted Wed, 02 April 2014 at 2:28 PM

Quote - I think you must have missed the relevant page in the PoserPython manual (page 13½ for Poser 6)...

kParmCodeKABAM
kParmCodeKABLOOIE
kParmCodeKABOOM
kParmCodeKERPLUNK
kParmCodeKERPLONK
kParmCodeKERSPLAT
...etc...

:blink:

 

Ah, you see.  There's the problem.  I never had Poser 6, which was released during a period when I couldn't afford to upgrade.  I've had all the other versions since Poser 4, but I've never seen that relevant section in the Poser Python docs.  The Poser Python docs tend to be... hmm.  Not quite thorough and up-to-date, most of the time.  Full of holes, like my old canvas Converse sneakers.  :lol: 

===========================sigline======================================================

Cage can be an opinionated jerk who posts without thinking.  He apologizes for this.  He's honestly not trying to be a turkeyhead.

Cage had some freebies, compatible with Poser 11 and below.  His Python scripts were saved at archive.org, along with the rest of the Morphography site, where they were hosted.