diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2019-05-22 19:29:35 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2019-05-22 20:37:08 +0300 |
commit | d3e81ceb35f25752632698126128cdee6e07795e (patch) | |
tree | 7b59d58edf4c9faa28555dddd4ff50b699f32ed8 /rigify/rigs/spines/super_spine.py | |
parent | 6b753382d69015a70e158e340b2d49b54790d4b6 (diff) |
Rigify: fix the use_global_undo change and fix driver creation for 2.8.
Using obj.animation_data.drivers[-1] in driver creation is very
bad and error prone. After recent change in Blender, that won't
even work for drivers on Bone, so fix all such uses.
Diffstat (limited to 'rigify/rigs/spines/super_spine.py')
-rw-r--r-- | rigify/rigs/spines/super_spine.py | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/rigify/rigs/spines/super_spine.py b/rigify/rigs/spines/super_spine.py index 85169ca6..5afe15b0 100644 --- a/rigify/rigs/spines/super_spine.py +++ b/rigify/rigs/spines/super_spine.py @@ -6,7 +6,7 @@ from ...utils import create_circle_widget, create_sphere_widget, create_neck_ben from ..widgets import create_ballsocket_widget from ...utils import MetarigError, make_mechanism_name, create_cube_widget from ...utils import ControlLayersOption -from ...utils.mechanism import make_property +from ...utils.mechanism import make_property, make_driver script = """ controls = [%s] @@ -775,22 +775,7 @@ class Rig: # driving the follow rotation switches for neck and head for bone, prop, in zip(owners, props): # Add driver to copy rotation constraint - drv = pb[bone].constraints[0].driver_add("influence").driver - drv.type = 'AVERAGE' - - var = drv.variables.new() - var.name = prop - var.type = "SINGLE_PROP" - var.targets[0].id = self.obj - var.targets[0].data_path = \ - torso.path_from_id() + '[' + '"' + prop + '"' + ']' - - drv_modifier = self.obj.animation_data.drivers[-1].modifiers[0] - - drv_modifier.mode = 'POLYNOMIAL' - drv_modifier.poly_order = 1 - drv_modifier.coefficients[0] = 1.0 - drv_modifier.coefficients[1] = -1.0 + make_driver(pb[bone].constraints[0], "influence", variables=[(self.obj, torso, prop)], polynomial=[1.0, -1.0]) def locks_and_widgets(self, bones): bpy.ops.object.mode_set(mode='OBJECT') |