当前位置: 首页>>代码示例>>Python>>正文


Python Red9_CoreUtils.nodeNameStrip方法代码示例

本文整理汇总了Python中Red9_CoreUtils.nodeNameStrip方法的典型用法代码示例。如果您正苦于以下问题:Python Red9_CoreUtils.nodeNameStrip方法的具体用法?Python Red9_CoreUtils.nodeNameStrip怎么用?Python Red9_CoreUtils.nodeNameStrip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Red9_CoreUtils的用法示例。


在下文中一共展示了Red9_CoreUtils.nodeNameStrip方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: matchInternalPoseObjects

# 需要导入模块: import Red9_CoreUtils [as 别名]
# 或者: from Red9_CoreUtils import nodeNameStrip [as 别名]
 def matchInternalPoseObjects(self, nodes=None, fromFilter=True):
     '''
     This is a throw-away and only used in the UI to select for debugging!
     from a given poseFile return or select the internal stored objects
     '''
     InternalNodes=[]
     if not fromFilter:
         #no filter, we just pass in the longName thats stored
         for key in self.poseDict.keys():
             if cmds.objExists(self.poseDict[key]['longName']):
                 InternalNodes.append(self.poseDict[key]['longName'])
             elif cmds.objExists(key):
                 InternalNodes.append(key)
             elif cmds.objExists(r9Core.nodeNameStrip(key)):
                 InternalNodes.append(r9Core.nodeNameStrip(key))
     else:
         #use the internal Poses filter and then Match against scene nodes
         if self.settings.filterIsActive():
             filterData=r9Core.FilterNode(nodes,self.settings).ProcessFilter()
             matchedPairs=self._matchNodesToPoseData(filterData)
             if matchedPairs:
                 InternalNodes=[node for _,node in matchedPairs]
     if not InternalNodes:
         raise StandardError('No Matching Nodes found!!')
     return InternalNodes
开发者ID:santicolomo,项目名称:Red9_StudioPack,代码行数:27,代码来源:Red9_PoseSaver.py

示例2: _snapNodestoPosePnts

# 需要导入模块: import Red9_CoreUtils [as 别名]
# 或者: from Red9_CoreUtils import nodeNameStrip [as 别名]
 def _snapNodestoPosePnts(self):
     '''
     snap each MAYA node to it's respective pntCloud point
     '''
     for pnt, node in self.posePointCloudNodes:
         log.debug('snapping Ctrl : %s > %s : %s' % (r9Core.nodeNameStrip(node), pnt, node))
         r9Anim.AnimFunctions.snap([pnt,node])
开发者ID:santicolomo,项目名称:Red9_StudioPack,代码行数:9,代码来源:Red9_PoseSaver.py

示例3: buildOffsetCloud

# 需要导入模块: import Red9_CoreUtils [as 别名]
# 或者: from Red9_CoreUtils import nodeNameStrip [as 别名]
 def buildOffsetCloud(self, rootReference=None, raw=False):
     '''
     Build a point cloud up for each node in nodes
     :param nodes: list of objects to be in the cloud
     :param rootReference: the node used for the initial pivot location
     :param raw: build the cloud but DON'T snap the nodes into place - an optimisation for the PoseLoad sequence
     '''
     self.posePointRoot=cmds.ls(cmds.spaceLocator(name='posePointCloud'),l=True)[0]
     
     ppcShape=cmds.listRelatives(self.posePointRoot,type='shape')[0]
     cmds.setAttr("%s.localScaleZ" % ppcShape, 30)
     cmds.setAttr("%s.localScaleX" % ppcShape, 30)
     cmds.setAttr("%s.localScaleY" % ppcShape, 30)
     
     if self.settings:
         if self.prioritySnapOnly:
             self.settings.searchPattern=self.settings.filterPriority
         self.inputNodes=r9Core.FilterNode(self.inputNodes, self.settings).ProcessFilter()
     if self.inputNodes:
         self.inputNodes.reverse()  # for the snapping operations
     
     if self.mayaUpAxis=='y':
         cmds.setAttr('%s.rotateOrder' % self.posePointRoot, 2)
     if rootReference:  # and not mesh:
         r9Anim.AnimFunctions.snap([rootReference,self.posePointRoot])
     for node in self.inputNodes:
         pnt=cmds.spaceLocator(name='pp_%s' % r9Core.nodeNameStrip(node))[0]
         if not raw:
             r9Anim.AnimFunctions.snap([node,pnt])
         cmds.parent(pnt,self.posePointRoot)
         self.posePointCloudNodes.append((pnt,node))
     cmds.select(self.posePointRoot)
     if self.mesh:
         self.shapeSwapMesh()
     return self.posePointCloudNodes
