Forum: Poser 11 / Poser Pro 11 OFFICIAL Technical


Subject: Is there a way to mirror a morph?

RAMWorks opened this issue on Jul 07, 2021 ยท 35 posts


adp001 posted Tue, 13 July 2021 at 1:40 PM

I'm a bit late, but maybe you want to try this:

from __future__ import print_function, division
import numpy as NP
import wx
import poser

SCENE = poser.Scene()
prop = SCENE.CurrentActor()

with wx.TextEntryDialog(None, "Insert morphname to process:",
                        caption="Morph Mirror for prop: " + prop.Name()) as dialog:
    if dialog.ShowModal() == wx.ID_OK:
        morphname = dialog.GetValue()
        morphparmA = prop.Parameter(morphname)
        if morphparmA:
            other_morphname = morphname + "_new"
            numv = prop.Geometry().NumVertices()
            morphdata = NP.array([morphparmA.MorphTargetDelta(idx) for idx in range(numv)])
            morphdata[:, 0] *= -1.0

            morphparmB = prop.Parameter(other_morphname)
            if not morphparmB:
                prop.SpawnTarget(other_morphname)
                morphparmB = prop.Parameter(other_morphname)

            for idx, v in enumerate(morphdata):
                morphparmB.SetMorphTargetDelta(idx, *v)

            morphparmA.SetValue(0)
            morphparmB.SetValue(1)
            SCENE.DrawAll()
            print("Done")
        else:
            print("Morph unknown:", morphname)
    else:
        print("Aborted.")

The script will ask for a morph created in the currently selected prop/actor. If the given morphname is found a new morph is created with the same name extended with "_new".

I hope it is what you are looking for.