コード例 #1
0
    def loadReferenceList(self, scrollList):

        sels = cmds.listRelatives(cmds.ls(sl=1), c=1, ad=1, f=1)

        cmds.textScrollList(scrollList, e=1, ra=1)

        fileNames = []
        namespaces = []
        filePaths = []
        for sel in sels:
            if not cmds.reference(sel, q=1, inr=1): continue

            namespace = cmds.referenceQuery(sel, ns=1)

            filePath = cmds.reference(sel, q=1, filename=1)

            fileName = filePath.split('/')[-1]
            if not fileName in fileNames:
                fileNames.append(fileName)
                namespaces.append(namespace[1:])
            else:
                continue

            filePaths.append(filePath)

        targetTxts = []
        for i in range(len(fileNames)):
            targetTxt = '%s --> %s' % (namespaces[i], filePaths[i])
            targetTxts.append(targetTxt)

        cmds.textScrollList(scrollList, e=1, append=targetTxts)
コード例 #2
0
ファイル: sgUISceneBake.py プロジェクト: jonntd/mayadev-1
    def loadReferenceList(self, scrollList ):
        
        sels = cmds.listRelatives( cmds.ls( sl=1 ), c=1, ad=1, f=1 )

        cmds.textScrollList( scrollList, e=1, ra=1 )
        
        fileNames = []
        namespaces = []
        filePaths = []
        for sel in sels:
            if not cmds.reference( sel, q=1, inr=1 ): continue
            
            namespace = cmds.referenceQuery( sel, ns=1 )
            
            filePath = cmds.reference( sel, q=1, filename=1 )
            
            fileName = filePath.split( '/' )[-1]
            if not fileName in fileNames:
                fileNames.append( fileName )
                namespaces.append( namespace[1:] )
            else:
                continue
            
            filePaths.append( filePath )

        targetTxts = []
        for i in range( len( fileNames ) ):
            targetTxt = '%s --> %s' %( namespaces[i], filePaths[i] )
            targetTxts.append( targetTxt )
        
        cmds.textScrollList( scrollList, e=1, append=targetTxts )
コード例 #3
0
ファイル: sgRigSkinCluster.py プロジェクト: jonntd/mayadev-1
def replaceObjectSkined( first, second ):
    
    secondParents = sgModelDag.getParents( second )

    if secondParents:
        secondTopParentMMtx = sgModelDag.getMMatrix( secondParents[0] )
    else:
        secondTopParentMMtx = om.MMatrix()
    secondMMtx = sgModelDag.getMMatrix( second )
    secondLocalMMtx = secondMMtx * secondTopParentMMtx.inverse()
    
    secondLocalMtx = sgModelConvert.convertMMatrixToMatrix( secondLocalMMtx )
    
    if cmds.reference( first, inr=1 ):
        first = cmds.duplicate( first )[0]
    
    if secondParents:
        first = cmds.parent( first, secondParents[0] )[0]
    cmds.xform( first, matrix=secondLocalMtx, os=1 )
    if secondParents:
        if not secondParents[-1] in cmds.listRelatives( first, p=1, f=1 ):
            first = cmds.parent( first, secondParents[-1] )[0]
    
    
    autoCopyWeight( second, first )
    
    cmds.delete( second )
コード例 #4
0
ファイル: curvePathEditor.py プロジェクト: jonntd/mayadev-1
    def refreshTextScrollList(self):
        
        targetWorldCtl = cmds.textField( self._worldCtl, q=1, tx=1 )
        
        if not targetWorldCtl: return None
        
        refs = cmds.ls( type='reference' )

        worldCtls = []
        for ref in refs:
            try :ctls = cmds.reference( rfn=ref, n=1 )
            except: continue
            for ctl in ctls:
                if ctl == targetWorldCtl: continue
                if ctl[-9:] == 'World_CTL':
                    worldCtls.append( ctl )
                    break
                elif ctl.find( 'DGTR' ) != -1 and ctl[-4:] == '_CTL':
                    namespace = ctl.split( 'DGTR' )[0]
                    worldCtls.append( namespace+'DGTR_World_CTL' )
                    break
           
        connectedCtls = retargetCmd.getConnectedRetargetWorldCtl( targetWorldCtl )
        
        for connectedCtl in connectedCtls:
            worldCtls.remove( connectedCtl )
        
        cmds.textScrollList( self._retargetList, e=1, ra=1, a=connectedCtls )