开发者ID:santicolomo,项目名称:Red9_StudioPack,代码行数:37,代码来源:Red9_PoseSaver.py

示例4: _buildPoseDict

# 需要导入模块: import Red9_CoreUtils [as 别名]
# 或者: from Red9_CoreUtils import nodeNameStrip [as 别名]
    def _buildPoseDict(self, nodes):
        """
        Build the internal poseDict up from the given nodes. This is the
        core of the Pose System
        """
        if self.metaPose:
            getMetaDict = self.metaRig.getNodeConnectionMetaDataMap  # optimisation

        for i, node in enumerate(nodes):
            key = r9Core.nodeNameStrip(node)
            self.poseDict[key] = {}
            self.poseDict[key]["ID"] = i  # selection order index
            self.poseDict[key]["longName"] = node  # longNode name

            if self.metaPose:
                self.poseDict[key]["metaData"] = getMetaDict(node)  # metaSystem the node is wired too

            channels = r9Anim.getSettableChannels(node, incStatics=True)
            if channels:
                self.poseDict[key]["attrs"] = {}
                for attr in channels:
                    if attr in self.skipAttrs:
                        log.debug("Skipping attr as requested : %s" % attr)
                        continue
                    try:
                        if (
                            cmds.getAttr("%s.%s" % (node, attr), type=True) == "TdataCompound"
                        ):  # blendShape weights support
                            attrs = cmds.aliasAttr(node, q=True)[::2]  # extract the target channels from the multi
                            for attr in attrs:
                                self.poseDict[key]["attrs"][attr] = cmds.getAttr("%s.%s" % (node, attr))
                        else:
                            self.poseDict[key]["attrs"][attr] = cmds.getAttr("%s.%s" % (node, attr))
                    except:
                        log.debug("%s : attr is invalid in this instance" % attr)
开发者ID:vitattoo,项目名称:Red9_StudioPack,代码行数:37,代码来源:Red9_PoseSaver.py

示例5: _buildPoseDict

# 需要导入模块: import Red9_CoreUtils [as 别名]
# 或者: from Red9_CoreUtils import nodeNameStrip [as 别名]
    def _buildPoseDict(self, nodes):
        '''
        Build the internal poseDict up from the given nodes. This is the
        core of the Pose System
        '''
        if self.metaPose:
            getMetaDict=self.metaRig.getNodeConnectionMetaDataMap  # optimisation

        for i,node in enumerate(nodes):
            key=r9Core.nodeNameStrip(node)
            self.poseDict[key]={}
            self.poseDict[key]['ID']=i           # selection order index
            self.poseDict[key]['longName']=node  # longNode name
            
            if self.metaPose:
                self.poseDict[key]['metaData']=getMetaDict(node)  # metaSystem the node is wired too

            channels=r9Anim.getSettableChannels(node,incStatics=True)
            if channels:
                self.poseDict[key]['attrs']={}
                for attr in channels:
                    try:
                        if cmds.getAttr('%s.%s' % (node,attr),type=True)=='TdataCompound':  # blendShape weights support
                            attrs=cmds.aliasAttr(node, q=True)[::2]  # extract the target channels from the multi
                            for attr in attrs:
                                self.poseDict[key]['attrs'][attr]=cmds.getAttr('%s.%s' % (node,attr))
                        else:
                            self.poseDict[key]['attrs'][attr]=cmds.getAttr('%s.%s' % (node,attr))
                    except:
                        log.debug('%s : attr is invalid in this instance' % attr)
