Beispiel #1
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 )
Beispiel #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()
            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 )
Beispiel #3
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
Beispiel #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 ) )
     
     # Colors.
     userColors = GeneralUtility.getUserDefinedColors( inType=1 )
     self.colorList = []
     for color in userColors:
         self.colorList.append( GeneralUtility.convertRGB( color, inType=1 ) )
     
     # Setup layout.
     verticalLayout = QtGui.QVBoxLayout()
     verticalLayout.setContentsMargins( 0,0,0,0 )
     verticalLayout.setSpacing( 0 )
     verticalLayout.setAlignment( QtCore.Qt.AlignTop )
     
     # Label for component
     #self.componentLabel = QTWidgets.basicLabel( nodeName, 'bold', 10, 'black', '6E9094', inIndent=20 )
     self.componentLabel = QtGui.QLabel()
     self.componentLabel.setText( nodeName )
     self.componentLabel.setIndent( 20 )
     controlColorPlug = NodeUtility.getPlug( nodeName, 'controlColor' )
     self.COLOR = NodeUtility.getPlugValue( controlColorPlug )
     self.componentLabel.setStyleSheet( 'font:bold; font-size:10px; color:black; background-color:rgb({0},{1},{2})'.format(self.colorList[self.COLOR-1][0],
                                                                                                                           self.colorList[self.COLOR-1][1],
                                                                                                                           self.colorList[self.COLOR-1][2] ) )
     self.componentLabel.setMinimumHeight( 18 )
     self.componentLabel.setContextMenuPolicy( QtCore.Qt.CustomContextMenu )
     self.componentLabel.customContextMenuRequested.connect( lambda point, nodeName=nodeName:on_context_menu( point, nodeName ) )
     
     propertyFrame = QTWidgets.basicFrame()
     propertyFrame.setMinimumHeight( 100 )
     propertyFrame.setMaximumHeight( 100 )
     
     propertyStack = QtGui.QVBoxLayout()
     
     # Add string edit property
     propertyRow = QtGui.QHBoxLayout()
     propertyPlug = NodeUtility.getPlug( nodeName, 'controlName' )
     propertyValue = NodeUtility.getPlugValue( propertyPlug )
     self.textBox = QtGui.QLineEdit()
     self.textBox.setAlignment( QtCore.Qt.AlignLeft )
     self.textBox.setMinimumHeight( 20 )
     if propertyValue:
         self.textBox.setText( propertyValue )
     
     textBoxLabel = QtGui.QLabel()
     textBoxLabel.setText( 'Control Name' )
     textBoxLabel.setAlignment( QtCore.Qt.AlignCenter )
     textBoxLabel.setMinimumHeight( 12 )
     
     propertyRow.addWidget( self.textBox )
     propertyRow.addWidget( textBoxLabel )
     
     # Colors.
     colorRow = QtGui.QHBoxLayout()
     
     color1Btn = QtGui.QPushButton()
     color1Btn.setStyleSheet( 'background-color:rgb({0},{1},{2}); width:20'.format( self.colorList[0][0], self.colorList[0][1], self.colorList[0][2] ) )
     color1Btn.clicked.connect( lambda a=nodeName, b=1:self.colorChange( a, b ) )
     
     color2Btn = QtGui.QPushButton()
     color2Btn.setStyleSheet( 'background-color:rgb({0},{1},{2}); width:20'.format( self.colorList[1][0], self.colorList[1][1], self.colorList[1][2] ) )
     color2Btn.clicked.connect( lambda a=nodeName, b=2:self.colorChange( a, b ) )
     
     color3Btn = QtGui.QPushButton()
     color3Btn.setStyleSheet( 'background-color:rgb({0},{1},{2}); width:20'.format( self.colorList[2][0], self.colorList[2][1], self.colorList[2][2] ) )
     color3Btn.clicked.connect( lambda a=nodeName, b=3:self.colorChange( a, b ) )
     
     color4Btn = QtGui.QPushButton()
     color4Btn.setStyleSheet( 'background-color:rgb({0},{1},{2}); width:20'.format( self.colorList[3][0], self.colorList[3][1], self.colorList[3][2] ) )
     color4Btn.clicked.connect( lambda a=nodeName, b=4:self.colorChange( a, b ) )
     
     color5Btn = QtGui.QPushButton()
     color5Btn.setStyleSheet( 'background-color:rgb({0},{1},{2}); width:20'.format( self.colorList[4][0], self.colorList[4][1], self.colorList[4][2] ) )
     color5Btn.clicked.connect( lambda a=nodeName, b=5:self.colorChange( a, b ) )
     
     color6Btn = QtGui.QPushButton()
     color6Btn.setStyleSheet( 'background-color:rgb({0},{1},{2}); width:20'.format( self.colorList[5][0], self.colorList[5][1], self.colorList[5][2] ) )
     color6Btn.clicked.connect( lambda a=nodeName, b=6:self.colorChange( a, b ) )
     
     color7Btn = QtGui.QPushButton()
     color7Btn.setStyleSheet( 'background-color:rgb({0},{1},{2}); width:20'.format( self.colorList[6][0], self.colorList[6][1], self.colorList[6][2] ) )
     color7Btn.clicked.connect( lambda a=nodeName, b=7:self.colorChange( a, b ) )
     
     color8Btn = QtGui.QPushButton()
     color8Btn.setStyleSheet( 'background-color:rgb({0},{1},{2}); width:20'.format( self.colorList[7][0], self.colorList[7][1], self.colorList[7][2] ) )
     color8Btn.clicked.connect( lambda a=nodeName, b=8:self.colorChange( a, b ) )
     
     colorRow.addWidget( color1Btn )
     colorRow.addWidget( color2Btn )
     colorRow.addWidget( color3Btn )
     colorRow.addWidget( color4Btn )
     colorRow.addWidget( color5Btn )
     colorRow.addWidget( color6Btn )
     colorRow.addWidget( color7Btn )
     colorRow.addWidget( color8Btn )        
     
     # Edit buttons.
     self.editButton = QtGui.QToolButton()
     self.editButton.setCheckable( True )
     self.editButton.setText( 'Edit Control' )
     self.editButton.toggled.connect( lambda:self.editCurveProperties() )
     
     propertyStack.addLayout( propertyRow )
     propertyStack.addLayout( colorRow )
     propertyStack.addWidget( self.editButton )
     propertyFrame.setLayout( propertyStack )
     
     # Add everything to the vertical layout.
     verticalLayout.addWidget( self.componentLabel )
     verticalLayout.addWidget( propertyFrame )
     
     # Connections
     self.textBox.editingFinished.connect( lambda inPlugName='controlName', inQTType='QLineEdit', inPlugValue=self.textBox, inNodeName=nodeName
                                      :CurveControlComponent( inNodeName ).setComponentAttributeFromQT( inPlugName, inQTType, inPlugValue, inNodeName ) )
     #return mainWidget
     self.setLayout( verticalLayout )
