Skip to content

Commit

Permalink
Spline Tentacle: switch the end twist fix field to radians.
Browse files Browse the repository at this point in the history
Now that custom properties support units, it is much clearer in the
ui than full rotations that have to be explained in a tooltip.
  • Loading branch information
angavrilov committed Sep 20, 2023
1 parent 27f07a6 commit f5acb51
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions rigs/limbs/spline_tentacle.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,15 @@ def configure_master_control(self):

# End twist correction for directly controllable tip
if self.use_tip:
max_val = len(self.bones.org) / 2
max_val = len(self.bones.org) * math.pi

self.make_property(
master, 'end_twist', 0.0, min=-max_val, max=max_val,
description="Rough end twist estimate in full rotations. The rig auto-corrects "
"it to the actual tip orientation within 180 degrees"
subtype='ANGLE', # precision=0, step=1000.0,
description="Rough end twist estimate. The rig auto-corrects it to the actual tip orientation "
"within 180 degrees of the specified value"
)
self.get_bone(master).id_properties_ui("end_twist").update(precision=0, step=1000.0)

self.add_direct_tip_buttons(panel, master, rig_name)

Expand Down Expand Up @@ -313,7 +315,7 @@ def add_end_controls_buttons(self, panel: 'PanelLayout', master: str, _rig_name:

# noinspection PyMethodMayBeStatic
def add_direct_tip_buttons(self, panel: 'PanelLayout', master: str, _rig_name: str):
panel.custom_prop(master, 'end_twist', text="End Twist Fix")
panel.custom_prop(master, 'end_twist', text="End Twist Estimate")

def add_fk_snap_buttons(self, panel: 'PanelLayout', master: str, rig_name: str):
panel.custom_prop(master, 'IK_FK', text="IK - FK", slider=True)
Expand Down Expand Up @@ -759,11 +761,10 @@ def rig_mch_ik_bone(self, i, mch):
num_ik = len(self.bones.org)

# Apply end twist rotation
rot_fac = 1.0 / num_ik
if self.use_tip:
rot_fac = math.pi * 2 / num_ik
rot_var = [(self.bones.ctrl.master, 'end_twist')]
else:
rot_fac = 1.0 / num_ik
rot_var = [(self.bones.ctrl.end_twist, '.rotation_euler.y')]

self.make_driver(
Expand Down

0 comments on commit f5acb51

Please sign in to comment.