Esempio n. 1
0
 def __init__(self, filterSettings=None):
     '''
     I'm not passing any data in terms of nodes here, We'll deal with
     those in the PoseSave and PoseLoad calls. Leaves this open for
     expansion
     '''
     self.poseDict={}
     self.infoDict={}
     self.skeletonDict={}
     self.posePointCloudNodes=[]
     self.filepath=''
     self.mayaUpAxis=r9Setup.mayaUpAxis()
     self.thumbnailRes=[128,128]
     
     self.__metaPose=False
     self.metaRig=None # filled by the code as we process
     self.matchMethod='base' #method used to match nodes internally in the poseDict
     self.relativePose=False
     self.relativeRots='projected'
     self.relativeTrans='projected'
     self.useFilter=True
     
     # make sure we have a settings object
     if filterSettings:
         if issubclass(type(filterSettings), r9Core.FilterNode_Settings):
             self.settings=filterSettings
             self.__metaPose=self.settings.metaRig
         else:
             raise StandardError('filterSettings param requires an r9Core.FilterNode_Settings object')
     else:
         self.settings=r9Core.FilterNode_Settings()
         self.__metaPose=self.settings.metaRig
 
     self.settings.printSettings()
Esempio n. 2
0
    def __init__(self, nodes, filterSettings=None, mesh=None):
        '''
        :param rootReference: the object to be used as the PPT's pivot reference
        :param nodes: feed the nodes to process in as a list, if a filter is given
                      then these are the rootNodes for it
        :param filterSettings: pass in a filterSettings object to filter the given hierarchy
        :param mesh: this is really for reference, rather than make a locator, pass in a reference geo
                     which is then shapeSwapped for the PPC root node giving great reference!
        '''
        self.mesh = mesh
        self.refMesh = 'posePointCloudGeoRef'
        self.refMeshShape = 'posePointCloudGeoRefShape'
        self.mayaUpAxis = r9Setup.mayaUpAxis()
        self.inputNodes = nodes  # inputNodes for processing
        self.posePointCloudNodes = []  # generated ppt nodes
        self.posePointRoot = None
        self.settings = None
        self.prioritySnapOnly = False  # ONLY make ppt points for the filterPriority nodes

        if filterSettings:
            if not issubclass(type(filterSettings),
                              r9Core.FilterNode_Settings):
                raise StandardError(
                    'filterSettings param requires an r9Core.FilterNode_Settings object'
                )
            elif filterSettings.filterIsActive():
                self.settings = filterSettings
Esempio n. 3
0
    def test_poseLoad_relativeProjected_mirrorIndex(self):
        '''
        load the pose with relative and check against the store 'projected' posefile
        '''
        # mirrorIndex Match -------------------------------------------------
        self.poseData.matchMethod = 'mirrorIndex'
        cmds.currentTime(0)
        requiredPose = os.path.join(self.poseFolder,
                                    'jump_f218_projected.pose')

        filepath = os.path.join(self.poseFolder, 'jump_f218.pose')
        cmds.select('L_Foot_Ctrl')
        self.poseData.poseLoad(self.rootNode,
                               filepath=filepath,
                               useFilter=True,
                               relativePose=True,
                               relativeRots='projected',
                               relativeTrans='projected')
        print '\n\n\n##########   MAYA UP AXIS : ###################', r9Setup.mayaUpAxis(
        )

        #the pose is no longer in the same space due to the relative code,
        #we need up update the internal pose before comparing
        self.poseData.buildDataMap(self.rootNode)
        assert r9Pose.PoseCompare(self.poseData, requiredPose).compare()