开发者ID:nicolasboselli,项目名称:test,代码行数:32,代码来源:Red9_PoseSaver.py

示例6: _buildOffsetCloud

# 需要导入模块: import Red9_CoreUtils [as 别名]
# 或者: from Red9_CoreUtils import nodeNameStrip [as 别名]
    def _buildOffsetCloud(self,nodes,rootReference=None,raw=False):
        '''
        Build a point cloud up for each node in nodes
        @param nodes: list of objects to be in the cloud
        @param rootReference: the node used for the initial pibot location
        @param raw: build the cloud but DON'T snap the nodes into place - an optimisation for the PoseLoad sequence
        '''
        self.posePointCloudNodes=[]

        self.posePointRoot=cmds.ls(cmds.spaceLocator(name='posePointCloud'),l=True)[0]   
        
        ppcShape=cmds.listRelatives(self.posePointRoot,type='shape')[0] 
        cmds.setAttr( "%s.localScaleZ" % ppcShape, 30)
        cmds.setAttr( "%s.localScaleX" % ppcShape, 30)
        cmds.setAttr( "%s.localScaleY" % ppcShape, 30)
        
        if self.mayaUpAxis=='y':
            cmds.setAttr('%s.rotateOrder' % self.posePointRoot, 2)
        if rootReference:# and not mesh:
            r9Anim.AnimFunctions.snap([rootReference,self.posePointRoot]) 
        for node in nodes:
            pnt=cmds.spaceLocator(name='pp_%s' % r9Core.nodeNameStrip(node))[0]
            if not raw:
                r9Anim.AnimFunctions.snap([node,pnt])
            cmds.parent(pnt,self.posePointRoot)
            self.posePointCloudNodes.append((pnt,node))
        return self.posePointCloudNodes
开发者ID:miketon,项目名称:SymLink,代码行数:29,代码来源:Red9_PoseSaver.py

示例7: formatAudioNode_to_Path

# 需要导入模块: import Red9_CoreUtils [as 别名]
# 或者: from Red9_CoreUtils import nodeNameStrip [as 别名]
 def formatAudioNode_to_Path(self):
     '''
     rename the AudioNode so it ties to the wav name
     '''
     try:
         cmds.rename(self.audioNode, r9Core.nodeNameStrip(os.path.splitext(os.path.basename(self.path))[0]))
     except:
         log.debug('failed to Rename node : %s' % self.audioNode)
开发者ID:santicolomo,项目名称:Red9_StudioPack,代码行数:10,代码来源:Red9_Audio.py

示例8: formatAudioNode_to_Path

# 需要导入模块: import Red9_CoreUtils [as 别名]
# 或者: from Red9_CoreUtils import nodeNameStrip [as 别名]
 def formatAudioNode_to_Path(self):
     '''
     rename the AudioNode so it ties to the wav name
     '''
     try:
         cmds.rename(self.audioNode, r9Core.nodeNameStrip(os.path.splitext(os.path.basename(self.path))[0]))
     except:
         if cmds.referenceQuery(self.audioNode,inr=True):
             log.info('failed to Rename Referenced Audio Node : %s' % self.audioNode)
         else:
             log.info('failed to Rename Audio node : %s' % self.audioNode)
开发者ID:satishgoda,项目名称:Red9_StudioPack,代码行数:13,代码来源:Red9_Audio.py

示例9: _buildSkeletonData

