Skip to content

Commit

Permalink
Shifter components: expose joint name description in settings. neck a…
Browse files Browse the repository at this point in the history
…nd spine #102
  • Loading branch information
miquelcampos committed Mar 22, 2022
1 parent 8cbdcc7 commit 25f064d
Show file tree
Hide file tree
Showing 4 changed files with 420 additions and 259 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
from pymel.core import datatypes

from mgear.shifter import component
import ast

from mgear.core import node, fcurve, applyop, vector, curve
from mgear.core import attribute, transform, primitive
from mgear.core import attribute, transform, primitive, string

#############################################
# COMPONENT
Expand All @@ -20,6 +21,12 @@ class Component(component.Main):
def addObjects(self):
"""Add all the objects needed to create the component."""

# joint Description Names
jd_names = ast.literal_eval(
self.settings["jointNamesDescription_custom"])
jdn_neck = jd_names[0]
jdn_head = jd_names[1]

self.normal = self.guide.blades["blade"].z * -1
self.up_axis = pm.upAxis(q=True, axis=True)

Expand Down Expand Up @@ -228,9 +235,10 @@ def addObjects(self):
self.fk_npo.append(fk_npo)
parentctl = fk_ctl

# self.jnt_pos.append([fk_ctl, i])
if i != self.divisions - 1:
self.jnt_pos.append([fk_ctl, "neck_" + str(i + 1).zfill(2)])
self.jnt_pos.append(
[fk_ctl, string.replaceSharpWithPadding(jdn_neck, i + 1)]
)

t = transform.getTransformLookingAt(
self.guide.pos["root"],
Expand Down Expand Up @@ -280,11 +288,12 @@ def addObjects(self):
attribute.setRotOrder(self.head_ctl, "ZXY")
attribute.setInvertMirror(self.head_ctl, ["tx", "rz", "ry"])

self.jnt_pos.append([self.head_ctl, "head"])
self.jnt_pos.append([self.head_ctl, jdn_head])

# =====================================================
# ATTRIBUTES
# =====================================================

def addAttributes(self):
"""Create the anim and setupr rig attributes for the component"""
# Anim -------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class Guide(guide.ComponentGuide):
email = EMAIL
version = VERSION

joint_names_description = ["spine_##", "head"]

def postInit(self):
"""Initialize the position for the guide"""
self.save_transform = ["root", "tan0", "tan1", "neck", "head", "eff"]
Expand Down
Loading

0 comments on commit 25f064d

Please sign in to comment.