def __style(self, text): reg_exp = QtCore.QRegExp('[a-zA-Z0-9_]+') validator = QtGui.QRegExpValidator(reg_exp, self) self.setValidator(validator) font = QtGui.QFont() font.setBold(True) font.setPointSize(15) self.setFont(font) self.text_label = QtWidgets.QLabel(self) self.text_label.setFocusPolicy(QtCore.Qt.NoFocus) self.text_label.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.text_label.setFont(font) self.text_label.setText(text) self.text_label.setStyleSheet("color: rgb{0}".format(self.color)) self.text_label.setEnabled(False) self.main_layout = QtWidgets.QHBoxLayout() self.main_layout.addWidget(self.text_label) self.main_layout.addStretch() self.main_layout.setContentsMargins(4, 0, 0, 0) self.setFocusPolicy(QtCore.Qt.TabFocus | QtCore.Qt.ClickFocus | QtCore.Qt.StrongFocus) self.setFrame(False) self.setTextMargins(self.get_text_width() + 12, 0, 0, 0) self.setContentsMargins(0, 0, 0, 0) self.setLayout(self.main_layout) self.setMinimumSize(QtCore.QSize(30, 30))
def __init__(self, parent=None, text=''): """ type parent: QtGui.QMenu """ QtWidgets.QWidgetAction.__init__(self, parent) self._frame = QtWidgets.QFrame(parent) self._checkbox = QtWidgets.QCheckBox(text)
def __init__(self, label='', parent=None, pixmap=None): """ type parent: QtWidgets.QMenu """ QtWidgets.QWidgetAction.__init__(self, parent) self._frame = QtWidgets.QFrame(parent) self._label = QtWidgets.QLabel(label, self._frame) self._label.setMinimumWidth(0) self._label.setPixmap(pixmap) self._slider = QtWidgets.QSlider(QtCore.Qt.Horizontal, self._frame) self.valueChanged = self._slider.valueChanged
def __style(self): reg_exp = QtCore.QRegExp('[a-zA-Z0-9_]+') validator = QtGui.QRegExpValidator(reg_exp, self) self.setValidator(validator) self.setFocusPolicy(QtCore.Qt.TabFocus | QtCore.Qt.ClickFocus) self.setFrame(False) self.setTextMargins(24, 0, 0, 0) self.setContentsMargins(0, 0, 0, 0) self.setStyleSheet("color: rgb(200, 200, 200, 255)") # self.icon_btn = QtWidgets.QPushButton(self) # self.icon_btn.setFixedSize(25, 25) # self.icon_btn.setIconSize(QtCore.QSize(20, 20)) # self.icon_btn.setFocusPolicy(QtCore.Qt.NoFocus) # self.icon_btn.setFlat(True) # self.icon_btn.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) # self.icon_btn.setEnabled(False) # self.icon_btn.setIcon(self.icon) # self.icon_btn.setStyleSheet("QPushButton{background:transparent;}") self.label_icon = QtWidgets.QLabel(self) self.label_icon.setFixedSize(25, 25) self.label_icon.setFocusPolicy(QtCore.Qt.NoFocus) self.label_icon.setStyleSheet("background:transparent;") self.label_icon.setPixmap(self.icon.pixmap(20, 20)) self.label_icon.setEnabled(False) self.lock_btn = QtWidgets.QPushButton(self) self.lock_btn.setFixedSize(15, 28) self.lock_btn.setIconSize(QtCore.QSize(15, 15)) self.lock_btn.setFocusPolicy(QtCore.Qt.NoFocus) self.lock_btn.setFlat(False) self.lock_btn.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor)) self.lock_btn.setEnabled(True) self.lock_btn.setIcon(self.unlock_icon) self.lock_btn.setStyleSheet( "QPushButton{background-color: rgb(25, 25, 25, 75);}" "QPushButton:hover{background-color: rgb(0, 0, 0, 0);}") self.main_layout = QtWidgets.QHBoxLayout() self.main_layout.addWidget(self.label_icon) self.main_layout.addItem( QtWidgets.QSpacerItem(10000, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)) self.main_layout.addWidget(self.lock_btn) self.main_layout.addStretch() self.main_layout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.main_layout) self.setMinimumSize(QtCore.QSize(30, 30)) size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) self.setSizePolicy(size_policy)
def skinClusterManager_folder_pushButton_cmd(self): dialog = QtWidgets.QInputDialog() value = to_utf8( dialog.getText(None, 'Create New Folder', 'Enter Folder Name')[0]) if value: if os.path.exists(os.path.join(self.config['root'], value)): raise NameError('Folder Already Exist !') else: os.mkdir(os.path.join(self.config['root'], value)) newItem = QtWidgets.QListWidgetItem( self.skinClusterManager_one_listWidget) newItem.linkType = 'folder' newItem.linkPath = os.path.join(self.config['root'], value) newItem.linkName = value newItem.setText(value) newItem.setIcon(__icon__('icon_folder'))
def createWidget(self, parent=None): """ type parent: QtGui.QMenu """ action_widget = self.frame() action_layout = QtWidgets.QVBoxLayout(action_widget) action_layout.setSpacing(5) action_layout.setContentsMargins(2, 4, 0, 0) for label in self.labels: radio_button = QtWidgets.QRadioButton(label) radio_button.setMouseTracking(0) self.radio_buttons.append(radio_button) action_layout.addWidget(radio_button) radio_button.clicked.connect(self.checked) self.radio_buttons[0].setChecked(True) action_widget.setLayout(action_layout) return action_widget
def __init__(self, parent=None, labels=None): """ type parent: QtGui.QMenu """ QtWidgets.QWidgetAction.__init__(self, parent) self.labels = labels self._frame = QtWidgets.QFrame(parent) self.radio_buttons = []
def createWidget(self, parent=None): """ type parent: QtGui.QMenu """ action_widget = self.frame() action_layout = QtWidgets.QHBoxLayout(action_widget) action_layout.setSpacing(0) action_layout.setContentsMargins(1, 4, 0, 0) action_layout.addWidget(self.checkbox()) action_widget.setLayout(action_layout) return action_widget
def __style(self): self.setMinimumSize(QtCore.QSize(self.wh[0], self.wh[1])) self.setMaximumSize(QtCore.QSize(self.wh[0], self.wh[1])) self.setMouseTracking(False) self.setScaledContents(True) self.setAlignment(QtCore.Qt.AlignCenter) self.setPixmap(self.pixmap) self.close_btn = QtWidgets.QPushButton(self) self.close_btn.setFlat(True) self.close_btn.setMouseTracking(False) self.close_btn.setMinimumSize(QtCore.QSize(int(self.wh[0] / 5), int(self.wh[0] / 5))) self.close_btn.setMaximumSize(QtCore.QSize(int(self.wh[0] / 5), int(self.wh[0] / 5))) self.close_btn.setIcon(self.close_icon) self.close_btn.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.comb_box = QtWidgets.QComboBox(self) self.comb_box.setFocusPolicy(QtCore.Qt.TabFocus | QtCore.Qt.ClickFocus) self.comb_box.setFrame(False) self.comb_box.setIconSize(QtCore.QSize(16, 16)) self.comb_box.addItem(self.image_icon, '') for c in string.hexdigits[0:10]: self.comb_box.addItem(self.image_icon, c)
def exportSkinWeight(self, exportPath=None, QWidget=None): if QWidget is not None: QWidget[0].setValue(0) nodes = pm.selected(fl=True) if not len(nodes): pm.displayWarning('nothing selected') return for node in nodes: nodeShape = node.getShape() if nodeShape is not None: nodeShapeType = nodeShape.type() if nodeShapeType in self.OBJ_TYPE: skinClusterNodes = self.getSkinCluster(node=node) if len(skinClusterNodes): self.__exportSkinWeight( node=node, shape=nodeShape, type=nodeShapeType, skinClusterNode=skinClusterNodes[0], exportPath=exportPath, QWidget=QWidget) if QWidget is not None: QWidget[0].setValue(0) newItem = QtWidgets.QListWidgetItem(QWidget[1]) newItem.linkType = 'weight' newItem.linkPath = os.path.join( exportPath, (node.name().replace('|', '#') + '[' + nodeShapeType + '].xml')) newItem.linkName = node.name( ) + '[' + nodeShapeType + '].xml' newItem.setText(node.name()) icon = QtGui.QIcon() if nodeShapeType == 'mesh': icon.addPixmap(__pixmap__('icon_mesh')) elif nodeShapeType == 'nurbsSurface': icon.addPixmap(__pixmap__('icon_surface')) elif nodeShapeType == 'nurbsCurve': icon.addPixmap(__pixmap__('icon_curve')) elif nodeShapeType == 'lattice': icon.addPixmap(__pixmap__('icon_lattice')) newItem.setIcon(icon) else: pm.displayWarning('find no skinCluster on object %s' % node) else: pm.displayWarning('object %s shape node not support' % node) else: pm.displayWarning('object %s has no shape' % node)
def __style(self, icon): reg_exp = QtCore.QRegExp('[a-zA-Z0-9_]+') validator = QtGui.QRegExpValidator(reg_exp, self) self.setValidator(validator) # self.icon_btn = QtWidgets.QPushButton(self) # self.icon_btn.setFixedSize(25, 25) # self.icon_btn.setIconSize(QtCore.QSize(20, 20)) # self.icon_btn.setFocusPolicy(QtCore.Qt.NoFocus) # self.icon_btn.setFlat(True) # self.icon_btn.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) # self.icon_btn.setEnabled(False) # self.icon_btn.setIcon(icon) # self.icon_btn.setStyleSheet("QPushButton{background:transparent;}") self.label_icon = QtWidgets.QLabel(self) self.label_icon.setFixedSize(25, 25) self.label_icon.setFocusPolicy(QtCore.Qt.NoFocus) self.label_icon.setStyleSheet("background:transparent;") self.label_icon.setPixmap(icon.pixmap(20, 20)) self.label_icon.setEnabled(False) self.main_layout = QtWidgets.QHBoxLayout(self) self.main_layout.addWidget(self.label_icon) self.main_layout.addStretch() self.main_layout.setContentsMargins(2, 0, 0, 0) self.setFocusPolicy(QtCore.Qt.TabFocus | QtCore.Qt.ClickFocus) self.setFrame(False) self.setTextMargins(24, 0, 0, 0) self.setContentsMargins(0, 0, 0, 0) self.setLayout(self.main_layout) self.setSizePolicy( QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)) self.setMinimumSize(QtCore.QSize(30, 30))
def skinClusterManager_refresh_pushButton_cmd(self): self.skinClusterManager_one_listWidget.clear() self.skinClusterManager_two_listWidget.clear() self.skinClusterManager_one_groupBox.setEnabled(False) self.skinClusterManager_two_listWidget.setEnabled(False) try: for item in os.listdir(self.config['root']): subPath = os.path.normpath( os.path.join(self.config['root'], item)) if os.path.isdir(subPath): newItem = QtWidgets.QListWidgetItem( self.skinClusterManager_one_listWidget) newItem.linkType = 'folder' newItem.linkPath = subPath newItem.linkName = item newItem.setText(item) newItem.setIcon(__icon__('icon_folder')) except: pass
def __style(self): self.setMinimumSize(QtCore.QSize(self.wh[0], self.wh[1])) self.setMaximumSize(QtCore.QSize(self.wh[0], self.wh[1])) self.setMouseTracking(True) self.setScaledContents(True) self.setAlignment(QtCore.Qt.AlignCenter) self.setPixmap(self.pixmap) self.close_btn = QtWidgets.QPushButton(self) self.close_btn.setFlat(True) self.close_btn.setMouseTracking(True) self.close_btn.setMinimumSize(QtCore.QSize(int(self.wh[0]/5), int(self.wh[0]/5))) self.close_btn.setMaximumSize(QtCore.QSize(int(self.wh[0]/5), int(self.wh[0]/5))) self.close_btn.setIcon(self.close_icon) self.close_btn.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.close_btn.setGeometry( self.width()-self.close_btn.width(), 0, self.close_btn.width(), self.close_btn.height() ) self.close_btn.hide()
def setupUi(self, skinClusterToolKit_Dialog): skinClusterToolKit_Dialog.setObjectName( _fromUtf8("skinClusterToolKit_Dialog")) skinClusterToolKit_Dialog.resize(211, 35) self.skinClusterToolKit_Dialog_verticalLayout = QtWidgets.QVBoxLayout( skinClusterToolKit_Dialog) self.skinClusterToolKit_Dialog_verticalLayout.setSpacing(2) self.skinClusterToolKit_Dialog_verticalLayout.setObjectName( _fromUtf8("skinClusterToolKit_Dialog_verticalLayout")) self.skinClusterToolKit_groupBox = QtWidgets.QGroupBox( skinClusterToolKit_Dialog) self.skinClusterToolKit_groupBox.setTitle(_fromUtf8("")) self.skinClusterToolKit_groupBox.setObjectName( _fromUtf8("skinClusterToolKit_groupBox")) self.skinClusterToolKit_groupBox_horizontalLayout = QtWidgets.QHBoxLayout( self.skinClusterToolKit_groupBox) self.skinClusterToolKit_groupBox_horizontalLayout.setSpacing(2) self.skinClusterToolKit_groupBox_horizontalLayout.setObjectName( _fromUtf8("skinClusterToolKit_groupBox_horizontalLayout")) self.skinClusterToolKit_getInfluence_pushButton = QtWidgets.QPushButton( self.skinClusterToolKit_groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.skinClusterToolKit_getInfluence_pushButton.sizePolicy( ).hasHeightForWidth()) self.skinClusterToolKit_getInfluence_pushButton.setSizePolicy( sizePolicy) self.skinClusterToolKit_getInfluence_pushButton.setMaximumSize( QtCore.QSize(25, 25)) self.skinClusterToolKit_getInfluence_pushButton.setIconSize( QtCore.QSize(20, 20)) self.skinClusterToolKit_getInfluence_pushButton.setFlat(True) self.skinClusterToolKit_getInfluence_pushButton.setObjectName( _fromUtf8("skinClusterToolKit_getInfluence_pushButton")) self.skinClusterToolKit_groupBox_horizontalLayout.addWidget( self.skinClusterToolKit_getInfluence_pushButton) self.skinClusterToolKit_holdInfluence_pushButton = QtWidgets.QPushButton( self.skinClusterToolKit_groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.skinClusterToolKit_holdInfluence_pushButton.sizePolicy( ).hasHeightForWidth()) self.skinClusterToolKit_holdInfluence_pushButton.setSizePolicy( sizePolicy) self.skinClusterToolKit_holdInfluence_pushButton.setMaximumSize( QtCore.QSize(25, 25)) self.skinClusterToolKit_holdInfluence_pushButton.setIconSize( QtCore.QSize(20, 20)) self.skinClusterToolKit_holdInfluence_pushButton.setFlat(True) self.skinClusterToolKit_holdInfluence_pushButton.setObjectName( _fromUtf8("skinClusterToolKit_holdInfluence_pushButton")) self.skinClusterToolKit_groupBox_horizontalLayout.addWidget( self.skinClusterToolKit_holdInfluence_pushButton) self.skinClusterToolKit_unHoldSelectedInfluence_pushButton = QtWidgets.QPushButton( self.skinClusterToolKit_groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.skinClusterToolKit_unHoldSelectedInfluence_pushButton. sizePolicy().hasHeightForWidth()) self.skinClusterToolKit_unHoldSelectedInfluence_pushButton.setSizePolicy( sizePolicy) self.skinClusterToolKit_unHoldSelectedInfluence_pushButton.setMaximumSize( QtCore.QSize(25, 25)) self.skinClusterToolKit_unHoldSelectedInfluence_pushButton.setIconSize( QtCore.QSize(20, 20)) self.skinClusterToolKit_unHoldSelectedInfluence_pushButton.setFlat( True) self.skinClusterToolKit_unHoldSelectedInfluence_pushButton.setObjectName( _fromUtf8("skinClusterToolKit_unHoldSelectedInfluence_pushButton")) self.skinClusterToolKit_groupBox_horizontalLayout.addWidget( self.skinClusterToolKit_unHoldSelectedInfluence_pushButton) self.line = QtWidgets.QFrame(self.skinClusterToolKit_groupBox) self.line.setFrameShape(QtWidgets.QFrame.VLine) self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.line.setObjectName(_fromUtf8("line")) self.skinClusterToolKit_groupBox_horizontalLayout.addWidget(self.line) self.skinClusterToolKit_copyComponentWeight_pushButton = QtWidgets.QPushButton( self.skinClusterToolKit_groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.skinClusterToolKit_copyComponentWeight_pushButton.sizePolicy( ).hasHeightForWidth()) self.skinClusterToolKit_copyComponentWeight_pushButton.setSizePolicy( sizePolicy) self.skinClusterToolKit_copyComponentWeight_pushButton.setMaximumSize( QtCore.QSize(25, 25)) self.skinClusterToolKit_copyComponentWeight_pushButton.setIconSize( QtCore.QSize(20, 20)) self.skinClusterToolKit_copyComponentWeight_pushButton.setFlat(True) self.skinClusterToolKit_copyComponentWeight_pushButton.setObjectName( _fromUtf8("skinClusterToolKit_copyComponentWeight_pushButton")) self.skinClusterToolKit_groupBox_horizontalLayout.addWidget( self.skinClusterToolKit_copyComponentWeight_pushButton) self.skinClusterToolKit_pasteComponentWeight_pushButton = QtWidgets.QPushButton( self.skinClusterToolKit_groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.skinClusterToolKit_pasteComponentWeight_pushButton.sizePolicy( ).hasHeightForWidth()) self.skinClusterToolKit_pasteComponentWeight_pushButton.setSizePolicy( sizePolicy) self.skinClusterToolKit_pasteComponentWeight_pushButton.setMaximumSize( QtCore.QSize(25, 25)) self.skinClusterToolKit_pasteComponentWeight_pushButton.setIconSize( QtCore.QSize(20, 20)) self.skinClusterToolKit_pasteComponentWeight_pushButton.setFlat(True) self.skinClusterToolKit_pasteComponentWeight_pushButton.setObjectName( _fromUtf8("skinClusterToolKit_pasteComponentWeight_pushButton")) self.skinClusterToolKit_groupBox_horizontalLayout.addWidget( self.skinClusterToolKit_pasteComponentWeight_pushButton) self.line_2 = QtWidgets.QFrame(self.skinClusterToolKit_groupBox) self.line_2.setFrameShape(QtWidgets.QFrame.VLine) self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_2.setObjectName(_fromUtf8("line_2")) self.skinClusterToolKit_groupBox_horizontalLayout.addWidget( self.line_2) self.skinClusterToolKit_resetBindPose_pushButton = QtWidgets.QPushButton( self.skinClusterToolKit_groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.skinClusterToolKit_resetBindPose_pushButton.sizePolicy( ).hasHeightForWidth()) self.skinClusterToolKit_resetBindPose_pushButton.setSizePolicy( sizePolicy) self.skinClusterToolKit_resetBindPose_pushButton.setMaximumSize( QtCore.QSize(25, 25)) self.skinClusterToolKit_resetBindPose_pushButton.setIconSize( QtCore.QSize(20, 20)) self.skinClusterToolKit_resetBindPose_pushButton.setFlat(True) self.skinClusterToolKit_resetBindPose_pushButton.setObjectName( _fromUtf8("skinClusterToolKit_resetBindPose_pushButton")) self.skinClusterToolKit_groupBox_horizontalLayout.addWidget( self.skinClusterToolKit_resetBindPose_pushButton) self.skinClusterToolKit_removeUnusedInfluence_pushButton = QtWidgets.QPushButton( self.skinClusterToolKit_groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.skinClusterToolKit_removeUnusedInfluence_pushButton. sizePolicy().hasHeightForWidth()) self.skinClusterToolKit_removeUnusedInfluence_pushButton.setSizePolicy( sizePolicy) self.skinClusterToolKit_removeUnusedInfluence_pushButton.setMaximumSize( QtCore.QSize(25, 25)) self.skinClusterToolKit_removeUnusedInfluence_pushButton.setIconSize( QtCore.QSize(20, 20)) self.skinClusterToolKit_removeUnusedInfluence_pushButton.setFlat(True) self.skinClusterToolKit_removeUnusedInfluence_pushButton.setObjectName( _fromUtf8("skinClusterToolKit_removeUnusedInfluence_pushButton")) self.skinClusterToolKit_groupBox_horizontalLayout.addWidget( self.skinClusterToolKit_removeUnusedInfluence_pushButton) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.skinClusterToolKit_groupBox_horizontalLayout.addItem(spacerItem) self.skinClusterToolKit_Dialog_verticalLayout.addWidget( self.skinClusterToolKit_groupBox) self.retranslateUi(skinClusterToolKit_Dialog) QtCore.QMetaObject.connectSlotsByName(skinClusterToolKit_Dialog)
def skinClusterManager_listWidget_cmd(self, listWidget=None, method=None): if listWidget.currentItem().linkType == 'folder': if method == 'single': self.skinClusterManager_two_listWidget.clear() self.skinClusterManager_one_groupBox.setEnabled(True) self.skinClusterManager_two_listWidget.setEnabled(True) self.pathing = listWidget.currentItem().linkPath self.skinClusterManager_path_LineEdit_cmd() for item in os.listdir(self.pathing): subPath = os.path.normpath(os.path.join( self.pathing, item)) if os.path.isfile(subPath) and fnmatch.fnmatch( item, '*.xml'): newItem = QtWidgets.QListWidgetItem( self.skinClusterManager_two_listWidget) newItem.linkType = 'weight' newItem.linkPath = subPath newItem.linkName = item newItem.setText(item.split('[')[0].replace('#', '|')) icon = QtGui.QIcon() if item.split('[')[1].split(']')[0] == 'mesh': icon.addPixmap(__pixmap__('icon_mesh')) elif item.split('[')[1].split( ']')[0] == 'nurbsSurface': icon.addPixmap(__pixmap__('icon_surface')) elif item.split('[')[1].split(']')[0] == 'nurbsCurve': icon.addPixmap(__pixmap__('icon_curve')) elif item.split('[')[1].split(']')[0] == 'lattice': icon.addPixmap(__pixmap__('icon_lattice')) newItem.setIcon(icon) elif method == 'double': confirmDialog = pm.confirmDialog( title='Delete', message='Delete?', button=['Delete Flder', 'Cancle'], cancelButton='Cancle', dismissString='Cancle', icon='question') if confirmDialog == 'Delete Flder': try: os.rmdir(self.pathing) # os.rmdir : delete empty dir listWidget.currentItem().setHidden(True) self.skinClusterManager_one_groupBox.setEnabled(False) self.skinClusterManager_two_listWidget.setEnabled( False) except: confirmDialog = pm.confirmDialog( title='Delete', message='File in Folder ' + ', Sure To Delete ?', button=['Yes', 'No'], defaultButton='Yes', cancelButton='No', dismissString='No', icon='warning') if confirmDialog == 'Yes': try: shutil.rmtree( self.pathing) # shutil.rmtree : delete dir listWidget.currentItem().setHidden(True) except: pass self.skinClusterManager_two_listWidget.clear() self.skinClusterManager_one_groupBox.setEnabled( False) self.skinClusterManager_two_listWidget.setEnabled( False) self.pathing = self.config['root'] self.skinClusterManager_path_LineEdit_cmd() else: pass elif listWidget.currentItem().linkType == 'weight': if method == 'single': pass elif method == 'double': self.machine.getInfluenceFromWeightData( listWidget.currentItem().linkPath)
def setupUi(self, skinClusterManager_Dialog): skinClusterManager_Dialog.setObjectName( _fromUtf8("skinClusterManager_Dialog")) skinClusterManager_Dialog.resize(295, 392) self.skinClusterManager_Dialog_verticalLayout = QtWidgets.QVBoxLayout( skinClusterManager_Dialog) self.skinClusterManager_Dialog_verticalLayout.setSpacing(4) self.skinClusterManager_Dialog_verticalLayout.setObjectName( _fromUtf8("skinClusterManager_Dialog_verticalLayout")) self.skinClusterManager_menu_horizontalLayout = QtWidgets.QHBoxLayout() self.skinClusterManager_menu_horizontalLayout.setSpacing(2) self.skinClusterManager_menu_horizontalLayout.setSizeConstraint( QtWidgets.QLayout.SetMaximumSize) self.skinClusterManager_menu_horizontalLayout.setObjectName( _fromUtf8("skinClusterManager_menu_horizontalLayout")) self.skinClusterManager_home_pushButton = QtWidgets.QPushButton( skinClusterManager_Dialog) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.skinClusterManager_home_pushButton. sizePolicy().hasHeightForWidth()) self.skinClusterManager_home_pushButton.setSizePolicy(sizePolicy) self.skinClusterManager_home_pushButton.setMaximumSize( QtCore.QSize(25, 25)) self.skinClusterManager_home_pushButton.setFlat(True) self.skinClusterManager_home_pushButton.setObjectName( _fromUtf8("skinClusterManager_home_pushButton")) self.skinClusterManager_menu_horizontalLayout.addWidget( self.skinClusterManager_home_pushButton) self.skinClusterManager_folder_pushButton = QtWidgets.QPushButton( skinClusterManager_Dialog) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.skinClusterManager_folder_pushButton. sizePolicy().hasHeightForWidth()) self.skinClusterManager_folder_pushButton.setSizePolicy(sizePolicy) self.skinClusterManager_folder_pushButton.setMaximumSize( QtCore.QSize(25, 25)) self.skinClusterManager_folder_pushButton.setFlat(True) self.skinClusterManager_folder_pushButton.setObjectName( _fromUtf8("skinClusterManager_folder_pushButton")) self.skinClusterManager_menu_horizontalLayout.addWidget( self.skinClusterManager_folder_pushButton) self.skinClusterManager_refresh_pushButton = QtWidgets.QPushButton( skinClusterManager_Dialog) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.skinClusterManager_refresh_pushButton.sizePolicy( ).hasHeightForWidth()) self.skinClusterManager_refresh_pushButton.setSizePolicy(sizePolicy) self.skinClusterManager_refresh_pushButton.setMaximumSize( QtCore.QSize(25, 25)) self.skinClusterManager_refresh_pushButton.setFlat(True) self.skinClusterManager_refresh_pushButton.setObjectName( _fromUtf8("skinClusterManager_refresh_pushButton")) self.skinClusterManager_menu_horizontalLayout.addWidget( self.skinClusterManager_refresh_pushButton) self.skinClusterManager_vis_pushButton = QtWidgets.QPushButton( skinClusterManager_Dialog) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.skinClusterManager_vis_pushButton. sizePolicy().hasHeightForWidth()) self.skinClusterManager_vis_pushButton.setSizePolicy(sizePolicy) self.skinClusterManager_vis_pushButton.setMaximumSize( QtCore.QSize(25, 25)) self.skinClusterManager_vis_pushButton.setFlat(True) self.skinClusterManager_vis_pushButton.setObjectName( _fromUtf8("skinClusterManager_vis_pushButton")) self.skinClusterManager_menu_horizontalLayout.addWidget( self.skinClusterManager_vis_pushButton) self.skinClusterManager_tool_pushButton = QtWidgets.QPushButton( skinClusterManager_Dialog) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.skinClusterManager_tool_pushButton. sizePolicy().hasHeightForWidth()) self.skinClusterManager_tool_pushButton.setSizePolicy(sizePolicy) self.skinClusterManager_tool_pushButton.setMaximumSize( QtCore.QSize(25, 25)) self.skinClusterManager_tool_pushButton.setFlat(True) self.skinClusterManager_tool_pushButton.setObjectName( _fromUtf8("skinClusterManager_tool_pushButton")) self.skinClusterManager_menu_horizontalLayout.addWidget( self.skinClusterManager_tool_pushButton) self.skinClusterManager_path_LineEdit = QtWidgets.QLineEdit( skinClusterManager_Dialog) self.skinClusterManager_path_LineEdit.setEnabled(False) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.skinClusterManager_path_LineEdit. sizePolicy().hasHeightForWidth()) self.skinClusterManager_path_LineEdit.setSizePolicy(sizePolicy) self.skinClusterManager_path_LineEdit.setCursor( QtGui.QCursor(QtCore.Qt.ArrowCursor)) self.skinClusterManager_path_LineEdit.setReadOnly(True) self.skinClusterManager_path_LineEdit.setObjectName( _fromUtf8("skinClusterManager_path_LineEdit")) self.skinClusterManager_menu_horizontalLayout.addWidget( self.skinClusterManager_path_LineEdit) self.skinClusterManager_path_pushButton = QtWidgets.QPushButton( skinClusterManager_Dialog) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.skinClusterManager_path_pushButton. sizePolicy().hasHeightForWidth()) self.skinClusterManager_path_pushButton.setSizePolicy(sizePolicy) self.skinClusterManager_path_pushButton.setMaximumSize( QtCore.QSize(16, 25)) self.skinClusterManager_path_pushButton.setIconSize( QtCore.QSize(12, 12)) self.skinClusterManager_path_pushButton.setFlat(True) self.skinClusterManager_path_pushButton.setObjectName( _fromUtf8("skinClusterManager_path_pushButton")) self.skinClusterManager_menu_horizontalLayout.addWidget( self.skinClusterManager_path_pushButton) self.skinClusterManager_Dialog_verticalLayout.addLayout( self.skinClusterManager_menu_horizontalLayout) self.skinClusterManager_horizontalLayout = QtWidgets.QHBoxLayout() self.skinClusterManager_horizontalLayout.setSpacing(3) self.skinClusterManager_horizontalLayout.setObjectName( _fromUtf8("skinClusterManager_horizontalLayout")) self.skinClusterManager_one_listWidget = QtWidgets.QListWidget( skinClusterManager_Dialog) self.skinClusterManager_one_listWidget.setFocusPolicy( QtCore.Qt.NoFocus) self.skinClusterManager_one_listWidget.setObjectName( _fromUtf8("skinClusterManager_one_listWidget")) self.skinClusterManager_horizontalLayout.addWidget( self.skinClusterManager_one_listWidget) self.skinClusterManager_two_listWidget = QtWidgets.QListWidget( skinClusterManager_Dialog) self.skinClusterManager_two_listWidget.setFocusPolicy( QtCore.Qt.NoFocus) self.skinClusterManager_two_listWidget.setSelectionMode( QtWidgets.QAbstractItemView.ExtendedSelection) self.skinClusterManager_two_listWidget.setObjectName( _fromUtf8("skinClusterManager_two_listWidget")) self.skinClusterManager_horizontalLayout.addWidget( self.skinClusterManager_two_listWidget) self.skinClusterManager_tools_groupBox_verticalLayout = QtWidgets.QVBoxLayout( ) self.skinClusterManager_tools_groupBox_verticalLayout.setSpacing(3) self.skinClusterManager_tools_groupBox_verticalLayout.setObjectName( _fromUtf8("skinClusterManager_tools_groupBox_verticalLayout")) self.skinClusterManager_one_groupBox = QtWidgets.QGroupBox( skinClusterManager_Dialog) self.skinClusterManager_one_groupBox.setTitle(_fromUtf8("")) self.skinClusterManager_one_groupBox.setObjectName( _fromUtf8("skinClusterManager_one_groupBox")) self.skinClusterManager_one_groupBox_verticalLayout = QtWidgets.QVBoxLayout( self.skinClusterManager_one_groupBox) self.skinClusterManager_one_groupBox_verticalLayout.setSpacing(2) self.skinClusterManager_one_groupBox_verticalLayout.setObjectName( _fromUtf8("skinClusterManager_one_groupBox_verticalLayout")) self.skinClusterManager_export_pushButton = QtWidgets.QPushButton( self.skinClusterManager_one_groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.skinClusterManager_export_pushButton. sizePolicy().hasHeightForWidth()) self.skinClusterManager_export_pushButton.setSizePolicy(sizePolicy) self.skinClusterManager_export_pushButton.setMaximumSize( QtCore.QSize(25, 25)) self.skinClusterManager_export_pushButton.setFlat(True) self.skinClusterManager_export_pushButton.setObjectName( _fromUtf8("skinClusterManager_export_pushButton")) self.skinClusterManager_one_groupBox_verticalLayout.addWidget( self.skinClusterManager_export_pushButton) self.skinClusterManager_exportComponents_pushButton = QtWidgets.QPushButton( self.skinClusterManager_one_groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.skinClusterManager_exportComponents_pushButton.sizePolicy( ).hasHeightForWidth()) self.skinClusterManager_exportComponents_pushButton.setSizePolicy( sizePolicy) self.skinClusterManager_exportComponents_pushButton.setMaximumSize( QtCore.QSize(25, 25)) self.skinClusterManager_exportComponents_pushButton.setFlat(True) self.skinClusterManager_exportComponents_pushButton.setObjectName( _fromUtf8("skinClusterManager_exportComponents_pushButton")) self.skinClusterManager_one_groupBox_verticalLayout.addWidget( self.skinClusterManager_exportComponents_pushButton) self.skinClusterManager_one_groupBox_one_line = QtWidgets.QFrame( self.skinClusterManager_one_groupBox) self.skinClusterManager_one_groupBox_one_line.setFrameShape( QtWidgets.QFrame.HLine) self.skinClusterManager_one_groupBox_one_line.setFrameShadow( QtWidgets.QFrame.Sunken) self.skinClusterManager_one_groupBox_one_line.setObjectName( _fromUtf8("skinClusterManager_one_groupBox_one_line")) self.skinClusterManager_one_groupBox_verticalLayout.addWidget( self.skinClusterManager_one_groupBox_one_line) self.skinClusterManager_import_pushButton = QtWidgets.QPushButton( self.skinClusterManager_one_groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.skinClusterManager_import_pushButton. sizePolicy().hasHeightForWidth()) self.skinClusterManager_import_pushButton.setSizePolicy(sizePolicy) self.skinClusterManager_import_pushButton.setMaximumSize( QtCore.QSize(25, 25)) self.skinClusterManager_import_pushButton.setFlat(True) self.skinClusterManager_import_pushButton.setObjectName( _fromUtf8("skinClusterManager_import_pushButton")) self.skinClusterManager_one_groupBox_verticalLayout.addWidget( self.skinClusterManager_import_pushButton) self.skinClusterManager_batchImport_pushButton = QtWidgets.QPushButton( self.skinClusterManager_one_groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.skinClusterManager_batchImport_pushButton.sizePolicy( ).hasHeightForWidth()) self.skinClusterManager_batchImport_pushButton.setSizePolicy( sizePolicy) self.skinClusterManager_batchImport_pushButton.setMaximumSize( QtCore.QSize(25, 25)) self.skinClusterManager_batchImport_pushButton.setFlat(True) self.skinClusterManager_batchImport_pushButton.setObjectName( _fromUtf8("skinClusterManager_batchImport_pushButton")) self.skinClusterManager_one_groupBox_verticalLayout.addWidget( self.skinClusterManager_batchImport_pushButton) self.skinClusterManager_one_groupBox_two_line = QtWidgets.QFrame( self.skinClusterManager_one_groupBox) self.skinClusterManager_one_groupBox_two_line.setFrameShape( QtWidgets.QFrame.HLine) self.skinClusterManager_one_groupBox_two_line.setFrameShadow( QtWidgets.QFrame.Sunken) self.skinClusterManager_one_groupBox_two_line.setObjectName( _fromUtf8("skinClusterManager_one_groupBox_two_line")) self.skinClusterManager_one_groupBox_verticalLayout.addWidget( self.skinClusterManager_one_groupBox_two_line) self.skinClusterManager_getInfluenceFromWeightData_pushButton = QtWidgets.QPushButton( self.skinClusterManager_one_groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.skinClusterManager_getInfluenceFromWeightData_pushButton. sizePolicy().hasHeightForWidth()) self.skinClusterManager_getInfluenceFromWeightData_pushButton.setSizePolicy( sizePolicy) self.skinClusterManager_getInfluenceFromWeightData_pushButton.setMaximumSize( QtCore.QSize(25, 25)) self.skinClusterManager_getInfluenceFromWeightData_pushButton.setFlat( True) self.skinClusterManager_getInfluenceFromWeightData_pushButton.setObjectName( _fromUtf8( "skinClusterManager_getInfluenceFromWeightData_pushButton")) self.skinClusterManager_one_groupBox_verticalLayout.addWidget( self.skinClusterManager_getInfluenceFromWeightData_pushButton) self.skinClusterManager_trash_pushButton = QtWidgets.QPushButton( self.skinClusterManager_one_groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.skinClusterManager_trash_pushButton. sizePolicy().hasHeightForWidth()) self.skinClusterManager_trash_pushButton.setSizePolicy(sizePolicy) self.skinClusterManager_trash_pushButton.setMaximumSize( QtCore.QSize(25, 25)) self.skinClusterManager_trash_pushButton.setFlat(True) self.skinClusterManager_trash_pushButton.setObjectName( _fromUtf8("skinClusterManager_trash_pushButton")) self.skinClusterManager_one_groupBox_verticalLayout.addWidget( self.skinClusterManager_trash_pushButton) self.skinClusterManager_reload_pushButton = QtWidgets.QPushButton( self.skinClusterManager_one_groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.skinClusterManager_reload_pushButton. sizePolicy().hasHeightForWidth()) self.skinClusterManager_reload_pushButton.setSizePolicy(sizePolicy) self.skinClusterManager_reload_pushButton.setMaximumSize( QtCore.QSize(25, 25)) self.skinClusterManager_reload_pushButton.setFlat(True) self.skinClusterManager_reload_pushButton.setObjectName( _fromUtf8("skinClusterManager_reload_pushButton")) self.skinClusterManager_one_groupBox_verticalLayout.addWidget( self.skinClusterManager_reload_pushButton) self.skinClusterManager_tools_groupBox_verticalLayout.addWidget( self.skinClusterManager_one_groupBox) self.skinClusterManager_two_groupBox = QtWidgets.QGroupBox( skinClusterManager_Dialog) self.skinClusterManager_two_groupBox.setTitle(_fromUtf8("")) self.skinClusterManager_two_groupBox.setObjectName( _fromUtf8("skinClusterManager_two_groupBox")) self.skinClusterManager_two_groupBox_verticalLayout = QtWidgets.QVBoxLayout( self.skinClusterManager_two_groupBox) self.skinClusterManager_two_groupBox_verticalLayout.setSpacing(2) self.skinClusterManager_two_groupBox_verticalLayout.setObjectName( _fromUtf8("skinClusterManager_two_groupBox_verticalLayout")) self.skinClusterManager_getInfluence_pushButton = QtWidgets.QPushButton( self.skinClusterManager_two_groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.skinClusterManager_getInfluence_pushButton.sizePolicy( ).hasHeightForWidth()) self.skinClusterManager_getInfluence_pushButton.setSizePolicy( sizePolicy) self.skinClusterManager_getInfluence_pushButton.setMaximumSize( QtCore.QSize(25, 25)) self.skinClusterManager_getInfluence_pushButton.setFlat(True) self.skinClusterManager_getInfluence_pushButton.setObjectName( _fromUtf8("skinClusterManager_getInfluence_pushButton")) self.skinClusterManager_two_groupBox_verticalLayout.addWidget( self.skinClusterManager_getInfluence_pushButton) self.skinClusterManager_holdInfluence_pushButton = QtWidgets.QPushButton( self.skinClusterManager_two_groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.skinClusterManager_holdInfluence_pushButton.sizePolicy( ).hasHeightForWidth()) self.skinClusterManager_holdInfluence_pushButton.setSizePolicy( sizePolicy) self.skinClusterManager_holdInfluence_pushButton.setMaximumSize( QtCore.QSize(25, 25)) self.skinClusterManager_holdInfluence_pushButton.setFlat(True) self.skinClusterManager_holdInfluence_pushButton.setObjectName( _fromUtf8("skinClusterManager_holdInfluence_pushButton")) self.skinClusterManager_two_groupBox_verticalLayout.addWidget( self.skinClusterManager_holdInfluence_pushButton) self.skinClusterManager_unHoldSelectedInfluence_pushButton = QtWidgets.QPushButton( self.skinClusterManager_two_groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.skinClusterManager_unHoldSelectedInfluence_pushButton. sizePolicy().hasHeightForWidth()) self.skinClusterManager_unHoldSelectedInfluence_pushButton.setSizePolicy( sizePolicy) self.skinClusterManager_unHoldSelectedInfluence_pushButton.setMaximumSize( QtCore.QSize(25, 25)) self.skinClusterManager_unHoldSelectedInfluence_pushButton.setFlat( True) self.skinClusterManager_unHoldSelectedInfluence_pushButton.setObjectName( _fromUtf8("skinClusterManager_unHoldSelectedInfluence_pushButton")) self.skinClusterManager_two_groupBox_verticalLayout.addWidget( self.skinClusterManager_unHoldSelectedInfluence_pushButton) self.skinClusterManager_two_groupBox_line = QtWidgets.QFrame( self.skinClusterManager_two_groupBox) self.skinClusterManager_two_groupBox_line.setFrameShape( QtWidgets.QFrame.HLine) self.skinClusterManager_two_groupBox_line.setFrameShadow( QtWidgets.QFrame.Sunken) self.skinClusterManager_two_groupBox_line.setObjectName( _fromUtf8("skinClusterManager_two_groupBox_line")) self.skinClusterManager_two_groupBox_verticalLayout.addWidget( self.skinClusterManager_two_groupBox_line) self.skinClusterManager_resetBindPose_pushButton = QtWidgets.QPushButton( self.skinClusterManager_two_groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.skinClusterManager_resetBindPose_pushButton.sizePolicy( ).hasHeightForWidth()) self.skinClusterManager_resetBindPose_pushButton.setSizePolicy( sizePolicy) self.skinClusterManager_resetBindPose_pushButton.setMaximumSize( QtCore.QSize(25, 25)) self.skinClusterManager_resetBindPose_pushButton.setFlat(True) self.skinClusterManager_resetBindPose_pushButton.setObjectName( _fromUtf8("skinClusterManager_resetBindPose_pushButton")) self.skinClusterManager_two_groupBox_verticalLayout.addWidget( self.skinClusterManager_resetBindPose_pushButton) self.skinClusterManager_removeUnusedInfluence_pushButton = QtWidgets.QPushButton( self.skinClusterManager_two_groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.skinClusterManager_removeUnusedInfluence_pushButton. sizePolicy().hasHeightForWidth()) self.skinClusterManager_removeUnusedInfluence_pushButton.setSizePolicy( sizePolicy) self.skinClusterManager_removeUnusedInfluence_pushButton.setMaximumSize( QtCore.QSize(25, 25)) self.skinClusterManager_removeUnusedInfluence_pushButton.setFlat(True) self.skinClusterManager_removeUnusedInfluence_pushButton.setObjectName( _fromUtf8("skinClusterManager_removeUnusedInfluence_pushButton")) self.skinClusterManager_two_groupBox_verticalLayout.addWidget( self.skinClusterManager_removeUnusedInfluence_pushButton) spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.skinClusterManager_two_groupBox_verticalLayout.addItem(spacerItem) self.skinClusterManager_tools_groupBox_verticalLayout.addWidget( self.skinClusterManager_two_groupBox) self.skinClusterManager_horizontalLayout.addLayout( self.skinClusterManager_tools_groupBox_verticalLayout) self.skinClusterManager_horizontalLayout.setStretch(0, 3) self.skinClusterManager_horizontalLayout.setStretch(1, 5) self.skinClusterManager_Dialog_verticalLayout.addLayout( self.skinClusterManager_horizontalLayout) self.skinClusterManager_progressBar = QtWidgets.QProgressBar( skinClusterManager_Dialog) self.skinClusterManager_progressBar.setEnabled(True) self.skinClusterManager_progressBar.setMaximumSize( QtCore.QSize(16777215, 8)) self.skinClusterManager_progressBar.setTextVisible(False) self.skinClusterManager_progressBar.setObjectName( _fromUtf8("skinClusterManager_progressBar")) self.skinClusterManager_Dialog_verticalLayout.addWidget( self.skinClusterManager_progressBar) self.retranslateUi(skinClusterManager_Dialog) QtCore.QMetaObject.connectSlotsByName(skinClusterManager_Dialog)
def exportComponentsSkinWeight(self, exportPath=None, QWidget=None): nodesTempList = [] components = pm.selected(fl=True) if components: for component in components: nodeShape = component.node() if nodeShape not in nodesTempList: nodesTempList.append(nodeShape) if len(nodesTempList) != 1: pm.displayWarning( 'this method support only one obj components right now...') return if nodesTempList[0].type() not in self.OBJ_TYPE: pm.displayWarning('this method only support obj components...') return node = nodesTempList[0].getParent() type = nodesTempList[0].type() countElement = len(components) skinClusterNodes = self.getSkinCluster(node=node) if skinClusterNodes: if QWidget is not None: QWidget[0].setRange(0, countElement) mainInfluence = self.getInfluence(node=node, select=False) mainInfluenceList = [ influence.name() for influence in mainInfluence ] # - Mian Data Tree - # dataInfoTree = ElementTree() dataInfoMain = Element('dataInfoMain') dataInfoTree._setroot(dataInfoMain) # - Data Info - # dataInfoElement = Element('dataInfo') SubElement(dataInfoElement, 'Author', {'value': self.user}) SubElement(dataInfoElement, 'Date', {'value': self.getTime()}) SubElement(dataInfoElement, 'Maya', {'value': self.mayaVersion}) dataInfoMain.append(dataInfoElement) # - Node Info - # nodeInfoElement = Element('nodeInfo') SubElement(nodeInfoElement, 'Node', {'value': str(node.name())}) SubElement(nodeInfoElement, 'Type', {'value': str(type)}) SubElement(nodeInfoElement, 'Element', {'value': str(countElement)}) SubElement(nodeInfoElement, 'Influence', {'value': str(mainInfluenceList)}) dataInfoMain.append(nodeInfoElement) # - Data Vertex Weight - # dataElement = Element('dataElement') if type == 'mesh': i = 0 for component in components: influenceList = pm.skinPercent( skinClusterNodes[0], component, ignoreBelow=self.IGNORE_VALUE, query=True, t=None) influenceIndexList = [ mainInfluenceList.index(eachInfluence) for eachInfluence in influenceList ] weightList = pm.skinPercent(skinClusterNodes[0], component, ignoreBelow=self.IGNORE_VALUE, query=True, v=True) SubElement( dataElement, 'Vertex', { 'index': str(component.currentItemIndex()), 'influence': str(influenceIndexList), 'weight': str(weightList) }) i += 1 try: QWidget[0].setValue(i) except: pass elif type == 'nurbsSurface': i = 0 for component in components: influenceList = pm.skinPercent( skinClusterNodes[0], component, ignoreBelow=self.IGNORE_VALUE, query=True, t=None) influenceIndexList = [ mainInfluenceList.index(eachInfluence) for eachInfluence in influenceList ] weightList = pm.skinPercent(skinClusterNodes[0], component, ignoreBelow=self.IGNORE_VALUE, query=True, v=True) SubElement( dataElement, 'Vertex', { 'index': str([ component.currentItemIndex()[0], component.currentItemIndex()[1] ]), 'influence': str(influenceIndexList), 'weight': str(weightList) }) i += 1 try: QWidget[0].setValue(i) except: pass elif type == 'nurbsCurve': i = 0 for component in components: influenceList = pm.skinPercent( skinClusterNodes[0], component, ignoreBelow=self.IGNORE_VALUE, query=True, t=None) influenceIndexList = [ mainInfluenceList.index(eachInfluence) for eachInfluence in influenceList ] weightList = pm.skinPercent(skinClusterNodes[0], component, ignoreBelow=self.IGNORE_VALUE, query=True, v=True) SubElement( dataElement, 'Vertex', { 'index': str(component.currentItemIndex()), 'influence': str(influenceIndexList), 'weight': str(weightList) }) i += 1 try: QWidget[0].setValue(i) except: pass elif type == 'lattice': i = 0 for component in components: influenceList = pm.skinPercent( skinClusterNodes[0], component, ignoreBelow=self.IGNORE_VALUE, query=True, t=None) influenceIndexList = [ mainInfluenceList.index(eachInfluence) for eachInfluence in influenceList ] weightList = pm.skinPercent(skinClusterNodes[0], component, ignoreBelow=self.IGNORE_VALUE, query=True, v=True) SubElement( dataElement, 'Vertex', { 'index': str([ component.currentItemIndex()[0], component.currentItemIndex()[1], component.currentItemIndex()[2] ]), 'influence': str(influenceIndexList), 'weight': str(weightList) }) i += 1 try: QWidget[0].setValue(i) except: pass dataInfoMain.append(dataElement) # - Write XML File - # exportPath = os.path.join( exportPath, (node.name().replace('|', '#') + '[' + type + '].xml')) dataInfoTree.write(exportPath, 'utf-8') if QWidget is not None: QWidget[0].setValue(0) newItem = QtWidgets.QListWidgetItem(QWidget[1]) newItem.linkType = 'weight' newItem.linkPath = exportPath newItem.linkName = node.name() + '[' + type + '].xml' newItem.setText(node.name()) icon = QtGui.QIcon() if type == 'mesh': icon.addPixmap(__pixmap__('icon_mesh')) elif type == 'nurbsSurface': icon.addPixmap(__pixmap__('icon_surface')) elif type == 'nurbsCurve': icon.addPixmap(__pixmap__('icon_curve')) elif type == 'lattice': icon.addPixmap(__pixmap__('icon_lattice')) newItem.setIcon(icon) else: pm.displayWarning('no skinCluster found %s' % node)