コード例 #5
0
    def _bake(cls, namespace):
        source_rig = None
        dest_rig = None
        source_root = None
        meta_nodes = getMetaNodes(mTypes='MsvMetaRig')
        if meta_nodes:
            for obj in meta_nodes:
                # print 'obj rig: %s, rig: %s' % (obj.rigName, rig_name)
                # if obj.rigName == rig_name:
                if obj.nameSpaceFull().startswith(namespace):
                    dest_rig = obj
                else:
                    _source_rig = obj
                    _source_root = _source_rig.get_export_root()
                    if _source_root:
                        source_root = _source_root
                        source_rig = _source_rig

        if not source_root:
            root_name = dest_rig.get_export_root().split('|')[-1].split(
                ':')[-1]
            for jnt in mc.ls(type='joint'):
                if not mc.reference(
                        jnt, q=True,
                        isNodeReferenced=True) and not jnt.startswith(
                            namespace) and jnt.endswith(root_name):
                    source_root = jnt

        binder_rigs = r9Meta.getMetaNodes("MsvAnimationBinderRig")

        # source root (new rig) name is C_pelvis, Marker
        # but the dest root (old rig) name is root, marker, etc, so don't use name matching
        dest_root = [
            joint for joint in binder_rigs[0].get_root_joints()
            if mc.listRelatives(joint, c=True, type='joint')
        ][0]

        anim_binder.bind_skeletons(source_root, dest_root)

        dest_root_node = dest_rig.get_export_root()
        if mc.nodeType(dest_root_node) == 'reference':
            # We reference the skeleton into rig file
            # and the Meta rig node will store the reference node instead of the root joint
            # ps: the reference node is parent node of root joint
            joint_nodes = [
                node for node in mc.referenceQuery(
                    dest_root_node, nodes=True, dp=True)
                if mc.nodeType(node) == 'joint'
            ]
            joint_node = joint_nodes[0].split('|')[-1]
            dest_root_node = cls._get_root_parent(joint_node)
        else:
            # dest_root_node is u'|Thanator_Rig:main_Grp|Thanator_Rig:output_Grp|Thanator_Rig:C_pelvis'
            # always to select it's root parent node
            dest_root_node = dest_root_node.split('|')[1]

        ctrls = cls._get_bound_ctrls(dest_root_node)
        # anim_binder.bake_binder_data(dest_root_node)
        self._bake_binder_data()
        return source_rig, dest_rig, ctrls
コード例 #6
0
ファイル: editTransform.py プロジェクト: jonntd/mayadev-1
    def refreshTextScrollList(self, *args ):
        
        targetWorldCtl = cmds.textField( self._worldCtl, q=1, tx=1 )
        
        refs = cmds.ls( type='reference' )

        worldCtls = []
        for ref in refs:
            try :ctls = cmds.reference( rfn=ref, n=1 )
            except: continue
            for ctl in ctls:
                if ctl == targetWorldCtl: continue
                if ctl[-9:] == 'World_CTL':
                    worldCtls.append( ctl )
                    break
                elif ctl.find( 'DGTR' ) != -1 and ctl[-4:] == '_CTL':
                    namespace = ctl.split( 'DGTR' )[0]
                    worldCtls.append( namespace+'DGTR_World_CTL' )
                    break
           
        connectedCtls = retargetCmd.getConnectedRetargetWorldCtl( targetWorldCtl )
        
        for connectedCtl in connectedCtls:
            worldCtls.remove( connectedCtl )
        
        cmds.textScrollList( self._retargetList, e=1, ra=1, a=connectedCtls )
        cmds.textScrollList( self._transformList, e=1, ra=1 )
コード例 #7
0
ファイル: timeControl.py プロジェクト: jonntd/mayadev-1
    def refreshTextScrollList(self, *args):

        targetWorldCtl = cmds.textField(self._worldCtl, q=1, tx=1)

        refs = cmds.ls(type='reference')

        worldCtls = []
        for ref in refs:
            try:
                ctls = cmds.reference(rfn=ref, n=1)
            except:
                continue
            for ctl in ctls:
                if ctl == targetWorldCtl: continue
                if ctl[-9:] == 'World_CTL':
                    worldCtls.append(ctl)
                    break
                elif ctl.find('DGTR') != -1 and ctl[-4:] == '_CTL':
                    namespace = ctl.split('DGTR')[0]
                    worldCtls.append(namespace + 'DGTR_World_CTL')
                    break

        timeControls = timeCmd.getTimeControl(targetWorldCtl, worldCtls)

        cmds.textScrollList(self._timeControl, e=1, ra=1, a=timeControls)
