Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2019-03-24 18:45:16 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2019-03-24 18:51:05 +0300
commit5ae815cbc321dcc1c60224293ded7849940052a7 (patch)
tree8d3cc00893cb7514684d633005c632d663d2cc2c /rigify/rigs/limbs/leg.py
parent51ceed0bfbd22e8270028b593c6832505d4c49e1 (diff)
Rigify: properly set custom property defaults and overridable flags.
Refactor rigs to use the new make_property utility function, and implement new 2.8 specific settings using it. The default value is now important for NLA evaluation, and the override flag will be used by the upcoming static override feature. Default can be backported to 2.79 for 2.8 forward compatibility.
Diffstat (limited to 'rigify/rigs/limbs/leg.py')
-rw-r--r--rigify/rigs/limbs/leg.py66
1 files changed, 11 insertions, 55 deletions
diff --git a/rigify/rigs/limbs/leg.py b/rigify/rigs/limbs/leg.py
index 743e5703..78974be2 100644
--- a/rigify/rigs/limbs/leg.py
+++ b/rigify/rigs/limbs/leg.py
@@ -13,6 +13,7 @@ from ...utils import align_bone_y_axis, align_bone_x_axis, align_bone_z_axis
from ...rig_ui_template import UTILITIES_RIG_LEG, REGISTER_RIG_LEG
from ...utils import ControlLayersOption
from rna_prop_ui import rna_idprop_ui_prop_get
+from ...utils.mechanism import make_property
from ..widgets import create_ikarrow_widget
from math import trunc, pi
@@ -148,14 +149,7 @@ class Rig:
# pb[ mch ][ name ] = 0.0
# prop = rna_idprop_ui_prop_get( pb[ mch ], name, create = True )
- pb[main_parent][name] = 0.0
- prop = rna_idprop_ui_prop_get(pb[main_parent], name, create=True)
-
- prop["min"] = 0.0
- prop["max"] = 1.0
- prop["soft_min"] = 0.0
- prop["soft_max"] = 1.0
- prop["description"] = name
+ make_property(pb[main_parent], name, 0.0)
drv = pb[mch].constraints[0].driver_add("influence").driver
@@ -359,17 +353,11 @@ class Rig:
name = 'rubber_tweak'
if i == trunc( len( tweaks[1:-1] ) / 2 ):
- pb[t][name] = 0.0
+ defval = 0.0
else:
- pb[t][name] = 1.0
-
- prop = rna_idprop_ui_prop_get( pb[t], name, create=True )
+ defval = 1.0
- prop["min"] = 0.0
- prop["max"] = 2.0
- prop["soft_min"] = 0.0
- prop["soft_max"] = 1.0
- prop["description"] = name
+ make_property(pb[t], name, defval, max=2.0, soft_max=1.0)
for j,d in enumerate(def_bones[:-1]):
drvs = {}
@@ -584,13 +572,7 @@ class Rig:
pb_parent = pb[parent]
# Create ik/fk switch property
- pb_parent['IK_FK'] = 0.0
- prop = rna_idprop_ui_prop_get(pb_parent, 'IK_FK', create=True)
- prop["min"] = 0.0
- prop["max"] = 1.0
- prop["soft_min"] = 0.0
- prop["soft_max"] = 1.0
- prop["description"] = 'IK/FK Switch'
+ prop = make_property(pb_parent, 'IK_FK', 0.0, description='IK/FK Switch')
# Constrain org to IK and FK bones
iks = [ik['ctrl']['limb']]
@@ -955,13 +937,7 @@ class Rig:
pb_parent.lock_rotation = True, True, True
pb_parent.lock_scale = True, True, True
- pb_parent['IK_Stretch'] = 1.0
- prop = rna_idprop_ui_prop_get(pb_parent, 'IK_Stretch', create=True)
- prop["min"] = 0.0
- prop["max"] = 1.0
- prop["soft_min"] = 0.0
- prop["soft_max"] = 1.0
- prop["description"] = 'IK Stretch'
+ prop = make_property(pb_parent, 'IK_Stretch', 1.0, description='IK Stretch')
# Add driver to limit scale constraint influence
b = bones['ik']['mch_str']
@@ -1087,11 +1063,7 @@ class Rig:
for prop in props:
if prop == 'pole_vector':
- owner[prop] = False
- pole_prop = rna_idprop_ui_prop_get(owner, prop, create=True)
- pole_prop["min"] = False
- pole_prop["max"] = True
- pole_prop["description"] = prop
+ make_property(owner, prop, False)
mch_ik = pb[bones['ik']['mch_ik']]
# ik target hide driver
@@ -1175,11 +1147,7 @@ class Rig:
elif prop == 'IK_follow':
- owner[prop] = True
- rna_prop = rna_idprop_ui_prop_get(owner, prop, create=True)
- rna_prop["min"] = False
- rna_prop["max"] = True
- rna_prop["description"] = prop
+ make_property(owner, prop, True)
drv = ctrl.constraints[0].driver_add("mute").driver
drv.type = 'AVERAGE'
@@ -1253,13 +1221,7 @@ class Rig:
elif prop == 'root/parent':
if len(ctrl.constraints) > 1:
- owner[prop] = 0.0
- rna_prop = rna_idprop_ui_prop_get(owner, prop, create=True)
- rna_prop["min"] = 0.0
- rna_prop["max"] = 1.0
- rna_prop["soft_min"] = 0.0
- rna_prop["soft_max"] = 1.0
- rna_prop["description"] = prop
+ make_property(owner, prop, 0.0)
drv = ctrl.constraints[1].driver_add("influence").driver
drv.type = 'AVERAGE'
@@ -1273,13 +1235,7 @@ class Rig:
elif prop == 'pole_follow':
if len(ctrl_pole.constraints) > 1:
- owner[prop] = 0.0
- rna_prop = rna_idprop_ui_prop_get(owner, prop, create=True)
- rna_prop["min"] = 0.0
- rna_prop["max"] = 1.0
- rna_prop["soft_min"] = 0.0
- rna_prop["soft_max"] = 1.0
- rna_prop["description"] = prop
+ make_property(owner, prop, 0.0)
drv = ctrl_pole.constraints[1].driver_add("influence").driver
drv.type = 'AVERAGE'