Esempio n. 4
0
    def test_poseLoadMeta_relativeProjected(self):
        '''
        load the pose with relative and check against the store 'projected' posefile
        '''
        cmds.currentTime(0)
        requiredPose = os.path.join(self.poseFolder,
                                    'jump_f218_projected.pose')

        filepath = os.path.join(self.poseFolder, 'jump_f218.pose')
        cmds.select('L_Foot_Ctrl')
        self.poseData.poseLoad(self.mRig.mNode,
                               filepath=filepath,
                               useFilter=True,
                               relativePose=True,
                               relativeRots='projected',
                               relativeTrans='projected')
        print '\n\n\n##########   MAYA UP AXIS : ###################', r9Setup.mayaUpAxis(
        )
        print 'status : ', self.mRig.poseCompare(requiredPose,
                                                 compareDict='poseDict',
                                                 supressWarning=False).status
        assert self.mRig.poseCompare(
            requiredPose, compareDict='poseDict',
            supressWarning=False).status  # using the mRig internal wrap

        self.mRig.poseCacheStore(
        )  # build an internal poseObj on the mRig now that we've loaded in relative space
        assert not r9Pose.PoseCompare(
            self.mRig.poseCache, filepath, compareDict='poseDict').compare()
        assert r9Pose.PoseCompare(self.mRig.poseCache,
                                  requiredPose,
                                  compareDict='poseDict').compare()
 def test_poseLoadMeta_relativeProjected(self):
     '''
     load the pose with relative and check against the store 'projected' posefile
     '''
     cmds.currentTime(0)
     requiredPose=os.path.join(self.poseFolder,'jump_f218_projected.pose')
     
     filepath=os.path.join(self.poseFolder,'jump_f218.pose')
     cmds.select('L_Foot_Ctrl')
     self.poseData.poseLoad(self.mRig.mNode, filepath=filepath, useFilter=True,
                            relativePose=True,
                            relativeRots='projected',
                            relativeTrans='projected')
     print '\n\n\n##########   MAYA UP AXIS : ###################', r9Setup.mayaUpAxis()
     print 'status : ', self.mRig.poseCompare(requiredPose, compareDict='poseDict', supressWarning=False).status
     assert self.mRig.poseCompare(requiredPose, compareDict='poseDict', supressWarning=False).status  # using the mRig internal wrap
     
     self.mRig.poseCacheStore()  # build an internal poseObj on the mRig now that we've loaded in relative space
     assert not r9Pose.PoseCompare(self.mRig.poseCache, filepath, compareDict='poseDict').compare()
     assert r9Pose.PoseCompare(self.mRig.poseCache, requiredPose, compareDict='poseDict').compare()
 def test_poseLoad_relativeProjected_mirrorIndex(self):
     '''
     load the pose with relative and check against the store 'projected' posefile
     '''
     # mirrorIndex Match -------------------------------------------------
     self.poseData.matchMethod='mirrorIndex'
     cmds.currentTime(0)
     requiredPose=os.path.join(self.poseFolder,'jump_f218_projected.pose')
     
     filepath=os.path.join(self.poseFolder,'jump_f218.pose')
     cmds.select('L_Foot_Ctrl')
     self.poseData.poseLoad(self.rootNode, filepath=filepath, useFilter=True,
                            relativePose=True,
                            relativeRots='projected',
                            relativeTrans='projected')
     print '\n\n\n##########   MAYA UP AXIS : ###################', r9Setup.mayaUpAxis()
     
     #the pose is no longer in the same space due to the relative code,
     #we need up update the internal pose before comparing
     self.poseData.buildDataMap(self.rootNode)
     assert r9Pose.PoseCompare(self.poseData, requiredPose).compare()
Esempio n. 7
0
    def __init__(self, filterSettings=None):
        '''
        I'm not passing any data in terms of nodes here, We'll deal with
        those in the PoseSave and PoseLoad calls. Leaves this open for
        expansion
        '''
        self.poseDict = {}
        self.infoDict = {}
        self.skeletonDict = {}
        self.posePointCloudNodes = []
        self.filepath = ''
        self.mayaUpAxis = r9Setup.mayaUpAxis()
        self.thumbnailRes = [128, 128]
        self.poseCurrentCache = {
        }  # cached dict storing the current state of the objects prior to applying the pose

        self.__metaPose = False
        self.metaRig = None  # filled by the code as we process
        self.matchMethod = 'base'  # method used to match nodes internally in the poseDict
        self.relativePose = False
        self.relativeRots = 'projected'
        self.relativeTrans = 'projected'
        self.useFilter = True
        self.prioritySnapOnly = False
        self.skipAttrs = []  # attrs to completely ignore in any pose handling

        # make sure we have a settings object
        if filterSettings:
            if issubclass(type(filterSettings), r9Core.FilterNode_Settings):
                self.settings = filterSettings
                self.__metaPose = self.settings.metaRig
            else:
                raise StandardError(
                    'filterSettings param requires an r9Core.FilterNode_Settings object'
                )
        else:
            self.settings = r9Core.FilterNode_Settings()
            self.__metaPose = self.settings.metaRig

        self.settings.printSettings()
