[Bf-blender-cvs] [aa41c17d32b] blender2.8: UI: add option for permanently allowing execution of scripts to dialog.

Brecht Van Lommel noreply at git.blender.org
Fri Nov 2 17:35:20 CET 2018


Commit: aa41c17d32b92a07c4a9478b638ee58d01eabd46
Author: Brecht Van Lommel
Date:   Fri Nov 2 17:24:19 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBaa41c17d32b92a07c4a9478b638ee58d01eabd46

UI: add option for permanently allowing execution of scripts to dialog.

Ref T57197

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

M	source/blender/windowmanager/intern/wm_files.c

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

diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index fc0500e4a56..a1a20397f99 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -2340,6 +2340,12 @@ static void wm_block_autorun_warning_allow(bContext *C, void *arg_block, void *U
 
 	UI_popup_block_close(C, win, arg_block);
 
+	/* Save user preferences for permanent execution. */
+	if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) {
+		WM_operator_name_call(C, "WM_OT_save_userpref", WM_OP_EXEC_DEFAULT, NULL);
+	}
+
+	/* Load file again with scripts enabled. */
 	wmOperatorType *ot = WM_operatortype_find("WM_OT_revert_mainfile", false);
 
 	WM_operator_properties_create_ptr(&props_ptr, ot);
@@ -2370,6 +2376,11 @@ static uiBlock *block_create_autorun_warning(struct bContext *C, struct ARegion
 	uiItemL(col, IFACE_("This may lead to unexpected behavior."), ICON_BLANK1);
 
 	uiItemS(layout);
+
+	PointerRNA userpref_ptr;
+	RNA_pointer_create(NULL, &RNA_UserPreferencesSystem, &U, &userpref_ptr);
+	uiItemR(layout, &userpref_ptr, "use_scripts_auto_execute", 0, IFACE_("Permanently allow execution of scripts"), ICON_NONE);
+
 	uiItemS(layout);
 
 	/* Buttons */



More information about the Bf-blender-cvs mailing list