• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utility.NodeUtility类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中marigold.utility.NodeUtility的典型用法代码示例。如果您正苦于以下问题:Python NodeUtility类的具体用法?Python NodeUtility怎么用?Python NodeUtility使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: createCompoundCurve

def createCompoundCurve(inCurves):
    """
    Merges all the controls into one transform node.
    
    @param inCurves: List of Strings. Names of curves to combine under one transform node.
                        The first curve in the list is considered the parent of all the others.
    @return: MObject. Compound curve transform node.
    """
    # List for creating the compound.
    compoundList = []

    # Get the nurbs curves of all curves in the list.
    for index in range(1, len(inCurves)):
        curve = NodeUtility.getDagPath(inCurves[index])
        for child in xrange(curve.childCount()):
            nurb = curve.child(child)
            nurbDagPath = OpenMaya.MDagPath.getAPathTo(nurb)
            if nurb.apiType() == OpenMaya.MFn.kNurbsCurve:
                compoundList.append(nurbDagPath.fullPathName())

    # Add the transform of the parent curve. This is the first curve passed into
    # the function.
    parent = NodeUtility.getDagPath(inCurves[0])
    compoundList.append(parent.fullPathName())

    # Now parent the shapes to the first curve's transform node.
    cmds.parent(compoundList, shape=True, relative=True)

    # Delete the remaining transform nodes of the other curves.
    for index in range(1, len(inCurves)):
        cmds.delete(inCurves[index])

    # Returns a MObject.
    return NodeUtility.getDependNode(parent.fullPathName())
开发者ID:EriLee,项目名称:marigold,代码行数:34,代码来源:NurbsCurveUtility.py


示例2: getComponents

def getComponents( inObj ):
    '''
    Creates the components GUI.
    '''    
    if inObj is not None:
        components_list = NodeUtility.getFrameBitSettings( inObj )
    else:
        components_list = None
    
    # If the newly selected bit has components then update the UI to show them.
    # Check to see if any of the components are connected to a meta node.
    # We do this check so that we don't create a bunch of UI elements
    # unnecessarily.
    if components_list is not None and metaNodeCheck( inObj, components_list ):            
        # Loop through each component on the bit.
        components_class_list = {}
        for node_name in components_list:
            # Check to see if the component is connected to a meta node.
            metaNode = NodeUtility.getNodeAttrDestination( inObj, node_name )
            if metaNode:
                # It has a meta node.
                # Get the meta node properties. This returns a dict.
                meta_properties = NodeUtility.getFrameBitSettings( metaNode[0] )
                component_class = meta_properties[ 'classType' ]
                # test hack!!!
                components_class_list[ node_name ] = component_class
        return components_class_list
    else:
        return None
开发者ID:EriLee,项目名称:marigold,代码行数:29,代码来源:__init__.py


示例3: addComponentToObject

def addComponentToObject( inClassType, **kwargs ):    
    if kwargs.has_key('inObject'):
        targetObj = kwargs['inObject']
        print 'targetObj: {0}'.format( targetObj )
        del kwargs['inObject']
        prevSel = None
    else:
        selList = cmds.ls( selection=True, long=True )
        if len( selList ) is 1:
            targetObj = selList[0]
            prevSel = selList[0]
    
    if targetObj is not None:
        component_class = str_to_class( inClassType )
        newNode = component_class.createCompNode( inClassType, **kwargs )
        
        # Add the component attribute to the object.
        NodeUtility.addPlug( targetObj, newNode.name(), 'attributeType', 'message' )
        nodePlug = '{0}.parentName'.format( newNode.name() )
        objectPlug = '{0}.{1}'.format( targetObj, newNode.name() )
        NodeUtility.connectPlugs( objectPlug, nodePlug )
        if prevSel is not None:
            cmds.select( prevSel )
            
        return newNode
开发者ID:EriLee,项目名称:marigold,代码行数:25,代码来源:__init__.py


示例4: requiredAttributes

 def requiredAttributes( self, *args, **kwargs ):
     NodeUtility.addPlug( self.newNode, 'parentName', 'attributeType', 'message' )
     #cmds.addAttr( newNode, longName='parentName', attributeType='message', storable=True )
     #self.setAttribute( cls(), 'parentName', self.newNode, inNodeName=self.newNode )
     self.setAttribute( 'parentName', self.newNode, self.newNode )
     
     NodeUtility.addPlug( self.newNode, 'classType', 'dataType', 'string' )
     #cls( self.newNode ).classType = [ self.newNode, self.nodeType, True ]
     self.classType = [ self.newNode, self.nodeType, True ]
