def __init__(self, parent=MAYA_WINDOW):
        super(TabTemplateWindow, self).__init__(parent)
        self.layout = QtGui.QFormLayout()
        self.setLayout(self.layout)
        self.setObjectName('thetemplateWindow')

        self.setWindowTitle("Template Tools")
        self.setMinimumSize(500, 500)
        self.setMaximumSize(500, 500)

        self.tabWidget = QtGui.QTabWidget()
        self.layout.addWidget(self.tabWidget)

        twWindow = twistWidget.TwistWidget()
        pvWindow = poleVectorWidget.PoleVectorWidget()
        fWindow = faceWidget.FaceWidget()
        skWindow = otherDeformationWidget.OtherDeformationWidget()

        self.tabWidget.addTab(twWindow, "Twist System")
        self.tabWidget.addTab(pvWindow, "Pole Vector System")
        self.tabWidget.addTab(fWindow, "Face System")
        self.tabWidget.addTab(skWindow, "Other Deformation Systems")

        screenWidth, screenHeight = self.screenCenter()
        self.move(QtCore.QPoint(screenWidth, screenHeight))
Exemplo n.º 2
0
    def assignObject(self):
        ''' fill form based on sender, then update group dict'''
        sender = self.sender()

        #COMPONENT SENDERS
        #start joint, side, name
        if sender is self.compWidget.startJoint_pushButton:
            sel = pm.ls(selection=True)
            if sel:
                self.compWidget.startJoint_lineEdit.setText(sel[0].shortName())
                name = naming.TipName(
                    self.compWidget.startJoint_lineEdit.text())
                self.compWidget.name_lineEdit.setText(name.base)
                if name.isSideLeft():
                    self.compWidget.left_radioButton.setChecked(True)
                    self.side == 'left'
                elif name.isSideRight():
                    self.compWidget.right_radioButton.setChecked(True)
                    self.side = 'right'
                else:
                    self.compWidget.center_radioButton.setChecked(True)
                    self.side = None
                #Get limb Name
                self.limb = self.compWidget.name_lineEdit.text(
                ) + naming.getSideName(self.side)
                self.attachWidget.attrPrefix_lineEdit.setText(self.limb)
        #endList
        elif sender is self.compWidget.endListAdd_pushButton:
            sel = pm.ls(selection=True)

            if sel:
                for item in pm.ls(selection=True):
                    self.compWidget.endList_listWidget.addItem(str(item))
            else:
                self.compWidget.endList_listWidget.addItem()
        elif sender is self.compWidget.endListRemove_pushButton:
            for item in self.compWidget.endList_listWidget.selectedItems():
                self.compWidget.endList_listWidget.takeItem(
                    self.compWidget.endList_listWidget.row(item))
        #aim List
        elif sender is self.compWidget.controlAdd_pushButton:
            sel = pm.ls(selection=True)
            numRows = self.compWidget.controlIndex_tableWidget.rowCount()
            for i, s in enumerate(sel):
                self.compWidget.controlIndex_tableWidget.insertRow(numRows + i)
                self.compWidget.controlIndex_tableWidget.setItem(
                    numRows + i, 0, QtGui.QTableWidgetItem(str(s)))
                self.compWidget.controlIndex_tableWidget.setItem(
                    numRows + i, 1, QtGui.QTableWidgetItem(str(numRows + i)))
        elif sender is self.compWidget.controlRemove_pushButton:
            for item in self.compWidget.controlIndex_tableWidget.selectedItems(
            ):
                self.attachWidget.controlIndex_tableWidget.removeRow(
                    item.row())

        #also excute overridden assign object
        super(AssignNewComponentWidget, self).assignObject(sender)

        #update
        self.update()
