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 )
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 )
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
def __init__( self ): super( UICharacterTools, self ).__init__() layout = QtGui.QVBoxLayout( self ) # PRESETS presetsLabel = QTWidgets.basicLabel( 'Character Presets', 'bold', 14, 'white', '2B2B30', inIndent=10 ) presetsLabel.setMinimumHeight( 30 ) presetsLabel.setAlignment( QtCore.Qt.AlignCenter ) self.scrollLayout = QtGui.QVBoxLayout() self.scrollLayout.setAlignment( QtCore.Qt.AlignTop ) self.scrollLayout.setContentsMargins( 8,8,8,8 ) self.scrollLayout.setSpacing( 4 ) scrollArea = QTWidgets.scrollArea( self.scrollLayout ) self.updateCards() # TOOLS #--Label toolsLabel = QTWidgets.basicLabel( 'Tools', 'bold', 14, 'white', '2B2B30', inIndent=10 ) toolsLabel.setMinimumHeight( 30 ) toolsLabel.setAlignment( QtCore.Qt.AlignCenter ) #--Combo menu comboRow = QtGui.QHBoxLayout() comboRow.setAlignment( QtCore.Qt.AlignLeft ) self.characterNameList = [] self.characterDict = {} for char in NodeUtility.getCharactersInScene(): charName = cmds.getAttr( '{0}.characterName'.format( char ) ) self.characterNameList.append( charName ) self.characterDict[charName] = char self.characterCombo = QtGui.QComboBox() self.updateCharacterCombo() self.characterCombo.setFixedWidth( 100 ) self.characterCombo.activated.connect( self.setActiveCharacter ) comboRefreshBtn = QTWidgets.imageTextButton( None, ':/riggingUI/icons/icon_refresh20.png', [16,16] ) comboRefreshBtn.setMaximumWidth( 20 ) comboRefreshBtn.setMaximumHeight( 20 ) comboRefreshBtn.clicked.connect( self.updateCharacterCombo ) comboRow.addWidget( self.characterCombo ) comboRow.addWidget( comboRefreshBtn ) #--Buttons modulePrioritiesBtn = QTWidgets.imageTextButton( 'Module Priorities', ':/riggingUI/icons/icon_match_translation.png', [16,16] ) modulePrioritiesBtn.clicked.connect( lambda:self.characterPriorityPromptTrigger() ) saveCharacterBtn = QTWidgets.imageTextButton( 'Save Character', ':/riggingUI/icons/icon_match_translation.png', [16,16] ) saveCharacterBtn.clicked.connect( lambda:self.saveCharacter() ) buildCharacterBtn = QTWidgets.imageTextButton( 'Build Character', ':/riggingUI/icons/icon_match_translation.png', [16,16] ) buildCharacterBtn.clicked.connect( lambda:self.buildCharacter() ) editModulesBtn = QTWidgets.imageTextButton( 'Edit Character Modules', ':/riggingUI/icons/icon_match_translation.png', [16,16] ) editModulesBtn.clicked.connect( lambda:self.characterModulePromptTrigger() ) #--Button grid layout. toolsGrid = QtGui.QGridLayout() toolsGrid.setColumnMinimumWidth( 0, 100 ) toolsGrid.setColumnMinimumWidth( 1, 100 ) toolsGrid.setColumnMinimumWidth( 2, 100 ) toolsGrid.setSpacing( 2 ) toolsGrid.setContentsMargins( 0,0,0,0 ) toolsGrid.addWidget( modulePrioritiesBtn, 0, 0 ) toolsGrid.addWidget( saveCharacterBtn, 0, 1 ) toolsGrid.addWidget( buildCharacterBtn, 0, 2 ) toolsGrid.addWidget( editModulesBtn, 1, 0 ) # SETUP LAYOUT layout.addWidget( presetsLabel ) layout.addWidget( scrollArea ) layout.addWidget( toolsLabel ) layout.addLayout( comboRow ) layout.addLayout( toolsGrid )
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 )
def __init__( self ): super( UILatticeTools, self ).__init__() layout = QtGui.QVBoxLayout( self ) # LATTICES SECTIONS latticesLabel = QTWidgets.basicLabel( 'Lattices', 'bold', 14, 'white', '2B2B30', inIndent=10 ) latticesLabel.setMinimumHeight( 30 ) latticesLabel.setAlignment( QtCore.Qt.AlignCenter ) # Grid that holds the toggle buttons for lattice types in the first column, and the # scroll layout for the list of lattices in the second column. latticesGrid = QtGui.QGridLayout() latticesGrid.setContentsMargins( 0, 0, 0, 0 ) latticesGrid.setHorizontalSpacing( 0 ) latticesGrid.setAlignment( QtCore.Qt.AlignTop ) latticesGrid.setVerticalSpacing( 0 ) # Toggle button layout. self.togLayout = QtGui.QVBoxLayout() self.togLayout.setAlignment( QtCore.Qt.AlignTop ) iconSize = [26,26] rootTog = QTWidgets.toggleButton( 'roots', ':/riggingUI/icons/icon_root.png', iconSize ) spineTog = QTWidgets.toggleButton( 'spines', ':/riggingUI/icons/icon_spine.png', iconSize ) armTog = QTWidgets.toggleButton( 'arms', ':/riggingUI/icons/icon_arm.png', iconSize ) legTog = QTWidgets.toggleButton( 'legs', ':/riggingUI/icons/icon_leg.png', iconSize ) handTog = QTWidgets.toggleButton( 'hands', ':/riggingUI/icons/icon_hand.png', iconSize ) footTog = QTWidgets.toggleButton( 'feet', ':/riggingUI/icons/icon_foot.png', iconSize ) headTog = QTWidgets.toggleButton( 'heads', ':/riggingUI/icons/icon_head.png', iconSize ) rootTog.toggled.connect( lambda toggleState:self.updateCards() ) spineTog.toggled.connect( lambda toggleState:self.updateCards() ) armTog.toggled.connect( lambda toggleState:self.updateCards() ) legTog.toggled.connect( lambda toggleState:self.updateCards() ) handTog.toggled.connect( lambda toggleState:self.updateCards() ) footTog.toggled.connect( lambda toggleState:self.updateCards() ) headTog.toggled.connect( lambda toggleState:self.updateCards() ) self.togLayout.addWidget( rootTog ) self.togLayout.addWidget( spineTog ) self.togLayout.addWidget( armTog ) self.togLayout.addWidget( legTog ) self.togLayout.addWidget( handTog ) self.togLayout.addWidget( footTog ) self.togLayout.addWidget( headTog ) self.togLayout.addStretch( 1 ) # Scroll area for lattice list. self.scrollLayout = QtGui.QVBoxLayout() self.scrollLayout.setAlignment( QtCore.Qt.AlignTop ) self.scrollLayout.setContentsMargins( 8,8,8,8 ) self.scrollLayout.setSpacing( 4 ) scrollArea = QTWidgets.scrollArea( self.scrollLayout ) # Put the toggle buttons and lattice scroll list in the main grid layout. latticesGrid.addLayout( self.togLayout, 0, 0 ) latticesGrid.addWidget( scrollArea, 0, 1 ) # TOOLS SECTION toolsLabel = QTWidgets.basicLabel( 'Lattice Tools', 'bold', 14, 'white', '2B2B30', inIndent=10 ) toolsLabel.setMinimumHeight( 30 ) toolsLabel.setAlignment( QtCore.Qt.AlignCenter ) latticeToolsGrid = QtGui.QGridLayout() latticeToolsGrid.setColumnMinimumWidth( 0, 100 ) latticeToolsGrid.setColumnMinimumWidth( 1, 100 ) latticeToolsGrid.setColumnMinimumWidth( 2, 100 ) latticeToolsGrid.setSpacing( 2 ) latticeToolsGrid.setContentsMargins( 0,0,0,0 ) # Buttons saveModeluBtn = QTWidgets.imageTextButton( 'Save Module', ':/riggingUI/icons/icon_match_translation.png', [16,16] ) saveModeluBtn.clicked.connect( lambda:self.saveModulePrompt() ) latticeToolsGrid.addWidget( saveModeluBtn, 0, 0 ) # Build the widget layout.addWidget( latticesLabel ) layout.addLayout( latticesGrid ) layout.addWidget( toolsLabel ) layout.addLayout( latticeToolsGrid )
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 )
def __init__( self ): super( UIComponentsTools, self ).__init__() layout = QtGui.QVBoxLayout( self ) # COMPONENTS MENU BAR menuFrame = QtGui.QFrame() menuFrame.setMinimumHeight( 20 ) # Meta menu. moduleMeta = QtGui.QAction( '&Module Meta', self) moduleMeta.triggered.connect( lambda a='ModuleRootComponent':Components.addComponentToObject( a ) ) characterMeta = QtGui.QAction( '&Character Meta', self) characterMeta.triggered.connect( lambda a='CharacterRootComponent':Components.addComponentToObject( a ) ) # Joints menu basicJoint = QtGui.QAction( '&Basic Joint', self) #basic_joint.setShortcut('Ctrl+Q') #basic_joint.setStatusTip('Exit application') basicJoint.triggered.connect( lambda a='BasicJointComponent':Components.addComponentToObject( a ) ) # Controls menu squareCurveControl = QtGui.QAction( '&Square', self) squareCurveControl.triggered.connect( lambda a='CurveControlComponent', b='square':Components.addComponentToObject( a, curveType=b ) ) triangleCurveControl = QtGui.QAction( '&Triangle', self) triangleCurveControl.triggered.connect( lambda a='CurveControlComponent', b='triangle':Components.addComponentToObject( a, curveType=b ) ) arrowCurveControl = QtGui.QAction( '&Arrow', self) arrowCurveControl.triggered.connect( lambda a='CurveControlComponent', b='arrow':Components.addComponentToObject( a, curveType=b ) ) plusCurveControl = QtGui.QAction( '&Plus', self) plusCurveControl.triggered.connect( lambda a='CurveControlComponent', b='plus':Components.addComponentToObject( a, curveType=b ) ) pyramidCurveControl = QtGui.QAction( '&Pyramid', self) pyramidCurveControl.triggered.connect( lambda a='CurveControlComponent', b='pyramid':Components.addComponentToObject( a, curveType=b ) ) circleCurveControl = QtGui.QAction( '&Circle', self) circleCurveControl.triggered.connect( lambda a='CurveControlComponent', b='circle':Components.addComponentToObject( a, curveType=b ) ) ringDirectionCurveControl = QtGui.QAction( '&Ring Direction', self) ringDirectionCurveControl.triggered.connect( lambda a='CurveControlComponent', b='ringDirection':Components.addComponentToObject( a, curveType=b ) ) # Setup menus. componentsMenubar = QtGui.QMenuBar( menuFrame ) metaMenu = componentsMenubar.addMenu( '&Meta' ) metaMenu.addAction( moduleMeta ) metaMenu.addAction( characterMeta ) jointsMenu = componentsMenubar.addMenu( '&Joints' ) jointsMenu.addAction( basicJoint ) controlsMenu = componentsMenubar.addMenu( '&Controls' ) controlsCurvesMenu = controlsMenu.addMenu( '&Curves' ) controlsCurvesMenu.addAction( squareCurveControl ) controlsCurvesMenu.addAction( triangleCurveControl ) controlsCurvesMenu.addAction( arrowCurveControl ) controlsCurvesMenu.addAction( plusCurveControl ) controlsCurvesMenu.addAction( pyramidCurveControl ) controlsCurvesMenu.addAction( circleCurveControl ) controlsCurvesMenu.addAction( ringDirectionCurveControl ) constraintsMenu = componentsMenubar.addMenu( '&Constraints' ) deformersMenu = componentsMenubar.addMenu( '&Deformers' ) # SELECTED HEADER self.selectedLockBtn = QTWidgets.imageTextButton( '', ':/riggingUI/icons/lock_off.png', [16,16] ) self.selectedLockBtn.setMaximumWidth( 30 ) self.selectedLockBtn.clicked.connect( self.lockSelection ) self.selectedLockActive = False self.selectedLabel = QTWidgets.basicLabel( 'nothing selected', 'bold', 14, 'white', '2B2B30', inIndent=10 ) self.selectedLabel.setMinimumHeight( 30 ) self.selectedLabel.setAlignment( QtCore.Qt.AlignCenter ) selectedGrid = QtGui.QGridLayout() selectedGrid.setContentsMargins( 0, 0, 0, 0 ) selectedGrid.setHorizontalSpacing( 0 ) selectedGrid.setColumnMinimumWidth( 0, 30 ) selectedGrid.addWidget( self.selectedLockBtn, 0, 0 ) selectedGrid.addWidget( self.selectedLabel, 0, 1 ) # SELECTED COMPONENTS LIST/EDITOR # Add the component specific GUI. self.componentsLayout = QtGui.QVBoxLayout() self.componentsLayout.setAlignment( QtCore.Qt.AlignTop ) scrollArea = QTWidgets.scrollArea( self.componentsLayout ) # Layout hookup layout.addWidget( menuFrame ) layout.addLayout( selectedGrid ) layout.addWidget( scrollArea ) # In order to delete this scriptJob when this UI is destroyed we need to # parent the scriptJob to a Maya UI item. In this case I'm using a text object # with visibility turned off. scriptJobHolder = cmds.text( visible=False ) self.SCRIPT_JOB_NUMBER = cmds.scriptJob( event=[ 'SelectionChanged', self.onSelectionChange ], protected=True, parent=scriptJobHolder ) scriptJobHolderQT = mayaToQtObject( scriptJobHolder ) layout.addWidget( scriptJobHolderQT )