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


Python NodeUtility.addPlug方法代码示例

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


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

示例1: addComponentToObject

# 需要导入模块: from marigold.utility import NodeUtility [as 别名]
# 或者: from marigold.utility.NodeUtility import addPlug [as 别名]
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,代码行数:27,代码来源:__init__.py

示例2: requiredAttributes

# 需要导入模块: from marigold.utility import NodeUtility [as 别名]
# 或者: from marigold.utility.NodeUtility import addPlug [as 别名]
 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,代码行数:11,代码来源:BaseComponent.py

示例3: requiredAttributes

# 需要导入模块: from marigold.utility import NodeUtility [as 别名]
# 或者: from marigold.utility.NodeUtility import addPlug [as 别名]
 def requiredAttributes( self ):
     super( CharacterRootComponent, self ).requiredAttributes()
     NodeUtility.addPlug( self.newNode, 'characterName', 'dataType', 'string' )
     self.setAttribute( 'characterName', 'joe', self.newNode )
             
     NodeUtility.addPlug( self.newNode, 'skeletonGroupName', 'dataType', 'string' )
     self.setAttribute( 'skeletonGroupName', 'skeleton', self.newNode )
     
     NodeUtility.addPlug( self.newNode, 'rigGroupName', 'dataType', 'string' )
     self.setAttribute( 'rigGroupName', 'rig', self.newNode )
     
     NodeUtility.addPlug( self.newNode, 'modules', 'attributeType', 'message' )
开发者ID:EriLee,项目名称:marigold,代码行数:14,代码来源:CharacterRoot.py

示例4: loadModule

# 需要导入模块: from marigold.utility import NodeUtility [as 别名]
# 或者: from marigold.utility.NodeUtility import addPlug [as 别名]
def loadModule( inFolder, inFileName ):
    '''
    Loads a module into the scene.
    
    @param inFolder: String. Name for the sub-folder the module XML is located.
    @param inFileName: String. Name of the module XML. 
    '''
    dirPath = getPresetPath( FRAME_PRESETS_PATH+inFolder )
    fullPath = dirPath+'/'+inFileName+'.xml'
    xmlFile = readModuleXML( fullPath )
    
    # Create a temp group to put the module inside while creating.
    moduleGroup = '|{0}'.format( cmds.group( em=True, name='TEMP' ) )
    
    # Grab all the bits.
    bits = xmlFile['bits']
    
    # Make each bit.
    tick = 0
    storeBitConnections = []

    while tick < len(bits):
        if bits[0]['parent'] == 'None':
            bitParent = moduleGroup
        else:
            bitParent = moduleGroup+bits[0]['parent']
        
        bitName = bits[0]['name']
        bitPlugs = bits[0]['plugs']
        shapePlugs = bits[0]['shape']
        bitComponents = bits[0]['components']
        
        # Make the bit.
        if cmds.objExists( bitParent ):
            newBit = cmds.makeGLBit( name=bitName, objecttype=bits[0]['shapeType'] )            
            cmds.parent( newBit, bitParent )
            
            # From this point we use the long name for the bit. This avoids any
            # name clashes.
            fullBitName = '{0}{1}'.format( bitParent, newBit )
            
            # Setup plugs for transform and custom attributes.
            for plug in bitPlugs:
                if not NodeUtility.attributeCheck( fullBitName, plug['name'] ):
                    NodeUtility.addPlug( fullBitName, plug['name'], plug['attrType'], plug['attrDataType'] )
                    if plug['value'] is not None:
                        NodeUtility.setPlug( fullBitName, plug['name'], plug['value'], inAttrDataType=plug['attrDataType'] )
                else:          
                    # Setup position and rotation.
                    NodeUtility.setPlug( fullBitName, plug['name'], plug['value'] )
            
            # Setup plugs for shape attributes.
            shapeName = cmds.listRelatives( fullBitName, shapes=True )
            fullShapeName = '{0}|{1}'.format( fullBitName, shapeName[0] )
            for plug in shapePlugs:
                if plug['attrDataType'] == 'TdataCompound' or plug['attrDataType'] == 'matrix':
                    # We skip compound nodes at this stage. They are for the child arrow drawing and must be
                    # hooked up after all the objects are created.
                    connectionChild = '{0}{1}'.format( moduleGroup, plug['value'] )
                    storeBitConnections.append( { 'parent':fullBitName, 'child':connectionChild } )
                elif plug['attrDataType'] == 'message':
                    print 'MESSAGE'
                else:
                    NodeUtility.setPlug( fullShapeName, plug['name'], plug['value'], inAttrDataType=plug['attrDataType'] )
            
            # Setup bit components.
            for comp in bitComponents:
                compType = comp['name']
                
                # We have to special case components that have additional kwargs.
                if compType == 'CurveControlComponent':
                    # Handle curve control component type.
                    for plug in comp['plugs']:
                        if plug['name'] == 'curveType':
                            curveType = plug['value']
                    newComp = components.addComponentToObject( compType, inObject=fullBitName, curveType=curveType )
                else:
                    # Handle basic component.
                    newComp = components.addComponentToObject( compType, inObject=fullBitName )

                for plug in comp['plugs']:
                    # Bit of a hack with the parentName attribute. This attr is setup when the component is created.
                    # So there is no need to apply the stored plug value from the XML.
                    if plug['attrDataType'] == 'message':
                        if plug['name'] != 'parentName':
                            if plug['value'] != 'None':
                                sourcePlug = plug['value'].split('.')
                                NodeUtility.connectNodes( sourcePlug[0], sourcePlug[1], newComp.name(), plug['name'] )
                    else:
                        NodeUtility.setPlug( newComp.name(), plug['name'], plug['value'], inAttrDataType=plug['attrDataType'] )
                    
            # Remove the bit from the list
            bits.remove( bits[0] )
        #tick = tick+1
            
    # Now do the hook ups for the child arrows.
    for i in storeBitConnections:
        NodeUtility.setBitChild( i['parent'], i['child'] )