开发者ID:EriLee,项目名称:marigold,代码行数:9,代码来源:BaseComponent.py


示例5: storeControlTransforms

def storeControlTransforms( sourceObj, targetObj ):
    '''
    Store control transform data.
    
    @param sourceObj: String. Name of object to pull data from.
    @param targetObj: String. Name of object to store data on.
    '''    
    sourceMatrix = TransformUtility.getMatrix( sourceObj, 'matrix' )
    
    # Store the position
    targetPosPlug = NodeUtility.getPlug( targetObj, 'controlPosition' )
    sourceTranslation = TransformUtility.getMatrixTranslation( sourceMatrix, OpenMaya.MSpace.kTransform )
    pos = [ sourceTranslation.x, sourceTranslation.y, sourceTranslation.z ]
    NodeUtility.setPlugValue( targetPosPlug, pos )
    
    # Store the rotation
    targetRotPlug = NodeUtility.getPlug( targetObj, 'controlRotation' )
    sourceRotation = TransformUtility.getMatrixRotation( sourceMatrix, 'euler' )
    #rot = [ degrees(angle) for angle in (sourceRotation.x, sourceRotation.y, sourceRotation.z) ]
    rot = [ sourceRotation.x, sourceRotation.y, sourceRotation.z ]
    NodeUtility.setPlugValue( targetRotPlug, rot )
    
    # Store the scale.
    targetSclPlug = NodeUtility.getPlug( targetObj, 'controlScale' )
    sourceScale = TransformUtility.getMatrixScale( sourceMatrix, OpenMaya.MSpace.kTransform )
    scl = [ sourceScale.x, sourceScale.y, sourceScale.z ]
    NodeUtility.setPlugValue( targetSclPlug, scl )
开发者ID:EriLee,项目名称:marigold,代码行数:27,代码来源:__init__.py


示例6: connectModules

 def connectModules(self):
     '''
     Connects a module to the character component.
     '''
     # Get modules selected from disList
     selList = self.disList.selectedItems()
     for module in selList:
         NodeUtility.connectNodes( self.charNode, 'modules', self.disMods[module.text()], 'characterRoot' )
         
     # Refresh the lists.
     self.updateLists()
开发者ID:EriLee,项目名称:marigold,代码行数:11,代码来源:UIEditCharacterModules.py


示例7: setPriorities

 def setPriorities( self ):
     '''
     Applies the user adjusted priorities to all the modules of a character.
     '''
     for index in xrange( self.dropList.count() ):
         moduleName = self.dropList.item( index ).text()
         moduleComponent = self.modDict[moduleName][0]
         priorityPlug = NodeUtility.getPlug( moduleComponent, 'buildPriority' )
         NodeUtility.setPlugValue( priorityPlug, index )
         
     self.close()
开发者ID:EriLee,项目名称:marigold,代码行数:11,代码来源:UICharacterPriorityPrompt.py