# 需要导入模块: import Red9_CoreUtils [as 别名]
# 或者: from Red9_CoreUtils import nodeNameStrip [as 别名]
 def _buildSkeletonData(self, rootJnt):
     '''
     :param rootNode: root of the skeleton to process
     '''
     self.skeletonDict={}
     if not rootJnt:
         log.info('skeleton rootJnt joint was not found')
         return
     
     fn=r9Core.FilterNode(rootJnt)
     fn.settings.nodeTypes='joint'
     fn.settings.incRoots=False
     skeleton=fn.ProcessFilter()
     
     for jnt in skeleton:
         key=r9Core.nodeNameStrip(jnt)
         self.skeletonDict[key]={}
         self.skeletonDict[key]['attrs']={}
         for attr in ['translateX','translateY','translateZ', 'rotateX','rotateY','rotateZ']:
             try:
                 self.skeletonDict[key]['attrs'][attr]=cmds.getAttr('%s.%s' % (jnt,attr))
             except:
                 log.debug('%s : attr is invalid in this instance' % attr)
开发者ID:santicolomo,项目名称:Red9_StudioPack,代码行数:25,代码来源:Red9_PoseSaver.py

示例10: _buildSkeletonData

# 需要导入模块: import Red9_CoreUtils [as 别名]
# 或者: from Red9_CoreUtils import nodeNameStrip [as 别名]
    def _buildSkeletonData(self, rootJnt):
        """
        :param rootNode: root of the skeleton to process
        """
        self.skeletonDict = {}
        if not rootJnt:
            log.info("skeleton rootJnt joint was not found")
            return

        fn = r9Core.FilterNode(rootJnt)
        fn.settings.nodeTypes = "joint"
        fn.settings.incRoots = False
        skeleton = fn.ProcessFilter()

        for jnt in skeleton:
            key = r9Core.nodeNameStrip(jnt)
            self.skeletonDict[key] = {}
            self.skeletonDict[key]["attrs"] = {}
            for attr in ["translateX", "translateY", "translateZ", "rotateX", "rotateY", "rotateZ"]:
                try:
                    self.skeletonDict[key]["attrs"][attr] = cmds.getAttr("%s.%s" % (jnt, attr))
                except:
                    log.debug("%s : attr is invalid in this instance" % attr)
开发者ID:vitattoo,项目名称:Red9_StudioPack,代码行数:25,代码来源:Red9_PoseSaver.py

示例11: poseLoad

# 需要导入模块: import Red9_CoreUtils [as 别名]
# 或者: from Red9_CoreUtils import nodeNameStrip [as 别名]