Exemplo n.º 3
0
    def initWindow(self, buildDict=None, hierDict=None, attachDict=None):
        #COMPONENT variables

        if buildDict:
            #startJoint
            if 'startJoint' in buildDict:
                self.compWidget.startJoint_lineEdit.setText(
                    buildDict['startJoint'])
            if 'name' in buildDict:
                self.compWidget.name_lineEdit.setText(buildDict['name'])
            if 'side' in buildDict:
                if buildDict['side'] == 'left':
                    self.compWidget.left_radioButton.setCcontrolIndex_tableWidgethecked(
                        True)
                elif buildDict['side'] == 'right':
                    self.compWidget.right_radioButton.setChecked(True)
                else:
                    self.compWidget.center_radioButton.setChecked(True)
                self.side = buildDict['side']
            if 'endList' in buildDict and buildDict['endList']:
                for i, item in enumerate(buildDict['endList']):
                    self.compWidget.endList_listWidget.insertItem(i, item)
            if 'aimJoints' in buildDict and buildDict['aimJoints']:
                numRows = self.compWidget.aim_tabelWidget.rowCount()
                for x in range(0, numRows):
                    self.compWidget.aim_tabelWidget.removeRow(x)

                for i, item in enumerate(buildDict['aimJoints']):
                    self.compWidget.aim_tabelWidget.insertRow(i)
                    self.compWidget.aim_tabelWidget.setItem(
                        i, 0, QtGui.QTableWidgetItem(str(item)))
                    if 'aimSockets' in buildDict:
                        self.compWidget.aim_tabelWidget.setItem(
                            i, 1,
                            QtGui.QTableWidgetItem(
                                str(buildDict['aimSockets'][i])))
            if 'controlOffset' in buildDict:
                self.compWidget.controlOffset_doubleSpinBox.setValue(
                    buildDict['controlOffset'])
            if 'controlScale' in buildDict:
                self.compWidget.controlScale_doubleSpinBox.setValue(
                    buildDict['controlScale'])
            if 'style' in buildDict:
                if isinstance(buildDict['style'], str) or isinstance(
                        buildDict['style'], unicode):
                    index = controller.PUPPET_CONTROL_SHAPE_TYPES.index(
                        buildDict['style'])
                    self.compWidget.controlStyle_comboBox.setCurrentIndex(
                        index)
                else:
                    self.compWidget.controlStyle_comboBox.setCurrentIndex(
                        buildDict['style'])

        #init hier and attach attrs
        if hierDict:
            self.setHierarchyAttrs(hierDict)
        if attachDict:
            self.setAttachAttrs(attachDict)
        self.update()
    def initWindow(self, buildDict=None, hierDict=None, attachDict=None):

        #COMPONENT variables
        if buildDict:
            #startJoint
            if 'startJoint' in buildDict:
                self.compWidget.startJoint_lineEdit.setText(
                    buildDict['startJoint'])
            if 'name' in buildDict:
                self.compWidget.name_lineEdit.setText(buildDict['name'])
            if 'side' in buildDict:
                if buildDict['side'] == 'left':
                    self.compWidget.left_radioButton.setChecked(True)
                elif buildDict['side'] == 'right':
                    self.compWidget.right_radioButton.setChecked(True)
                else:
                    self.compWidget.center_radioButton.setChecked(True)
                self.side = buildDict['side']
            if 'endList' in buildDict and buildDict['endList']:
                for i, item in enumerate(buildDict['endList']):
                    self.compWidget.endList_listWidget.insertItem(i, item)
            if 'controlOffset' in buildDict:
                self.compWidget.pvOffset_doubleSpinBox.setValue(
                    buildDict['pvOffset'])
            if 'controlScale' in buildDict:
                self.compWidget.pvScale_doubleSpinBox.setValue(
                    buildDict['pvScale'])
            if 'inverseTop' in buildDict:
                self.compWidget.inverseTop_lineEdit.setText(
                    naming.noneToBlank(buildDict['inverseTop']))
            if 'inversePivot' in buildDict:
                self.compWidget.inversePivot_lineEdit.setText(
                    naming.noneToBlank(buildDict['inversePivot']))
            if 'inversePrefix' in buildDict:
                self.compWidget.inversePrefix_lineEdit.setText(
                    naming.noneToBlank(buildDict['inversePrefix']))

            if 'parentSwitchTarget' in buildDict and buildDict[
                    'parentSwitchTarget']:
                numRows = self.compWidget.parentSwitch_tableWidget.rowCount()
                for x in range(0, numRows):
                    self.compWidget.parentSwitch_tableWidget.removeRow(x)

                for i, item in enumerate(buildDict['parentSwitchTarget']):
                    self.compWidget.parentSwitch_tableWidget.insertRow(i)
                    self.compWidget.parentSwitch_tableWidget.setItem(
                        i, 0, QtGui.QTableWidgetItem(str(item)))
                    if 'parentSwitchLabel' in buildDict:
                        self.compWidget.parentSwitch_tableWidget.setItem(
                            i, 1,
                            QtGui.QTableWidgetItem(
                                str(buildDict['parentSwitchLabel'][i])))

        #init hier and attach attrs
        if hierDict:
            self.setHierarchyAttrs(hierDict)
        if attachDict:
            self.setAttachAttrs(attachDict)
        self.update()
