<s> '''<STR_LIT>''' <EOL> from pyfbsdk import FBConstraintManager <EOL> from pyfbsdk import FBSystem <EOL> from pyfbsdk import FBConstraint <EOL> from pymobu . components import PMBBox <EOL> kConstraintTypes = dict ( ( FBConstraintManager ( ) . TypeGetName ( i ) , i ) for i in xrange ( FBConstraintManager ( ) . TypeGetCount ( ) ) ) <EOL> def GetConstraintByName ( name , includeNamespace = True ) : <EOL> '''<STR_LIT>''' <EOL> for const in FBSystem ( ) . Scene . Constraints : <EOL> if includeNamespace : <EOL> constraintName = const . LongName <EOL> else : <EOL> constraintName = const . Name <EOL> if name == constraintName : <EOL> return ConvertToPMBConstraint ( const ) <EOL> def GetConstraintsByType ( _type ) : <EOL> '''<STR_LIT>''' <EOL> ret = [ ] <EOL> for constraint in FBSystem ( ) . Scene . Constraints : <EOL> if not isinstance ( constraint , PMBConstraint ) : <EOL> classType = getattr ( kConstraintClassDict . get ( constraint . Description ) , '<STR_LIT>' ) <EOL> else : <EOL> classType = getattr ( constraint , '<STR_LIT>' ) <EOL> if classType == _type : <EOL> ret . append ( ConvertToPMBConstraint ( constraint ) ) <EOL> return ret <EOL> def GetCharacterByName ( name ) : <EOL> '''<STR_LIT>''' <EOL> for char in FBSystem ( ) . Scene . Characters : <EOL> if name == char . LongName : <EOL> return ConvertToPMBConstraint ( char ) <EOL> def CreateConstraint ( _type , name = None ) : <EOL> '''<STR_LIT>''' <EOL> try : <EOL> constraint = FBConstraintManager ( ) . TypeCreateConstraint ( kConstraintTypes [ _type ] ) <EOL> except KeyError : <EOL> raise Exception ( "<STR_LIT>" % _type ) <EOL> FBSystem ( ) . Scene . Constraints . append ( constraint ) <EOL> if name : <EOL> constraint . Name = name <EOL> return ConvertToPMBConstraint ( constraint ) <EOL> def ConvertToPMBConstraint ( constraint ) : <EOL> '''<STR_LIT>''' <EOL> if isinstance ( constraint , PMBConstraint ) : <EOL> return constraint <EOL> elif isinstance ( constraint , FBConstraint ) : <EOL> try : <EOL> constClass = kConstraintClassDict [ constraint . Description ] <EOL> return constClass ( constraint ) <EOL> except KeyError : <EOL> return constraint <EOL> else : <EOL> raise TypeError ( "<STR_LIT>" % constraint . __class__ . __name__ ) <EOL> FBConstraint . ConvertToPyMoBu = ConvertToPMBConstraint <EOL> @ property <EOL> def _AffectXProperty ( self ) : <EOL> '''<STR_LIT>''' <EOL> return self . component . PropertyList . Find ( "<STR_LIT>" ) . Data <EOL> @ _AffectXProperty . setter <EOL> def _AffectXProperty ( self , state ) : <EOL> self . component . PropertyList . Find ( "<STR_LIT>" ) . Data = state <EOL> @ property <EOL> def _AffectYProperty ( self ) : <EOL> '''<STR_LIT>''' <EOL> return self . component . PropertyList . Find ( "<STR_LIT>" ) . Data <EOL> @ _AffectYProperty . setter <EOL> def _AffectYProperty ( self , state ) : <EOL> self . component . PropertyList . Find ( "<STR_LIT>" ) . Data = state <EOL> @ property <EOL> def _AffectZProperty ( self ) : <EOL> '''<STR_LIT>''' <EOL> return self . component . PropertyList . Find ( "<STR_LIT>" ) . Data <EOL> @ _AffectZProperty . setter <EOL> def _AffectZProperty ( self , state ) : <EOL> self . component . PropertyList . Find ( "<STR_LIT>" ) . Data = state <EOL> def _RefFuncIndexWrapper ( func , idx ) : <EOL> '''<STR_LIT>''' <EOL> def _wrappedFunc ( self , * args , ** kwargs ) : <EOL> return func ( self , idx = idx , * args , ** kwargs ) <EOL> return _wrappedFunc <EOL> def _GetSingleRef ( self , idx ) : <EOL> '''<STR_LIT>''' <EOL> return self . component . ReferenceGet ( idx ) <EOL> def _SetSingleRef ( self , model , idx ) : <EOL> '''<STR_LIT>''' <EOL> _RemoveSingleRef ( self , idx ) <EOL> model = getattr ( model , '<STR_LIT>' , model ) <EOL> self . component . ReferenceAdd ( idx , model ) <EOL> def _RemoveSingleRef ( self , idx ) : <EOL> '''<STR_LIT>''' <EOL> while self . component . ReferenceGetCount ( idx ) : <EOL> constrained = _GetSingleRef ( self , idx ) <EOL> self . component . ReferenceRemove ( idx , constrained ) <EOL> def _GetMultiRef ( self , idx ) : <EOL> '''<STR_LIT>''' <EOL> return [ self . component . ReferenceGet ( idx , i ) for i in xrange ( self . component . ReferenceGetCount ( idx ) ) ] <EOL> def _AddMultiRef ( self , models , idx ) : <EOL> '''<STR_LIT>''' <EOL> if not hasattr ( models , "<STR_LIT>" ) : <EOL> models = [ models ] <EOL> for m in models : <EOL> m = getattr ( m , '<STR_LIT>' , m ) <EOL> self . component . ReferenceAdd ( idx , m ) <EOL> def _RemoveMultiRef ( self , models , idx ) : <EOL> '''<STR_LIT>''' <EOL> if not hasattr ( models , "<STR_LIT>" ) : <EOL> models = [ models ] <EOL> for m in models : <EOL> m = getattr ( m , '<STR_LIT>' , m ) <EOL> self . component . ReferenceRemove ( idx , m ) <EOL> class PMBConstraint ( PMBBox ) : <EOL> '''<STR_LIT>''' <EOL> @ classmethod <EOL> def Create ( cls , name = None ) : <EOL> '''<STR_LIT>''' <EOL> return CreateConstraint ( _type = cls . constraintType , name = name ) <EOL> @ classmethod <EOL> def Convert ( cls , component ) : <EOL> return ConvertToPMBConstraint ( component ) <EOL> class ConstrainedSourceMixIn ( object ) : <EOL> '''<STR_LIT>''' <EOL> SetConstrainedObject = _RefFuncIndexWrapper ( _SetSingleRef , <NUM_LIT:0> ) <EOL> GetConstrainedObject = _RefFuncIndexWrapper ( _GetSingleRef , <NUM_LIT:0> ) <EOL> RemoveConstrainedObject = _RefFuncIndexWrapper ( _RemoveSingleRef , <NUM_LIT:0> ) <EOL> GetSourceObject = _RefFuncIndexWrapper ( _GetMultiRef , <NUM_LIT:1> ) <EOL> AddSourceObject = _RefFuncIndexWrapper ( _AddMultiRef , <NUM_LIT:1> ) <EOL> RemoveSourceObject = _RefFuncIndexWrapper ( _RemoveMultiRef , <NUM_LIT:1> ) <EOL> class PMBCharacter ( PMBConstraint ) : <EOL> '''<STR_LIT>''' <EOL> @ classmethod <EOL> def Create ( cls , name ) : <EOL> from pyfbsdk import FBCharacter <EOL> return cls ( FBCharacter ( name ) ) <EOL> def GetSlots ( self , returnNames = False ) : <EOL> '''<STR_LIT>''' <EOL> slots = self . ListProperties ( pattern = '<STR_LIT>' , type = '<STR_LIT>' ) <EOL> if returnNames : <EOL> return map ( lambda x : x . GetName ( ) , slots ) <EOL> else : <EOL> return slots <EOL> def ExportMapping ( self , filePath , stripPrefix = None ) : <EOL> '''<STR_LIT>''' <EOL> import cPickle as pickle <EOL> mapping = self . GetCharacterMapping ( True , False , stripPrefix ) <EOL> dumpFile = file ( filePath , "<STR_LIT:w>" ) <EOL> pickle . dump ( mapping , dumpFile , <NUM_LIT:0> ) <EOL> dumpFile . close ( ) <EOL> def ImportMapping ( self , filePath , addPrefix = None , haltOnError = True ) : <EOL> '''<STR_LIT>''' <EOL> import cPickle as pickle <EOL> with file ( filePath ) as pickleFile : <EOL> dumpData = pickle . load ( pickleFile ) <EOL> for slot , model in dumpData . iteritems ( ) : <EOL> if model and addPrefix : <EOL> model = addPrefix + model <EOL> try : <EOL> self . SetSlotModel ( slot , model ) <EOL> except : <EOL> if haltOnError : <EOL> raise <EOL> def GetSlotModel ( self , slot ) : <EOL> '''<STR_LIT>''' <EOL> try : <EOL> return self . component . PropertyList . Find ( slot ) [ <NUM_LIT:0> ] <EOL> except IndexError : <EOL> return None <EOL> def RemoveSlotModel ( self , slot ) : <EOL> '''<STR_LIT>''' <EOL> self . SetSlotModel ( slot , None ) <EOL> def SetSlotModel ( self , slot , model ) : <EOL> '''<STR_LIT>''' <EOL> from pyfbsdk import FBFindModelByName <EOL> if isinstance ( model , basestring ) : <EOL> obj = FBFindModelByName ( model ) <EOL> if not obj : <EOL> raise Exception ( "<STR_LIT>" % ( model , self , slot ) ) <EOL> else : <EOL> obj = getattr ( model , '<STR_LIT>' , model ) <EOL> charSlot = self . ListProperties ( pattern = slot ) <EOL> if not charSlot : <EOL> raise Exception ( "<STR_LIT>" % slot ) <EOL> charSlot [ <NUM_LIT:0> ] . removeAll ( ) <EOL> if obj : <EOL> charSlot [ <NUM_LIT:0> ] . append ( obj ) <EOL> def GetCharacterMapping ( self , returnNames = True , skipEmpty = True , stripPrefix = None ) : <EOL> '''<STR_LIT>''' <EOL> charSlots = self . GetSlots ( ) <EOL> mapping = { } <EOL> for slot in charSlots : <EOL> if not len ( slot ) : <EOL> if skipEmpty : <EOL> continue <EOL> else : <EOL> model = None <EOL> else : <EOL> model = slot [ <NUM_LIT:0> ] <EOL> if returnNames : <EOL> slot = slot . GetName ( ) <EOL> if model : <EOL> model = model . LongName <EOL> if stripPrefix : <EOL> model = model . replace ( stripPrefix , "<STR_LIT>" ) <EOL> mapping [ slot ] = model <EOL> return mapping <EOL> class PMBAimConstraint ( PMBConstraint ) : <EOL> '''<STR_LIT>''' <EOL> constraintType = '<STR_LIT>' <EOL> kWorldUpType = { "<STR_LIT>" : <NUM_LIT:0> , "<STR_LIT>" : <NUM_LIT:1> , "<STR_LIT>" : <NUM_LIT:2> , "<STR_LIT>" : <NUM_LIT:3> , "<STR_LIT:None>" : <NUM_LIT:4> } <EOL> SetConstrainedObject = _RefFuncIndexWrapper ( _SetSingleRef , <NUM_LIT:0> ) <EOL> GetConstrainedObject = _RefFuncIndexWrapper ( _GetSingleRef , <NUM_LIT:0> ) <EOL> RemoveConstrainedObject = _RefFuncIndexWrapper ( _RemoveSingleRef , <NUM_LIT:0> ) <EOL> AddAimAtObject = _RefFuncIndexWrapper ( _AddMultiRef , <NUM_LIT:1> ) <EOL> GetAimAtObject = _RefFuncIndexWrapper ( _GetMultiRef , <NUM_LIT:1> ) <EOL> RemoveAimAtObject = _RefFuncIndexWrapper ( _RemoveMultiRef , <NUM_LIT:1> ) <EOL> SetWorldUpObject = _RefFuncIndexWrapper ( _SetSingleRef , <NUM_LIT:2> ) <EOL> GetWorldUpObject = _RefFuncIndexWrapper ( _GetSingleRef , <NUM_LIT:2> ) <EOL> RemoveWorldUpObject = _RefFuncIndexWrapper ( _RemoveSingleRef , <NUM_LIT:2> ) <EOL> def SetWorldUpType ( self , _type ) : <EOL> '''<STR_LIT>''' <EOL> try : <EOL> self . component . PropertyList . Find ( "<STR_LIT>" ) . Data = self . kWorldUpType [ _type ] <EOL> except KeyError : <EOL> raise Exception ( "<STR_LIT>" % _type ) <EOL> def GetWorldUpType ( self ) : <EOL> '''<STR_LIT>''' <EOL> _type = self . component . PropertyList . Find ( "<STR_LIT>" ) . Data <EOL> for t , i in self . kWorldUpType . iteritems ( ) : <EOL> if i == _type : <EOL> return t <EOL> def GetUpVector ( self ) : <EOL> '''<STR_LIT>''' <EOL> return self . component . PropertyList . Find ( "<STR_LIT>" ) . Data <EOL> def SetUpVector ( self , vector ) : <EOL> '''<STR_LIT>''' <EOL> self . component . PropertyList . Find ( "<STR_LIT>" ) . Data = vector <EOL> def GetRotationOffset ( self ) : <EOL> '''<STR_LIT>''' <EOL> return self . component . PropertyList . Find ( "<STR_LIT>" ) . Data <EOL> def SetRotationOffset ( self , vector ) : <EOL> '''<STR_LIT>''' <EOL> self . component . PropertyList . Find ( "<STR_LIT>" ) . Data = vector <EOL> def GetAimVector ( self ) : <EOL> '''<STR_LIT>''' <EOL> return self . component . PropertyList . Find ( "<STR_LIT>" ) . Data <EOL> def SetAimVector ( self , vector ) : <EOL> '''<STR_LIT>''' <EOL> self . component . PropertyList . Find ( "<STR_LIT>" ) . Data = vector <EOL> AffectX = _AffectXProperty <EOL> AffectY = _AffectYProperty <EOL> AffectZ = _AffectZProperty <EOL> class PMBParentChildConstraint ( ConstrainedSourceMixIn , PMBConstraint ) : <EOL> '''<STR_LIT>''' <EOL> constraintType = '<STR_LIT>' <EOL> @ property <EOL> def AffectTranslationX ( self ) : <EOL> return self . component . PropertyList . Find ( "<STR_LIT>" ) . Data <EOL> @ AffectTranslationX . setter <EOL> def AffectTranslationX ( self , state ) : <EOL> self . component . PropertyList . Find ( "<STR_LIT>" ) . Data = state <EOL> @ property <EOL> def AffectTranslationY ( self ) : <EOL> return self . component . PropertyList . Find ( "<STR_LIT>" ) . Data <EOL> @ AffectTranslationY . setter <EOL> def AffectTranslationY ( self , state ) : <EOL> self . component . PropertyList . Find ( "<STR_LIT>" ) . Data = state <EOL> @ property <EOL> def AffectTranslationZ ( self ) : <EOL> return self . component . PropertyList . Find ( "<STR_LIT>" ) . Data <EOL> @ AffectTranslationZ . setter <EOL> def AffectTranslationZ ( self , state ) : <EOL> self . component . PropertyList . Find ( "<STR_LIT>" ) . Data = state <EOL> @ property <EOL> def AffectRotationX ( self ) : <EOL> return self . component . PropertyList . Find ( "<STR_LIT>" ) . Data <EOL> @ AffectRotationX . setter <EOL> def AffectRotationX ( self , state ) : <EOL> self . component . PropertyList . Find ( "<STR_LIT>" ) . Data = state <EOL> @ property <EOL> def AffectRotationY ( self ) : <EOL> return self . component . PropertyList . Find ( "<STR_LIT>" ) . Data <EOL> @ AffectRotationY . setter <EOL> def AffectRotationY ( self , state ) : <EOL> self . component . PropertyList . Find ( "<STR_LIT>" ) . Data = state <EOL> @ property <EOL> def AffectRotationZ ( self ) : <EOL> return self . component . PropertyList . Find ( "<STR_LIT>" ) . Data <EOL> @ AffectRotationZ . setter <EOL> def AffectRotationZ ( self , state ) : <EOL> self . component . PropertyList . Find ( "<STR_LIT>" ) . Data = state <EOL> @ property <EOL> def AffectScalingX ( self ) : <EOL> return self . component . PropertyList . Find ( "<STR_LIT>" ) . Data <EOL> @ AffectScalingX . setter <EOL> def AffectScalingX ( self , state ) : <EOL> self . component . PropertyList . Find ( "<STR_LIT>" ) . Data = state <EOL> @ property <EOL> def AffectScalingY ( self ) : <EOL> return self . PropertyList . Find ( "<STR_LIT>" ) . Data <EOL> @ AffectScalingY . setter <EOL> def AffectScalingY ( self , state ) : <EOL> self . component . PropertyList . Find ( "<STR_LIT>" ) . Data = state <EOL> @ property <EOL> def AffectScalingZ ( self ) : <EOL> return self . component . PropertyList . Find ( "<STR_LIT>" ) . Data <EOL> @ AffectScalingZ . setter <EOL> def AffectScalingZ ( self , state ) : <EOL> self . component . PropertyList . Find ( "<STR_LIT>" ) . Data = state <EOL> @ property <EOL> def ScalingAffectsTranslation ( self ) : <EOL> return self . component . PropertyList . Find ( "<STR_LIT>" ) . Data <EOL> @ ScalingAffectsTranslation . setter <EOL> def ScalingAffectsTranslation ( self , state ) : <EOL> self . component . PropertyList . Find ( "<STR_LIT>" ) . Data = state <EOL> class PMBRotationConstraint ( ConstrainedSourceMixIn , PMBConstraint ) : <EOL> '''<STR_LIT>''' <EOL> constraintType = '<STR_LIT>' <EOL> AffectX = _AffectXProperty <EOL> AffectY = _AffectYProperty <EOL> AffectZ = _AffectZProperty <EOL> def GetRotation ( self ) : <EOL> return self . component . PropertyList . Find ( '<STR_LIT>' ) . Data <EOL> def SetRotation ( self , vector ) : <EOL> self . component . PropertyList . Find ( '<STR_LIT>' ) . Data = vector <EOL> class PMBPositionConstraint ( ConstrainedSourceMixIn , PMBConstraint ) : <EOL> '''<STR_LIT>''' <EOL> constraintType = '<STR_LIT>' <EOL> AffectX = _AffectXProperty <EOL> AffectY = _AffectYProperty <EOL> AffectZ = _AffectZProperty <EOL> def GetTranslation ( self ) : <EOL> return self . component . PropertyList . Find ( '<STR_LIT>' ) . Data <EOL> def SetTranslation ( self , vector ) : <EOL> self . component . PropertyList . Find ( '<STR_LIT>' ) . Data = vector <EOL> class PMBScaleConstraint ( ConstrainedSourceMixIn , PMBConstraint ) : <EOL> '''<STR_LIT>''' <EOL> constraintType = '<STR_LIT>' <EOL> kBlendMethods = dict ( Average = <NUM_LIT:0> , Geometric = <NUM_LIT:1> ) <EOL> AffectX = _AffectXProperty <EOL> AffectY = _AffectYProperty <EOL> AffectZ = _AffectZProperty <EOL> def GetScaling ( self ) : <EOL> return self . component . PropertyList . Find ( '<STR_LIT>' ) . Data <EOL> def SetScaling ( self , vector ) : <EOL> self . component . PropertyList . Find ( '<STR_LIT>' ) . Data = vector <EOL> def GetBlendMethod ( self ) : <EOL> '''<STR_LIT>''' <EOL> currentMethod = self . component . PropertyList . Find ( '<STR_LIT>' ) . Data <EOL> for method , idx in self . kBlendMethods . iteritems ( ) : <EOL> if currentMethod == idx : <EOL> return method <EOL> def SetBlendMethod ( self , method ) : <EOL> '''<STR_LIT>''' <EOL> try : <EOL> self . component . PropertyList . Find ( '<STR_LIT>' ) . Data = self . kBlendMethods [ method ] <EOL> except KeyError : <EOL> raise Exception ( "<STR_LIT>" % method ) <EOL> class PMBThreePointsConstraint ( PMBConstraint ) : <EOL> '''<STR_LIT>''' <EOL> constraintType = '<STR_LIT>' <EOL> SetConstrainedObject = _RefFuncIndexWrapper ( _SetSingleRef , <NUM_LIT:0> ) <EOL> GetConstrainedObject = _RefFuncIndexWrapper ( _GetSingleRef , <NUM_LIT:0> ) <EOL> RemoveConstrainedObject = _RefFuncIndexWrapper ( _RemoveSingleRef , <NUM_LIT:0> ) <EOL> SetOriginObject = _RefFuncIndexWrapper ( _SetSingleRef , <NUM_LIT:1> ) <EOL> GetOriginObject = _RefFuncIndexWrapper ( _GetSingleRef , <NUM_LIT:1> ) <EOL> RemoveOriginObject = _RefFuncIndexWrapper ( _RemoveSingleRef , <NUM_LIT:1> ) <EOL> SetTargetObject = _RefFuncIndexWrapper ( _SetSingleRef , <NUM_LIT:2> ) <EOL> GetTargetObject = _RefFuncIndexWrapper ( _GetSingleRef , <NUM_LIT:2> ) <EOL> RemoveTargetObject = _RefFuncIndexWrapper ( _RemoveSingleRef , <NUM_LIT:2> ) <EOL> SetUpObject = _RefFuncIndexWrapper ( _SetSingleRef , <NUM_LIT:3> ) <EOL> GetUpObject = _RefFuncIndexWrapper ( _GetSingleRef , <NUM_LIT:3> ) <EOL> RemoveUpObject = _RefFuncIndexWrapper ( _RemoveSingleRef , <NUM_LIT:3> ) <EOL> class PMBRigidBodyConstraint ( ConstrainedSourceMixIn , PMBConstraint ) : <EOL> '''<STR_LIT>''' <EOL> constraintType = '<STR_LIT>' <EOL> class PMBMappingConstraint ( PMBConstraint , FBConstraint ) : <EOL> '''<STR_LIT>''' <EOL> constraintType = '<STR_LIT>' <EOL> SetConstrainedObject = _RefFuncIndexWrapper ( _SetSingleRef , <NUM_LIT:0> ) <EOL> GetConstrainedObject = _RefFuncIndexWrapper ( _GetSingleRef , <NUM_LIT:0> ) <EOL> RemoveConstrainedObject = _RefFuncIndexWrapper ( _RemoveSingleRef , <NUM_LIT:0> ) <EOL> SetReferenceObject = _RefFuncIndexWrapper ( _SetSingleRef , <NUM_LIT:1> ) <EOL> GetReferenceObject = _RefFuncIndexWrapper ( _GetSingleRef , <NUM_LIT:1> ) <EOL> RemoveReferenceObject = _RefFuncIndexWrapper ( _RemoveSingleRef , <NUM_LIT:1> ) <EOL> SetSourceObject = _RefFuncIndexWrapper ( _SetSingleRef , <NUM_LIT:2> ) <EOL> GetSourceObject = _RefFuncIndexWrapper ( _GetSingleRef , <NUM_LIT:2> ) <EOL> RemoveSourceObject = _RefFuncIndexWrapper ( _RemoveSingleRef , <NUM_LIT:2> ) <EOL> SetSourceReferenceObject = _RefFuncIndexWrapper ( _SetSingleRef , <NUM_LIT:3> ) <EOL> GetSourceReferenceObject = _RefFuncIndexWrapper ( _GetSingleRef , <NUM_LIT:3> ) <EOL> RemoveSourceReferenceObject = _RefFuncIndexWrapper ( _RemoveSingleRef , <NUM_LIT:3> ) <EOL> class PMBRangeConstraint ( PMBConstraint ) : <EOL> '''<STR_LIT>''' <EOL> constraintType = '<STR_LIT>' <EOL> SetConstrainedObject = _RefFuncIndexWrapper ( _SetSingleRef , <NUM_LIT:0> ) <EOL> GetConstrainedObject = _RefFuncIndexWrapper ( _GetSingleRef , <NUM_LIT:0> ) <EOL> RemoveConstrainedObject = _RefFuncIndexWrapper ( _RemoveSingleRef , <NUM_LIT:0> ) <EOL> SetSourceObject = _RefFuncIndexWrapper ( _SetSingleRef , <NUM_LIT:1> ) <EOL> GetSourceObject = _RefFuncIndexWrapper ( _GetSingleRef , <NUM_LIT:1> ) <EOL> RemoveSourceObject = _RefFuncIndexWrapper ( _RemoveSingleRef , <NUM_LIT:1> ) <EOL> AddPullingObject = _RefFuncIndexWrapper ( _AddMultiRef , <NUM_LIT:2> ) <EOL> GetPullingObject = _RefFuncIndexWrapper ( _GetMultiRef , <NUM_LIT:2> ) <EOL> RemovePullingObject = _RefFuncIndexWrapper ( _RemoveMultiRef , <NUM_LIT:2> ) <EOL> class PMBChainIKConstraint ( PMBConstraint , FBConstraint ) : <EOL> '''<STR_LIT>''' <EOL> constraintType = '<STR_LIT>' <EOL> kSolverType = dict ( ikRPsolver = <NUM_LIT:0> , ikSCsolver = <NUM_LIT:1> ) <EOL> kPoleType = dict ( Vector = <NUM_LIT:0> , Object = <NUM_LIT:1> ) <EOL> kEvalTSAnim = dict ( Never = <NUM_LIT:0> , Auto = <NUM_LIT:1> , Always = <NUM_LIT:2> ) <EOL> SetFirstJoint = _RefFuncIndexWrapper ( _SetSingleRef , <NUM_LIT:0> ) <EOL> GetFirstJoint = _RefFuncIndexWrapper ( _GetSingleRef , <NUM_LIT:0> ) <EOL> RemoveFirstJoint = _RefFuncIndexWrapper ( _RemoveSingleRef , <NUM_LIT:0> ) <EOL> SetEndJoint = _RefFuncIndexWrapper ( _SetSingleRef , <NUM_LIT:1> ) <EOL> GetEndJoint = _RefFuncIndexWrapper ( _GetSingleRef , <NUM_LIT:1> ) <EOL> RemoveEndJoint = _RefFuncIndexWrapper ( _RemoveSingleRef , <NUM_LIT:1> ) <EOL> SetEffector = _RefFuncIndexWrapper ( _SetSingleRef , <NUM_LIT:2> ) <EOL> GetEffector = _RefFuncIndexWrapper ( _GetSingleRef , <NUM_LIT:2> ) <EOL> RemoveEffector = _RefFuncIndexWrapper ( _RemoveSingleRef , <NUM_LIT:2> ) <EOL> SetFloor = _RefFuncIndexWrapper ( _SetSingleRef , <NUM_LIT:3> ) <EOL> GetFloor = _RefFuncIndexWrapper ( _GetSingleRef , <NUM_LIT:3> ) <EOL> RemoveFloor = _RefFuncIndexWrapper ( _RemoveSingleRef , <NUM_LIT:3> ) <EOL> AddPoleVectorObject = _RefFuncIndexWrapper ( _AddMultiRef , <NUM_LIT:4> ) <EOL> GetPoleVectorObject = _RefFuncIndexWrapper ( _GetMultiRef , <NUM_LIT:4> ) <EOL> RemovePoleVectorObject = _RefFuncIndexWrapper ( _RemoveMultiRef , <NUM_LIT:4> ) <EOL> def GetSolverType ( self ) : <EOL> '''<STR_LIT>''' <EOL> solverType = self . component . PropertyList . Find ( '<STR_LIT>' ) . Data <EOL> for _type , idx in self . kSolverType . iteritems ( ) : <EOL> if solverType == idx : <EOL> return _type <EOL> def SetSolverType ( self , _type ) : <EOL> '''<STR_LIT>''' <EOL> try : <EOL> self . component . PropertyList . Find ( '<STR_LIT>' ) . Data = self . kSolverType [ _type ] <EOL> except KeyError : <EOL> raise Exception ( "<STR_LIT>" % _type ) <EOL> def GetTwist ( self ) : <EOL> '''<STR_LIT>''' <EOL> return self . component . PropertyList . Find ( '<STR_LIT>' ) . Data <EOL> def SetTwist ( self , value ) : <EOL> '''<STR_LIT>''' <EOL> self . component . PropertyList . Find ( '<STR_LIT>' ) . Data = value <EOL> def GetPoleType ( self ) : <EOL> '''<STR_LIT>''' <EOL> poleVectorType = self . component . PropertyList . Find ( '<STR_LIT>' ) . Data <EOL> for _type , idx in self . kPoleType . iteritems ( ) : <EOL> if poleVectorType == idx : <EOL> return _type <EOL> def SetPoleType ( self , _type ) : <EOL> '''<STR_LIT>''' <EOL> try : <EOL> self . component . PropertyList . Find ( '<STR_LIT>' ) . Data = self . kPoleType [ _type ] <EOL> except : <EOL> raise Exception ( "<STR_LIT>" % _type ) <EOL> def GetPoleVector ( self ) : <EOL> '''<STR_LIT>''' <EOL> return self . component . PropertyList . Find ( '<STR_LIT>' ) . Data <EOL> def SetPoleVector ( self , vector ) : <EOL> '''<STR_LIT>''' <EOL> self . component . PropertyList . Find ( '<STR_LIT>' ) . Data = vector <EOL> def GetPoleOffset ( self ) : <EOL> '''<STR_LIT>''' <EOL> return self . component . PropertyList . Find ( '<STR_LIT>' ) . Data <EOL> def SetPoleOffset ( self , vector ) : <EOL> '''<STR_LIT>''' <EOL> self . component . PropertyList . Find ( '<STR_LIT>' ) . Data = vector <EOL> def GetEvalTSAnimation ( self ) : <EOL> '''<STR_LIT>''' <EOL> animState = self . component . PropertyList . Find ( '<STR_LIT>' ) . Data <EOL> for state , idx in self . kEvalTSAnim . iteritems ( ) : <EOL> if animState == idx : <EOL> return state <EOL> def SetEvalTSAnimation ( self , state ) : <EOL> '''<STR_LIT>''' <EOL> try : <EOL> self . component . PropertyList . Find ( '<STR_LIT>' ) . Data = self . kEvalTSAnim [ state ] <EOL> except KeyError : <EOL> raise Exception ( "<STR_LIT>" % state ) <EOL> class PMBPathConstraint ( PMBConstraint ) : <EOL> '''<STR_LIT>''' <EOL> constraintType = '<STR_LIT>' <EOL> kWarpMode = dict ( Percent = <NUM_LIT:0> , Segment = <NUM_LIT:1> ) <EOL> kAxes = { '<STR_LIT:X>' : <NUM_LIT:0> , '<STR_LIT>' : <NUM_LIT:1> , '<STR_LIT:Y>' : <NUM_LIT:2> , '<STR_LIT>' : <NUM_LIT:3> , '<STR_LIT>' : <NUM_LIT:4> , '<STR_LIT>' : <NUM_LIT:5> } <EOL> SetConstrainedObject = _RefFuncIndexWrapper ( _SetSingleRef , <NUM_LIT:0> ) <EOL> GetConstrainedObject = _RefFuncIndexWrapper ( _GetSingleRef , <NUM_LIT:0> ) <EOL> RemoveConstrainedObject = _RefFuncIndexWrapper ( _RemoveSingleRef , <NUM_LIT:0> ) <EOL> def SetPathSource ( self , model ) : <EOL> '''<STR_LIT>''' <EOL> from pyfbsdk import FBModelPath3D <EOL> if not isinstance ( model , FBModelPath3D ) : <EOL> raise Exception ( "<STR_LIT>" % model . __class__ . __name__ ) <EOL> self . RemovePathSource ( ) <EOL> self . component . ReferenceAdd ( <NUM_LIT:1> , model ) <EOL> GetSourceObject = _RefFuncIndexWrapper ( _GetSingleRef , <NUM_LIT:2> ) <EOL> RemoveSourceObject = _RefFuncIndexWrapper ( _RemoveSingleRef , <NUM_LIT:2> ) <EOL> def GetWarpMode ( self ) : <EOL> '''<STR_LIT>''' <EOL> warp = self . component . PropertyList . Find ( '<STR_LIT>' ) . Data <EOL> for mode , idx in self . kWarpMode . iteritems ( ) : <EOL> if warp == idx : <EOL> return mode <EOL> def SetWarpMode ( self , mode ) : <EOL> '''<STR_LIT>''' <EOL> try : <EOL> self . component . PropertyList . Find ( '<STR_LIT>' ) . Data = self . kWarpMode [ mode ] <EOL> except KeyError : <EOL> raise Exception ( "<STR_LIT>" % mode ) <EOL> def GetWarp ( self ) : <EOL> '''<STR_LIT>''' <EOL> return self . component . PropertyList . Find ( '<STR_LIT>' ) . Data <EOL> def SetWarp ( self , value ) : <EOL> '''<STR_LIT>''' <EOL> self . component . PropertyList . Find ( '<STR_LIT>' ) . Data = value <EOL> @ property <EOL> def FollowPath ( self ) : <EOL> '''<STR_LIT>''' <EOL> return self . component . PropertyList . Find ( '<STR_LIT>' ) . Data <EOL> @ FollowPath . setter <EOL> def FollowPath ( self , state ) : <EOL> self . component . PropertyList . Find ( '<STR_LIT>' ) . Data = state <EOL> def SetUpVectorAxis ( self , axis ) : <EOL> '''<STR_LIT>''' <EOL> try : <EOL> self . component . PropertyList . Find ( '<STR_LIT>' ) . Data = self . kAxes [ axis ] <EOL> except KeyError : <EOL> raise Exception ( "<STR_LIT>" % axis ) <EOL> def GetUpVectorAxis ( self ) : <EOL> '''<STR_LIT>''' <EOL> upAxis = self . component . PropertyList . Find ( '<STR_LIT>' ) . Data <EOL> for axis , idx in self . kAxes . iteritems ( ) : <EOL> if upAxis == idx : <EOL> return axis <EOL> def SetFrontVectorAxis ( self , axis ) : <EOL> '''<STR_LIT>''' <EOL> try : <EOL> self . component . PropertyList . Find ( '<STR_LIT>' ) . Data = self . kAxes [ axis ] <EOL> except KeyError : <EOL> raise Exception ( "<STR_LIT>" % axis ) <EOL> def GetFrontVectorAxis ( self ) : <EOL> '''<STR_LIT>''' <EOL> frontAxis = self . component . PropertyList . Find ( '<STR_LIT>' ) . Data <EOL> for axis , idx in self . kAxes . iteritems ( ) : <EOL> if frontAxis == idx : <EOL> return axis <EOL> def SetTranslationOffset ( self , vector ) : <EOL> '''<STR_LIT>''' <EOL> self . component . PropertyList . Find ( '<STR_LIT>' ) . Data = vector <EOL> def GetTranslationOffset ( self ) : <EOL> '''<STR_LIT>''' <EOL> return self . component . PropertyList . Find ( '<STR_LIT>' ) . Data <EOL> def SetRoll ( self , value ) : <EOL> '''<STR_LIT>''' <EOL> self . component . PropertyList . Find ( '<STR_LIT>' ) . Data = value <EOL> def GetRoll ( self ) : <EOL> '''<STR_LIT>''' <EOL> return self . component . PropertyList . Find ( '<STR_LIT>' ) . Data <EOL> def SetPitch ( self , value ) : <EOL> '''<STR_LIT>''' <EOL> self . component . PropertyList . Find ( '<STR_LIT>' ) . Data = value <EOL> def GetPitch ( self ) : <EOL> '''<STR_LIT>''' <EOL> return self . component . PropertyList . Find ( '<STR_LIT>' ) . Data <EOL> def SetYaw ( self , value ) : <EOL> '''<STR_LIT>''' <EOL> self . component . PropertyList . Find ( '<STR_LIT>' ) . Data = value <EOL> def GetYaw ( self ) : <EOL> '''<STR_LIT>''' <EOL> return self . component . PropertyList . Find ( '<STR_LIT>' ) . Data <EOL> def SetUIColor ( self , color ) : <EOL> '''<STR_LIT>''' <EOL> self . component . PropertyList . Find ( '<STR_LIT>' ) . Data = color <EOL> def GetUIColor ( self ) : <EOL> '''<STR_LIT>''' <EOL> return self . component . PropertyList . Find ( '<STR_LIT>' ) . Data <EOL> @ property <EOL> def ShowWarpKeyFrame ( self ) : <EOL> '''<STR_LIT>''' <EOL> return self . component . PropertyList . Find ( '<STR_LIT>' ) . Data <EOL> @ ShowWarpKeyFrame . setter <EOL> def ShowWarpKeyFrame ( self , state ) : <EOL> self . component . PropertyList . Find ( '<STR_LIT>' ) . Data = state <EOL> class PMBExpressionConstraint ( PMBConstraint ) : <EOL> '''<STR_LIT>''' <EOL> constraintType = '<STR_LIT>' <EOL> class PMBMultiReferentialConstraint ( PMBConstraint ) : <EOL> '''<STR_LIT>''' <EOL> constraintType = '<STR_LIT>' <EOL> AddRigidObject = _RefFuncIndexWrapper ( _AddMultiRef , <NUM_LIT:0> ) <EOL> GetRigidObject = _RefFuncIndexWrapper ( _GetMultiRef , <NUM_LIT:0> ) <EOL> RemoveRigidObject = _RefFuncIndexWrapper ( _RemoveMultiRef , <NUM_LIT:0> ) <EOL> AddParentObject = _RefFuncIndexWrapper ( _AddMultiRef , <NUM_LIT:1> ) <EOL> GetParentObject = _RefFuncIndexWrapper ( _GetMultiRef , <NUM_LIT:1> ) <EOL> RemoveParentObject = _RefFuncIndexWrapper ( _RemoveMultiRef , <NUM_LIT:1> ) <EOL> def SetActiveReference ( self , model ) : <EOL> raise NotImplementedError ( '<STR_LIT>' ) <EOL> def GetActiveReference ( self ) : <EOL> raise NotImplementedError ( '<STR_LIT>' ) <EOL> def SetOffsetTranslation ( self , model , vector ) : <EOL> '''<STR_LIT>''' <EOL> if hasattr ( model , '<STR_LIT:Name>' ) : <EOL> model = model . Name <EOL> propertyName = '<STR_LIT>' % model <EOL> self . component . PropertyList . Find ( propertyName ) . Data = vector <EOL> def GetOffsetTranslation ( self , model ) : <EOL> '''<STR_LIT>''' <EOL> if hasattr ( model , '<STR_LIT:Name>' ) : <EOL> model = model . Name <EOL> propertyName = '<STR_LIT>' % model <EOL> return self . component . PropertyList . Find ( propertyName ) . Data <EOL> def SetOffsetRotation ( self , model , vector ) : <EOL> '''<STR_LIT>''' <EOL> if hasattr ( model , '<STR_LIT:Name>' ) : <EOL> model = model . Name <EOL> propertyName = '<STR_LIT>' % model <EOL> self . component . PropertyList . Find ( propertyName ) . Data = vector <EOL> def GetOffsetRotation ( self , model ) : <EOL> '''<STR_LIT>''' <EOL> if hasattr ( model , '<STR_LIT:Name>' ) : <EOL> model = model . Name <EOL> propertyName = '<STR_LIT>' % model <EOL> return self . component . PropertyList . Find ( propertyName ) . Data <EOL> class PMBConstraintRelation ( PMBConstraint ) : <EOL> '''<STR_LIT>''' <EOL> constraintType = '<STR_LIT>' <EOL> def GetBoxByName ( self , name ) : <EOL> '''<STR_LIT>''' <EOL> for relBox in self . component . Boxes : <EOL> box = getattr ( relBox , '<STR_LIT>' , relBox ) <EOL> if box . LongName == name : <EOL> return relBox <EOL> kConstraintClassDict = { "<STR_LIT>" : PMBAimConstraint , <EOL> "<STR_LIT>" : PMBPositionConstraint , <EOL> "<STR_LIT>" : PMBThreePointsConstraint , <EOL> "<STR_LIT>" : PMBChainIKConstraint , <EOL> "<STR_LIT>" : PMBExpressionConstraint , <EOL> "<STR_LIT>" : PMBMappingConstraint , <EOL> "<STR_LIT>" : PMBMultiReferentialConstraint , <EOL> "<STR_LIT>" : PMBParentChildConstraint , <EOL> "<STR_LIT>" : PMBPathConstraint , <EOL> "<STR_LIT>" : PMBRangeConstraint , <EOL> "<STR_LIT>" : PMBConstraintRelation , <EOL> "<STR_LIT>" : PMBRigidBodyConstraint , <EOL> "<STR_LIT>" : PMBRotationConstraint , <EOL> "<STR_LIT>" : PMBScaleConstraint , <EOL> "<STR_LIT>" : PMBCharacter } </s>
