def __init__(self, parent=None): QtWidgets.QWidget.__init__(self, parent) self.setFixedWidth(250) layout = QtWidgets.QVBoxLayout() layout.setContentsMargins(6, 2, 6, 2) seed = widgets.SliderGroup(text="Seed") seed.setMaxValue(2000) translate_y = widgets.SliderGroup(text="Translate X") translate_x = widgets.SliderGroup(text="Translate Y") translate_z = widgets.SliderGroup(text="Translate Z") options_layout = QtWidgets.QHBoxLayout() relative_btn = QtWidgets.QRadioButton("Relative") absolute_btn = QtWidgets.QRadioButton("Absolute") random_btn = QtWidgets.QRadioButton("Random") relative_btn.setChecked(True) apply_btn = QtWidgets.QPushButton("Apply") options_layout.addWidget(absolute_btn) options_layout.addWidget(relative_btn) options_layout.addWidget(random_btn) layout.addLayout(options_layout) layout.addWidget(seed) layout.addWidget(translate_x) layout.addWidget(translate_y) layout.addWidget(translate_z) layout.addWidget(apply_btn) self.seed = seed self.relative = relative_btn self.absolute = absolute_btn self.random = random_btn self.apply = apply_btn self.translate_y = translate_y self.translate_x = translate_x self.translate_z = translate_z self.setLayout(layout) self.connections() self.lock_sliders()
def setupUi(self): self.setObjectName("renameWindow") mainLayout = QtWidgets.QVBoxLayout(self) # groupboxes groupBox_rename = QtWidgets.QGroupBox("Rename") groupBox_replace = QtWidgets.QGroupBox("Replace") groupBox_prefix = QtWidgets.QGroupBox("Prefix") groupBox_suffix = QtWidgets.QGroupBox("Suffix") # lineedits lineEdit_rename = QtWidgets.QLineEdit(groupBox_rename) lineEdit_search = QtWidgets.QLineEdit(groupBox_replace) lineEdit_replace = QtWidgets.QLineEdit(groupBox_replace) lineEdit_prefix = QtWidgets.QLineEdit(groupBox_prefix) lineEdit_suffix = QtWidgets.QLineEdit(groupBox_suffix) # buttons btn_rename = QtWidgets.QPushButton("Rename", groupBox_rename) btn_apply = QtWidgets.QPushButton("Apply", groupBox_replace) btn_prefix = QtWidgets.QPushButton("Prefix", groupBox_prefix) btn_suffix = QtWidgets.QPushButton("Suffix", groupBox_suffix) # labels label_rename = QtWidgets.QLabel("eg: spine_#_jnt", groupBox_rename) label_search = QtWidgets.QLabel("Search for:", groupBox_replace) label_replace = QtWidgets.QLabel("Replace with:", groupBox_replace) # layout for rename section vLayout_rename = QtWidgets.QVBoxLayout(groupBox_rename) hLayout_rename = QtWidgets.QHBoxLayout() hLayout_rename.addWidget(lineEdit_rename) hLayout_rename.addWidget(btn_rename) vLayout_rename.addLayout(hLayout_rename) vLayout_rename.addWidget(label_rename) # layout for search / replace section gLayout_replace = QtWidgets.QGridLayout(groupBox_replace) gLayout_replace.addWidget(label_search, 0, 0, QtCore.Qt.AlignRight) gLayout_replace.addWidget(label_replace, 1, 0, QtCore.Qt.AlignRight) gLayout_replace.addWidget(lineEdit_search, 0, 1) gLayout_replace.addWidget(lineEdit_replace, 1, 1) gLayout_replace.addWidget(btn_apply, 1, 2) # layout for prefix hLayout_prefix = QtWidgets.QHBoxLayout(groupBox_prefix) hLayout_prefix.addWidget(lineEdit_prefix) hLayout_prefix.addWidget(btn_prefix) # layout for suffix hLayout_suffix = QtWidgets.QHBoxLayout(groupBox_suffix) hLayout_suffix.addWidget(lineEdit_suffix) hLayout_suffix.addWidget(btn_suffix) # main layout mainLayout.addWidget(groupBox_rename) mainLayout.addWidget(groupBox_replace) mainLayout.addWidget(groupBox_prefix) mainLayout.addWidget(groupBox_suffix) self.data = { 'buttons': { 'rename': btn_rename, 'apply': btn_apply, 'prefix': btn_prefix, 'suffix': btn_suffix }, 'lineedit': { 'rename': lineEdit_rename, 'search': lineEdit_search, 'replace': lineEdit_replace, 'prefix': lineEdit_prefix, 'suffix': lineEdit_suffix } }
state = not self.random.isChecked() self.rotate_x.setEnabled(state) self.rotate_y.setEnabled(state) self.rotate_z.setEnabled(state) self.seed.setEnabled(not state) def on_apply(self): if self.random.isChecked(): approach = random.choice(["relative", "absolute"]) x = random.seed(self.seed.getValue()) y = random.seed(self.seed.getValue()) z = random.seed(self.seed.getValue()) else: approach = "relative" if self.relative.isChecked() else "absolute" x = self.rotate_x.getValue() y = self.rotate_y.getValue() z = self.rotate_z.getValue() lib.rotate_offset(x, y, z, approach=approach) if __name__ == '__main__': import sys app = QtWidgets.QApplication(sys.argv) w = Rotate() w.show() sys.exit(app.exec_())
def setupUi(self): self.setObjectName("controlFactory") sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) # layouts mainLayout = QtWidgets.QVBoxLayout(self) vLayout_addCurve = QtWidgets.QVBoxLayout() hLayout_addCurve = QtWidgets.QHBoxLayout() vLayout_copyCurve = QtWidgets.QVBoxLayout() hLayout_copyCurve = QtWidgets.QHBoxLayout() vLayout_removeCurve = QtWidgets.QVBoxLayout() hLayout_removeCurve = QtWidgets.QHBoxLayout() vLayout_color = QtWidgets.QVBoxLayout() hLayout_color = QtWidgets.QHBoxLayout() vLayout_scale = QtWidgets.QVBoxLayout() hLayout_scale = QtWidgets.QHBoxLayout() vLayout_tweak = QtWidgets.QVBoxLayout() hLayout_tweak = QtWidgets.QHBoxLayout() vLayout_addGroups = QtWidgets.QVBoxLayout() hLayout_addOffsetGroups = QtWidgets.QHBoxLayout() vLayout_addCurve.addLayout(hLayout_addCurve) vLayout_copyCurve.addLayout(hLayout_copyCurve) vLayout_removeCurve.addLayout(hLayout_removeCurve) vLayout_color.addLayout(hLayout_color) vLayout_scale.addLayout(hLayout_scale) vLayout_tweak.addLayout(hLayout_tweak) vLayout_addGroups.addLayout(hLayout_addOffsetGroups) # buttons pb_addCurve = QtWidgets.QPushButton() pb_copyCurve = QtWidgets.QPushButton() pb_copyShapes = QtWidgets.QPushButton("Copy ControlShapes") pb_removeCurve = QtWidgets.QPushButton() pb_removeShapes = QtWidgets.QPushButton("Remove ControlShapes") pb_color = QtWidgets.QPushButton() pb_scale = QtWidgets.QPushButton() pb_tweak = QtWidgets.QPushButton() pb_addOffsetGroups = QtWidgets.QPushButton() pb_addGroups = QtWidgets.QPushButton("Add zero grp") pb_N = QtWidgets.QPushButton("N") pb_R = QtWidgets.QPushButton("R") pb_T = QtWidgets.QPushButton("T") pb_default = QtWidgets.QPushButton("X") pb_plusX = QtWidgets.QPushButton("+") pb_minusX = QtWidgets.QPushButton("-") pb_plusY = QtWidgets.QPushButton("+") pb_minusY = QtWidgets.QPushButton("-") pb_plusZ = QtWidgets.QPushButton("+") pb_minusZ = QtWidgets.QPushButton("-") pb_scaleDown = QtWidgets.QPushButton("-") pb_scaleUp = QtWidgets.QPushButton("+") pb_N.setSizePolicy(sizePolicy) pb_R.setSizePolicy(sizePolicy) pb_T.setSizePolicy(sizePolicy) pb_default.setSizePolicy(sizePolicy) pb_addCurve.setMaximumSize(QtCore.QSize(25, 25)) pb_copyCurve.setMaximumSize(QtCore.QSize(25, 25)) pb_removeCurve.setMaximumSize(QtCore.QSize(25, 25)) pb_color.setMaximumSize(QtCore.QSize(25, 25)) pb_scale.setMaximumSize(QtCore.QSize(25, 25)) pb_tweak.setMaximumSize(QtCore.QSize(25, 25)) pb_addOffsetGroups.setMaximumSize(QtCore.QSize(25, 25)) pb_plusX.setMaximumSize(QtCore.QSize(30, 16777215)) pb_minusX.setMaximumSize(QtCore.QSize(30, 16777215)) pb_plusY.setMaximumSize(QtCore.QSize(30, 16777215)) pb_minusY.setMaximumSize(QtCore.QSize(30, 16777215)) pb_minusZ.setMaximumSize(QtCore.QSize(30, 16777215)) pb_plusZ.setMaximumSize(QtCore.QSize(30, 16777215)) pb_scaleDown.setMaximumSize(QtCore.QSize(30, 16777215)) pb_scaleUp.setMaximumSize(QtCore.QSize(30, 16777215)) pb_addCurve.setMinimumSize(QtCore.QSize(25, 25)) pb_copyCurve.setMinimumSize(QtCore.QSize(25, 25)) pb_removeCurve.setMinimumSize(QtCore.QSize(25, 25)) pb_color.setMinimumSize(QtCore.QSize(25, 25)) pb_scale.setMinimumSize(QtCore.QSize(25, 25)) pb_tweak.setMinimumSize(QtCore.QSize(25, 25)) pb_addOffsetGroups.setMinimumSize(QtCore.QSize(25, 25)) # labels label_addCurve = QtWidgets.QLabel("Add Control Curve") label_addCurve.setFrameShape(QtWidgets.QFrame.NoFrame) label_copyCurve = QtWidgets.QLabel("Copy Control Curve") label_removeCurve = QtWidgets.QLabel("Remove Control Curve(s)") label_color = QtWidgets.QLabel("Color") label_scale = QtWidgets.QLabel("Scale") label_minScale = QtWidgets.QLabel("Min") label_maxScale = QtWidgets.QLabel("Max") label_title = QtWidgets.QLabel("Value") label_sliderValue = QtWidgets.QLabel("") label_rotation = QtWidgets.QLabel("Rotation") label_rtX = QtWidgets.QLabel("Rotate X") label_rtY = QtWidgets.QLabel("Rotate Y") label_rtZ = QtWidgets.QLabel("Rotate Z") label_addGroups = QtWidgets.QLabel("Add offset groups") label_minScale.setAlignment(QtCore.Qt.AlignCenter) label_maxScale.setAlignment(QtCore.Qt.AlignCenter) # minimize widgets widget_addCurve = QtWidgets.QWidget() widget_copy = QtWidgets.QWidget() widget_remove = QtWidgets.QWidget() widget_color = QtWidgets.QWidget() widget_scale = QtWidgets.QWidget() widget_tweak = QtWidgets.QWidget() widget_addGroups = QtWidgets.QWidget() vLayout_addCurve.addWidget(widget_addCurve) vLayout_copyCurve.addWidget(widget_copy) vLayout_removeCurve.addWidget(widget_remove) vLayout_color.addWidget(widget_color) vLayout_scale.addWidget(widget_scale) vLayout_tweak.addWidget(widget_tweak) vLayout_addGroups.addWidget(widget_addGroups) # checkbox cb_shapeOnly = QtWidgets.QCheckBox("ControlShape Only") cb_viewport = QtWidgets.QCheckBox("Viewport") cb_outliner = QtWidgets.QCheckBox("Outliner") cb_nonUniform = QtWidgets.QCheckBox("Non-uniform") cb_x = QtWidgets.QCheckBox("x") cb_y = QtWidgets.QCheckBox("y") cb_z = QtWidgets.QCheckBox("z") cb_zero = QtWidgets.QCheckBox("zero") cb_sdk = QtWidgets.QCheckBox("sdk") cb_offset = QtWidgets.QCheckBox("offset") cb_parent = QtWidgets.QCheckBox("parent") # line edits le_x = QtWidgets.QLineEdit() le_y = QtWidgets.QLineEdit() le_z = QtWidgets.QLineEdit() le_minScale = QtWidgets.QLineEdit() le_maxScale = QtWidgets.QLineEdit() le_minScale.setMaximumSize(QtCore.QSize(30, 16777215)) le_maxScale.setMaximumSize(QtCore.QSize(30, 16777215)) # slider hSlider_scaleFactor = QtWidgets.QSlider() # spacers spacerStart = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) spacerEnd = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) # add buttons to title layouts hLayout_addCurve.addWidget(pb_addCurve) hLayout_copyCurve.addWidget(pb_copyCurve) hLayout_removeCurve.addWidget(pb_removeCurve) hLayout_color.addWidget(pb_color) hLayout_scale.addWidget(pb_scale) hLayout_tweak.addWidget(pb_tweak) hLayout_addOffsetGroups.addWidget(pb_addOffsetGroups) # add labels to title layouts hLayout_addCurve.addWidget(label_addCurve) hLayout_copyCurve.addWidget(label_copyCurve) hLayout_removeCurve.addWidget(label_removeCurve) hLayout_color.addWidget(label_color) hLayout_scale.addWidget(label_scale) hLayout_tweak.addWidget(label_rotation) hLayout_addOffsetGroups.addWidget(label_addGroups) # addCurve layout vLayout_inner_addCurve = QtWidgets.QVBoxLayout(widget_addCurve) gLayout_addCurve = QtWidgets.QGridLayout() vLayout_inner_addCurve.addLayout(gLayout_addCurve) vLayout_inner_addCurve.addWidget(cb_shapeOnly) # copyCurve layout vLayout_copy = QtWidgets.QVBoxLayout(widget_copy) vLayout_copy.addWidget(pb_copyShapes) # removeCurve layout vLayout_remove = QtWidgets.QVBoxLayout(widget_remove) vLayout_remove.addWidget(pb_removeShapes) # color layout vLayout_colorWidget = QtWidgets.QVBoxLayout(widget_color) gLayout_color = QtWidgets.QGridLayout() gLayout_color.addWidget(pb_N, 0, 0, 1, 1) gLayout_color.addWidget(pb_R, 0, 2, 1, 1) gLayout_color.addWidget(pb_T, 0, 1, 1, 1) gLayout_color.addWidget(pb_default, 0, 3, 1, 1) hLayout_colorType = QtWidgets.QHBoxLayout() hLayout_colorType.addWidget(cb_viewport) hLayout_colorType.addWidget(cb_outliner) vLayout_colorWidget.addLayout(hLayout_colorType) vLayout_colorWidget.addLayout(gLayout_color) # scale layout vLayout_scaleWidget = QtWidgets.QVBoxLayout(widget_scale) vLayout_nonUniform = QtWidgets.QVBoxLayout() vLayout_nonUniform.addWidget(cb_nonUniform) hLayout_nonUniform = QtWidgets.QHBoxLayout() hLayout_nonUniform.setContentsMargins(30, -1, -1, -1) hLayout_nonUniform.addWidget(cb_x) hLayout_nonUniform.addWidget(cb_y) hLayout_nonUniform.addWidget(cb_z) vLayout_nonUniform.addLayout(hLayout_nonUniform) hLayout_upDown = QtWidgets.QHBoxLayout() vLayout_scaleFactor = QtWidgets.QVBoxLayout() hLayout_scaleFactor = QtWidgets.QHBoxLayout() vLayout_min = QtWidgets.QVBoxLayout() vLayout_min.addWidget(label_minScale) vLayout_min.addWidget(le_minScale) hLayout_scaleFactor.addLayout(vLayout_min) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) hLayout_scaleFactor.addItem(spacerItem) vLayout_sliderValue = QtWidgets.QVBoxLayout() vLayout_sliderValue.addWidget(label_title) vLayout_sliderValue.addWidget(label_sliderValue) hLayout_scaleFactor.addLayout(vLayout_sliderValue) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) hLayout_scaleFactor.addItem(spacerItem) vLayout_max = QtWidgets.QVBoxLayout() vLayout_max.addWidget(label_maxScale) vLayout_max.addWidget(le_maxScale) hLayout_scaleFactor.addLayout(vLayout_max) vLayout_scaleFactor.addLayout(hLayout_scaleFactor) hSlider_scaleFactor.setMinimum(1) hSlider_scaleFactor.setOrientation(QtCore.Qt.Horizontal) hSlider_scaleFactor.setTickPosition(QtWidgets.QSlider.NoTicks) vLayout_scaleFactor.addWidget(hSlider_scaleFactor) hLayout_upDown.addLayout(vLayout_scaleFactor) vLayout_btn = QtWidgets.QVBoxLayout() spacer = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) vLayout_btn.addItem(spacer) hLayout_btn = QtWidgets.QHBoxLayout() hLayout_btn.addWidget(pb_scaleDown) hLayout_btn.addWidget(pb_scaleUp) vLayout_btn.addLayout(hLayout_btn) hLayout_upDown.addLayout(vLayout_btn) vLayout_scaleWidget.addLayout(vLayout_nonUniform) vLayout_scaleWidget.addLayout(hLayout_upDown) # tweak layout gLayout_tweak = QtWidgets.QGridLayout(widget_tweak) gLayout_tweak.addItem(spacerStart, 0, 0, 1, 1) gLayout_tweak.addWidget(pb_plusX, 0, 4, 1, 1) gLayout_tweak.addWidget(le_x, 0, 2, 1, 1) gLayout_tweak.addWidget(pb_minusX, 0, 3, 1, 1) gLayout_tweak.addWidget(label_rtX, 0, 1, 1, 1) gLayout_tweak.addItem(spacerEnd, 0, 5, 1, 1) gLayout_tweak.addWidget(label_rtY, 1, 1, 1, 1) gLayout_tweak.addWidget(label_rtZ, 2, 1, 1, 1) gLayout_tweak.addWidget(le_y, 1, 2, 1, 1) gLayout_tweak.addWidget(le_z, 2, 2, 1, 1) gLayout_tweak.addWidget(pb_minusY, 1, 3, 1, 1) gLayout_tweak.addWidget(pb_minusZ, 2, 3, 1, 1) gLayout_tweak.addWidget(pb_plusY, 1, 4, 1, 1) gLayout_tweak.addWidget(pb_plusZ, 2, 4, 1, 1) # add groups layout vLayout_addOffsetGroups = QtWidgets.QVBoxLayout(widget_addGroups) hLayout_addGroups = QtWidgets.QHBoxLayout() hLayout_addGroups.addWidget(cb_zero) hLayout_addGroups.addWidget(cb_sdk) hLayout_addGroups.addWidget(cb_offset) hLayout_addGroups.addWidget(cb_parent) vLayout_addOffsetGroups.addLayout(hLayout_addGroups) vLayout_addOffsetGroups.addWidget(pb_addGroups) line_1 = QtWidgets.QFrame() line_1.setFrameShape(QtWidgets.QFrame.HLine) line_1.setFrameShadow(QtWidgets.QFrame.Sunken) line_2 = QtWidgets.QFrame() line_2.setFrameShape(QtWidgets.QFrame.HLine) line_2.setFrameShadow(QtWidgets.QFrame.Sunken) line_3 = QtWidgets.QFrame() line_3.setFrameShape(QtWidgets.QFrame.HLine) line_3.setFrameShadow(QtWidgets.QFrame.Sunken) line_4 = QtWidgets.QFrame() line_4.setFrameShape(QtWidgets.QFrame.HLine) line_4.setFrameShadow(QtWidgets.QFrame.Sunken) line_5 = QtWidgets.QFrame() line_5.setFrameShape(QtWidgets.QFrame.HLine) line_5.setFrameShadow(QtWidgets.QFrame.Sunken) line_6 = QtWidgets.QFrame() line_6.setFrameShape(QtWidgets.QFrame.HLine) line_6.setFrameShadow(QtWidgets.QFrame.Sunken) mainLayout.addLayout(vLayout_addCurve) mainLayout.addWidget(line_1) mainLayout.addLayout(vLayout_copyCurve) mainLayout.addWidget(line_2) mainLayout.addLayout(vLayout_removeCurve) mainLayout.addWidget(line_3) mainLayout.addLayout(vLayout_color) mainLayout.addWidget(line_4) mainLayout.addLayout(vLayout_scale) mainLayout.addWidget(line_5) mainLayout.addLayout(vLayout_tweak) mainLayout.addWidget(line_6) mainLayout.addLayout(vLayout_addGroups) self.data = { 'buttons': { 'addCurve': pb_addCurve, 'copyCurve': pb_copyCurve, 'copyShapes': pb_copyShapes, 'removeCurve': pb_removeCurve, 'removeShapes': pb_removeShapes, 'color': pb_color, 'scale': pb_scale, 'tweak': pb_tweak, 'addOffsetGroups': pb_addOffsetGroups, 'addGroups': pb_addGroups, 'N': pb_N, 'R': pb_R, 'T': pb_T, 'X': pb_default, 'plusX': pb_plusX, 'minusX': pb_minusX, 'plusY': pb_plusY, 'minusY': pb_minusY, 'plusZ': pb_plusZ, 'minusZ': pb_minusZ, 'scaleDown': pb_scaleDown, 'scaleUp': pb_scaleUp }, 'layouts': { 'addCurve': gLayout_addCurve, 'color': gLayout_color }, 'widgets': { 'addCurve': widget_addCurve, 'copy': widget_copy, 'remove': widget_remove, 'color': widget_color, 'scale': widget_scale, 'tweak': widget_tweak, 'addGroups': widget_addGroups }, 'checkbox': { 'shapeOnly': cb_shapeOnly, 'viewport': cb_viewport, 'outliner': cb_outliner, 'nonUniform': cb_nonUniform, 'x': cb_x, 'y': cb_y, 'z': cb_z, 'zero': cb_zero, 'sdk': cb_sdk, 'offset': cb_offset, 'parent': cb_parent }, 'lineedit': { 'x': le_x, 'y': le_y, 'z': le_z, 'minScale': le_minScale, 'maxScale': le_maxScale }, 'slider': { 'scale': hSlider_scaleFactor }, 'label': { 'slider': label_sliderValue } }
def initialize(self): # add validators self.data['lineedit']['x'].setValidator( QtGui.QDoubleValidator(0, 180, 2)) self.data['lineedit']['y'].setValidator( QtGui.QDoubleValidator(0, 180, 2)) self.data['lineedit']['z'].setValidator( QtGui.QDoubleValidator(0, 180, 2)) self.data['lineedit']['minScale'].setValidator( QtGui.QDoubleValidator(1.0, 100, 2)) self.data['lineedit']['maxScale'].setValidator( QtGui.QDoubleValidator(1.0, 100, 2)) # add buttons - add control curve dirs = os.listdir(ctrls.CONTROLS_DIRECTORY) col = 6 row = 0 count = 0 self.mapperAddCurve = QtCore.QSignalMapper() for fileName in dirs: if fileName.endswith('.json'): if count == 6: count = 0 row += 1 btn = QtWidgets.QPushButton() btn.setToolTip(fileName) iconName = fileName.replace('.json', '.png') if iconName in dirs: iconPath = os.path.join(ctrls.CONTROLS_DIRECTORY, iconName) btn.setIcon(QtGui.QIcon(iconPath)) btn.setIconSize(QtCore.QSize(30, 30)) self.data['layouts']['addCurve'].addWidget(btn, row, count) count += 1 self.mapperAddCurve.setMapping(btn, fileName) btn.clicked.connect(self.mapperAddCurve.map) self.mapperAddCurve.mapped['QString'].connect(self.addCtrlShape) # add buttons - color self.mapperColor = QtCore.QSignalMapper() col = 8 row = 0 count = 4 for i in xrange(1, 32): if count == col: count = 0 row += 1 rgb = cmds.colorIndex(i, q=True) r, g, b = rgb[0], rgb[1], rgb[2] btn = QtWidgets.QPushButton() btn.btnIndex = count btn.setAutoFillBackground(True) values = "{r}, {g}, {b}, {a}".format(r=r * 255, g=g * 255, b=b * 255, a=255) btn.setStyleSheet("QPushButton { background-color: rgba(" + values + "); }") self.data['layouts']['color'].addWidget(btn, row, count) count += 1 self.mapperColor.setMapping(btn, i) btn.clicked.connect(self.mapperColor.map) self.mapperColor.mapped['int'].connect(self.colorShapes)
def buildFrame(self): someFrame = QtWidgets.QFrame(self) layout = QtWidgets.QVBoxLayout() someFrame.setLayout(layout) someFrame.layout().addWidget(QtWidgets.QPushButton("Test")) return someFrame
def setupUi(self, re_manager): re_manager.setObjectName("re_manager") re_manager.resize(702, 722) self.centralwidget = QtWidgets.QWidget(re_manager) self.centralwidget.setEnabled(True) self.centralwidget.setObjectName("centralwidget") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.centralwidget) self.verticalLayout_2.setObjectName("verticalLayout_2") self.animsTreeView = QtWidgets.QTreeView(self.centralwidget) self.animsTreeView.setObjectName("animsTreeView") self.verticalLayout_2.addWidget(self.animsTreeView) self.animLoadSelectedBtn = QtWidgets.QPushButton(self.centralwidget) self.animLoadSelectedBtn.setObjectName("animLoadSelectedBtn") self.verticalLayout_2.addWidget(self.animLoadSelectedBtn) self.timeEditorBtn = QtWidgets.QPushButton(self.centralwidget) self.timeEditorBtn.setObjectName("timeEditorBtn") self.verticalLayout_2.addWidget(self.timeEditorBtn) self.loadSequencerBtn = QtWidgets.QPushButton(self.centralwidget) self.loadSequencerBtn.setObjectName("loadSequencerBtn") self.verticalLayout_2.addWidget(self.loadSequencerBtn) self.groupBox = QtWidgets.QGroupBox(self.centralwidget) self.groupBox.setObjectName("groupBox") self.verticalLayout = QtWidgets.QVBoxLayout(self.groupBox) self.verticalLayout.setObjectName("verticalLayout") self.renameBonesBtn = QtWidgets.QPushButton(self.groupBox) self.renameBonesBtn.setObjectName("renameBonesBtn") self.verticalLayout.addWidget(self.renameBonesBtn) self.injectAnimBtn = QtWidgets.QPushButton(self.groupBox) self.injectAnimBtn.setObjectName("injectAnimBtn") self.verticalLayout.addWidget(self.injectAnimBtn) self.verticalLayout_2.addWidget(self.groupBox) re_manager.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(re_manager) self.menubar.setGeometry(QtCore.QRect(0, 0, 702, 21)) self.menubar.setObjectName("menubar") self.menuFile = QtWidgets.QMenu(self.menubar) self.menuFile.setObjectName("menuFile") self.menuRecent_Files = QtWidgets.QMenu(self.menuFile) self.menuRecent_Files.setObjectName("menuRecent_Files") self.menuAbout = QtWidgets.QMenu(self.menubar) self.menuAbout.setObjectName("menuAbout") re_manager.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(re_manager) self.statusbar.setObjectName("statusbar") re_manager.setStatusBar(self.statusbar) self.actionImport_motlist = QtWidgets.QAction(re_manager) self.actionImport_motlist.setCheckable(False) self.actionImport_motlist.setObjectName("actionImport_motlist") self.actionAbout = QtWidgets.QAction(re_manager) self.actionAbout.setObjectName("actionAbout") self.menuFile.addAction(self.actionImport_motlist) self.menuFile.addAction(self.menuRecent_Files.menuAction()) self.menuAbout.addAction(self.actionAbout) self.menubar.addAction(self.menuFile.menuAction()) self.menubar.addAction(self.menuAbout.menuAction()) self.retranslateUi(re_manager) QtCore.QMetaObject.connectSlotsByName(re_manager)
def setupUi(self): self.setObjectName("dataIO") mainLayout = QtWidgets.QVBoxLayout(self) mainLayout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize) pb_import = QtWidgets.QPushButton("Import") # u'\uf093' pb_export = QtWidgets.QPushButton("Export") # u'\uf0c7' hLayout1 = QtWidgets.QHBoxLayout() hLayout1.addWidget(pb_import) hLayout1.addWidget(pb_export) pb_skin = QtWidgets.QPushButton(u'SKIN') pb_ctrl = QtWidgets.QPushButton(u'CTRL') pb_channel = QtWidgets.QPushButton(u'CH') pb_sdk = QtWidgets.QPushButton(u'SDK') pb_skeleton = QtWidgets.QPushButton(u'SKEL') pb_blendshape = QtWidgets.QPushButton(u'BSHP') pb_pose = QtWidgets.QPushButton(u'POSE') btnLayout = QtWidgets.QHBoxLayout() btnLayout.addWidget(pb_skin) btnLayout.addWidget(pb_ctrl) btnLayout.addWidget(pb_channel) btnLayout.addWidget(pb_sdk) btnLayout.addWidget(pb_skeleton) btnLayout.addWidget(pb_blendshape) btnLayout.addWidget(pb_pose) le_filepath = QtWidgets.QLineEdit() pb_browse = QtWidgets.QPushButton(u'\uf07b') le_filepath.setText(cmds.workspace(q=1, rd=1) + 'skin.json') hLayout2 = QtWidgets.QHBoxLayout() hLayout2.addWidget(le_filepath) hLayout2.addWidget(pb_browse) pb_apply = QtWidgets.QPushButton(u'APPLY') vLayout = QtWidgets.QVBoxLayout() vLayout.addWidget(pb_apply) mainLayout.addLayout(hLayout1) mainLayout.addLayout(btnLayout) mainLayout.addLayout(hLayout2) mainLayout.addLayout(vLayout) w_skin = QtWidgets.QWidget() w_ctrl = QtWidgets.QWidget() w_channel = QtWidgets.QWidget() w_sdk = QtWidgets.QWidget() w_skeleton = QtWidgets.QWidget() w_blendshape = QtWidgets.QWidget() w_pose = QtWidgets.QWidget() mainLayout.addWidget(w_skin) mainLayout.addWidget(w_ctrl) mainLayout.addWidget(w_channel) mainLayout.addWidget(w_sdk) mainLayout.addWidget(w_skeleton) mainLayout.addWidget(w_blendshape) mainLayout.addWidget(w_pose) # set checkable pb_skin.setCheckable(1) pb_ctrl.setCheckable(1) pb_channel.setCheckable(1) pb_sdk.setCheckable(1) pb_skeleton.setCheckable(1) pb_blendshape.setCheckable(1) pb_pose.setCheckable(1) pb_import.setCheckable(1) pb_export.setCheckable(1) # set visible w_skin.hide() w_ctrl.hide() w_channel.hide() w_sdk.hide() w_skeleton.hide() w_pose.hide() # name all the important widgets names = { # Buttons "SkinButton": pb_skin, "CtrlButton": pb_ctrl, "ChannelButton": pb_channel, "SDKButton": pb_sdk, "SkeletonButton": pb_skeleton, "BlendshapeButton": pb_blendshape, "PoseButton": pb_pose, "ImportButton": pb_import, "ExportButton": pb_export, "BrowseButton": pb_browse, "ApplyButton": pb_apply, # LineEdits "FilePath": le_filepath, } for name, w in names.items(): w.setObjectName(name) self.data = { 'buttons': { 'import': pb_import, 'export': pb_export, 'browse': pb_browse, 'apply': pb_apply }, 'options': { 'skin': pb_skin, 'ctrl': pb_ctrl, 'channel': pb_channel, 'sdk': pb_sdk, 'skeleton': pb_skeleton, 'shp': pb_blendshape, 'pose': pb_pose }, 'lineedits': { 'browse': le_filepath }, 'widgets': { 'skin': w_skin, 'ctrl': w_ctrl, 'channel': w_channel, 'sdk': w_sdk, 'skeleton': w_skeleton, 'shp': w_blendshape, 'pose': w_pose } }
def __init__(self): super(Panel, self).__init__() table = QtWidgets.QTabWidget() layout1 = QtWidgets.QHBoxLayout() layout2 = QtWidgets.QHBoxLayout() layout3 = QtWidgets.QHBoxLayout() for i in range(5): layout1.addWidget(QtWidgets.QPushButton()) for i in range(5): layout2.addWidget(QtWidgets.QCheckBox()) for i in range(5): layout3.addWidget(QtWidgets.QLineEdit()) tab1 = QtWidgets.QWidget() tab2 = QtWidgets.QWidget() tab3 = QtWidgets.QWidget() tab1.setLayout(layout1) tab2.setLayout(layout2) tab3.setLayout(layout3) table.addTab(tab1, "Push") table.addTab(tab2, "Checkbox") table.addTab(tab3, "Line edit") master_layout = QtWidgets.QHBoxLayout() master_layout.addWidget(table) self.setLayout(master_layout)
def importSkinWeight(importPath, meshes, namespace=False): """ Import skinWeight from a json file, to a list of meshes. To a whole mesh, or selected vertices. Args: filepath: The file path where a json file is loaded. meshes: A list of mesh nodes. If [], import all available meshes. namespace: True to respect imported namespace data. False to ignore any namespaces. Returns: True if import succeeds. False if import fails. """ with open(importPath) as infile: try: data = json.load(infile) LOG.info('Loaded skinWeight data from {0}.'.format(importPath)) except: LOG.error('Unable to load skinWeight data from {0}.'.format(importPath)) return False if not meshes: meshes = data.keys() for mesh in meshes: selectedIndice = [] selectedVerts = [v.split('.vtx')[-1] for v in cmds.ls(sl=1, fl=1) if (('.vtx' in v) and (mesh in v))] for v in selectedVerts: id = re.findall('\\d+', v)[0] selectedIndice.append(id) if namespace: if not (mesh in data): LOG.warning('Unable to find mesh data for "{0}"'.format(mesh)) continue meshName = mesh else: shortName = mesh.split(':')[-1] meshName = '' for m in data.keys(): if m.split(':')[-1] == shortName: meshName = m if not meshName: LOG.warning('Unable to find mesh data for "{0}"'.format(shortName)) continue # if mesh is not in current scene, skip if not cmds.objExists(meshName): continue weights = data[meshName]['weights'] infs = data[meshName]['infs'] skinClusterName = data[meshName]['skinCluster'] skinNorm = data[meshName]['nw'] if cmds.polyEvaluate(mesh, v=1) != len(weights.keys()): LOG.warning('Mesh "{0}": Vertex number does not match with the imported skinCluster "{1}"'.format( mesh, skinClusterName)) # progressBar visualization total = len(weights.items()) progressBar = QtWidgets.QProgressBar() progressBar.setMinimumSize(QtCore.QSize(450, 40)) progressBar.setMinimum(1) progressBar.setMaximum(total) progressBar.setWindowTitle('Importing skincluster: {}'.format(mesh)) progressBar.show() completed = 0 # vertices selection if selectedIndice: # get skinCluster currentName = getSkinCluster(mesh) # check if skinCluster exists if not currentName: LOG.error('Mesh "{0}": SkinCluster missing selected vertices'.format(mesh)) return False # check the name of skinCluster elif currentName != skinClusterName: LOG.warning('SkinCluster "{0}": Name does not match with the imported skinCluster "{1}"'.format(currentName, skinClusterName)) # check the number of influences currentInfs = cmds.skinCluster(currentName, q=1, inf=1) if len(currentInfs) != len(infs): LOG.warning('SkinCluster "{0}": Influence number does not match with the imported skinCluster "{1}"'.format(currentName, skinClusterName)) # unlock influences used by skincluster for inf in infs: if not cmds.objExists(inf): LOG.warning('Unable to find influence "{0}"]'.format(inf)) continue cmds.setAttr('%s.liw' % inf, 0) for vertId in selectedIndice: if not (vertId in weights): LOG.info('Unable to find weight data for {0}.vtx[{1}]'.format(mesh, vertId)) continue # TODO # deal with vertices with missing weight data: missing data for vertId # currently acting awkward weightData = weights[vertId] wlAttr = '%s.weightList[%s]' % (currentName, vertId) completed += 1 progressBar.setValue(completed) for infId, infValue in weightData.items(): wAttr = '.weights[%s]' % infId cmds.setAttr(wlAttr + wAttr, infValue) return True # get skinCluster if getSkinCluster(mesh): cmds.delete(getSkinCluster(mesh)) create(mesh, infs, name=skinClusterName, nw=skinNorm) # normalize needs turned off for the prune to work if skinNorm != 0: cmds.setAttr('%s.normalizeWeights' % skinClusterName, 0) cmds.skinPercent(skinClusterName, mesh, nrm=False, prw=100) # restore normalize setting cmds.setAttr('%s.normalizeWeights' % skinClusterName, skinNorm) # apply weights for vertId, weightData in weights.items(): wlAttr = '%s.weightList[%s]' % (skinClusterName, vertId) completed += 1 progressBar.setValue(completed) for infId, infValue in weightData.items(): wAttr = '.weights[%s]' % infId cmds.setAttr(wlAttr + wAttr, infValue) return True
def exportSkinWeight(exportPath, meshes, namespace=False): """ Export skinWeights of a list of meshes to a json file. Args: exportPath: The file path where a json file is saved. meshes: A list of mesh nodes. namespace: True to export with namespace. False to export without namespace. Returns: True if export succeeds. False if export fails. """ data = {} if not meshes: LOG.error('Meshes input {0} is not valid.'.format(meshes)) return False for mesh in meshes: skinCluster = getSkinCluster(mesh) if not skinCluster: LOG.warning('Mesh {} has no skinCluster, skipping... '.format(mesh)) continue skinNorm = cmds.getAttr('%s.normalizeWeights' % skinCluster) # get the MFnSkinCluster for clusterName selList = om.MSelectionList() selList.add(skinCluster) clusterNode = om.MObject() selList.getDependNode(0, clusterNode) skinFn = oma.MFnSkinCluster(clusterNode) # get the MDagPath for all influence infDags = om.MDagPathArray() skinFn.influenceObjects(infDags) # { # "mesh_name": { # "weights": { # "vert id": { # "influence id": weight, # "influence id": weight # } # }, # "infs": [inf1, inf2, inf3, inf4, ...], # "skinCluster": skinCluster_name # } # } infIds = {} infs = [] unique = True for i in xrange(infDags.length()): infPath = infDags[i].partialPathName() if '|' in infPath: LOG.warning('Influence of {}: "{}" is not have a unique name.'.format(mesh, infDags[i].fullPathName())) unique = False infId = int(skinFn.indexForInfluenceObject(infDags[i])) infIds[infId] = i infs.append(infPath) if not unique: LOG.warning('{} skincluster export is skipped. Please make sure all influence names are unique'.format(mesh)) continue # get the MPlug for the weightList and weights attributes wlPlug = skinFn.findPlug('weightList') wPlug = skinFn.findPlug('weights') wlAttr = wlPlug.attribute() wAttr = wPlug.attribute() wInfIds = om.MIntArray() # progressBar visualization total = wlPlug.numElements() progressBar = QtWidgets.QProgressBar() progressBar.setMinimumSize(QtCore.QSize(450, 40)) progressBar.setMinimum(1) progressBar.setMaximum(total) progressBar.setWindowTitle('Exporting skincluster: {}'.format(mesh)) progressBar.show() completed = 0 weights = {} for vId in xrange(wlPlug.numElements()): vWeights = {} # tell the weights attribute which vertex id it represents wPlug.selectAncestorLogicalIndex(vId, wlAttr) # get the indice of all non-zero weights for this vert wPlug.getExistingArrayAttributeIndices(wInfIds) # create a copy of the current wPlug infPlug = om.MPlug(wPlug) completed += 1 progressBar.setValue(completed) for infId in wInfIds: # tell the infPlug it represents the current influence id infPlug.selectAncestorLogicalIndex(infId, wAttr) # add this influence and its weight to this verts weights try: vWeights[infIds[infId]] = infPlug.asDouble() except KeyError: # assumes a removed influence pass weights[vId] = vWeights if namespace: meshName = mesh else: meshName = mesh.split(':')[-1] data[meshName] = {'weights': weights, 'infs': infs, 'skinCluster': skinCluster, 'nw': skinNorm} with open(exportPath, 'w') as outfile: try: if data: json.dump(data, outfile, sort_keys=True, indent=4) LOG.info('Exported skin weights for mesh {0}.'.format(meshes)) return True else: LOG.info('No valid skinCluster is found for mesh {0}.'.format(meshes)) return False except: LOG.error('Unable to export skinWeight data to {0}.'.format(exportPath)) return False
def setupUi(self): self.setObjectName("jointFactory") mainLayout= QtWidgets.QVBoxLayout(self) # buttons pb_toggle = QtWidgets.QPushButton("Toggle Local Axes Visibility") pb_orientJoints = QtWidgets.QPushButton("Orient Joints") pb_planarOrientJoints = QtWidgets.QPushButton("Planar Orient Joints for 3") pb_minusX = QtWidgets.QPushButton("-") pb_plusX = QtWidgets.QPushButton("+") pb_minusY = QtWidgets.QPushButton("-") pb_plusY = QtWidgets.QPushButton("+") pb_minusZ = QtWidgets.QPushButton("-") pb_plusZ = QtWidgets.QPushButton("+") pb_insertJoints = QtWidgets.QPushButton("Apply") pb_copyJointOrient = QtWidgets.QPushButton("Copy Joint Orientation") pb_turnOffLRA = QtWidgets.QPushButton("Turn Off All LRA") pb_minusX.setMaximumSize(QtCore.QSize(30, 16777215)) pb_plusX.setMaximumSize(QtCore.QSize(30, 16777215)) pb_minusY.setMaximumSize(QtCore.QSize(30, 16777215)) pb_plusY.setMaximumSize(QtCore.QSize(30, 16777215)) pb_minusZ.setMaximumSize(QtCore.QSize(30, 16777215)) pb_plusZ.setMaximumSize(QtCore.QSize(30, 16777215)) # radio buttons rb_worldUpAxisX = QtWidgets.QRadioButton("x") rb_worldUpAxisY = QtWidgets.QRadioButton("y") rb_worldUpAxisZ = QtWidgets.QRadioButton("z") rb_aimAxisX = QtWidgets.QRadioButton("x") rb_aimAxisY = QtWidgets.QRadioButton("y") rb_aimAxisZ = QtWidgets.QRadioButton("z") rb_upAxisX = QtWidgets.QRadioButton("x") rb_upAxisY = QtWidgets.QRadioButton("y") rb_upAxisZ = QtWidgets.QRadioButton("z") rbg_worldUpAxis = QtWidgets.QButtonGroup(self) rbg_worldUpAxis.addButton(rb_worldUpAxisX) rbg_worldUpAxis.addButton(rb_worldUpAxisY) rbg_worldUpAxis.addButton(rb_worldUpAxisZ) rbg_aimAxis = QtWidgets.QButtonGroup(self) rbg_aimAxis.addButton(rb_aimAxisX) rbg_aimAxis.addButton(rb_aimAxisY) rbg_aimAxis.addButton(rb_aimAxisZ) rbg_upAxis = QtWidgets.QButtonGroup(self) rbg_upAxis.addButton(rb_upAxisX) rbg_upAxis.addButton(rb_upAxisY) rbg_upAxis.addButton(rb_upAxisZ) hLayout_worldUpAxis = QtWidgets.QHBoxLayout() hLayout_worldUpAxis.addWidget(rb_worldUpAxisX) hLayout_worldUpAxis.addWidget(rb_worldUpAxisY) hLayout_worldUpAxis.addWidget(rb_worldUpAxisZ) hLayout_aimAxis = QtWidgets.QHBoxLayout() hLayout_aimAxis.addWidget(rb_aimAxisX) hLayout_aimAxis.addWidget(rb_aimAxisY) hLayout_aimAxis.addWidget(rb_aimAxisZ) hLayout_upAxis = QtWidgets.QHBoxLayout() hLayout_upAxis.addWidget(rb_upAxisX) hLayout_upAxis.addWidget(rb_upAxisY) hLayout_upAxis.addWidget(rb_upAxisZ) # checkbox cb_orientChildren = QtWidgets.QCheckBox("Orient children") cb_orient2World = QtWidgets.QCheckBox("Orient Joint to World") cb_orientChildren.setLayoutDirection(QtCore.Qt.LeftToRight) cb_orient2World.setLayoutDirection(QtCore.Qt.LeftToRight) # combo box combo_upAxis = QtWidgets.QComboBox() combo_upAxis.addItem("+") combo_upAxis.addItem("-") combo_aimAxis = QtWidgets.QComboBox() combo_aimAxis.addItem("+") combo_aimAxis.addItem("-") combo_worldUpAxis = QtWidgets.QComboBox() combo_worldUpAxis.addItem("+") combo_worldUpAxis.addItem("-") # labels label_upAxis = QtWidgets.QLabel("Up Axis") label_worldUpAxis = QtWidgets.QLabel("World Up Axis:") label_aimAxis = QtWidgets.QLabel("Aim Axis:") label_x = QtWidgets.QLabel("x") label_y = QtWidgets.QLabel("y") label_z = QtWidgets.QLabel("z") label_insertJoints = QtWidgets.QLabel("Insert Joints:") label_upAxis.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) label_worldUpAxis.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) label_aimAxis.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) # line edits le_x = QtWidgets.QLineEdit() le_y = QtWidgets.QLineEdit() le_z = QtWidgets.QLineEdit() le_insertJoints = QtWidgets.QLineEdit() spacerStart = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) spacerEnd = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) gLayout_orient = QtWidgets.QGridLayout() gLayout_orient.setContentsMargins(-1, -1, 0, -1) gLayout_orient.addLayout(hLayout_worldUpAxis, 4, 2, 1, 1) gLayout_orient.addLayout(hLayout_aimAxis, 2, 2, 1, 1) gLayout_orient.addWidget(cb_orientChildren, 0, 2, 1, 1) gLayout_orient.addWidget(combo_upAxis, 3, 3, 1, 1) gLayout_orient.addItem(spacerStart, 2, 0, 1, 1) gLayout_orient.addItem(spacerEnd, 2, 4, 1, 1) gLayout_orient.addWidget(cb_orient2World, 1, 2, 1, 1) gLayout_orient.addWidget(label_upAxis, 3, 1, 1, 1) gLayout_orient.addWidget(combo_worldUpAxis, 4, 3, 1, 1) gLayout_orient.addWidget(combo_aimAxis, 2, 3, 1, 1) gLayout_orient.addWidget(label_worldUpAxis, 4, 1, 1, 1) gLayout_orient.addWidget(label_aimAxis, 2, 1, 1, 1) gLayout_orient.addLayout(hLayout_upAxis, 3, 2, 1, 1) spacerEnd = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) spacerStart = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) gLayout_tweak = QtWidgets.QGridLayout() gLayout_tweak.addWidget(label_x, 0, 1, 1, 1) gLayout_tweak.addWidget(le_z, 2, 2, 1, 1) gLayout_tweak.addWidget(le_y, 1, 2, 1, 1) gLayout_tweak.addWidget(label_y, 1, 1, 1, 1) gLayout_tweak.addWidget(le_x, 0, 2, 1, 1) gLayout_tweak.addWidget(label_z, 2, 1, 1, 1) gLayout_tweak.addItem(spacerEnd, 0, 6, 1, 1) gLayout_tweak.addItem(spacerStart, 0, 0, 1, 1) gLayout_tweak.addWidget(pb_minusX, 0, 3, 1, 1) gLayout_tweak.addWidget(pb_plusX, 0, 4, 1, 1) gLayout_tweak.addWidget(pb_minusY, 1, 3, 1, 1) gLayout_tweak.addWidget(pb_plusY, 1, 4, 1, 1) gLayout_tweak.addWidget(pb_minusZ, 2, 3, 1, 1) gLayout_tweak.addWidget(pb_plusZ, 2, 4, 1, 1) line_1 = QtWidgets.QFrame() line_1.setFrameShape(QtWidgets.QFrame.HLine) line_1.setFrameShadow(QtWidgets.QFrame.Sunken) line_2 = QtWidgets.QFrame() line_2.setFrameShape(QtWidgets.QFrame.HLine) line_2.setFrameShadow(QtWidgets.QFrame.Sunken) spacerStart = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) spacerEnd = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) hLayout_insert = QtWidgets.QHBoxLayout() hLayout_insert.setContentsMargins(0, -1, 0, -1) hLayout_insert.addItem(spacerStart) hLayout_insert.addWidget(label_insertJoints) hLayout_insert.addWidget(le_insertJoints) hLayout_insert.addWidget(pb_insertJoints) hLayout_insert.addItem(spacerEnd) mainLayout.addWidget(pb_toggle) mainLayout.addLayout(gLayout_orient) mainLayout.addWidget(pb_orientJoints) mainLayout.addWidget(pb_planarOrientJoints) mainLayout.addWidget(line_1) mainLayout.addLayout(gLayout_tweak) mainLayout.addWidget(line_2) mainLayout.addLayout(hLayout_insert) mainLayout.addWidget(pb_copyJointOrient) mainLayout.addWidget(pb_turnOffLRA) mainLayout.setStretch(0, 1) self.data = { 'buttons': { 'toggle': pb_toggle, 'orientJoints': pb_orientJoints, 'planarOrientJoints': pb_planarOrientJoints, 'minusX': pb_minusX, 'plusX': pb_plusX, 'minusY': pb_minusY, 'plusY': pb_plusY, 'minusZ': pb_minusZ, 'plusZ': pb_plusZ, 'insertJoints': pb_insertJoints, 'copyJointOrient': pb_copyJointOrient, 'turnOffLRA': pb_turnOffLRA }, 'radio': { 'worldUpAxisX': rb_worldUpAxisX, 'worldUpAxisY': rb_worldUpAxisY, 'worldUpAxisZ': rb_worldUpAxisZ, 'aimAxisX': rb_aimAxisX, 'aimAxisY': rb_aimAxisY, 'aimAxisZ': rb_aimAxisZ, 'upAxisX': rb_upAxisX, 'upAxisY': rb_upAxisY, 'upAxisZ': rb_upAxisZ }, 'rbg': { 'worldUpAxis': rbg_worldUpAxis, 'aimAxis': rbg_aimAxis, 'upAxis': rbg_upAxis }, 'checkbox': { 'orientChildren': cb_orientChildren, 'orient2World': cb_orient2World }, 'combo': { 'upAxis': combo_upAxis, 'aimAxis': combo_aimAxis, 'worldUpAxis': combo_worldUpAxis }, 'lineedit': { 'x': le_x, 'y': le_y, 'z': le_z, 'insertJoints': le_insertJoints } }