#.........这里部分代码省略.........
            is True then use the filter on the destination hierarchy.
        :param relativePose: kick in the posePointCloud to align the loaded pose 
            relatively to the selected node.
        :param relativeRots: 'projected' or 'absolute' - how to calculate the offset.
        :param relativeTrans: 'projected' or 'absolute' - how to calculate the offset.
        :param maintainSpaces: this preserves any parentSwitching mismatches between 
            the stored pose and the current rig settings, current spaces are maintained. 
            This only checks those nodes in the snapList and only runs under relative mode.
        '''
        
        if relativePose and not cmds.ls(sl=True):
            raise StandardError('Nothing selected to align Relative Pose too')
        if not type(nodes)==list:
            nodes=[nodes]  # cast to list for consistency
        
        #push args to object - means that any poseHandler.py file has access to them
        self.relativePose = relativePose
        self.relativeRots = relativeRots
        self.relativeTrans = relativeTrans
        self.PosePointCloud = None
        self.filepath = filepath
        self.useFilter = useFilter  # used in the getNodes call
        self.maintainSpaces = maintainSpaces
        
        nodesToLoad = self._poseLoad_buildcache(nodes)
        
        if not self.matchedPairs:
            raise StandardError('No Matching Nodes found in the PoseFile!')
        else:
            if self.relativePose:
                if self.prioritySnapOnly:
                    #we've already filtered the hierarchy, may as well just filter the results for speed
                    nodesToLoad=r9Core.prioritizeNodeList(nodesToLoad, self.settings.filterPriority, regex=True, prioritysOnly=True)
                    nodesToLoad.reverse()
                    
                #setup the PosePointCloud -------------------------------------------------
                reference=cmds.ls(sl=True,l=True)[0]
                self.PosePointCloud=PosePointCloud(nodesToLoad)
                self.PosePointCloud.buildOffsetCloud(reference, raw=True)
                resetCache=[cmds.getAttr('%s.translate' % self.PosePointCloud.posePointRoot),
                            cmds.getAttr('%s.rotate' % self.PosePointCloud.posePointRoot)]
                
                if self.maintainSpaces:
                    if self.metaRig:
                        parentSpaceCache=self.getMaintainedAttrs(nodesToLoad, self.metaRig.parentSwitchAttr)
                    elif 'parentSpaces' in self.settings.rigData:
                        parentSpaceCache=self.getMaintainedAttrs(nodesToLoad, self.settings.rigData['parentSpaces'])
    
            self._applyPose(percent)

            if self.relativePose:
                #snap the poseCloud to the new xform of the referenced node, snap the cloud
                #to the pose, reset the clouds parent to the cached xform and then snap the
                #nodes back to the cloud
                r9Anim.AnimFunctions.snap([reference,self.PosePointCloud.posePointRoot])
                 
                if self.relativeRots=='projected':
                    if self.mayaUpAxis=='y':
                        cmds.setAttr('%s.rx' % self.PosePointCloud.posePointRoot,0)
                        cmds.setAttr('%s.rz' % self.PosePointCloud.posePointRoot,0)
                    elif self.mayaUpAxis=='z':  # fucking Z!!!!!!
                        cmds.setAttr('%s.rx' % self.PosePointCloud.posePointRoot,0)
                        cmds.setAttr('%s.ry' % self.PosePointCloud.posePointRoot,0)
                    
                self.PosePointCloud._snapPosePntstoNodes()
                
                if not self.relativeTrans=='projected':
                    cmds.setAttr('%s.translate' % self.PosePointCloud.posePointRoot,
                                 resetCache[0][0][0],
                                 resetCache[0][0][1],
                                 resetCache[0][0][2])
                if not self.relativeRots=='projected':
                    cmds.setAttr('%s.rotate' % self.PosePointCloud.posePointRoot,
                                 resetCache[1][0][0],
                                 resetCache[1][0][1],
                                 resetCache[1][0][2])
               
                if self.relativeRots=='projected':
                    if self.mayaUpAxis=='y':
                        cmds.setAttr('%s.ry' % self.PosePointCloud.posePointRoot,resetCache[1][0][1])
                    elif self.mayaUpAxis=='z':  # fucking Z!!!!!!
                        cmds.setAttr('%s.rz' % self.PosePointCloud.posePointRoot,resetCache[1][0][2])
                if self.relativeTrans=='projected':
                    if self.mayaUpAxis=='y':
                        cmds.setAttr('%s.tx' % self.PosePointCloud.posePointRoot,resetCache[0][0][0])
                        cmds.setAttr('%s.tz' % self.PosePointCloud.posePointRoot,resetCache[0][0][2])
                    elif self.mayaUpAxis=='z':  # fucking Z!!!!!!
                        cmds.setAttr('%s.tx' % self.PosePointCloud.posePointRoot,resetCache[0][0][0])
                        cmds.setAttr('%s.ty' % self.PosePointCloud.posePointRoot,resetCache[0][0][1])
                
                #if maintainSpaces then restore the original parentSwitch attr values
                #BEFORE pushing the point cloud data back to the rig
                if self.maintainSpaces and parentSpaceCache:  # and self.metaRig:
                    for child,attr,value in parentSpaceCache:
                        log.debug('Resetting parentSwitches : %s.%s = %f' % (r9Core.nodeNameStrip(child),attr,value))
                        cmds.setAttr('%s.%s' % (child,attr), value)
                            
                self.PosePointCloud._snapNodestoPosePnts()
                self.PosePointCloud.delete()
                cmds.select(reference)
开发者ID:santicolomo,项目名称:Red9_StudioPack,代码行数:104,代码来源:Red9_PoseSaver.py


注:本文中的Red9_CoreUtils.nodeNameStrip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。