Exemplo n.º 5
0
    def __init__(self):
        super(AttachWidget, self).__init__()
        self.setupUi(self)
        self.setObjectName('AttachTool')
        self.setWindowTitle('Attach Tool')
        #self.setMinimumSize(250, 600)
        #self.setMaximumSize(250, 600)

        layout = QtGui.QVBoxLayout()
        #layout.addWidget(self.compWidget)
        layout.addWidget(self)
        self.setLayout(layout)

        #self.compWidget.widget_groupBox.toggled.connect(self.showAttach)
        self.attachPoint_groupBox.clicked.connect(self.assignObject)
        self.attachPointNode_groupBox.clicked.connect(self.assignObject)
        self.attachOrient_groupBox.clicked.connect(self.assignObject)
        self.attachOrientNode_groupBox.clicked.connect(self.assignObject)
 def screenCenter(self):
     resolution = QtGui.QDesktopWidget().screenGeometry()
     width = (resolution.width() / 2) - (self.frameSize().width() / 2)
     height = (resolution.height() / 2) - (self.frameSize().height() / 2)
     return width, height
Exemplo n.º 7
0
    def __init__(self,
                 parent=None,
                 componentDict=None,
                 componentWidget=None,
                 compType='FKComponent',
                 assignPath=None,
                 limb=None,
                 puppet=None):

        super(EditWidget, self).__init__()

        #Init Default variables for Builder
        self.limb = limb
        self.oldLimb = None
        self.puppet = puppet
        self.compType = compType
        self.componentDict = componentDict
        self.componentListWidget = componentWidget

        if assignPath:
            self.compWidget = uic.loadUi(assignPath)

        #Add Hierarchy Widget
        self.hierWidget = uic.loadUi(HIERWIDGET)

        #Create Attach Widget
        attachObj = attachWidget.AttachWidget()
        self.attachWidget = attachObj

        #Add Execute Widget
        self.execWidget = uic.loadUi(EXECWIDGET)

        layout = QtGui.QVBoxLayout()
        if assignPath:
            layout.addWidget(self.compWidget)
        layout.addWidget(self.hierWidget)
        layout.addWidget(self.attachWidget)
        layout.addWidget(self.execWidget)
        self.setLayout(layout)

        #other settings
        #hierWidget width/height
        if assignPath:
            compHeight = self.compWidget.height()
        else:
            compHeight = 0
        height = compHeight + self.hierWidget.height(
        ) + self.attachWidget.height() + self.execWidget.height()
        self.setMinimumSize(500, height - 100)
        self.setMaximumSize(500, height - 100)

        self.settings = QtCore.QSettings()

        #Open in the Middle of the Screen
        screenWidth, screenHeight = self.screenCenter()
        self.move(QtCore.QPoint(screenWidth, screenHeight))

        #create dicts
        self._sceneGroupDict = dict()
        self._hierarchyAttrList = dict()
        self._attachAttrList = dict()

        if assignPath:
            self.compWidget.widget_groupBox.toggled.connect(self.showAttach)
        self.hierWidget.widget_groupBox.toggled.connect(self.showAttach)
        self.attachWidget.widget_groupBox.toggled.connect(self.showAttach)

        #ATTACH
        #attach widget things
        self.attachWidget.attachPoint_groupBox.clicked.connect(
            self.assignObject)
        self.attachWidget.attachPointNode_groupBox.clicked.connect(
            self.assignObject)
        self.attachWidget.attachOrient_groupBox.clicked.connect(
            self.assignObject)
        self.attachWidget.attachOrientNode_groupBox.clicked.connect(
            self.assignObject)

        #ATTACH SENDERS
        self.attachWidget.driven_pushButton.clicked.connect(self.assignObject)
        self.attachWidget.addDrivers_pushButton.clicked.connect(
            self.assignObject)
        self.attachWidget.removeDrivers_pushButton.clicked.connect(
            self.assignObject)
        self.attachWidget.loadConfig_pushButton.clicked.connect(
            self.assignObject)
        self.attachWidget.loadAttachPoint_pushButton.clicked.connect(
            self.assignObject)
        self.attachWidget.loadAttachOrient_pushButton.clicked.connect(
            self.assignObject)

        self.execWidget.cancel_pushButton.clicked.connect(self.close)

        #clean window
        self.slotReset()
        self.update()