示例8: __init__

 def __init__( self, nodeName, parent=None ):
     super( componentWidget, self ).__init__( parent )
     self.parent = parent
     
     def on_context_menu( point, inNodeName ):
         popMenu = QtGui.QMenu()
         deleteAction = QtGui.QAction( 'Delete Component', popMenu, triggered=lambda a=inNodeName:self.deleteComponentFromObject( a ) )
         popMenu.addAction( deleteAction )
         
         popMenu.exec_( self.componentLabel.mapToGlobal( point ) )
         
     # Setup layout.
     verticalLayout = QtGui.QVBoxLayout()
     verticalLayout.setContentsMargins( 0,0,0,0 )
     verticalLayout.setSpacing( 0 )
     verticalLayout.setAlignment( QtCore.Qt.AlignTop )
     
     # Label for component
     componentLabel = QTWidgets.basicLabel( nodeName, 'bold', 10, 'black', '6E9094', inIndent=20 )
     componentLabel.setMinimumHeight( 18 )    
     componentLabel.setContextMenuPolicy( QtCore.Qt.CustomContextMenu )
     componentLabel.customContextMenuRequested.connect( lambda point, nodeName=nodeName:on_context_menu( point, nodeName ) )
     
     # Properties
     propertyStack = QtGui.QVBoxLayout()
     
     propertyFrame = QTWidgets.basicFrame()
     propertyFrame.setMinimumHeight( 40 )
     propertyFrame.setMaximumHeight( 40 )
     
     # Add string edit property
     modulePlug = NodeUtility.getPlug( nodeName, 'moduleName' )
     moduleValue = NodeUtility.getPlugValue( modulePlug )
     moduleTextLayout = QTWidgets.stringProperty( 'Module Name', moduleValue )
     
     '''
     ADD EDIT FIELDS FOR PRIORITY AND CHARACTER ROOT!!!!!!!!!
     '''
     
     # Add everything to the vertical layout.
     propertyStack.addLayout( moduleTextLayout )        
     propertyFrame.setLayout( propertyStack )
     
     verticalLayout.addWidget( componentLabel )
     verticalLayout.addWidget( propertyFrame )
     
     # Connections
     moduleTextBox = propertyFrame.findChild( QtGui.QLineEdit, 'Module Name' )
     moduleTextBox.editingFinished.connect( lambda inPlugName='moduleName', inQTType='QLineEdit', inPlugValue=moduleTextBox, inNodeName=nodeName
                                            :ModuleRootComponent( inNodeName ).setComponentAttributeFromQT( inPlugName, inQTType, inPlugValue, inNodeName ) )
     
     #return mainWidget
     self.setLayout( verticalLayout )
开发者ID:EriLee,项目名称:marigold,代码行数:53,代码来源:ModuleRoot.py


示例9: addComponentToObject

 def addComponentToObject( self, inClassType ):
     selList = cmds.ls( selection=True, long=True )
     if len( selList ) is 1:
         prevSel = selList[0]
         component_class = Components.str_to_class( inClassType )
         newNode = component_class.createCompNode( inClassType )
         
         # Add the component attribute to the object.
         FrameUtility.addPlug( selList[0], newNode.name(), 'attributeType', 'message' )
         nodePlug = '{0}.parentName'.format( newNode.name() )
         objectPlug = '{0}.{1}'.format( selList[0], newNode.name() )
         NodeUtility.connectPlugs( objectPlug, nodePlug )
         cmds.select( prevSel )
开发者ID:EriLee,项目名称:marigold,代码行数:13,代码来源:qtui.py


示例10: __init__

    def __init__( self, nodeName, parent=None ):
        super( componentWidget, self ).__init__( parent )
        self.parent = parent
                
        def on_context_menu( point, inNodeName ):
            popMenu = QtGui.QMenu()
            buildAction = QtGui.QAction( 'Build Joint', popMenu, triggered=lambda a=inNodeName:self.buildNode( a ) )
            popMenu.addAction( buildAction )
            
            deleteAction = QtGui.QAction( 'Delete Component', popMenu, triggered=lambda a=inNodeName:self.deleteComponentFromObject( a ) )
            popMenu.addAction( deleteAction )
            
            popMenu.exec_( componentLabel.mapToGlobal( point ) )
        
        # Setup layout.
        verticalLayout = QtGui.QVBoxLayout()
        verticalLayout.setContentsMargins( 0,0,0,0 )
        verticalLayout.setSpacing( 0 )
        verticalLayout.setAlignment( QtCore.Qt.AlignTop )
                
        # Label for component
        componentLabel = QTWidgets.basicLabel( nodeName, 'bold', 10, 'black', '6E9094', inIndent=20 )
        componentLabel.setMinimumHeight( 18 )    
        componentLabel.setContextMenuPolicy( QtCore.Qt.CustomContextMenu )
        componentLabel.customContextMenuRequested.connect( lambda point, node=nodeName:on_context_menu( point, node ) )
        
        # Properties
        propertyStack = QtGui.QVBoxLayout()
        
        propertyFrame = QTWidgets.basicFrame()
        propertyFrame.setMinimumHeight( 40 )
        propertyFrame.setMaximumHeight( 40 )
        
        # Add string edit property
        propertyPlug = NodeUtility.getPlug( nodeName, 'jointName' )
        propertyValue = NodeUtility.getPlugValue( propertyPlug )
        jointTextLayout = QTWidgets.stringProperty( 'Joint Name', propertyValue )
        
        propertyStack.addLayout( jointTextLayout )        
        propertyFrame.setLayout( propertyStack )
        
        verticalLayout.addWidget( componentLabel )
        verticalLayout.addWidget( propertyFrame )

        # Connections
        textBox = propertyFrame.findChild( QtGui.QLineEdit )
        textBox.editingFinished.connect( lambda inPlugName='jointName', inQTType='QLineEdit', inPlugValue=textBox, inNodeName=nodeName
                                         :BasicJointComponent( inNodeName ).setComponentAttributeFromQT( inPlugName, inQTType, inPlugValue, inNodeName ) )
        
        self.setLayout( verticalLayout )
