Thu, Nov 28, 11:54 AM CST

Renderosity Forums / Poser 11 / Poser Pro 11 OFFICIAL Technical



Welcome to the Poser 11 / Poser Pro 11 OFFICIAL Technical Forum

Forum Moderators: nerd

Poser 11 / Poser Pro 11 OFFICIAL Technical F.A.Q (Last Updated: 2024 Nov 17 7:07 pm)

banner

Welcome to the Poser Forums! Need help with these versions, advice on upgrading? Etc...you've arrived at the right place!


Looking for Poser Tutorials? Find those HERE



Subject: Swapping left and right for an entire animation


evanhem ( ) posted Thu, 08 October 2020 at 3:21 PM · edited Thu, 28 November 2024 at 11:43 AM

Hello, I have a sequence of movements that are done with the right arm. The animation is 1144 frames. I basically key the right arm joints at various frames and interpolate for the rest: image.png

For the whole motion, the left arm and everything else is fixed.

I would like to generate a new motion that is the exact mirror of this one.

I noticed that if I use Pose Symmetry -> Swap right and left, that it is only valid for one frame at a time. I thought that maybe swapping every key frame would work, but it does not fully mirror the motion.

Is there a way to do this automatically without too much labor?

Thank you.


adp001 ( ) posted Thu, 08 October 2020 at 6:59 PM · edited Thu, 08 October 2020 at 7:02 PM

This litle script may help:

import sys

if sys.version_info.major > 2:
    basestring = str
else:
    range = xrange

SCENE = poser.Scene()

SWAP_FUNCS = ["SwapTop",  # 0
              "SwapBottom",  # 1
              "SymmetryLeftToRight",  # 2
              "SymmetryRightToLeft",  # 3
              "SymmetryBotLeftToRight",  # 4
              "SymmetryBotRightToLeft",  # 5
              "SymmetryTopLeftToRight",  # 6
              "SymmetryTopRightToLeft",  # 7
              ]


def do_swap(actor=None, swap_function="SwapTop", keysfromscene=0, startframe=1):
    """
    :param actor:
    :param swap_function: String, name of the function to use.
    :param keysfromscene: Use framekeys from global scene or local actor. 1 == scene, 0 == actor.
    :param startframe: Frame nr to start (1 to n)
    """
    if actor is None:
        actor = SCENE.CurrentActor()
    figure = actor.ItsFigure()

    if isinstance(swap_function, int):
        swap_function = SWAP_FUNCS[swap_function]
    if isinstance(swap_function, basestring):
        swap = getattr(figure, swap_function, None)
        if swap:
            SCENE.SelectActor(actor)
            nextframe = SCENE.NextKeyFrameAll if keysfromscene == 1 else SCENE.NextKeyFrame

            framenr = startframe - 1
            while framenr is not None:
                SCENE.SetFrame(framenr)
                swap(0)
                framenr = nextframe()

            SCENE.DrawAll()


if __name__ == "__main__":
    idx = poser.DialogSimple.AskMenu("Select", "Swap method to use:", SWAP_FUNCS)
    if idx is not None:
        do_swap(swap_function=idx)

Simplest use: Select actor/figure you want to work with.

Start the script. It will ask for a methode you want to use to swap. For what you decribed, you may want to use "SwapTop". The script selects all keyframes inside the selected actor and performs a swap.




evanhem ( ) posted Fri, 09 October 2020 at 11:16 AM

Thanks! I think Swap Top worked pretty well. Only thing I had to manually do was then delete the old key frames for the opposing side and then change the interpolation type to linear, to preserve what I had before, since default is spline.

The code is simple enough to where it can continue to help me understand Python and the Poser methods.


caisson ( ) posted Mon, 12 October 2020 at 1:28 PM

I think that Pose Symmetry - Custom allows you to specify a frame range ... IIRC.

----------------------------------------

Not approved by Scarfolk Council. For more information please reread. Or visit my local shop.


Privacy Notice

This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.