开发者ID:EriLee,项目名称:marigold,代码行数:100,代码来源:XMLUtility.py

示例5: requiredAttributes

# 需要导入模块: from marigold.utility import NodeUtility [as 别名]
# 或者: from marigold.utility.NodeUtility import addPlug [as 别名]
 def requiredAttributes( self, *args, **kwargs ):
     '''
     kwargs
     curveType: Type of curve control to make. Square, triangle, arrow, plus, pyramid, circle, ringDirection.
     '''
     super( CurveControlComponent, self ).requiredAttributes()
     NodeUtility.addPlug( self.newNode, 'controlName', 'dataType', 'string' )
     NodeUtility.addPlug( self.newNode, 'curveType', 'dataType', 'string' )
     self.setAttribute( 'curveType', kwargs['curveType'], self.newNode )
     
     # Add attribute for control color.
     NodeUtility.addPlug( self.newNode, 'controlColor', 'attributeType', 'byte' )
     self.setAttribute( 'controlColor', 1, self.newNode )
     
     # Control transform relative to the parent.
     NodeUtility.addPlug( self.newNode, 'controlPosition', 'attributeType', 'float3' )
     NodeUtility.addPlug( self.newNode, 'controlRotation', 'attributeType', 'float3' )
     NodeUtility.addPlug( self.newNode, 'controlScale', 'attributeType', 'float3' )
     
     # Add attributes for the curve CVs.
     tempCurve = self.createCurveControl( '{0}TempCurve'.format( self.newNode ), kwargs['curveType'] )
     tempCurveName = OpenMaya.MDagPath.getAPathTo( tempCurve ).fullPathName()
     tempCurvePoints = NurbsCurveUtility.getCurveCvs( tempCurveName )
     NurbsCurveUtility.addCurveValues( self.newNode, tempCurvePoints )
     
     # Update curve transform values.
     storeControlTransforms( tempCurveName, self.newNode )
     
     # Clean up.
     cmds.delete( tempCurveName )
开发者ID:EriLee,项目名称:marigold,代码行数:32,代码来源:CurveControl.py

示例6: requiredAttributes

