diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2019-10-22 17:24:04 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2019-11-02 11:57:47 +0300 |
commit | b9a821bf6045f36c20c6a52f87a2f79e4bfde257 (patch) | |
tree | cc83c20cc3f014b0180f23b4ed8ba66cfe73c542 /rigify | |
parent | af18f8d5695cc392f22124d5aaf7c20639577a12 (diff) |
Rigify: switch the human metarig from simple_tentacle to super_finger.
For better compatibility, support the Tweak layer assignment
in super_finger for the detail controls, and allow changing
the B-Bone resolution.
Diffstat (limited to 'rigify')
-rw-r--r-- | rigify/metarigs/human.py | 24 | ||||
-rw-r--r-- | rigify/rigs/basic/pivot.py | 4 | ||||
-rw-r--r-- | rigify/rigs/chain_rigs.py | 6 | ||||
-rw-r--r-- | rigify/rigs/experimental/super_chain.py | 8 | ||||
-rw-r--r-- | rigify/rigs/limbs/limb_rigs.py | 8 | ||||
-rw-r--r-- | rigify/rigs/limbs/simple_tentacle.py | 2 | ||||
-rw-r--r-- | rigify/rigs/limbs/super_finger.py | 42 | ||||
-rw-r--r-- | rigify/rigs/spines/basic_tail.py | 2 |
8 files changed, 56 insertions, 40 deletions
diff --git a/rigify/metarigs/human.py b/rigify/metarigs/human.py index c849303f..e4279982 100644 --- a/rigify/metarigs/human.py +++ b/rigify/metarigs/human.py @@ -70,10 +70,10 @@ def create(obj): arm.rigify_layers[5].row = 5 arm.rigify_layers[5].selset = False arm.rigify_layers[5].group = 6 - arm.rigify_layers[6].name = "Fingers (Tweak)" + arm.rigify_layers[6].name = "Fingers (Detail)" arm.rigify_layers[6].row = 6 arm.rigify_layers[6].selset = False - arm.rigify_layers[6].group = 4 + arm.rigify_layers[6].group = 5 arm.rigify_layers[7].name = "Arm.L (IK)" arm.rigify_layers[7].row = 7 arm.rigify_layers[7].selset = False @@ -1964,7 +1964,7 @@ def create(obj): pbone.rotation_mode = 'QUATERNION' pbone.bone.layers = [True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] pbone = obj.pose.bones[bones['f_index.01.L']] - pbone.rigify_type = 'limbs.simple_tentacle' + pbone.rigify_type = 'limbs.super_finger' pbone.lock_location = (False, False, False) pbone.lock_rotation = (False, False, False) pbone.lock_rotation_w = False @@ -1980,7 +1980,7 @@ def create(obj): except AttributeError: pass pbone = obj.pose.bones[bones['thumb.01.L']] - pbone.rigify_type = 'limbs.simple_tentacle' + pbone.rigify_type = 'limbs.super_finger' pbone.lock_location = (False, False, False) pbone.lock_rotation = (False, False, False) pbone.lock_rotation_w = False @@ -1996,7 +1996,7 @@ def create(obj): except AttributeError: pass pbone = obj.pose.bones[bones['f_middle.01.L']] - pbone.rigify_type = 'limbs.simple_tentacle' + pbone.rigify_type = 'limbs.super_finger' pbone.lock_location = (False, False, False) pbone.lock_rotation = (False, False, False) pbone.lock_rotation_w = False @@ -2012,7 +2012,7 @@ def create(obj): except AttributeError: pass pbone = obj.pose.bones[bones['f_ring.01.L']] - pbone.rigify_type = 'limbs.simple_tentacle' + pbone.rigify_type = 'limbs.super_finger' pbone.lock_location = (False, False, False) pbone.lock_rotation = (False, False, False) pbone.lock_rotation_w = False @@ -2028,7 +2028,7 @@ def create(obj): except AttributeError: pass pbone = obj.pose.bones[bones['f_pinky.01.L']] - pbone.rigify_type = 'limbs.simple_tentacle' + pbone.rigify_type = 'limbs.super_finger' pbone.lock_location = (False, False, False) pbone.lock_rotation = (False, False, False) pbone.lock_rotation_w = False @@ -2044,7 +2044,7 @@ def create(obj): except AttributeError: pass pbone = obj.pose.bones[bones['f_index.01.R']] - pbone.rigify_type = 'limbs.simple_tentacle' + pbone.rigify_type = 'limbs.super_finger' pbone.lock_location = (False, False, False) pbone.lock_rotation = (False, False, False) pbone.lock_rotation_w = False @@ -2060,7 +2060,7 @@ def create(obj): except AttributeError: pass pbone = obj.pose.bones[bones['thumb.01.R']] - pbone.rigify_type = 'limbs.simple_tentacle' + pbone.rigify_type = 'limbs.super_finger' pbone.lock_location = (False, False, False) pbone.lock_rotation = (False, False, False) pbone.lock_rotation_w = False @@ -2076,7 +2076,7 @@ def create(obj): except AttributeError: pass pbone = obj.pose.bones[bones['f_middle.01.R']] - pbone.rigify_type = 'limbs.simple_tentacle' + pbone.rigify_type = 'limbs.super_finger' pbone.lock_location = (False, False, False) pbone.lock_rotation = (False, False, False) pbone.lock_rotation_w = False @@ -2092,7 +2092,7 @@ def create(obj): except AttributeError: pass pbone = obj.pose.bones[bones['f_ring.01.R']] - pbone.rigify_type = 'limbs.simple_tentacle' + pbone.rigify_type = 'limbs.super_finger' pbone.lock_location = (False, False, False) pbone.lock_rotation = (False, False, False) pbone.lock_rotation_w = False @@ -2108,7 +2108,7 @@ def create(obj): except AttributeError: pass pbone = obj.pose.bones[bones['f_pinky.01.R']] - pbone.rigify_type = 'limbs.simple_tentacle' + pbone.rigify_type = 'limbs.super_finger' pbone.lock_location = (False, False, False) pbone.lock_rotation = (False, False, False) pbone.lock_rotation_w = False diff --git a/rigify/rigs/basic/pivot.py b/rigify/rigs/basic/pivot.py index d4c5898d..c0625c1a 100644 --- a/rigify/rigs/basic/pivot.py +++ b/rigify/rigs/basic/pivot.py @@ -85,13 +85,13 @@ class Rig(BaseRig): params.make_extra_control = bpy.props.BoolProperty( name = "Extra Control", default = False, - description = "Create an extended control" + description = "Create an optional control" ) params.make_extra_deform = bpy.props.BoolProperty( name = "Extra Deform", default = False, - description = "Create an extra deform bone" + description = "Create an optional deform bone" ) diff --git a/rigify/rigs/chain_rigs.py b/rigify/rigs/chain_rigs.py index 3f53cd69..fc070eb1 100644 --- a/rigify/rigs/chain_rigs.py +++ b/rigify/rigs/chain_rigs.py @@ -82,10 +82,10 @@ class SimpleChainRig(BaseRig): @stage.generate_widgets def make_control_widgets(self): - for ctrl in self.bones.ctrl.fk: - self.make_control_widget(ctrl) + for args in zip(count(0), self.bones.ctrl.fk): + self.make_control_widget(*args) - def make_control_widget(self, ctrl): + def make_control_widget(self, i, ctrl): create_bone_widget(self.obj, ctrl) ############################## diff --git a/rigify/rigs/experimental/super_chain.py b/rigify/rigs/experimental/super_chain.py index 9c34478d..c1e1f631 100644 --- a/rigify/rigs/experimental/super_chain.py +++ b/rigify/rigs/experimental/super_chain.py @@ -713,10 +713,10 @@ def add_parameters(params): ) params.bbones = bpy.props.IntProperty( - name='bbone segments', - default=10, - min=1, - description='Number of segments' + name = 'B-Bone Segments', + default = 10, + min = 1, + description = 'Number of B-Bone segments' ) params.wgt_offset = bpy.props.FloatProperty( diff --git a/rigify/rigs/limbs/limb_rigs.py b/rigify/rigs/limbs/limb_rigs.py index dee9a6f4..e09dfb7b 100644 --- a/rigify/rigs/limbs/limb_rigs.py +++ b/rigify/rigs/limbs/limb_rigs.py @@ -809,17 +809,17 @@ class BaseLimbRig(BaseRig): ) params.segments = bpy.props.IntProperty( - name = 'limb segments', + name = 'Limb Segments', default = 2, min = 1, - description = 'Number of segments' + description = 'Number of limb segments' ) params.bbones = bpy.props.IntProperty( - name = 'bbone segments', + name = 'B-Bone Segments', default = 10, min = 1, - description = 'Number of segments' + description = 'Number of B-Bone segments' ) params.make_custom_pivot = bpy.props.BoolProperty( diff --git a/rigify/rigs/limbs/simple_tentacle.py b/rigify/rigs/limbs/simple_tentacle.py index 10bdd2b5..25d26e86 100644 --- a/rigify/rigs/limbs/simple_tentacle.py +++ b/rigify/rigs/limbs/simple_tentacle.py @@ -78,7 +78,7 @@ class Rig(TweakChainRig): ) # Widgets - def make_control_widget(self, ctrl): + def make_control_widget(self, i, ctrl): create_circle_widget(self.obj, ctrl, radius=0.3, head_tail=0.5) diff --git a/rigify/rigs/limbs/super_finger.py b/rigify/rigs/limbs/super_finger.py index 1a9171a7..0b3fcd8a 100644 --- a/rigify/rigs/limbs/super_finger.py +++ b/rigify/rigs/limbs/super_finger.py @@ -24,11 +24,12 @@ import re from itertools import count from ...utils.errors import MetarigError -from ...utils.bones import flip_bone, align_chain_x_axis +from ...utils.bones import put_bone, flip_bone, align_chain_x_axis, set_bone_widget_transform from ...utils.naming import make_derived_name from ...utils.widgets import create_widget from ...utils.widgets_basic import create_circle_widget from ...utils.misc import map_list +from ...utils.layers import ControlLayersOption from ...base_rig import stage @@ -40,7 +41,7 @@ class Rig(SimpleChainRig): def initialize(self): super().initialize() - self.bbone_segments = 8 + self.bbone_segments = self.params.bbones self.first_parent = self.get_bone_parent(self.bones.org[0]) def prepare_bones(self): @@ -116,6 +117,8 @@ class Rig(SimpleChainRig): for args in zip(count(0), self.bones.ctrl.fk, self.bones.org + [None]): self.configure_control_bone(*args) + ControlLayersOption.TWEAK.assign(self.params, self.obj, self.bones.ctrl.fk) + def configure_control_bone(self, i, ctrl, org): if org: self.copy_bone_properties(org, ctrl) @@ -125,11 +128,13 @@ class Rig(SimpleChainRig): bone.lock_rotation = (True, True, True) bone.lock_scale = (True, True, True) - def make_control_widget(self, ctrl): + def make_control_widget(self, i, ctrl): if ctrl == self.bones.ctrl.fk[-1]: # Tip control create_circle_widget(self.obj, ctrl, radius=0.3, head_tail=0.0) else: + set_bone_widget_transform(self.obj, ctrl, self.bones.org[i]) + create_circle_widget(self.obj, ctrl, radius=0.3, head_tail=0.5) ############################## @@ -234,11 +239,12 @@ class Rig(SimpleChainRig): def configure_master_properties(self): master = self.bones.ctrl.master - self.make_property(master, 'finger_curve', 0.0, description="Rubber hose finger cartoon effect") + if self.bbone_segments > 1: + self.make_property(master, 'finger_curve', 0.0, description="Rubber hose finger cartoon effect") - # Create UI - panel = self.script.panel_with_selected_check(self, self.bones.ctrl.flatten()) - panel.custom_prop(master, 'finger_curve', text="Curvature", slider=True) + # Create UI + panel = self.script.panel_with_selected_check(self, self.bones.ctrl.flatten()) + panel.custom_prop(master, 'finger_curve', text="Curvature", slider=True) def rig_deform_bone(self, i, deform, org): master = self.bones.ctrl.master @@ -246,8 +252,9 @@ class Rig(SimpleChainRig): self.make_constraint(deform, 'COPY_TRANSFORMS', org) - self.make_driver(bone.bone, 'bbone_easein', variables=[(master, 'finger_curve')]) - self.make_driver(bone.bone, 'bbone_easeout', variables=[(master, 'finger_curve')]) + if self.bbone_segments > 1: + self.make_driver(bone.bone, 'bbone_easein', variables=[(master, 'finger_curve')]) + self.make_driver(bone.bone, 'bbone_easeout', variables=[(master, 'finger_curve')]) ############### # OPTIONS @@ -261,6 +268,15 @@ class Rig(SimpleChainRig): ('-X', '-X manual', ''), ('-Y', '-Y manual', ''), ('-Z', '-Z manual', '')] params.primary_rotation_axis = bpy.props.EnumProperty(items=items, name="Primary Rotation Axis", default='automatic') + params.bbones = bpy.props.IntProperty( + name = 'B-Bone Segments', + default = 10, + min = 1, + description = 'Number of B-Bone segments' + ) + + ControlLayersOption.TWEAK.add_parameters(params) + @classmethod def parameters_ui(self, layout, params): """ Create the ui for the rig parameters. @@ -269,6 +285,10 @@ class Rig(SimpleChainRig): r.label(text="Bend rotation axis:") r.prop(params, "primary_rotation_axis", text="") + layout.prop(params, 'bbones') + + ControlLayersOption.TWEAK.parameters_ui(layout, params) + def create_sample(obj): # generated by rigify.utils.write_metarig @@ -321,10 +341,6 @@ def create_sample(obj): pbone.lock_scale = (False, False, False) pbone.rotation_mode = 'QUATERNION' try: - pbone.rigify_parameters.separate_extra_layers = True - except AttributeError: - pass - try: pbone.rigify_parameters.extra_layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] except AttributeError: pass diff --git a/rigify/rigs/spines/basic_tail.py b/rigify/rigs/spines/basic_tail.py index 716116bf..be054e7d 100644 --- a/rigify/rigs/spines/basic_tail.py +++ b/rigify/rigs/spines/basic_tail.py @@ -95,7 +95,7 @@ class Rig(BaseHeadTailRig): ) # Widgets - def make_control_widget(self, ctrl): + def make_control_widget(self, i, ctrl): create_circle_widget(self.obj, ctrl, radius=0.5, head_tail=0.75) #################################################### |