diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2019-09-29 12:10:01 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2019-09-29 17:48:59 +0300 |
commit | 704ace1b48181180b70a5b4ed0039420c4acb4db (patch) | |
tree | 134f9f39da2b1df29ab4f691ef8fb16df7ef9157 /rigify/utils | |
parent | 6bb8ab3ad7b8131ffa9ed3261b6da8627903f3b1 (diff) |
Rigify: implement priorities to add toes to the FK bone group.
Toes behave as FK, but are needed both in IK and FK mode.
Diffstat (limited to 'rigify/utils')
-rw-r--r-- | rigify/utils/layers.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/rigify/utils/layers.py b/rigify/utils/layers.py index b624e9ac..7a1bcef8 100644 --- a/rigify/utils/layers.py +++ b/rigify/utils/layers.py @@ -52,6 +52,13 @@ def get_layers(layers): return [x in layers for x in range(0, 32)] +def set_bone_layers(bone, layers, combine=False): + if combine: + bone.layers = [ a or b for a, b in zip(bone.layers, layers) ] + else: + bone.layers = layers + + #============================================= # UI utilities #============================================= @@ -72,7 +79,7 @@ class ControlLayersOption: else: return None - def assign(self, params, bone_set, bone_list): + def assign(self, params, bone_set, bone_list, combine=False): layers = self.get(params) if isinstance(bone_set, bpy.types.Object): @@ -84,7 +91,18 @@ class ControlLayersOption: if isinstance(bone, bpy.types.PoseBone): bone = bone.bone - bone.layers = layers + set_bone_layers(bone, layers, combine) + + def assign_rig(self, rig, bone_list, combine=False, priority=None): + layers = self.get(rig.params) + bone_set = rig.obj.data.bones + + if layers: + for name in bone_list: + set_bone_layers(bone_set[name], layers, combine) + + if priority is not None: + rig.generator.set_layer_group_priority(name, layers, priority) def add_parameters(self, params): prop_toggle = bpy.props.BoolProperty( |