Forum: Poser - OFFICIAL


Subject: Is there an existing script to copy parameter limits between figures?

Cage opened this issue on May 03, 2013 · 9 posts


Cage posted Fri, 03 May 2013 at 11:22 PM

I have need of a script to copy joint limits between several modified versions of Antonia.  Before I break down and write one, I thought I should ask if there's already such a script out there.  Is there such a thing?  😕

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


markschum posted Sat, 04 May 2013 at 12:10 AM

I started something a while back

 

import poser
scn = poser.Scene()
xt = poser.kParmCodeXTRAN
yt = poser.kParmCodeYTRAN
zt = poser.kParmCodeZTRAN
xr = poser.kParmCodeXROT
yr = poser.kParmCodeYROT
zr = poser.kParmCodeZROT
parmtypes = [xt,yt,zt,xr,yr,zr]
fig = scn.Figure("Figure 1")
fig2 = scn.Figure("Figure 2")
acts = fig.Actors()
for act in acts:
    if act.IsBodyPart():
        for t in parmtypes:
            p = act.Parameter(t).MaxValue()
            fig2.Actor(act.Name()).Parameter(t).SetMaxValue(p)

 

No idea if it works.


Cage posted Sat, 04 May 2013 at 12:29 AM

Hey, wow.  That's simpler than I was anticipating.  :woot:  Thanks, markschum!  :thumbupboth:

I don't remember clearly, but I thought when I'd tried to process limits using a script, there was some unusual extra step required to actually activate them.  Maybe I'm thinking of a case where I needed forceLimits to be active.  Hmm.  😕  I have this tendency to make things more complicated in my thoughts than they really are, out there in the real world.  :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.


Morkonan posted Sat, 04 May 2013 at 6:31 AM

Quote - ...No idea if it works.

I tried to follow the instructions, but got my head stuck in a tree while being force-fed small toy fire-engines by a plaid colored gorrilla named "Sam." I think I did something wrong...

IIRC, Poser2012Pro has a native way to copy joint parameters. I've only fiddled with it a couple of times and succeeded in launching a watermelon fifty-feet into the air so it could catch a ride with a zeppelin... I probably did something wrong there, too.

 

(Note: I assume all I have to do in order to test this is to copy the text and create a python file extension for it?)


ockham posted Sat, 04 May 2013 at 6:35 AM

Nope, there isn't an extra step.  I've got a script that looks about the same as markschum's example, and it works instantly.

You would need an error check on the body parts and parm names, like this

import poser

scene=poser.Scene()

fig1=scene.Figure('FirstVickyOrSomething')

fig2=scene.Figure('SecondVickyOrWhatever')

for a1 in fig1.Actors():
    try:
        a2=fig2.Actor(a1.Name())
    except:
        continue
    for p1 in a1.Parameters():
        try:
            p2=a2.Parameter(p1.Name())
        except:
            continue
        p2.SetMaxValue(p1.MaxValue())
        p2.SetMinValue(p1.MinValue())
       

My python page
My ShareCG freebies


Cage posted Mon, 13 May 2013 at 3:28 PM

I adapted the code posted here, in the attached, and finally got around to testing it.  The process works, but setting min and max limits in Poser is strangely slow, so the script prints its progress to let the user know it's still running.  Use of try-except proved to be even slower than what I have and presented the risk of possible exception errors being hidden when the script runs, so I dropped that in favor of building a quick list of actor names common to both figures, using Python set intersection.

I'm posting this here since there doesn't seem to be a copy limits script already available in Poserdom, and not everyone can write one as needed.  :unsure:  Change the extension from .txt to .py to use the script.

The script requires at least Poser 6, for use of DialogSimple.  Python sets may or may not have been available for Poser 6, so possibly P7 is needed to run this.  I never had P6, so I can't test it in that version.  :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.


primorge posted Mon, 13 May 2013 at 9:44 PM

Thank you for that, Markschum and Cage.


markschum posted Tue, 14 May 2013 at 11:52 AM

My scripts tend to be brute force single use code that I rewrite as needed. For a general purpose script they need changes as ockham has shown or you get a crash. Crashing python is my second hobby ;-)


Cage posted Tue, 14 May 2013 at 12:53 PM

Quote - My scripts tend to be brute force single use code that I rewrite as needed. For a general purpose script they need changes as ockham has shown or you get a crash. Crashing python is my second hobby ;-)

Oh, aye.  :lol:  Crashing Poser Python quickly becomes one's primary pursuit, when one is writing a PPy script.  :lol:  I think I've had only two or three work immediately without ever going awry.  I suspect what I posted above could throw a wobbly if any actor lacks a ROT or TRAN dial.  The error handling I added, now that I look at it, would only be able to kick in after Poser threw an error and quit the script.  Oops!  😊  But I suspect you can't actually pass Poser an actor without those dials.  It will create them if they aren't there... umm, right?  Never tested that.  :unsure:  I know the dials can be hidden, but can they ever be wholly absent?  Hmm.  😕

I'll bet LesBentley or someone can answer that.  I'm a Poser Techie, but not a high-ranking member of that order.  :lol:  Such things remain a mystery to me, and I only end up testing them when it becomes absolutely necessary.

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