开发者ID:EriLee,项目名称:marigold,代码行数:50,代码来源:BasicJoint.py


示例11: addComponentToObject

 def addComponentToObject( self, inClassType ):
     '''
     '''
     selList = cmds.ls( selection=True, long=True )
     if len( selList ) is 1:
         prevSel = selList[0]
         newNode = componentNodes.jointComponentNode().createCompNode( inClassType )
         # Add the component attribute to the object.
         FrameUtility.addPlug( selList[0], newNode.name(), 'attributeType', 'message' )
         #cmds.addAttr( inObject, longName='jointComponent', attributeType='message', storable=False )
         nodePlug = '{0}.parentName'.format( newNode.name() )
         objectPlug = '{0}.{1}'.format( selList[0], newNode.name() )
         NodeUtility.connectPlugs( objectPlug, nodePlug )
         cmds.select( prevSel )
开发者ID:EriLee,项目名称:marigold,代码行数:14,代码来源:mainGUI.py


示例12: getFramesInSceneWIP

def getFramesInSceneWIP():
    # Get all the meta nodes in the scene.
    metaNodes = NodeUtility.getMetaNodesInScene()
    print metaNodes
    
    if not metaNodes:
        return None
    else:
        for node in metaNodes:
            # Get the root bit of the frame module.
            rootBit = NodeUtility.getNodeAttrSource( node, 'rootBit' )
            # Get the parent's full path. We need to remove the group name from the beginning as well.
            parent = cleanParentFullName( rootBit[0] )
            print parent
开发者ID:EriLee,项目名称:marigold,代码行数:14,代码来源:FrameUtility.py


示例13: mirrorModule

def mirrorModule():
    # Mirrors a module.
    selList = cmds.ls( selection=True, long=True )
    if len( selList ) == 1:
        # Prompt for axis.
        mirrorAxis = int( cmds.layoutDialog( ui=mirrorObjectPrompt ) )
        
        inBitObj = selList[0]
    
        # Check if selected bit is the root.
        if NodeUtility.attributeCheck( inBitObj, 'frameRoot' ):
            # This is the root bit of the module. From here we know we can get the
            # meta node by accessing the frameRoot attribute.
            metaNode = NodeUtility.getNodeAttrDestination( inBitObj, 'frameRoot' )[0]
        else:
            # The selected bit is not the root. Run through each custom attribute
            # to find one connected to the meta node.
            attrList = cmds.listAttr( inBitObj, userDefined=True )
            for attr in attrList:
                connection = NodeUtility.getNodeAttrDestination( inBitObj, attr )
                if NodeUtility.attributeCheck( connection[0], 'metaType' ):
                    metaNode = connection[0]
                    break
                
        # Now that we have the meta node, we need the XML file name and it's location.
        metaClassPlug = NodeUtility.getPlug( metaNode, 'metaClass' )
        metaClassValue = NodeUtility.getPlugValue( metaClassPlug )
        
        metaBuildFolderPlug = NodeUtility.getPlug( metaNode, 'buildFolder' )
        metaBuildFolderValue = NodeUtility.getPlugValue( metaBuildFolderPlug )
        
        # Create the target module.
        targetRootBit = buildFrameModule( metaBuildFolderValue, metaClassValue )
    
        # Loop through each object in the source module.
        metaRootBit = NodeUtility.getNodeAttrSource( metaNode, 'rootBit' )[0]
        
        sourceChildBits = getFrameRootAllChildren( metaRootBit )
        targetChildBits = getFrameRootAllChildren( targetRootBit )
        
        sourceBits = []
        targetBits = []
        
        for i,bit in enumerate( sourceChildBits ):
            sourceBits.append( bit )
        sourceBits.insert( 0, metaRootBit )
        
        for i, bit in enumerate( targetChildBits ):
            targetBits.append( bit )
        targetBits.insert( 0, targetRootBit )
        
        for bit in xrange( len(sourceBits) ):
            # Mirror the source onto the target.
            mirrorObject( inSourceObj=sourceBits[bit], inTargetObj=targetBits[bit], inMirrorAxis=mirrorAxis )
