Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Organizing all the skin joints into sub deformer sets as control sets. #371

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions release/scripts/mgear/animbits/softTweakWindowUI.ui
Expand Up @@ -116,7 +116,7 @@
<widget class="QLineEdit" name="name_lineEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="ctlGrp_label">
<widget class="QLabel" name="customGrp_label">
<property name="text">
<string>Ctl grp</string>
</property>
Expand All @@ -125,7 +125,7 @@
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="ctlGrp_lineEdit"/>
<widget class="QLineEdit" name="customGrp_lineEdit"/>
</item>
<item>
<widget class="QPushButton" name="setCtrlGrp_pushButton">
Expand Down
11 changes: 7 additions & 4 deletions release/scripts/mgear/core/dagmenu.py
Expand Up @@ -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",
Expand Down
7 changes: 6 additions & 1 deletion release/scripts/mgear/shifter/__init__.py
Expand Up @@ -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():
Expand All @@ -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)
Expand Down
20 changes: 15 additions & 5 deletions release/scripts/mgear/shifter/component/__init__.py
Expand Up @@ -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"):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
Expand Up @@ -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", "<html><head/><body><p>Name for a custom controllers Group (Maya set) for the component controllers.</p><p align=\"center\"><span style=\" font-weight:600;\">i.e</span>: Setting the name &quot;arm&quot; will create a sub group (sub set in Mayas terminology) with the name &quot;rig_arm_grp&quot;. This group will be under the &quot;rig_controllers_grp&quot;</p><p>Leave this option empty for the default behaviour.</p></body></html>", 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))
Expand Down