コード例 #8
0
def replaceObjectSkined(first, second):

    secondParents = sgModelDag.getParents(second)

    if secondParents:
        secondTopParentMMtx = sgModelDag.getMMatrix(secondParents[0])
    else:
        secondTopParentMMtx = om.MMatrix()
    secondMMtx = sgModelDag.getMMatrix(second)
    secondLocalMMtx = secondMMtx * secondTopParentMMtx.inverse()

    secondLocalMtx = sgModelConvert.convertMMatrixToMatrix(secondLocalMMtx)

    if cmds.reference(first, inr=1):
        first = cmds.duplicate(first)[0]

    if secondParents:
        first = cmds.parent(first, secondParents[0])[0]
    cmds.xform(first, matrix=secondLocalMtx, os=1)
    if secondParents:
        if not secondParents[-1] in cmds.listRelatives(first, p=1, f=1):
            first = cmds.parent(first, secondParents[-1])[0]

    autoCopyWeight(second, first)

    cmds.delete(second)
コード例 #9
0
def repairTexture(ty = 0):
	if ty:
		selObj = mc.listRelatives(mc.ls(sl = True)[0],c = True,s = True,type = 'mesh',f = True)[0]
		if mc.reference(selObj,inr = True):
			links = mc.ls('%s.instObjGroups[*]'%selObj)
			for link in links:
				linkConAttr = mc.connectionInfo('%s.objectGroups[0]'%link,ges = True)
				sgNode = mc.connectionInfo(linkConAttr,dfs = True)[0]
				mc.disconnectAttr(linkConAttr,sgNode)
				mc.connectAttr(link,sgNode,f = True)
	else:
		objs = [o for o in mc.ls(s = True,l= True,type = 'mesh') if  mc.reference(o,inr = True)]
		for obj in objs:
			if mc.objExists('%s.instObjGroups.objectGroups[0]'%obj):
				lins = mc.ls('%s.instObjGroups[*]'%obj)
				for lin in lins:
					if mc.connectionInfo('%s.objectGroups[0]'%lin,isSource = True):
						linConAttr = mc.connectionInfo('%s.objectGroups[0]'%lin,ges = True)
						sgNod = mc.connectionInfo(linConAttr,dfs = True)[0]
						mc.disconnectAttr(linConAttr,sgNod)
						mc.connectAttr(lin,sgNod,f = True)
コード例 #10
0
ファイル: bjtsMenu.py プロジェクト: jonntd/mayadev-1
 def driverSetMenu(self):
     cmds.setParent( self.parentUi, menu=1 )
     
     ns = self.sels[-1].replace( 'BJT_World', '' )
     
     driverSet.bjtDriverSet( ns )
     
     if cmds.reference( self.sels[-1], inr=1 ): return None
     
     if not driverSet.isConnected( self.sels[-1] ):
         cmds.menuItem( l='Create Driver Joint', c= partial( driverSet.setConnect, ns ), rp='N' )
     else:
         cmds.menuItem( l='Delete Driver Joint', c= partial( driverSet.setDisconnect, ns ), rp='N' )
コード例 #11
0
def getReferencedShaderInfo( shadingEngine ):

    print "current shading engine : ", shadingEngine

    shaderInfo = sgBModel_shader.ReferencedShaderInfo()
    
    shader = cmds.listConnections( shadingEngine+'.surfaceShader', s=1, d=0 )
    displace = cmds.listConnections( shadingEngine+'.displacementShader', s=1, d=0 )
    volume = cmds.listConnections( shadingEngine+'.volumeShader', s=1, d=0 )
    
    if shader: shader = shader[0]
    if displace: displace = displace[0]
    if volume: volume = volume[0]
    
    if not shader: return None

    pmc_ShadingEngine = pymelcore.ls( shadingEngine )[0]
    
    targets = []
    for member in pmc_ShadingEngine.members():
        if 'indices' in dir( member ):
            targets.append( [member.node().name(), member.indices()] )
        else:
            targets.append( [member.node().name(), None] )

    if not cmds.reference( shader, q=1, inr=1 ):
        cmds.warning( "%s is not referenced" % shader )
        refPath = None
    else:
        refPath = cmds.reference( shader, q=1, f=1 )
    
    shaderInfo.referencePath   = refPath
    shaderInfo.shaderName      = shader.split( ':' )[-1]
    shaderInfo.displaceName    = displace
    shaderInfo.volumeName      = volume
    shaderInfo.assignedTargets = targets
    
    return shaderInfo
