diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-04-01 01:43:11 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-04-01 01:49:16 +0300 |
commit | de21f07f6c192e8076ae091e8c73587411bda4fd (patch) | |
tree | f1aacbd3256fc548aeaa3f4dd7826a4953b759e2 /source/blender/blenkernel/intern | |
parent | bc318fc47099df92323276f849fe5a6ce9007546 (diff) |
Generic check for string being a Py keyword
Driver code used incomplete list of Py keywords
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 845229e49e3..29da218f973 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1649,15 +1649,12 @@ void driver_variable_name_validate(DriverVar *dvar) * NOTE: These won't confuse Python, but it will be impossible to use the variable * in an expression without Python misinterpreting what these are for */ - if (STREQ(dvar->name, "if") || STREQ(dvar->name, "elif") || STREQ(dvar->name, "else") || - STREQ(dvar->name, "for") || STREQ(dvar->name, "while") || STREQ(dvar->name, "def") || - STREQ(dvar->name, "True") || STREQ(dvar->name, "False") || STREQ(dvar->name, "import") || - STREQ(dvar->name, "pass") || STREQ(dvar->name, "with")) - { +#ifdef WITH_PYTHON + if (BPY_string_is_keyword(dvar->name)) { dvar->flag |= DVAR_FLAG_INVALID_PY_KEYWORD; } - - +#endif + /* If any these conditions match, the name is invalid */ if (dvar->flag & DVAR_ALL_INVALID_FLAGS) dvar->flag |= DVAR_FLAG_INVALID_NAME; |