diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-03-26 05:57:39 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-03-26 06:11:34 +0300 |
commit | 6618a19fa90eb4c9e50b85f087efcf8a4ec372ad (patch) | |
tree | d7dc26239249c9e613cae5fbdf71c84ecdb30452 /source | |
parent | da4dc6847b0cbb53ab9cb343f074329b61c7aecf (diff) |
Fix T62946: missing warning when Python driver expression execution is disabled.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/python/intern/bpy_driver.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c index 425a8a29cf9..93d9225ad01 100644 --- a/source/blender/python/intern/bpy_driver.c +++ b/source/blender/python/intern/bpy_driver.c @@ -31,6 +31,7 @@ #include "BLI_listbase.h" #include "BLI_math_base.h" +#include "BLI_string.h" #include "BKE_fcurve.h" #include "BKE_global.h" @@ -332,7 +333,7 @@ static bool bpy_driver_secure_bytecode_validate(PyObject *expr_code, PyObject *d } if (contains_name == false) { - fprintf(stderr, "\tBPY_driver_eval() - restructed access disallows name '%s', " + fprintf(stderr, "\tBPY_driver_eval() - restricted access disallows name '%s', " "enable auto-execution to support\n", _PyUnicode_AsString(name)); return false; } @@ -350,7 +351,7 @@ static bool bpy_driver_secure_bytecode_validate(PyObject *expr_code, PyObject *d for (Py_ssize_t i = 0; i < code_len; i++) { const int opcode = _Py_OPCODE(codestr[i]); if (secure_opcodes[opcode] == 0) { - fprintf(stderr, "\tBPY_driver_eval() - restructed access disallows opcode '%d', " + fprintf(stderr, "\tBPY_driver_eval() - restricted access disallows opcode '%d', " "enable auto-execution to support\n", opcode); return false; } @@ -552,6 +553,11 @@ float BPY_driver_exec(struct PathResolvedRNA *anim_rna, ChannelDriver *driver, C NULL,} )) { + if (!(G.f & G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET)) { + G.f |= G_FLAG_SCRIPT_AUTOEXEC_FAIL; + BLI_snprintf(G.autoexec_fail, sizeof(G.autoexec_fail), "Driver '%s'", expr); + } + Py_DECREF(expr_code); expr_code = NULL; PyTuple_SET_ITEM(((PyObject *)driver_orig->expr_comp), 0, NULL); |