######################################################################
#
#       Dial Symmetry.py
#
#       Copyright (c) 2003 C. Cigas
#
#       craig@castironflamingo.com
#
#       Copy the dial settings from one body part to the opposite
#       side part.
#
#       Handle the funky actor names for Michael 1, 2 and Freak.
#
import poser
from string import find, replace

newAct = None
oldAct = poser.Scene().CurrentActor()
if oldAct:
        if oldAct.IsBodyPart():
                if find(oldAct.Name(), "Left") == 0:
                        try:
                                newAct = poser.Scene().Actor(replace(oldAct.Name(), "Left", "Right"))
                        except:
                                pass
                elif find(oldAct.Name(), "Right") == 0:
                        try:
                                newAct = poser.Scene().Actor(replace(oldAct.Name(), "Right", "Left"))
                        except:
                                newAct = poser.Scene().ActorByInternalName("l" + oldAct.InternalName()[1:])
                elif oldAct.Name()[0] == "l":
                        try:
                                newAct = poser.Scene().ActorByInternalName("r" + oldAct.InternalName()[1:])
                        except:
                                pass
                                
                if newAct:
                        for parm in oldAct.Parameters():
                                if parm.IsMorphTarget():
                                        try:
                                                newAct.Parameter(parm.Name()).SetValue(parm.Value())
                                        except:
                                                pass