Exemplo n.º 8
0
    def setAttachAttrs(self, attachDict):

        #ATTACH variables
        if 'driven' in attachDict:
            self.attachWidget.driven_lineEdit.setText(attachDict['driven'])
        if 'drivers' in attachDict:
            for i, item in enumerate(attachDict['drivers']):
                self.attachWidget.drivers_tableWidget.setItem(
                    i, 0, QtGui.QTableWidgetItem(str(item)))
        if 'labels' in attachDict:
            for i, item in enumerate(attachDict['labels']):
                self.attachWidget.drivers_tableWidget.setItem(
                    i, 1, QtGui.QTableWidgetItem(str(item)))
        if 'config' in attachDict:
            self.attachWidget.configNode_lineEdit.setText(attachDict['config'])
        if 'prefix' in attachDict:
            self.attachWidget.attrPrefix_lineEdit.setText(attachDict['prefix'])
        if 'point' in attachDict:
            self.attachWidget.point_checkBox.setChecked(attachDict['point'])
        if 'orient' in attachDict:
            self.attachWidget.orient_checkBox.setChecked(attachDict['orient'])
        if 'scale' in attachDict:
            self.attachWidget.scale_checkBox.setChecked(attachDict['scale'])
        if 'attachPoint' in attachDict:
            if isinstance(attachDict['attachPoint'], bool):
                self.attachWidget.attachPoint_groupBox.setChecked(True)
                self.attachWidget.attachPointNode_groupBox.setChecked(False)
                if attachDict['attachPoint']:
                    self.attachWidget.attachPoint_True.setChecked(True)
                else:
                    self.attachWidget.attachPoint_False.setChecked(True)
            else:
                self.attachWidget.attachPoint_groupBox.setChecked(False)
                self.attachWidget.attachPointNode_groupBox.setChecked(True)
                self.attachWidget.loadAttachPoint_lineEdit.setText(
                    attachDict['attachPoint'])
        if 'attachOrient' in attachDict:
            if isinstance(attachDict['attachOrient'], bool):
                self.attachWidget.attachOrient_groupBox.setChecked(True)
                self.attachWidget.attachOrientNode_groupBox.setChecked(False)
                if attachDict['attachOrient']:
                    self.attachWidget.attachOrient_True.setChecked(True)
                else:
                    self.attachWidget.attachOrient_False.setChecked(True)
            else:
                self.attachWidget.attachOrient_groupBox.setChecked(False)
                self.attachWidget.attachOrientNode_groupBox.setChecked(True)
                self.attachWidget.loadAttachOrient_lineEdit.setText(
                    attachDict['attachOrient'])
        if 'attachScale' in attachDict:
            if isinstance(attachDict['attachScale'], bool):
                self.attachWidget.attachScale_groupBox.setChecked(True)
                self.attachWidget.attachScaleNode_groupBox.setChecked(False)
                if attachDict['attachScale']:
                    self.attachWidget.attachScale_True.setChecked(True)
                else:
                    self.attachWidget.attachScale_False.setChecked(True)
            else:
                self.attachWidget.attachScale_groupBox.setChecked(False)
                self.attachWidget.attachScaleNode_groupBox.setChecked(True)
                self.attachWidget.loadAttachScale_lineEdit.setText(
                    attachDict['attachOrient'])
        if 'multiAttr':
            self.attachWidget.multiAttrSwitch_checkBox.setChecked(
                attachDict['multiAttr'])
        if 'switch':
            self.attachWidget.multiAttrSwitch_checkBox.setChecked(
                attachDict['switch'])

        self.updateAttachAttrs()
