Exemplo 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.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()
Exemplo n.º 2
0
def batchPatchPoses(posedir, config, poseroot, load=True, save=True, patchfunc=None,\
                    relativePose=False, relativeRots=False, relativeTrans=False):
    '''
    whats this?? a fast method to run through all the poses in a given dictionary and update
    or patch them. If patchfunc isn't given it'll just run through and resave the pose - updating
    the systems if needed. If it is then it gets run between the load and save calls.
    :param posedir: directory of poses to process
    :param config: hierarchy settings cfg to use to ID the nodes (hierarchy tab preset = filterSettings object)
    :param poseroot: root node to the filters - poseTab rootNode/MetaRig root
    :param patchfunc: optional function to run between the load and save call in processing, great for
            fixing issues on mass with poses. Note we now pass pose file back into this func as an arg
    :param load: should the batch load the pose
    :param save: should the batch resave the pose
    '''

    filterObj = r9Core.FilterNode_Settings()
    filterObj.read(os.path.join(r9Setup.red9ModulePath(), 'presets',
                                config))  # 'Crytek_New_Meta.cfg'))
    mPose = PoseData(filterObj)

    files = os.listdir(posedir)
    files.sort()
    for f in files:
        if f.lower().endswith('.pose'):
            if load:
                mPose.poseLoad(poseroot,
                               os.path.join(posedir, f),
                               useFilter=True,
                               relativePose=relativePose,
                               relativeRots=relativeRots,
                               relativeTrans=relativeTrans)
            if patchfunc:
                patchfunc(f)
            if save:
                mPose.poseSave(poseroot,
                               os.path.join(posedir, f),
                               useFilter=True,
                               storeThumbnail=False)
            log.info('Processed Pose File :  %s' % f)