From 7120e9c9e08720c20833a334fee197ed9a11dc64 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Fri, 11 Feb 2022 23:27:26 +0300 Subject: Rigify: allow aligning IK control location channels to world space. For IK controls that move freely in space without being tied to a parent it makes sense to align the location channels to world (or root), while keeping rotation channels aligned to the limb end orientation. Blender already has a Local Location parenting option for this very use case, but Rigify wasn't using it. This adjusts the switchable parent mechanism so that the option works as intended, and provides a Rigify option that controls its value for IK controls. Note that now it is possible to enable the Local Location option directly on the control bones after generation and it will work correctly - it is not required to enable IK Local Location. --- rigify/rigs/limbs/super_finger.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'rigify/rigs/limbs/super_finger.py') diff --git a/rigify/rigs/limbs/super_finger.py b/rigify/rigs/limbs/super_finger.py index 9eed5415..2229c0c0 100644 --- a/rigify/rigs/limbs/super_finger.py +++ b/rigify/rigs/limbs/super_finger.py @@ -152,6 +152,12 @@ class Rig(SimpleChainRig): no_fix_rotation=True, no_fix_scale=True, ) + @stage.parent_bones + def parent_ik_control(self): + if self.make_ik: + bone = self.get_bone(self.bones.ctrl.ik) + bone.use_local_location = self.params.ik_local_location + @stage.configure_bones def configure_ik_control(self): if self.make_ik: @@ -366,6 +372,12 @@ class Rig(SimpleChainRig): description = "Create an optional IK control" ) + params.ik_local_location = bpy.props.BoolProperty( + name = 'IK Local Location', + default = True, + description = "Specifies the value of the Local Location option for IK controls, which decides if the location channels are aligned to the local control orientation or world", + ) + ControlLayersOption.TWEAK.add_parameters(params) ControlLayersOption.EXTRA_IK.add_parameters(params) @@ -380,6 +392,9 @@ class Rig(SimpleChainRig): layout.prop(params, 'bbones') layout.prop(params, 'make_extra_ik_control', text='IK Control') + if params.make_extra_ik_control: + layout.prop(params, 'ik_local_location') + ControlLayersOption.TWEAK.parameters_ui(layout, params) if params.make_extra_ik_control: -- cgit v1.2.3