Skip to content

Commit

Permalink
Rigbits: Eye rigger Right side joints start from center option #249
Browse files Browse the repository at this point in the history
  • Loading branch information
miquelcampos committed Aug 16, 2023
1 parent 0f0cd1d commit 6a6f1e9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
16 changes: 14 additions & 2 deletions release/scripts/mgear/rigbits/facial_rigger2/eye_rigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def rig(
everyNVertex=1,
fixedJoints=False,
fixedJointsNumber=3,
orderFromCenter=False,
):
"""Create eyelid and eye rig
Expand Down Expand Up @@ -73,6 +74,10 @@ def rig(
aim_controller (None, optional): Description
deformers_group (None, optional): Description
everyNVertex (int, optional): Will create a joint every N vertex
fixedJoints (bool, optional): If True use a fixed number of joint
fixedJointsNumber (int, optional): fixed Number og joint
orderFromCenter (bool, optional): if True the order will be from
center, and not from right to left
No Longer Returned:
TYPE: Description
Expand Down Expand Up @@ -198,12 +203,16 @@ def setName(name, ind=None):
upEyelid_edge = meshNavigation.edgeRangeInLoopFromMid(
edgeList, upPos, inPos, outPos
)

up_crv = curve.createCurveFromOrderedEdges(
upEyelid_edge, inPos, setName("upperEyelid"), parent=eyeCrv_root
)
upCtl_crv = curve.createCurveFromOrderedEdges(
upEyelid_edge, inPos, setName("upCtl_crv"), parent=eyeCrv_root
)
if side == "R" and orderFromCenter:
pm.reverseCurve(up_crv, ch=False)
pm.reverseCurve(upCtl_crv, ch=False)
pm.rebuildCurve(upCtl_crv, s=2, rt=0, rpo=True, ch=False)

lowEyelid_edge = meshNavigation.edgeRangeInLoopFromMid(
Expand All @@ -215,6 +224,9 @@ def setName(name, ind=None):
lowCtl_crv = curve.createCurveFromOrderedEdges(
lowEyelid_edge, inPos, setName("lowCtl_crv"), parent=eyeCrv_root
)
if side == "R" and orderFromCenter:
pm.reverseCurve(low_crv, ch=False)
pm.reverseCurve(lowCtl_crv, ch=False)

pm.rebuildCurve(lowCtl_crv, s=2, rt=0, rpo=True, ch=False)

Expand Down Expand Up @@ -459,7 +471,7 @@ def setName(name, ind=None):
# upper eyelid controls
upperCtlNames = ["inCorner", "upInMid", "upMid", "upOutMid", "outCorner"]
cvs = upCtl_crv.getCVs(space="world")
if side == "R" and not sideRange:
if side == "R" and not sideRange and not orderFromCenter:
# if side == "R":
cvs = [cv for cv in reversed(cvs)]
# offset = offset * -1
Expand Down Expand Up @@ -590,7 +602,7 @@ def setName(name, ind=None):
]

cvs = lowCtl_crv.getCVs(space="world")
if side == "R" and not sideRange:
if side == "R" and not sideRange and not orderFromCenter:
cvs = [cv for cv in reversed(cvs)]
for i, cv in enumerate(cvs):
# we skip the first and last point since is already in the uper eyelid
Expand Down
6 changes: 6 additions & 0 deletions release/scripts/mgear/rigbits/facial_rigger2/eye_riggerUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ def create_controls(self):
self.fixedJointsNumber.setSingleStep(1)
self.fixedJointsNumber.setValue(3)

self.orderFromCenter = QtWidgets.QCheckBox(
"Right side Joints order starts from center"
)
self.orderFromCenter.setChecked(False)

# Topological Autoskin
self.topoSkin_group = QtWidgets.QGroupBox("Skin")
self.rigidLoops_label = QtWidgets.QLabel("Rigid Loops:")
Expand Down Expand Up @@ -232,6 +237,7 @@ def create_layout(self):
joints_layout.addLayout(headJnt_layout)
joints_layout.addLayout(everyNVertex_layout)
joints_layout.addLayout(fixedJoints_layout)
joints_layout.addWidget(self.orderFromCenter)
self.joints_group.setLayout(joints_layout)

# topological autoskin Layout
Expand Down

0 comments on commit 6a6f1e9

Please sign in to comment.