Skip to content

Commit

Permalink
Shifter: adding option to deactivate neutral rotation on the generate…
Browse files Browse the repository at this point in the history
…d joints. Update data collector to avoid errors with leafJoint option on control_01
  • Loading branch information
miquelcampos committed Jul 4, 2024
1 parent 32f71aa commit 2e0c180
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion release/scripts/mgear/shifter/component/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,15 @@ def _addJoint(
jnt.attr("jointOrientX").set(r[0])
jnt.attr("jointOrientY").set(r[1])
jnt.attr("jointOrientZ").set(r[2])
elif not neutral_rot:
jnt.setAttr("jointOrient", 0, 0, 0)
driven_m = pm.getAttr(jnt + ".parentInverseMatrix[0]")
m = t * driven_m
tm = datatypes.TransformationMatrix(m)
r = datatypes.degrees(tm.getRotation())
jnt.attr("rotateX").set(r[0])
jnt.attr("rotateY").set(r[1])
jnt.attr("rotateZ").set(r[2])

# set not keyable
attribute.setNotKeyableAttributes(jnt)
Expand Down Expand Up @@ -2246,7 +2255,10 @@ def collect_build_data(self):
def store_relative_names(relative_dict):
result = {}
for key, relative in relative_dict.items():
result[key] = relative.name()
if isinstance(relative, pm.nodetypes.Transform):
result[key] = relative.name()
else:
result[key] = None
return result

self.build_data["FullName"] = self.fullName
Expand Down

0 comments on commit 2e0c180

Please sign in to comment.