コード例 #12
0
    def _unload_useless_nodes(cls, source_rig, dest_rig, binder_namespace,
                              source_root_nodes):
        if source_rig:
            # remove source reference
            source_namespace = source_rig.nameSpaceFull()
            cls._unload_reference(source_rig)
        else:
            root_name = dest_rig.get_export_root().split('|')[-1].split(
                ':')[-1]
            for jnt in mc.ls(type='joint'):
                if not mc.reference(
                        jnt, q=True,
                        isNodeReferenced=True) and not jnt.startswith(
                            binder_namespace) and jnt.endswith(root_name):
                    source_namespace = jnt.split(':')[0]
                    for root in source_root_nodes:
                        if mc.objExists(root):
                            try:
                                mc.delete(root)
                            except Exception as e:
                                print e.message
                    break

        # remove the binder file's node and rename source namespace nodes
        nodes_with_namespace = [node for node in mc.ls(recursive=True)]
        for i in reversed(range(len(nodes_with_namespace))):
            node = nodes_with_namespace[i]

            if mc.objExists(node):
                if node.startswith(binder_namespace):
                    if mc.nodeType(node) == 'reference':
                        continue

                    try:
                        mc.lockNode(node, lock=False)
                        mc.delete(node)
                    except Exception as e:
                        print e.message

                elif node.startswith(source_namespace):
                    try:
                        mc.lockNode(node, lock=False)
                        mc.rename(
                            node,
                            node.replace(source_namespace + ':',
                                         source_namespace + '__'))
                    except Exception as e:
                        print e.message
コード例 #13
0
    def driverSetMenu(self):
        cmds.setParent(self.parentUi, menu=1)

        ns = self.sels[-1].replace('BJT_World', '')

        driverSet.bjtDriverSet(ns)

        if cmds.reference(self.sels[-1], inr=1): return None

        if not driverSet.isConnected(self.sels[-1]):
            cmds.menuItem(l='Create Driver Joint',
                          c=partial(driverSet.setConnect, ns),
                          rp='N')
        else:
            cmds.menuItem(l='Delete Driver Joint',
                          c=partial(driverSet.setDisconnect, ns),
                          rp='N')
コード例 #14
0
ファイル: retargeting.py プロジェクト: jonntd/mayadev-1
def getWorldCtlList():
    
    refs = cmds.ls( type='reference' )

    worldCtls = []
    for ref in refs:
        try :ctls = cmds.reference( rfn=ref, n=1 )
        except: continue
        for ctl in ctls:
            if ctl[-9:] == 'World_CTL':
                worldCtls.append( ctl )
                break
            elif ctl.find( 'DGTR' ) != -1 and ctl[-4:] == '_CTL':
                namespace = ctl.split( 'DGTR' )[0]
                worldCtls.append( namespace+'DGTR_World_CTL' )
                break
            
    return worldCtls
コード例 #15
0
ファイル: retargeting.py プロジェクト: jonntd/mayadev-1
def getWorldCtlList():

    refs = cmds.ls(type='reference')

    worldCtls = []
    for ref in refs:
        try:
            ctls = cmds.reference(rfn=ref, n=1)
        except:
            continue
        for ctl in ctls:
            if ctl[-9:] == 'World_CTL':
                worldCtls.append(ctl)
                break
            elif ctl.find('DGTR') != -1 and ctl[-4:] == '_CTL':
                namespace = ctl.split('DGTR')[0]
                worldCtls.append(namespace + 'DGTR_World_CTL')
                break

    return worldCtls
コード例 #16
0
ファイル: characterSet_lib.py プロジェクト: boochos/work
def flush():
    all = listTop()
    print 'top list'
    if all:
        deleteFlushed()
        print 'deleted'
        tmp = []
        for char in all:
            if cmds.reference(char, inr=True) is False:
                tmp.append(char)
        all = tmp
        if len(all) > 0:
            path = shotPath()
            for set in all:
                exportFile(set, os.path.join(path + set))
                print "-- flushed:   '" + set + "'  --"
            deleteAll()
        else:
            pass
    else:
        message('No Character Sets in Scene')