开发者ID:EriLee,项目名称:marigold,代码行数:54,代码来源:FrameUtility.py


示例14: nodeRotation

 def nodeRotation( self ):
     '''
     dagFn= OpenMaya.MFnDagNode( self.fNodePath )
     path = OpenMaya.MDagPath()
     dagFn.getPath( path )
     path.pop()
     transformFn = OpenMaya.MFnTransform( path )
     q = OpenMaya.MQuaternion()
     transformFn.getRotation( q, OpenMaya.MSpace.kWorld )
     return q
     '''
     plug = NodeUtility.getPlug( 'ControlBox1', 'rotate' )
     rot = NodeUtility.getPlugValue( plug )
     e = OpenMaya.MEulerRotation( rot[0], rot[1], rot[2] )
     return e
开发者ID:EriLee,项目名称:marigold,代码行数:15,代码来源:rigControllers.py


示例15: matchTransforms

def matchTransforms( inType ):
    '''
    @param inType: String. Type of matching to perform. 'tran', 'rot', or 'all'
    '''
    selObjs = cmds.ls( selection=True, dag=False, ap=True )
    
    if len( selObjs ) == 0:
        cmds.warning( 'No objects are selected. Select two objects and try again' )
    elif len( selObjs ) > 2:
        cmds.warning( 'To many objects are selected. Select only two objects and try again' )
    else:
        # first object is child, second object is target
        cObj = selObjs[0]
        tObj = selObjs[1]
        
        # do the matching of child to target
        MFnTrans = OpenMaya.MFnTransform()
        childDagPath = NodeUtility.getDagPath( cObj )
        MFnTrans.setObject( childDagPath )
        targetMatrix = getMatrix( tObj, 'worldMatrix' )
        if inType == 'tran' or inType == 'all':
            childTranslation = getMatrixTranslation( targetMatrix, OpenMaya.MSpace.kWorld )
            MFnTrans.setTranslation( childTranslation, OpenMaya.MSpace.kWorld )
        if inType == 'rot' or inType == 'all':            
            childRotation = getMatrixRotation( targetMatrix, 'quat' )
            MFnTrans.setRotation( childRotation, OpenMaya.MSpace.kWorld )
开发者ID:EriLee,项目名称:marigold,代码行数:26,代码来源:TransformUtility.py


示例16: buildNode

 def buildNode( cls, nodeName ):
     '''
     Builds a curve control.
     
     @param nodeName: String. Name of the node.
     '''        
     # Create the curve.
     curveNode = CurveControlComponent( nodeName ).createCurveControl( cls( nodeName ).controlName, cls( nodeName ).curveType )
     controlName = OpenMaya.MDagPath.getAPathTo( curveNode ).fullPathName()
     
     # Set the control to the transform matrix.
     applyStoredTransforms( nodeName, controlName )
     
     # Get the saved properties and apply them to the curve.
     cvList = NurbsCurveUtility.readCurveValues( nodeName )
     cvPointArray = NurbsCurveUtility.buildCVPointArray( cvList )
     NurbsCurveUtility.setCurveCvs( controlName, cvPointArray )
     
     # Color.
     GeneralUtility.setUserColor( controlName, userColor=cls( nodeName ).controlColor )
     
     # Create the control spacer.
     transReference = NodeUtility.getNodeAttrSource( nodeName, 'parentName' )
     controlSpacer = GeneralUtility.createSpacer( None, inGroupName=cls( nodeName ).controlName, inTargetObject=transReference[0], inDoParent=False, inPrefix='sp' )
     cmds.parent( controlName, controlSpacer, relative=True )
     return curveNode
开发者ID:EriLee,项目名称:marigold,代码行数:26,代码来源:CurveControl.py


示例17: getCurveCvs