Esempio n. 8
0
    def __init__(self, filterSettings=None):
        """
        I'm not passing any data in terms of nodes here, We'll deal with
        those in the PoseSave and PoseLoad calls. Leaves this open for
        expansion
        """
        self.poseDict = {}
        self.infoDict = {}
        self.skeletonDict = {}
        self.posePointCloudNodes = []
        self.filepath = ""
        self.mayaUpAxis = r9Setup.mayaUpAxis()
        self.thumbnailRes = [128, 128]
        self.poseCurrentCache = {}  # cached dict storing the current state of the objects prior to applying the pose

        self.__metaPose = False
        self.metaRig = None  # filled by the code as we process
        self.matchMethod = "base"  # method used to match nodes internally in the poseDict
        self.relativePose = False
        self.relativeRots = "projected"
        self.relativeTrans = "projected"
        self.useFilter = True
        self.prioritySnapOnly = False
        self.skipAttrs = []  # attrs to completely ignore in any pose handling

        # make sure we have a settings object
        if filterSettings:
            if issubclass(type(filterSettings), r9Core.FilterNode_Settings):
                self.settings = filterSettings
                self.__metaPose = self.settings.metaRig
            else:
                raise StandardError("filterSettings param requires an r9Core.FilterNode_Settings object")
        else:
            self.settings = r9Core.FilterNode_Settings()
            self.__metaPose = self.settings.metaRig

        self.settings.printSettings()
 def __init__(self, nodes, filterSettings=None, mesh=None):
     '''
     :param rootReference: the object to be used as the PPT's pivot reference
     :param nodes: feed the nodes to process in as a list, if a filter is given
                   then these are the rootNodes for it
     :param filterSettings: pass in a filterSettings object to filter the given hierarchy
     :param mesh: this is really for reference, rather than make a locator, pass in a reference geo
                  which is then shapeSwapped for the PPC root node giving great reference!
     '''
     self.mesh = mesh
     self.refMesh = 'posePointCloudGeoRef'
     self.refMeshShape = 'posePointCloudGeoRefShape'
     self.mayaUpAxis = r9Setup.mayaUpAxis()
     self.inputNodes = nodes  # inputNodes for processing
     self.posePointCloudNodes = []  # generated ppt nodes
     self.posePointRoot = None
     self.settings = None
     self.prioritySnapOnly=False  # ONLY make ppt points for the filterPriority nodes
     
     if filterSettings:
         if not issubclass(type(filterSettings), r9Core.FilterNode_Settings):
             raise StandardError('filterSettings param requires an r9Core.FilterNode_Settings object')
         elif filterSettings.filterIsActive():
             self.settings=filterSettings
Esempio n. 10
0
import maya.standalone
maya.standalone.initialize(name='python')

import maya.cmds as cmds
import os

# import Red9_Meta as r9Meta
import Red9.core.Red9_Meta as r9Meta
import Red9.core.Red9_CoreUtils as r9Core
import Red9.core.Red9_PoseSaver as r9Pose

import Red9.startup.setup as r9Setup
r9Setup.start(Menu=False)

# force the upAxis, just in case
r9Setup.mayaUpAxis('y')


red9MetaRigConfig = os.path.join(r9Setup.red9Presets(), 'Red9_MetaRig_unitTest.cfg')

def getPoseFolder():
    return os.path.join(r9Setup.red9ModulePath(), 'tests', 'testFiles', 'MetaRig_Poses')

class Test_MetaRig():
    '''
    these are wrapped calls on MetaRig itself, note that compare goes via
    the skeletonDict in the internal metaRig compare calls
    '''
    def setup(self):
        cmds.file(os.path.join(r9Setup.red9ModulePath(), 'tests', 'testFiles', 'MetaRig_anim_jump.mb'), open=True, f=True)
        self.mRig = r9Meta.getMetaNodes(mTypes=r9Meta.MetaRig)[0]
Esempio n. 11
0
'''


#import pymel.core as pm
import maya.standalone
maya.standalone.initialize(name='python')

import Red9.core.Red9_AnimationUtils as r9Anim
import Red9.startup.setup as r9Setup
import maya.cmds as cmds
import os
r9Setup.start(Menu=False)

#force the upAxis, just in case
r9Setup.mayaUpAxis('y')

class Test_MirrorSetups(object):
    def setup(self):
        
        self.leftWrist='leftWrist'
        self.leftFoot = 'leftFoot'
        self.rightWrist = 'rightWrist'
        self.rightFoot = 'rightFoot'
        self.root = 'root'
        
        cmds.polyCube(n=self.leftWrist)[0]
        cmds.polyCube(n=self.leftFoot)[0]
        cmds.polyCube(n=self.rightWrist)[0]
        cmds.polyCube(n=self.rightFoot)[0]
        cmds.polyCube(n=self.root)[0]