Exemplo n.º 9
0
    def assignObject(self, sender=None):
        if not sender:
            sender = self.sender()

        #driven
        if sender == self.attachWidget.driven_pushButton:
            sel = pm.ls(selection=True)
            if sel:
                self.attachWidget.driven_lineEdit.setText(sel[0])

        #add drivers
        if sender is self.attachWidget.addDrivers_pushButton:
            sel = pm.ls(selection=True)
            numRows = self.attachWidget.drivers_tableWidget.rowCount()
            for i, s in enumerate(sel):
                name = naming.TipName(name=s)
                self.attachWidget.drivers_tableWidget.insertRow(numRows + i)
                self.attachWidget.drivers_tableWidget.setItem(
                    numRows + i, 0, QtGui.QTableWidgetItem(str(s)))
                self.attachWidget.drivers_tableWidget.setItem(
                    numRows + i, 1, QtGui.QTableWidgetItem(str(name.base)))

        #remove drivers
        if sender is self.attachWidget.removeDrivers_pushButton:
            for item in self.attachWidget.drivers_tableWidget.selectedItems():
                self.attachWidget.drivers_tableWidget.setItem(item.row())

        #config
        if sender is self.attachWidget.loadConfig_pushButton:
            sel = pm.ls(selection=True)
            if sel:
                self.attachWidget.configNode_lineEdit.setText(str(sel[0]))

        #attach point
        if sender is self.attachWidget.loadAttachPoint_pushButton:
            sel = pm.ls(selection=True)
            if sel:
                self.attachWidget.loadAttachPoint_lineEdit.setText(str(sel[0]))

        #attach orient
        if sender is self.attachWidget.loadAttachOrient_pushButton:
            sel = pm.ls(selection=True)
            if sel:
                self.attachWidget.loadAttachOrient_lineEdit.setText(str(
                    sel[0]))

        #checkboxes
        if sender is self.attachWidget.attachPoint_groupBox:
            if self.attachWidget.attachPoint_groupBox.isChecked():
                self.attachWidget.attachPointNode_groupBox.setChecked(False)
        if sender is self.attachWidget.attachPointNode_groupBox:
            if self.attachWidget.attachPointNode_groupBox.isChecked():
                self.attachWidget.attachPoint_groupBox.setChecked(False)

        if sender is self.attachWidget.attachOrient_groupBox:
            if self.attachWidget.attachOrient_groupBox.isChecked():
                self.attachWidget.attachOrientNode_groupBox.setChecked(False)
        if sender is self.attachWidget.attachOrientNode_groupBox:
            if self.attachWidget.attachOrientNode_groupBox.isChecked():
                self.attachWidget.attachOrient_groupBox.setChecked(False)

        self.updateHierarchyAttrs()
        self.updateAttachAttrs()