def getCurveCvs(inCurve):
    """
    Retrieves the positions for all CVs on the curve.
    
    @param inCurve: String. Name of the curve from which to retrieve CV positions.
    @return: List of Dicts. Each dict holds the information for one nurbs curve. since
                there could be multiple curves for one object we build a list of each curve.
    """
    curDag = NodeUtility.getDagPath(inCurve)
    curFn = OpenMaya.MFnNurbsCurve()
    curCvs = OpenMaya.MPointArray()

    storedCvs = []
    childShapes = curDag.childCount()
    for child in xrange(childShapes):
        childObj = curDag.child(child)
        # if childObj.apiType() == OpenMaya.MFn.kNurbsCurve:
        tempCvs = {}
        curFn.setObject(childObj)
        curFn.getCVs(curCvs)
        for cv in xrange(curCvs.length()):
            tempCvs[cv] = [curCvs[cv].x, curCvs[cv].y, curCvs[cv].z]
        storedCvs.append(tempCvs)

    return storedCvs
开发者ID:EriLee,项目名称:marigold,代码行数:25,代码来源:NurbsCurveUtility.py


示例18: addPlug

def addPlug( inBit, inPlugName, inAttrType, inAttrDataType ):
    '''
    Adds a plug to the frame bit.
    
    @param inBit: String. Name of the bit to add the attribute to.
    @param inPlugName: String. Name of the plug to add.
    @param inAttrType: String. Type of attribute to add.
    @param inAttrDataType: String. The attribute data type.
    '''
    if inAttrType == 'attributeType':
        if inAttrDataType == 'float3':
            cmds.addAttr( inBit, longName=inPlugName, attributeType=inAttrDataType )
            cmds.addAttr( longName='{0}X'.format( inPlugName ), attributeType='float', parent=inPlugName )
            cmds.addAttr( longName='{0}Y'.format( inPlugName ), attributeType='float', parent=inPlugName )
            cmds.addAttr( longName='{0}Z'.format( inPlugName ), attributeType='float', parent=inPlugName )
        else:
            cmds.addAttr( inBit, longName=inPlugName, attributeType=inAttrDataType )
    elif inAttrType == 'dataType':
        if inAttrDataType == 'typed':
            # Make it a string.
            inAttrDataType = 'string'
        cmds.addAttr( inBit, longName=inPlugName, dataType=inAttrDataType )
    elif inAttrType == 'matrixType':
        mObj = NodeUtility.getDependNode( inBit )
        dgModifier = OpenMaya.MDGModifier()
        mAttr = OpenMaya.MFnMatrixAttribute()
        controlMatrix = mAttr.create( inPlugName, inPlugName, OpenMaya.MFnMatrixAttribute.kDouble )
        dgModifier.addAttribute( mObj, controlMatrix )
        dgModifier.doIt()
开发者ID:EriLee,项目名称:marigold,代码行数:29,代码来源:FrameUtility.py


示例19: getFrameBitSettings

def getFrameBitSettings( inFrameBit ):
    '''
    Retrieves the settings for the frame bit.
    
    @param inFrameBit: String. Name of frame bit.
    @return: Dictionary. All the custom attributes on the frame bit.
    '''    
    attrList = cmds.listAttr( inFrameBit, userDefined=True )
    if attrList is not None:
        tempDict = {}
        for attr in attrList:
            plug = NodeUtility.getPlug( inFrameBit, attr )
            plugValue = NodeUtility.getPlugValue( plug )
            tempDict[ attr ] = plugValue
    else:
        tempDict = None
    return tempDict
开发者ID:EriLee,项目名称:marigold,代码行数:17,代码来源:FrameUtility.py


示例20: saveModule

 def saveModule( self ):
     '''
     Save the module into an XML file for re-use.
     We assume that the root node of the module is the one with the module root meta node.
     This means it and all of it's children will be saved in the XML.
     '''
     # Get the selected module
     item = cmds.ls( long=True, selection=True )[0]
     
     # Try to get the module meta component.
     moduleComp = Components.searchModule( item, 'ModuleRootComponent' )
     
     if moduleComp:
         # Get the module info and save it as an XML.
         modulePlug = NodeUtility.getPlug( moduleComp[1], 'moduleName' )
         moduleName = NodeUtility.getPlugValue( modulePlug )
         XMLUtility.writeModuleXML( moduleComp[0], self.SELECTED_ITEM, moduleName )
开发者ID:EriLee,项目名称:marigold,代码行数:17,代码来源:UILatticesTools.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python marionette.Actions类代码示例发布时间:2022-05-27
下一篇:
Python http.get函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap