[Bf-extensions-cvs] [8564a9d4] master: Rigify: change the first variable name for var0 to var in make_driver.

Alexander Gavrilov noreply at git.blender.org
Thu May 9 12:30:55 CEST 2019


Commit: 8564a9d406d6d1a4eb0d87a309ac9ef01a5f4d0c
Author: Alexander Gavrilov
Date:   Thu May 9 13:30:06 2019 +0300
Branches: master
https://developer.blender.org/rBA8564a9d406d6d1a4eb0d87a309ac9ef01a5f4d0c

Rigify: change the first variable name for var0 to var in make_driver.

Only my own branch and feature sets use this, so should be safe to change.
This naming is more similar to what blender UI does when adding vars.

===================================================================

M	rigify/utils/mechanism.py

===================================================================

diff --git a/rigify/utils/mechanism.py b/rigify/utils/mechanism.py
index e4344ef1..ee1e3dfc 100644
--- a/rigify/utils/mechanism.py
+++ b/rigify/utils/mechanism.py
@@ -179,10 +179,10 @@ def make_driver(owner, prop, *, index=-1, type='SUM', expression=None, variables
 
     Specification format:
         If the variables argument is a dictionary, keys specify variable names.
-        Otherwise names are set to var0, var1... etc:
+        Otherwise names are set to var, var1, var2, ... etc:
 
           variables = [ ..., ..., ... ]
-          variables = { 'var0': ..., 'var1': ..., 'var2': ... }
+          variables = { 'var': ..., 'var1': ..., 'var2': ... }
 
         Variable specifications are constructed as nested dictionaries and lists that
         follow the property structure of the original Blender objects, but the most
@@ -226,7 +226,8 @@ def make_driver(owner, prop, *, index=-1, type='SUM', expression=None, variables
     if isinstance(variables, list):
         # variables = [ info, ... ]
         for i, var_info in enumerate(variables):
-            _add_driver_variable(drv, 'var'+str(i), var_info, target_id)
+            var_name = 'var' if i == 0 else 'var' + str(i)
+            _add_driver_variable(drv, var_name, var_info, target_id)
     else:
         # variables = { 'varname': info, ... }
         for var_name, var_info in variables.items():



More information about the Bf-extensions-cvs mailing list