diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2022-02-11 23:27:26 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2022-02-11 23:40:22 +0300 |
commit | 7120e9c9e08720c20833a334fee197ed9a11dc64 (patch) | |
tree | 1900e8544142f3ac4bcc91059fb94a8fae9eb840 /rigify/rigs/limbs/limb_rigs.py | |
parent | 01c94f43a6ddc174c3f90aa9fa9c247ea79b4b76 (diff) |
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.
Diffstat (limited to 'rigify/rigs/limbs/limb_rigs.py')
-rw-r--r-- | rigify/rigs/limbs/limb_rigs.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/rigify/rigs/limbs/limb_rigs.py b/rigify/rigs/limbs/limb_rigs.py index 2b4723a4..b72e9d40 100644 --- a/rigify/rigs/limbs/limb_rigs.py +++ b/rigify/rigs/limbs/limb_rigs.py @@ -432,6 +432,12 @@ class BaseLimbRig(BaseRig): else: self.set_bone_parent(self.bones.ctrl.ik_base, self.bones.mch.ik_swing) + self.set_ik_local_location(self.bones.ctrl.ik) + self.set_ik_local_location(self.bones.ctrl.ik_pole) + + def set_ik_local_location(self, ctrl): + self.get_bone(ctrl).use_local_location = self.params.ik_local_location + @stage.configure_bones def configure_ik_controls(self): base = self.get_bone(self.bones.ctrl.ik_base) @@ -927,6 +933,12 @@ class BaseLimbRig(BaseRig): description = "Create a rotation pivot control that can be repositioned arbitrarily" ) + 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", + ) + # Setting up extra layers for the FK and tweak ControlLayersOption.FK.add_parameters(params) ControlLayersOption.TWEAK.add_parameters(params) @@ -949,6 +961,7 @@ class BaseLimbRig(BaseRig): r.prop(params, "bbones") layout.prop(params, 'make_custom_pivot', text="Custom IK Pivot") + layout.prop(params, 'ik_local_location') ControlLayersOption.FK.parameters_ui(layout, params) ControlLayersOption.TWEAK.parameters_ui(layout, params) |