Forum: Poser Python Scripting


Subject: How to edit a model by selecting a frame in a script

Tekitoumen opened this issue on Jul 20, 2022 ยท 7 posts


adp001 posted Thu, 21 July 2022 at 8:46 AM

Example:

Assumed you have a figure with a morph called "Breath". To get a handle to that morph, do this:

figure = poser.Scene().CurrentFigure()
breath_morph = figure.Parameter("Breath")

Say you want to start with Breath == 0 at frame == 0 and a full breath (value=1) every 10 seconds. We further assume your scene goes with 25 frames per second. So, we have a full breath at 10 Seconds * 25 Frames == Frame 250, 500, 750, 1000, etc. 

full = True

for frame in range(0, poser.Scene().NumFrames(), 125):
    breath_morph.SetValue(int(full))
    full = not full

That's all it needs. Poser does the rest, interpolating all the steps in between.

To set a scene length that makes sense with those values, do something like:

poser.Scene().SetNumFrames(1000)