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

[leg_2jnt_free_tangents_01] Updated the component #382

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ def addObjects(self):
tp=self.parentCtlTag,
)

if self.settings["mirrorMid"] and self.negate:
self.root_npo.sx.set(-1)

# FK Controlers -----------------------------------
t = transform.getTransformLookingAt(
self.guide.apos[0],
Expand Down Expand Up @@ -152,33 +155,35 @@ def addObjects(self):

# IK Controlers -----------------------------------

self.ik_cns = primitive.addTransformFromPos(
self.root_ctl, self.getName("ik_cns"), self.guide.pos["ankle"]
# Define the wrist transform (wt)
if not self.settings["ikOri"]:
m = transform.getTransformLookingAt(self.guide.pos["ankle"],
self.guide.pos["eff"],
self.normal,
"z-x",
False)
else:
m = transform.getTransformFromPos(self.guide.pos["ankle"])

self.ik_cns = primitive.addTransform(
self.root_ctl, self.getName("ik_cns"), m
)

self.ikcns_ctl = self.addCtl(
self.ik_cns,
"ikcns_ctl",
transform.getTransformFromPos(self.guide.pos["ankle"]),
m,
self.color_ik,
"null",
w=self.size * 0.12,
tp=self.root_ctl,
)
attribute.setInvertMirror(self.ikcns_ctl, ["tx"])

m = transform.getTransformLookingAt(
self.guide.pos["ankle"],
self.guide.pos["eff"],
self.x_axis,
"zx",
False,
)

self.ik_ctl = self.addCtl(
self.ikcns_ctl,
"ik_ctl",
transform.getTransformFromPos(self.guide.pos["ankle"]),
m,
self.color_ik,
"cube",
w=self.size * 0.12,
Expand Down Expand Up @@ -512,9 +517,9 @@ def addObjects(self):
tp=self.mid_ctl,
)

if self.negate:
self.uplegTangentA_npo.rz.set(180)
self.uplegTangentA_npo.sz.set(-1)
if self.settings["mirrorMid"] and self.negate:
self.uplegTangentA_npo.rx.set(180)
self.uplegTangentA_npo.sx.set(-1)
attribute.setKeyableAttributes(self.uplegTangentA_ctl, self.t_params)

t = transform.getInterpolateTransformMatrix(
Expand All @@ -535,9 +540,9 @@ def addObjects(self):
tp=self.mid_ctl,
)

if self.negate:
self.uplegTangentB_npo.rz.set(180)
self.uplegTangentB_npo.sz.set(-1)
if self.settings["mirrorMid"] and self.negate:
self.uplegTangentB_npo.rx.set(180)
self.uplegTangentB_npo.sx.set(-1)
attribute.setKeyableAttributes(self.uplegTangentB_ctl, self.t_params)

tC = self.tws1B_npo.getMatrix(worldSpace=True)
Expand All @@ -558,9 +563,9 @@ def addObjects(self):
tp=self.mid_ctl,
)

if self.negate:
self.lowlegTangentA_npo.rz.set(180)
self.lowlegTangentA_npo.sz.set(-1)
if self.settings["mirrorMid"] and self.negate:
self.lowlegTangentA_npo.rx.set(180)
self.lowlegTangentA_npo.sx.set(-1)
attribute.setKeyableAttributes(self.lowlegTangentA_ctl, self.t_params)

t = transform.getInterpolateTransformMatrix(self.tws1B_npo, tC, 0.5)
Expand All @@ -584,9 +589,8 @@ def addObjects(self):
tp=self.mid_ctl,
)

if self.negate:
self.lowlegTangentB_npo.rz.set(180)
self.lowlegTangentB_npo.sz.set(-1)
if self.settings["mirrorMid"] and self.negate:
self.lowlegTangentB_npo.sx.set(-1)
attribute.setKeyableAttributes(self.lowlegTangentB_ctl, self.t_params)

t = self.mid_ctl.getMatrix(worldSpace=True)
Expand All @@ -605,9 +609,6 @@ def addObjects(self):
tp=self.mid_ctl,
)

if self.negate:
self.kneeTangent_npo.rz.set(180)
self.kneeTangent_npo.sz.set(-1)
attribute.setKeyableAttributes(self.kneeTangent_ctl, self.t_params)

# match IK FK references
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@


