From 2f00a1040ca6e312f4232a6107773b51fe988782 Mon Sep 17 00:00:00 2001 From: Joji Date: Tue, 26 Dec 2023 12:40:26 -0800 Subject: [PATCH 1/2] Organizing all the skin joints into user-defined sets as control sets. https://github.com/mgear-dev/mgear4/issues/369 --- .../mgear/animbits/softTweakWindowUI.ui | 4 ++-- release/scripts/mgear/shifter/__init__.py | 7 ++++++- .../mgear/shifter/component/__init__.py | 20 ++++++++++++++----- .../shifter/component/main_settings_ui.py | 2 +- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/release/scripts/mgear/animbits/softTweakWindowUI.ui b/release/scripts/mgear/animbits/softTweakWindowUI.ui index 7edaf8d0..d6d921f8 100644 --- a/release/scripts/mgear/animbits/softTweakWindowUI.ui +++ b/release/scripts/mgear/animbits/softTweakWindowUI.ui @@ -116,7 +116,7 @@ - + Ctl grp @@ -125,7 +125,7 @@ - + diff --git a/release/scripts/mgear/shifter/__init__.py b/release/scripts/mgear/shifter/__init__.py index 81fe6380..c7707724 100644 --- a/release/scripts/mgear/shifter/__init__.py +++ b/release/scripts/mgear/shifter/__init__.py @@ -554,6 +554,12 @@ def finalize(self): pm.connectAttr(masterSet.message, self.model.rigGroups[groupIdx]) groupIdx += 1 + # Create deformer set + deformSet = pm.sets(n=self.model.name() + "_deformers_grp", em=True) + pm.connectAttr(deformSet.message, self.model.rigGroups[groupIdx]) + masterSet.add(deformSet) + groupIdx += 1 + # Creating all groups pm.select(cl=True) for name, objects in self.groups.items(): @@ -571,7 +577,6 @@ def finalize(self): pg.add(sub) # create geo group - geoSet = pm.sets(n=self.model.name() + "_geo_grp", em=True) pm.connectAttr(geoSet.message, self.model.rigGroups[groupIdx]) masterSet.add(geoSet) diff --git a/release/scripts/mgear/shifter/component/__init__.py b/release/scripts/mgear/shifter/component/__init__.py index 97b0a113..c0c9b7eb 100644 --- a/release/scripts/mgear/shifter/component/__init__.py +++ b/release/scripts/mgear/shifter/component/__init__.py @@ -587,7 +587,12 @@ def _addJoint( pm.connectAttr(self.rig.jntVis_att, jnt.attr("visibility")) attribute.lockAttribute(jnt) - self.addToGroup(jnt, "deformers") + if self.settings["ctlGrp"]: + jntGrp = "deformers_{}_{}".format(self.settings["ctlGrp"], self.side) + self.addToGroup(jnt, jntGrp, "deformers") + else: + jntGrp = "deformers_{}".format(self.getName()) + self.addToGroup(jnt, jntGrp, "deformers") if guide_relative: if not jnt.hasAttr("guide_relative"): @@ -757,7 +762,12 @@ def addJoint_vanilla( pm.connectAttr(self.rig.jntVis_att, jnt.attr("visibility")) attribute.lockAttribute(jnt) - self.addToGroup(jnt, "deformers") + if self.settings["ctlGrp"]: + jntGrp = "deformers_{}_{}".format(self.settings["ctlGrp"], self.side) + self.addToGroup(jnt, jntGrp, "deformers") + else: + jntGrp = "deformers_{}".format(self.getName()) + self.addToGroup(jnt, jntGrp, "deformers") # This is a workaround due the evaluation problem with compound attr # TODO: This workaround, should be removed onces the evaluation issue @@ -998,11 +1008,11 @@ def addCtl( attribute.add_mirror_config_channels(ctl, mirrorConf) if add_2_grp: if self.settings["ctlGrp"]: - ctlGrp = self.settings["ctlGrp"] + ctlGrp = "{}_{}".format(self.settings["ctlGrp"], self.side) self.addToGroup(ctl, ctlGrp, "controllers") else: - ctlGrp = "controllers" - self.addToGroup(ctl, ctlGrp) + ctlGrp = self.getName() + self.addToGroup(ctl, ctlGrp, "controllers") # lock the control parent attributes if is not a control if parent not in self.groups[ctlGrp] and lp: diff --git a/release/scripts/mgear/shifter/component/main_settings_ui.py b/release/scripts/mgear/shifter/component/main_settings_ui.py index 6c635fe9..a1ab2bc2 100644 --- a/release/scripts/mgear/shifter/component/main_settings_ui.py +++ b/release/scripts/mgear/shifter/component/main_settings_ui.py @@ -298,7 +298,7 @@ def retranslateUi(self, Form): self.componentIndex_label.setText(QtWidgets.QApplication.translate("Form", "Component Index:", None, -1)) self.conector_label.setText(QtWidgets.QApplication.translate("Form", "Connector:", None, -1)) self.connector_comboBox.setItemText(0, QtWidgets.QApplication.translate("Form", "standard", None, -1)) - self.groupBox_2.setTitle(QtWidgets.QApplication.translate("Form", "Custom Controllers Group", None, -1)) + self.groupBox_2.setTitle(QtWidgets.QApplication.translate("Form", "Custom Group", None, -1)) self.subGroup_lineEdit.setToolTip(QtWidgets.QApplication.translate("Form", "

Name for a custom controllers Group (Maya set) for the component controllers.

i.e: Setting the name "arm" will create a sub group (sub set in Mayas terminology) with the name "rig_arm_grp". This group will be under the "rig_controllers_grp"

Leave this option empty for the default behaviour.

", None, -1)) self.jointSettings_groupBox.setTitle(QtWidgets.QApplication.translate("Form", "Joint Settings", None, -1)) self.useJointIndex_checkBox.setText(QtWidgets.QApplication.translate("Form", "Parent Joint Index", None, -1)) From 16b7b4b6d4b9183c960913d126c2b475f6b6521b Mon Sep 17 00:00:00 2001 From: Joji Date: Fri, 29 Dec 2023 13:11:38 -0800 Subject: [PATCH 2/2] Fixed a bug that prevented access to the controllers set. --- release/scripts/mgear/core/dagmenu.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/release/scripts/mgear/core/dagmenu.py b/release/scripts/mgear/core/dagmenu.py index 32236b11..181a8b5f 100644 --- a/release/scripts/mgear/core/dagmenu.py +++ b/release/scripts/mgear/core/dagmenu.py @@ -851,10 +851,13 @@ def mgear_dagmenu_fill(parent_menu, current_control): ) # reset all - selection_set = cmds.ls( - cmds.listConnections(current_control), type="objectSet" - ) - all_rig_controls = cmds.sets(selection_set, query=True) + controls_set = cmds.ls("*_controllers_grp", type="objectSet") + all_rig_controls = set() + if controls_set: + members = cmds.sets(controls_set[0], query=True) + for member in members: + all_rig_controls.update(cmds.sets(member, q=True) or []) + cmds.menuItem( parent=resetOption, label="Reset all",