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


Python NodeUtility.getNodeAttrDestination方法代码示例

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


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

示例1: mirrorModule

# 需要导入模块: from marigold.utility import NodeUtility [as 别名]
# 或者: from marigold.utility.NodeUtility import getNodeAttrDestination [as 别名]
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.
        '''
        NEED TO FIX THIS!
        targetRootBit = buildFrameModule( metaBuildFolderValue, metaClassValue )
        '''
    
        # Loop through each object in the source module.
        metaRootBit = NodeUtility.getNodeAttrSource( metaNode, 'rootBit' )[0]
        
        sourceChildBits = NodeUtility.getFrameRootAllChildren( metaRootBit )
        targetChildBits = NodeUtility.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,代码行数:59,代码来源:TransformUtility.py

示例2: getComponents

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

示例3: deleteBitChild

# 需要导入模块: from marigold.utility import NodeUtility [as 别名]
# 或者: from marigold.utility.NodeUtility import getNodeAttrDestination [as 别名]
def deleteBitChild():
    # Disconnected the child from it's parent.
    selList = cmds.ls( selection=True, long=True )
    for i in selList:
        connections = NodeUtility.getNodeAttrDestination( i, 'matrix' )
        parent = '{0}.{1}'.format( connections[0], connections[1] )
        for plug in connections:
            if plug.find( 'targetWorldMatrix' ) is not -1:
                cmds.removeMultiInstance( parent, b=True )
        cmds.parent( i, world=True )
开发者ID:EriLee,项目名称:marigold,代码行数:12,代码来源:FrameUtility.py

示例4: metaNodeCheck

# 需要导入模块: from marigold.utility import NodeUtility [as 别名]
# 或者: from marigold.utility.NodeUtility import getNodeAttrDestination [as 别名]
def metaNodeCheck( inObj, inComponents ):
    '''
    Checks if the component plug of an object has a meta node connected.
    @param inObj: String. Name of the selected object.
    @param inComponents: List of connected components to the selected object.
    '''    
    for comName in inComponents:
        metaNode = NodeUtility.getNodeAttrDestination( inObj, comName )
        if metaNode:
            return True
    return False
开发者ID:EriLee,项目名称:marigold,代码行数:13,代码来源:__init__.py

示例5: componentsGUI

# 需要导入模块: from marigold.utility import NodeUtility [as 别名]
# 或者: from marigold.utility.NodeUtility import getNodeAttrDestination [as 别名]
 def componentsGUI( self, inBit=None ):
     '''
     Creates the components GUI.
     '''
     if inBit is None:
         components = None
     else:
         # Get the components of the selected bit.
         components = FrameUtility.getFrameBitSettings( inBit )
     
     # Clean up the compArea layout prior to adding new children by
     # removing the previously selected bit's information from the UI.
     mainChildren = cmds.columnLayout( self.fillArea, query=True, childArray=True )
     
     if mainChildren is not None:
         for child in mainChildren:
             cmds.deleteUI( child )
     
     col = cmds.columnLayout( adjustableColumn=True, columnAttach=('both', 5), parent=self.fillArea )
     
     # HIGHLIGHTED
     cmds.separator( style='none', height=4, width=413 )
     self.selName = cmds.text( label=str.upper( 'nothing selected' ), height=20, font='boldLabelFont', backgroundColor=[0.2,0.2,0.2] )
     cmds.separator( style='none', height=10 )        
     
     # 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 is not None and self.metaNodeCheck( inBit, components ):
         # Create the scroll layout.
         mainScroll = cmds.scrollLayout( parent=col )
         
         # Loop through each component on the bit.
         for comName in components:
             # Check to see if the component is connected to a meta node.
             metaNode = NodeUtility.getNodeAttrDestination( inBit, comName )
             if metaNode:
                 # It has a meta node.
                 # Get the meta node parameters.                
                 metaParameters = FrameUtility.getFrameBitSettings( metaNode[0] )
                 
                 # Make the component UI elements.
                 frameOne = cmds.frameLayout( parent=mainScroll, borderStyle='out', label=comName, collapsable=True )
                 
                 cmds.popupMenu()
                 #bit name, component name, meta node name
                 cmds.menuItem( label='Delete Component', command=lambda b, a1=inBit, a2=comName, a3=metaNode[0]:self.deleteComponent(a1, a2, a3) )
                 cmds.menuItem( label='Build Component', command=lambda b, a1=metaNode[0]:self.buildComponent(a1) )
                 
                 compColumn = cmds.rowColumnLayout( numberOfColumns=1 )
                 
                 # Loop through the parameters and add them to the component UI.
                 for param in metaParameters:
                     #print isinstance(param, unicode)
                     if not( param == u'parentName' or param == u'classType' ):
                         propRow = cmds.rowColumnLayout( numberOfColumns=4, columnWidth=[(1,100),(2,100),(3,40),(4,40)],
                                           columnSpacing=[(1,10),(2,10),(3,10),(4,2)] )
                         cmds.text( label=param, align='left' )
                         cmds.textField( text=metaParameters[param], enterCommand=lambda b, a1=metaNode[0], a2=param:self.updateComponentParameter(a1, a2, b) )
                         cmds.setParent( '..' )#propRow
                         
                 cmds.setParent( '..' )#compColumn
                 cmds.setParent( '..' )#frameOne                
             cmds.setParent( '..' )#mainScroll
     cmds.setParent( '..' )#col
     
     # Selection script job
     self.selJob = cmds.scriptJob( event=[ 'SelectionChanged', self.onSelectionChange ],
                                   parent=col, protected=True )
开发者ID:EriLee,项目名称:marigold,代码行数:72,代码来源:mainGUI.py


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