# guide info
AUTHOR = "Jeremie Passerin, Miquel Campos"
AUTHOR = "Jeremie Passerin, Miquel Campos, Joji Nishimura"
URL = ", www.mcsgear.com"
EMAIL = ", "
VERSION = [1, 2, 0]
VERSION = [1, 3, 0]
TYPE = "leg_2jnt_freeTangents_01"
NAME = "leg"
DESCRIPTION = (
Expand Down Expand Up @@ -69,6 +69,7 @@ def addParameters(self):
self.pUpvRefArray = self.addParam("pinrefarray", "string", "")
self.pMaxStretch = self.addParam("maxstretch", "double", 1.5, 1, None)
self.pMirrorMid = self.addParam("mirrorMid", "bool", False)
self.pIKOrient = self.addParam("ikOri", "bool", True)

# Divisions
self.pDiv0 = self.addParam("div0", "long", 2, 1, None)
Expand Down Expand Up @@ -161,6 +162,8 @@ def populate_componentControls(self):
)

self.populateCheck(self.settingsTab.mirrorMid_checkBox, "mirrorMid")
self.populateCheck(self.settingsTab.ikOri_checkBox, "ikOri")

self.settingsTab.div0_spinBox.setValue(self.root.attr("div0").get())
self.settingsTab.div1_spinBox.setValue(self.root.attr("div1").get())
ikRefArrayItems = self.root.attr("ikrefarray").get().split(",")
Expand Down Expand Up @@ -211,6 +214,11 @@ def create_componentConnections(self):
self.setProfile
)

self.settingsTab.ikOri_checkBox.stateChanged.connect(
partial(self.updateCheck,
self.settingsTab.ikOri_checkBox,
"ikOri"))

self.settingsTab.mirrorMid_checkBox.stateChanged.connect(
partial(
self.updateCheck,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ def setupUi(self, Form):
self.div1_spinBox.setObjectName("div1_spinBox")
self.horizontalLayout.addWidget(self.div1_spinBox)
self.verticalLayout.addLayout(self.horizontalLayout)
self.ikOri_checkBox = QtWidgets.QCheckBox(self.groupBox)
self.ikOri_checkBox.setObjectName("ikOri_checkBox")
self.verticalLayout.addWidget(self.ikOri_checkBox)
self.mirrorMid_checkBox = QtWidgets.QCheckBox(self.groupBox)
self.mirrorMid_checkBox.setObjectName("mirrorMid_checkBox")
self.verticalLayout.addWidget(self.mirrorMid_checkBox)
Expand Down Expand Up @@ -218,10 +221,13 @@ def retranslateUi(self, Form):
self.ikfk_label.setText(gqt.fakeTranslate("Form", "IK/FK Blend", None, -1))
self.maxStretch_label.setText(gqt.fakeTranslate("Form", "Max Stretch", None, -1))
self.divisions_label.setText(gqt.fakeTranslate("Form", "Divisions", None, -1))
self.ikOri_checkBox.setText(gqt.fakeTranslate("Form", "Align ankle to world orientation", None, -1))
self.ikOri_checkBox.setToolTip(gqt.fakeTranslate("Form", "This option aligns the ankle with either world oriantation or guide. NOTE: This option override Mirror IK ctl behaviour", None, -1))
self.ikOri_checkBox.setStatusTip(gqt.fakeTranslate("Form", "This option aligns the ankle with either world oriantation or guide", None, -1))
self.mirrorMid_checkBox.setToolTip(gqt.fakeTranslate("Form", "This option set the axis of the mid CTL (elbow) and the up vector control to move in a mirror behaviour ", None, -1))
self.mirrorMid_checkBox.setStatusTip(gqt.fakeTranslate("Form", "This option set the axis of the mid CTL (elbow) and the up vector control to move in a mirror behaviour ", None, -1))
self.mirrorMid_checkBox.setWhatsThis(gqt.fakeTranslate("Form", "This option set the axis of the mid CTL (elbow) and the up vector control to move in a mirror behaviour ", None, -1))
self.mirrorMid_checkBox.setText(gqt.fakeTranslate("Form", "Mirror Mid Ctl and UPV axis", None, -1))
self.mirrorMid_checkBox.setText(gqt.fakeTranslate("Form", "Mirror Mid, UPV and Tangent Ctl axis behaviour", None, -1))
self.squashStretchProfile_pushButton.setText(gqt.fakeTranslate("Form", "Squash and Stretch Profile", None, -1))
self.ikRefArray_groupBox.setTitle(gqt.fakeTranslate("Form", "IK Reference Array", None, -1))
self.ikRefArray_copyRef_pushButton.setText(gqt.fakeTranslate("Form", "Copy from UpV Ref", None, -1))
Expand Down
Loading