コード例 #17
0
def exportBakeData( targets, startFrame, endFrame, cachePath = '' ):
    
    transformBakePath = cachePath + '/transformBake.cPickle'
    
    targets = sgModelConvert.convertFullPathNames( targets )
    trObjs = cmds.listRelatives( targets, c=1, ad=1, type='transform', f=1 )
    if not trObjs: trObjs = []
    trObjs += targets
    
    trParents = []
    for trObj in trObjs:
        parents = sgModelDag.getParents( trObj )
        trParents += parents
    
    trs = list( set( trObjs + trParents ) )
    
    trs.sort()
    
    namespaces = []
    filePaths  = []
    cacheBodyPaths = []
    
    namespaceIndices = []
    for tr in trs:
        if not cmds.reference( tr, q=1, inr=1 ):
            namespaceIndices.append( None )
            continue
        
        namespace = cmds.referenceQuery( tr, ns=1 )
        filePath = cmds.reference( tr, q=1, filename =1 ).split( '{' )[0]
        
        cacheBodyPath = '.'.join( filePath.split( '.' )[:-1] ) + '_cachebody.' + filePath.split( '.' )[-1]

        if not os.path.exists( cacheBodyPath ):
            cacheBodyPath = ''

        if not namespace in namespaces:
            print "appended namespace :", namespace
            namespaces.append( namespace )
            filePaths.append( filePath )
            cacheBodyPaths.append( cacheBodyPath )
        
        namespaceIndex = namespaces.index( namespace )
        namespaceIndices.append( namespaceIndex )

    parentList = []
    objectList = []
    
    shapes = []
    for i in range( len( trs ) ):
        tr = trs[i]
        trParent = cmds.listRelatives( tr, p=1, f=1 )
        trMtx = cmds.getAttr( tr+'.m' )
        trPiv = cmds.xform( tr, q=1, os=1, piv=1 )[:3]
        
        listAttrs = cmds.listAttr( tr, k=1 )
        attrInfoList = []
        for attr in listAttrs:
            if not cmds.attributeQuery( attr, node=tr, ex=1 ): continue
            if cmds.listConnections( tr+'.'+ attr, s=1, d=0 ):
                animCurves = cmds.listConnections( tr+'.'+ attr, s=1, d=0, type='animCurve' )
                if animCurves:
                    attrInfoList.append( [attr, sgModelDg.AnimCurveData( animCurves[0] )] )
                else:
                    attrInfoList.append( [attr, []] )
            else:
                parentAttrs = cmds.attributeQuery( attr, node=tr, listParent = 1 )
                if parentAttrs:
                    if cmds.listConnections( tr+'.'+parentAttrs[0], s=1, d=0 ):
                        attrInfoList.append( [attr, []] )

        if trParent: trParent = trParent[0]
        if trParent in parentList:
            parentIndex= parentList.index( trParent )
        else:
            parentIndex = -1
        
        objectList.append( [ namespaceIndices[i], parentIndex, tr, trMtx, trPiv, attrInfoList ] )
        parentList.append( tr )
        
        shape = sgModelDag.getShape( tr )
        if shape: shapes.append( shape )
    
    timeUnit = cmds.currentUnit( q=1, time=1 )
    dataForExport = [ namespaces, filePaths, cacheBodyPaths, objectList, timeUnit ]

    deformedShapes = sgModelDag.getDeformedObjects( shapes )

    if deformedShapes:
        def setKeyframeBakeTargets( *args ):
            cuTime = cmds.currentTime( q=1 )
            
            for i in range( len(objectList) ):
                for j in range( len( objectList[i][5] ) ):
                    attr = objectList[i][5][j][0]
                    info = objectList[i][5][j][1]
                    if type( info ) != type( [] ): continue
                    tr = objectList[i][2]
                    value = cmds.getAttr( tr+'.' + attr )
                    objectList[i][5][j][1].append( [ cuTime, value ] )
        
        callbackId = om.MEventMessage().addEventCallback( 'timeChanged', setKeyframeBakeTargets )
        cmds.select( deformedShapes )
        sgFunctionFileAndPath.makeFolder( cachePath )
        mel.eval( 'doCreateGeometryCache 6 { "3", "%s", "%s", "OneFile", "1", "%s","1","","0", "export", "0", "1", "1","0","0","mcc","0" };' %( startFrame, endFrame, cachePath ) )
        om.MMessage().removeCallback( callbackId )

    transformBakePath = sgFunctionFileAndPath.makeFile( transformBakePath, False )
    f = open( transformBakePath, 'w' )
    cPickle.dump( dataForExport, f )
    f.close()
    
    return transformBakePath
コード例 #18
0
ファイル: allCtlsMenu.py プロジェクト: jonntd/mayadev-1
 def prefixMenu(self):
     
     if cmds.reference( self.sels[-1], inr=1 ): return None
     
     cmds.setParent( self.parentUi, menu=1 )
     cmds.menuItem( l='Add Prefix Name', rp='N', c= partial( self.mainCmd.AddNameSpace, self.sels[-1] ) )
