Skip to content

Commit

Permalink
Epic Mannequin Template several problems and bugs Closes #242
Browse files Browse the repository at this point in the history
  • Loading branch information
miquelcampos committed Sep 1, 2023
1 parent 887ef3d commit 1e7e342
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,24 @@ def addObjects(self):
for x in self.fk_ctl[:-1]:
attribute.setInvertMirror(x, ["tx", "rz", "ry"])

# chest control
t = transform.getTransform(self.scl_transforms[-1])
t = transform.setMatrixPosition(t, self.guide.apos[-1])
self.chest_npo = primitive.addTransform(
self.scl_transforms[-1], self.getName("chest_npo"), t
)
self.chest_ctl = self.addCtl(
self.chest_npo,
"chest",
t,
self.color_fk,
"cube",
w=self.size,
h=self.size * 0.05,
d=self.size,
tp=self.preiviousCtlTag,
)

# Connections (Hooks) ------------------------------
self.cnx0 = primitive.addTransform(self.root, self.getName("0_cnx"))
self.cnx1 = primitive.addTransform(self.root, self.getName("1_cnx"))
Expand Down Expand Up @@ -509,6 +527,10 @@ def addAttributes(self):
"frontBend", "Front Bend", "double", 0.5, 0, 2
)

self.chestCtlVis_att = self.addAnimParam(
"chest_vis", "Chest Ctl Vis", "bool", False
)

# Setup ------------------------------------------
# Eval Fcurve
if self.guide.paramDefs["st_profile"].value:
Expand Down Expand Up @@ -558,6 +580,10 @@ def addOperators(self):
"""

# chest ctl vis
for shp in self.chest_ctl.getShapes():
pm.connectAttr(self.chestCtlVis_att, shp.attr("visibility"))

# Auto bend ----------------------------
if self.settings["autoBend"]:
mul_node = node.createMulNode(
Expand Down Expand Up @@ -797,8 +823,8 @@ def addOperators(self):
transform.getTransform(self.cnx1), self.guide.apos[-1]
)
self.cnx1.setMatrix(t, worldSpace=True)
pm.parentConstraint(self.scl_transforms[-1], self.cnx1, mo=True)
pm.scaleConstraint(self.scl_transforms[-1], self.cnx1)
pm.parentConstraint(self.chest_ctl, self.cnx1, mo=True)
pm.scaleConstraint(self.chest_ctl, self.cnx1)

# =====================================================
# CONNECTOR
Expand All @@ -811,7 +837,7 @@ def setRelation(self):
self.relatives["tan0"] = self.fk_ctl[1]
self.controlRelatives["root"] = self.fk_ctl[0]
self.controlRelatives["spineTop"] = self.fk_ctl[-2]
self.controlRelatives["chest"] = self.fk_ctl[-2]
self.controlRelatives["chest"] = self.chest_ctl

self.jointRelatives["root"] = 0
self.jointRelatives["tan0"] = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,24 @@ def addObjects(self):
transform.getTransform(self.auxTwistChain[0]),
)

# chest control
t = transform.getTransform(self.scl_transforms[-1])
t = transform.setMatrixPosition(t, self.guide.apos[-1])
self.chest_npo = primitive.addTransform(
self.scl_transforms[-1], self.getName("chest_npo"), t
)
self.chest_ctl = self.addCtl(
self.chest_npo,
"chest",
t,
self.color_fk,
"cube",
w=self.size,
h=self.size * 0.05,
d=self.size,
tp=self.preiviousCtlTag,
)

# Connections (Hooks) ------------------------------
self.cnx0 = primitive.addTransform(self.root, self.getName("0_cnx"))
self.cnx1 = primitive.addTransform(self.root, self.getName("1_cnx"))
Expand Down Expand Up @@ -549,6 +567,10 @@ def addAttributes(self):
"frontBend", "Front Bend", "double", 0.5, 0, 2
)

self.chestCtlVis_att = self.addAnimParam(
"chest_vis", "Chest Ctl Vis", "bool", False
)

# Setup ------------------------------------------
# Eval Fcurve
if self.guide.paramDefs["st_profile"].value:
Expand Down Expand Up @@ -597,6 +619,9 @@ def addOperators(self):
we shouldn't create any new object in this method.
"""
# chest ctl vis
for shp in self.chest_ctl.getShapes():
pm.connectAttr(self.chestCtlVis_att, shp.attr("visibility"))

# Auto bend ----------------------------
if self.settings["autoBend"]:
Expand Down Expand Up @@ -904,8 +929,8 @@ def addOperators(self):
transform.getTransform(self.cnx1), self.guide.apos[-1]
)
self.cnx1.setMatrix(t, worldSpace=True)
pm.parentConstraint(self.scl_transforms[-1], self.cnx1, mo=True)
pm.scaleConstraint(self.scl_transforms[-1], self.cnx1)
pm.parentConstraint(self.chest_ctl, self.cnx1, mo=True)
pm.scaleConstraint(self.chest_ctl, self.cnx1)

# =====================================================
# CONNECTOR
Expand All @@ -918,7 +943,7 @@ def setRelation(self):
self.relatives["tan0"] = self.fk_ctl[1]
self.controlRelatives["root"] = self.fk_ctl[0]
self.controlRelatives["spineTop"] = self.fk_ctl[-2]
self.controlRelatives["chest"] = self.fk_ctl[-2]
self.controlRelatives["chest"] = self.chest_ctl

self.jointRelatives["root"] = 0
self.jointRelatives["tan0"] = 1
Expand Down

0 comments on commit 1e7e342

Please sign in to comment.