Example #1
0
def componentGui( inNodeName ):        
    def on_context_menu( point ):
        popMenu = QtGui.QMenu()
        popMenu.addAction( 'actionEdit' )
        popMenu.addAction( 'actionDelete' )
        popMenu.addSeparator()
        popMenu.addAction( 'actionAdd' )
        popMenu.exec_( componentLabel.mapToGlobal( point ) )
    
    mainWidget = QtGui.QWidget()
        
    verticalLayout = QtGui.QVBoxLayout( mainWidget )
    verticalLayout.setContentsMargins( 0,0,0,0 )
    verticalLayout.setSpacing( 0 )
    verticalLayout.setAlignment( QtCore.Qt.AlignTop )
    
    # Label for component
    componentLabel = QTWidgets.basicLabel( inNodeName, 'bold', 10, 'black', 448094 )    
    componentLabel.setContextMenuPolicy( QtCore.Qt.CustomContextMenu )
    componentLabel.customContextMenuRequested.connect( on_context_menu )
    
    propertyFrame = QTWidgets.basicFrame()
    propertyFrame.setMinimumHeight( 40 )
    propertyFrame.setMaximumHeight( 40 )
    
    # Add string edit property
    plug = NodeUtility.getPlug( inNodeName, 'jointName' )
    plugValue = NodeUtility.getPlugValue( plug )
    QTWidgets.stringProperty( propertyFrame, 'Joint Name', plugValue )
    
    # Add everything to the vertical layout.
    verticalLayout.addWidget( componentLabel )
    verticalLayout.addWidget( propertyFrame )
    
    #print 'test2: {0}'.format( prop.takeAt(0).widget() )
    #print propertyFrame.count()
    #print propertyFrame.findChild( QtGui.QLineEdit )
    #for item in xrange( propertyFrame.count() ):
    #    print propertyFrame.itemAt( item ).widget()
    
    return mainWidget
Example #2
0
 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 )
Example #3
0
    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 )
Example #4
0
 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( 120 )
     propertyFrame.setMaximumHeight( 120 )
     
     # Add string edit property
     characterPlug = NodeUtility.getPlug( nodeName, 'characterName' )
     characterValue = NodeUtility.getPlugValue( characterPlug )
     characterTextLayout = QTWidgets.stringProperty( 'Character Name', characterValue )
     
     skelGroupPlug = NodeUtility.getPlug( nodeName, 'skeletonGroupName' )
     skelGroupValue = NodeUtility.getPlugValue( skelGroupPlug )
     skelGroupTextLayout = QTWidgets.stringProperty( 'Skeleton Group Name', skelGroupValue )
     
     rigGroupPlug = NodeUtility.getPlug( nodeName, 'rigGroupName' )
     rigGroupValue = NodeUtility.getPlugValue( rigGroupPlug )
     rigGroupTextLayout = QTWidgets.stringProperty( 'Rigging Group Name', rigGroupValue )
     
     '''
     ADD MODULES BUTTON. PROBABLY HAVE A POPUP LISTING UNCONNECTED MODULES IN THE SCENE??
     '''
     
     # Add everything to the vertical layout.
     propertyStack.addLayout( characterTextLayout )
     propertyStack.addLayout( skelGroupTextLayout )
     propertyStack.addLayout( rigGroupTextLayout )
     
     propertyFrame.setLayout( propertyStack )
     
     verticalLayout.addWidget( componentLabel )
     verticalLayout.addWidget( propertyFrame )
     
     # Connections
     charTextBox = propertyFrame.findChild( QtGui.QLineEdit, 'Character Name' )
     charTextBox.editingFinished.connect( lambda inPlugName='characterName', inQTType='QLineEdit', inPlugValue=charTextBox, inNodeName=nodeName
                                          :CharacterRootComponent( inNodeName ).setComponentAttributeFromQT( inPlugName, inQTType, inPlugValue, inNodeName ) )
     
     skelTextBox = propertyFrame.findChild( QtGui.QLineEdit, 'Skeleton Group Name' )
     skelTextBox.editingFinished.connect( lambda inPlugName='skeletonGroupName', inQTType='QLineEdit', inPlugValue=skelTextBox, inNodeName=nodeName
                                          :CharacterRootComponent( inNodeName ).setComponentAttributeFromQT( inPlugName, inQTType, inPlugValue, inNodeName ) )
     
     rigTextBox = propertyFrame.findChild( QtGui.QLineEdit, 'Rigging Group Name' )
     rigTextBox.editingFinished.connect( lambda inPlugName='rigGroupName', inQTType='QLineEdit', inPlugValue=rigTextBox, inNodeName=nodeName
                                         :CharacterRootComponent( inNodeName ).setComponentAttributeFromQT( inPlugName, inQTType, inPlugValue, inNodeName ) )
     
     #return mainWidget
     self.setLayout( verticalLayout )