Skip to content

Commit

Permalink
Merge pull request #367 from joji2468ng/guide_setup
Browse files Browse the repository at this point in the history
Updated the guide node
  • Loading branch information
miquelcampos authored Jan 5, 2024
2 parents cde8966 + 3fb802b commit 8b02991
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
10 changes: 9 additions & 1 deletion release/scripts/mgear/shifter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,9 @@ def initialHierarchy(self):
# --------------------------------------------------
# Model
self.model = primitive.addTransformFromPos(None, self.options["rig_name"])
attribute.lockAttribute(self.model)

lockAttrs = ["tx", "ty", "tz", "rx", "ry", "rz", "sx", "sy", "sz"]
attribute.lockAttribute(self.model, attributes=lockAttrs)

# --------------------------------------------------
# INFOS
Expand Down Expand Up @@ -588,11 +590,17 @@ def finalize(self):

# hide all DG nodes inputs in channel box -----------------------
# only hides if components_finalize or All steps are done

if self.component_finalize:
for c in self.model.listHistory(ac=True, f=True):
if c.type() != "transform":
c.isHistoricallyInteresting.set(False)

# hide a guide if the guide_vis pram is turned off
if self.guide.model.hasAttr("guide_vis"):
if not self.guide.model.guide_vis.get():
self.guide.model.hide()

# Bind skin re-apply
if self.options["importSkin"]:
try:
Expand Down
4 changes: 4 additions & 0 deletions release/scripts/mgear/shifter/component/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2097,6 +2097,10 @@ def jointStructure(self):

self.jointList.append(self.addJoint(**jpo))

for jnt in self.jointList:
radiusValue = self.rig.guide.model.joint_radius.get()
jnt.radius.set(radiusValue)

# =====================================================
# FINALIZE
# =====================================================
Expand Down
14 changes: 13 additions & 1 deletion release/scripts/mgear/shifter/guide.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,10 +715,23 @@ def getComponentGuide(self, comp_type):
def initialHierarchy(self):
"""Create the initial rig guide hierarchy (model, options...)"""
self.model = pm.group(n="guide", em=True, w=True)

if versions.current() >= 20220000:
attribute.addAttribute(
self.model, "guide_x_ray", "bool", False, keyable=True)

attribute.addAttribute(
self.model, "guide_vis", "bool", False, keyable=True)

attribute.addAttribute(
self.model,
"joint_radius",
"double",
value=0.1,
minValue=0,
keyable=True
)

# Options
self.options = self.addPropertyParamenters(self.model)

Expand Down Expand Up @@ -1016,7 +1029,6 @@ def updateProperties(self, root, newName, newSide, newIndex):
return
self.setFromHierarchy(root, False)
name = "_".join(root.name().split("|")[-1].split("_")[:-1])
print(name)
comp_guide = self.components[name]
comp_guide.rename(root, newName, newSide, newIndex)

Expand Down

0 comments on commit 8b02991

Please sign in to comment.