當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。