# 需要导入模块: from marigold.utility import NodeUtility [as 别名]
# 或者: from marigold.utility.NodeUtility import addPlug [as 别名]
 def requiredAttributes( self ):
     super( ModuleRootComponent, self ).requiredAttributes()
     NodeUtility.addPlug( self.newNode, 'moduleName', 'dataType', 'string' )
     NodeUtility.addPlug( self.newNode, 'buildPriority', 'attributeType', 'byte' )
     NodeUtility.addPlug( self.newNode, 'characterRoot', 'attributeType', 'message' )
开发者ID:EriLee,项目名称:marigold,代码行数:7,代码来源:ModuleRoot.py

示例7: requiredAttributes

# 需要导入模块: from marigold.utility import NodeUtility [as 别名]
# 或者: from marigold.utility.NodeUtility import addPlug [as 别名]
 def requiredAttributes( self ):
     super( GLBoxControlComponent, self ).requiredAttributes()
     NodeUtility.addPlug( self.newNode, 'controlName', 'dataType', 'string' )
     
     # Add the GLBox attributes.
     #kLongName = '-name' SKIPPING
     #kLongPosition = '-position'
     NodeUtility.addPlug( self.newNode, 'position', 'attributeType', '' )
     #kLongLineWidth = '-lineWidth'
     NodeUtility.addPlug( self.newNode, 'lineWidth', 'attributeType', 'float' )
     #kLongRotate = '-rotate'
     NodeUtility.addPlug( self.newNode, 'rotate', '', '' )
     #kLongTransparency = '-alpha'
     NodeUtility.addPlug( self.newNode, 'alpha', 'attributeType', 'float' )
     #kLongBackAlpha = '-backAlpha'
     NodeUtility.addPlug( self.newNode, 'backAlpha', 'attributeType', 'float' )
     #kLongColor = '-color'
     NodeUtility.addPlug( self.newNode, 'color', '', '' )
     #kLongDrawType = '-drawType'
     NodeUtility.addPlug( self.newNode, 'drawType', '', '' )
     #kLongWidth = '-width'
     NodeUtility.addPlug( self.newNode, 'width', 'attributeType', 'float' )
     #kLongHeight = '-height'
     NodeUtility.addPlug( self.newNode, 'height', 'attributeType', 'float' )
     #kLongDepth = '-depth'
     NodeUtility.addPlug( self.newNode, 'depth', 'attributeType', 'float' )
     #kLongTopFrontRight = '-topFrontRight'
     NodeUtility.addPlug( self.newNode, 'topFrontRight', '', '' )
     #kLongTopFrontLeft = '-topFrontLeft'
     NodeUtility.addPlug( self.newNode, 'topFrontLeft', '', '' )
     #kLongTopBackRight = '-topBackRight'
     NodeUtility.addPlug( self.newNode, 'topBackRight', '', '' )
     #kLongTopBackLeft = '-topBackLeft'
     NodeUtility.addPlug( self.newNode, 'topBackLeft', '', '' )
     #kLongBotFrontRight = '-botFrontRight'
     NodeUtility.addPlug( self.newNode, 'botFrontRight', '', '' )
     #kLongBotFrontLeft = '-botFrontLeft'
     NodeUtility.addPlug( self.newNode, 'botFrontLeft', '', '' )
     #kLongBotBackRight = '-botBackRight'
     NodeUtility.addPlug( self.newNode, 'botBackRight', '', '' )
     #kLongBotBackLeft = '-botBackLeft'
     NodeUtility.addPlug( self.newNode, 'botBackLeft', '', '' )
开发者ID:EriLee,项目名称:marigold,代码行数:44,代码来源:GLBoxControl.py

示例8: requiredAttributes

# 需要导入模块: from marigold.utility import NodeUtility [as 别名]
# 或者: from marigold.utility.NodeUtility import addPlug [as 别名]
 def requiredAttributes( self ):
     super( BasicJointComponent, self ).requiredAttributes()
     NodeUtility.addPlug( self.newNode, 'jointName', 'dataType', 'string' )
开发者ID:EriLee,项目名称:marigold,代码行数:5,代码来源:BasicJoint.py


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