Beispiel #5
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 )
Beispiel #6
0
    def __init__( self ):
        super( UIBitsTools, self ).__init__()
        
        layout = QtGui.QVBoxLayout( self )

        # Build bits controls
        # Presets
        moduleRootBtn = QTWidgets.imageButton( 'Create Module', ':/riggingUI/icons/preset_module.png', [32,32] )
        moduleRootBtn.clicked.connect( lambda a=1:self.preset_buttons(a) )
        
        characterRootBtn = QTWidgets.imageButton( 'Create Character', ':/riggingUI/icons/preset_character.png', [32,32] )
        characterRootBtn.clicked.connect( lambda a=2:self.preset_buttons(a) )
        
        # Primitive buttons.        
        sphereBtn = QTWidgets.imageButton( 'Sphere', ':/riggingUI/icons/bit_sphere.png', [32,32] )
        sphereBtn.clicked.connect( self.primitive_buttons )
        
        boxBtn = QTWidgets.imageButton( 'Box', ':/riggingUI/icons/bit_box.png', [32,32] )
        boxBtn.clicked.connect( self.primitive_buttons )
        
        cylinderBtn = QTWidgets.imageButton( 'Cylinder', ':/riggingUI/icons/bit_cylinder.png', [32,32] )
        cylinderBtn.clicked.connect( self.primitive_buttons )
        
        coneBtn = QTWidgets.imageButton( 'Cone', ':/riggingUI/icons/bit_cone.png', [32,32] )
        coneBtn.clicked.connect( self.primitive_buttons )
        
        torusBtn = QTWidgets.imageButton( 'Torus', ':/riggingUI/icons/bit_torus.png', [32,32] )
        torusBtn.clicked.connect( self.primitive_buttons )
        
        # Bit tools.
        matchTranslationBtn = QTWidgets.imageTextButton( 'Match Translation', ':/riggingUI/icons/icon_match_translation.png', [16,16] )
        matchTranslationBtn.clicked.connect( lambda a='tran':TransformUtility.matchTransforms( a ) )
        
        matchRotationBtn = QTWidgets.imageTextButton( 'Match Rotation', ':/riggingUI/icons/icon_match_rotation.png', [16,16] )
        matchRotationBtn.clicked.connect( lambda a='rot':TransformUtility.matchTransforms( a ) )
        
        matchAllBtn = QTWidgets.imageTextButton( 'Match All', ':/riggingUI/icons/icon_match_all.png', [16,16] )
        matchAllBtn.clicked.connect( lambda a='all':TransformUtility.matchTransforms( a ) )
        
        copyBitSettingsBtn = QTWidgets.imageTextButton( 'Copy Bit Settings', ':/riggingUI/icons/bit_copy_settings.png', [16,16] )
        copyBitSettingsBtn.clicked.connect( lambda:NodeUtility.copyBitSettings() )
        
        addChildBtn = QTWidgets.imageTextButton( 'Add Child', ':/riggingUI/icons/bit_add_child.png', [16,16] ) 
        addChildBtn.clicked.connect( lambda:NodeUtility.setBitChild() )
        
        deleteChildBtn = QTWidgets.imageTextButton( 'Delete Child', ':/riggingUI/icons/bit_delete_child.png', [16,16] )
        deleteChildBtn.clicked.connect( lambda:NodeUtility.deleteBitChild() )
        
        # Build bits layout.
        # Presets.
        presetsHeader = QTWidgets.basicLabel( 'Bit Presets', 'bold', 14, 'white', '2B2B30' )
        presetsHeader.setMinimumHeight( 30 )
        presetsHeader.setAlignment( QtCore.Qt.AlignCenter )
        
        presetsFrame = QTWidgets.basicFrame()
        presetsLayout = QtGui.QHBoxLayout()
        presetsLayout.addWidget( moduleRootBtn )
        presetsLayout.addWidget( characterRootBtn )
        presetsFrame.setLayout( presetsLayout )
        
        # Primitive buttons
        bitPrimitivesHeader = QTWidgets.basicLabel( 'Bit Primitives', 'bold', 14, 'white', '2B2B30' )
        bitPrimitivesHeader.setMinimumHeight( 30 )
        bitPrimitivesHeader.setAlignment( QtCore.Qt.AlignCenter )
        
        primitiveFrame = QTWidgets.basicFrame()
        
        primitiveLayout = QtGui.QHBoxLayout()
        primitiveLayout.addWidget( sphereBtn )
        primitiveLayout.addWidget( boxBtn )
        primitiveLayout.addWidget( cylinderBtn )
        primitiveLayout.addWidget( coneBtn )
        primitiveLayout.addWidget( torusBtn )
        primitiveFrame.setLayout( primitiveLayout )
        
        # Bit tools.
        bitToolsHeader = QTWidgets.basicLabel( 'Bit Tools', 'bold', 14, 'white', '2B2B30' )
        bitToolsHeader.setMinimumHeight( 30 )
        bitToolsHeader.setAlignment( QtCore.Qt.AlignCenter )
        
        bitToolsGrid = QtGui.QGridLayout()
        bitToolsGrid.setColumnMinimumWidth( 0, 100 )
        bitToolsGrid.setColumnMinimumWidth( 1, 100 )
        bitToolsGrid.setColumnMinimumWidth( 2, 100 )
        bitToolsGrid.setSpacing( 2 )
        bitToolsGrid.setContentsMargins( 0,0,0,0 )
        # widget, row, col
        bitToolsGrid.addWidget( matchTranslationBtn, 0, 0 )
        bitToolsGrid.addWidget( matchRotationBtn, 0, 1 )
        bitToolsGrid.addWidget( matchAllBtn, 0, 2 )
        bitToolsGrid.addWidget( copyBitSettingsBtn, 1, 0 )
        bitToolsGrid.addWidget( addChildBtn, 1, 1 )
        bitToolsGrid.addWidget( deleteChildBtn, 1, 2 )
        
        # Added the bits widgets to the sub-layout of the main window.
        layout.addWidget( presetsHeader )
        layout.addWidget( presetsFrame )
        layout.addWidget( bitPrimitivesHeader )
        layout.addWidget( primitiveFrame )
        layout.addWidget( bitToolsHeader )
        layout.addLayout( bitToolsGrid )