[Bf-blender-cvs] [6618a19fa90] master: Fix T62946: missing warning when Python driver expression execution is disabled.

Brecht Van Lommel noreply at git.blender.org
Tue Mar 26 04:28:03 CET 2019


Commit: 6618a19fa90eb4c9e50b85f087efcf8a4ec372ad
Author: Brecht Van Lommel
Date:   Tue Mar 26 03:57:39 2019 +0100
Branches: master
https://developer.blender.org/rB6618a19fa90eb4c9e50b85f087efcf8a4ec372ad

Fix T62946: missing warning when Python driver expression execution is disabled.

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

M	source/blender/python/intern/bpy_driver.c

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

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);



More information about the Bf-blender-cvs mailing list