[Bf-blender-cvs] [05dc109553f] blender2.8: Merge branch 'master' into blender2.8

Campbell Barton noreply at git.blender.org
Sun Jun 17 20:37:35 CEST 2018


Commit: 05dc109553f447a8ba0d1db7daf2f2c39fcb6d38
Author: Campbell Barton
Date:   Sun Jun 17 20:37:10 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB05dc109553f447a8ba0d1db7daf2f2c39fcb6d38

Merge branch 'master' into blender2.8

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



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

diff --cc source/blender/editors/space_graph/graph_buttons.c
index 263b68a2124,cac379f3786..2a0d5baa5c3
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@@ -787,21 -778,11 +787,21 @@@ static void graph_draw_driver_settings_
  		bool bpy_ctx_expr_error  = (strstr(driver->expression, "bpy.context.") != NULL);
  
  		/* expression */
 -		uiItemR(col, &driver_ptr, "expression", 0, IFACE_("Expr"), ICON_NONE);
 +		/* TODO: "Show syntax hints" button */
 +		col = uiLayoutColumn(layout, true);
 +		block = uiLayoutGetBlock(col);
 +
 +		uiItemL(col, IFACE_("Expression:"), ICON_NONE);
 +		uiItemR(col, &driver_ptr, "expression", 0, "", ICON_NONE);
 +		uiItemR(col, &driver_ptr, "use_self", 0, NULL, ICON_NONE);
  
  		/* errors? */
 +		col = uiLayoutColumn(layout, true);
 +		block = uiLayoutGetBlock(col);
 +
  		if ((G.f & G_SCRIPT_AUTOEXEC) == 0) {
 +			/* TODO: Add button to enable? */
- 			uiItemL(col, IFACE_("ERROR: Python auto-execution disabled"), ICON_CANCEL);
+ 			uiItemL(col, IFACE_("WARNING: Python expressions limited for security"), ICON_ERROR);
  		}
  		else if (driver->flag & DRIVER_FLAG_INVALID) {
  			uiItemL(col, IFACE_("ERROR: Invalid Python expression"), ICON_CANCEL);
diff --cc source/blender/python/intern/bpy_driver.c
index 96bfa9f26d3,bc81eb8ee24..fd405e9f14b
--- a/source/blender/python/intern/bpy_driver.c
+++ b/source/blender/python/intern/bpy_driver.c
@@@ -262,33 -447,36 +453,36 @@@ float BPY_driver_exec(struct PathResolv
  		bpy_pydriver_namespace_clear_self();
  	}
  
 -	if (driver->expr_comp == NULL)
 -		driver->flag |= DRIVER_FLAG_RECOMPILE;
 +	if (driver_orig->expr_comp == NULL)
 +		driver_orig->flag |= DRIVER_FLAG_RECOMPILE;
  
  	/* compile the expression first if it hasn't been compiled or needs to be rebuilt */
 -	if (driver->flag & DRIVER_FLAG_RECOMPILE) {
 -		Py_XDECREF(driver->expr_comp);
 -		driver->expr_comp = PyTuple_New(2);
 +	if (driver_orig->flag & DRIVER_FLAG_RECOMPILE) {
 +		Py_XDECREF(driver_orig->expr_comp);
 +		driver_orig->expr_comp = PyTuple_New(2);
  
  		expr_code = Py_CompileString(expr, "<bpy driver>", Py_eval_input);
 -		PyTuple_SET_ITEM(((PyObject *)driver->expr_comp), 0, expr_code);
 +		PyTuple_SET_ITEM(((PyObject *)driver_orig->expr_comp), 0, expr_code);
  
 -		driver->flag &= ~DRIVER_FLAG_RECOMPILE;
 -		driver->flag |= DRIVER_FLAG_RENAMEVAR; /* maybe this can be removed but for now best keep until were sure */
 +		driver_orig->flag &= ~DRIVER_FLAG_RECOMPILE;
 +		driver_orig->flag |= DRIVER_FLAG_RENAMEVAR; /* maybe this can be removed but for now best keep until were sure */
+ #ifdef USE_BYTECODE_WHITELIST
+ 		is_recompile = true;
+ #endif
  	}
  	else {
 -		expr_code = PyTuple_GET_ITEM(((PyObject *)driver->expr_comp), 0);
 +		expr_code = PyTuple_GET_ITEM(((PyObject *)driver_orig->expr_comp), 0);
  	}
  
 -	if (driver->flag & DRIVER_FLAG_RENAMEVAR) {
 +	if (driver_orig->flag & DRIVER_FLAG_RENAMEVAR) {
  		/* may not be set */
 -		expr_vars = PyTuple_GET_ITEM(((PyObject *)driver->expr_comp), 1);
 +		expr_vars = PyTuple_GET_ITEM(((PyObject *)driver_orig->expr_comp), 1);
  		Py_XDECREF(expr_vars);
  
 -		expr_vars = PyTuple_New(BLI_listbase_count(&driver->variables));
 -		PyTuple_SET_ITEM(((PyObject *)driver->expr_comp), 1, expr_vars);
 +		expr_vars = PyTuple_New(BLI_listbase_count(&driver_orig->variables));
 +		PyTuple_SET_ITEM(((PyObject *)driver_orig->expr_comp), 1, expr_vars);
  
 -		for (dvar = driver->variables.first, i = 0; dvar; dvar = dvar->next) {
 +		for (dvar = driver_orig->variables.first, i = 0; dvar; dvar = dvar->next) {
  			PyTuple_SET_ITEM(expr_vars, i++, PyUnicode_FromString(dvar->name));
  		}



More information about the Bf-blender-cvs mailing list