コード例 #19
0
cmds.file(rename='ref.ma')
cmds.file(force=True, type='mayaAscii', save=True)
cmds.file(force=True, new=True)
cmds.file('ref.ma', reference=True, namespace='ref')

#放大球体,设置属性,或获取属性
cmds.setAttr('ref:pSphere1.s', 5, 5, 5)
cmds.getAttr('ref:pSphere1.s')
# Result: 5 5 5 #

# The 'cleanReference' and 'editCommand' flags only work on
#不加载引用
cmds.file(unloadReference='refRN')

#查询已经修改过的对象
cmds.reference(referenceNode='refRN', query=True, editCommand=True)
# Result: setAttr ref:pSphere1.s -type "double3" 5 5 5 setAttr ref:lightLinker1.lnk -s 2 #

# Remove all setAttr edits on refRN:
#移除所有编辑过的引用对象节点
cmds.file(cleanReference='refRN', editCommand='setAttr')
cmds.reference(referenceNode='refRN', query=True, editCommand=True)
#注意这里没有反馈

#加载引用
cmds.file(loadReference='refRN')
#再次查看物体属性,发现之前物体的修改,已经全部没有了
cmds.getAttr('ref:pSphere1.s')
# Result: 1 1 1 #
# Note that scale has returned to 1 1 1
コード例 #20
0
    def shaveReName(self):
        noShaveCacheFiles = []
        allOnlyShaveShapes = []
        PROJECT_PATH = mm.eval('getenv "OCTV_PROJECTS"')
        OCT_DRIVE = r'\\octvision.com\cg'
        allShaveShapes = mc.ls(type='shaveHair')
        for eachShape in allShaveShapes:
            allOnlyShaveShapes.append(eachShape.split("|")[-1])

        allOnlyShaveShapes = list(set(allOnlyShaveShapes))
        if len(allShaveShapes) > len(allOnlyShaveShapes):
            mc.warning(u"毛发Shave的shapes节点有重名的,将导致同名的Shave使用同一个缓存!")
        myshaveGlobals = "shaveGlobals"

        allOnlyShaveShapes = list(set(allOnlyShaveShapes))
        myshaveGlobals = "shaveGlobals"
        if allShaveShapes and myshaveGlobals:
            shavePath = mc.getAttr("%s.tmpDir" % myshaveGlobals)
            if shavePath:
                if shavePath.find('${OCTV_PROJECTS}') >= 0:
                    shavePath = shavePath.replace('${OCTV_PROJECTS}',
                                                  PROJECT_PATH)
                elif shavePath.find('z:') >= 0:
                    shavePath = shavePath.replace('z:', OCT_DRIVE)
                elif shavePath.find('Z:') >= 0:
                    shavePath = shavePath.replace('Z:', OCT_DRIVE)
                if not os.path.isdir(shavePath):
                    proPath = mc.workspace(q=True, rd=True)
                    shavePath = os.path.normpath(
                        os.path.join(proPath, shavePath))
                if shavePath.find('z:') >= 0:
                    shavePath = shavePath.replace('z:', OCT_DRIVE)
                elif shavePath.find('Z:') >= 0:
                    shavePath = shavePath.replace('Z:', OCT_DRIVE)
                if os.path.isdir(shavePath):
                    allSahveDirs = os.listdir(shavePath)
                    if allSahveDirs:
                        shaveNames = []
                        for eachDir in allSahveDirs:
                            shaveNames.append(eachDir.split(".")[0])
                        shaveNames = list(set(shaveNames))
                        for eachShape in allShaveShapes:
                            if mc.reference(eachShape, isNodeReferenced=True):
                                mc.confirmDialog(message=u"请先导入参考的文件!")
                                return
                            myName = ""
                            if ":" in eachShape.split("|")[-1]:
                                shaveNames = eachShape.replace(":", "_")
                                myName = mc.rename(eachShape, shaveNames)
                                eachTran = mc.listRelatives(myName,
                                                            f=True,
                                                            p=True)[0]
                                pathTran = eachTran.split("|")
                                if ":" in pathTran[-1]:
                                    tranName = pathTran[-1].replace(":", "_")
                                    myName = mc.rename(pathTran[-1], tranName)
                            else:
                                noShaveCacheFiles.append(myshaveGlobals)

        if not noShaveCacheFiles:
            mc.confirmDialog(message=u"修改shave的名字成功!")
            return