Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2014-08-18 14:43:08 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2014-08-18 16:13:55 +0400
commit71ce415f4a48cf8915ba921594c96c09b54191a3 (patch)
tree69b3fc71f6d1546317bb366de88336805e7badd4
parentdc05d817eb2d37b3d65ced0fcefa96f23548d2f3 (diff)
Fix T41462: "Reload from trusted" button not prompting for confirmation.
Made 'revert_mainfile' op also handle the 'use scripts' option, and use it for this feature (since it has a nice simple invoke confirmation popup).
-rw-r--r--release/scripts/startup/bl_ui/space_info.py4
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c16
2 files changed, 14 insertions, 6 deletions
diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py
index ddb83310fe8..cecddb86f2b 100644
--- a/release/scripts/startup/bl_ui/space_info.py
+++ b/release/scripts/startup/bl_ui/space_info.py
@@ -57,11 +57,9 @@ class INFO_HT_header(Header):
row = layout.row(align=True)
if bpy.app.autoexec_fail is True and bpy.app.autoexec_fail_quiet is False:
- layout.operator_context = 'EXEC_DEFAULT'
row.label("Auto-run disabled: %s" % bpy.app.autoexec_fail_message, icon='ERROR')
if bpy.data.is_saved:
- props = row.operator("wm.open_mainfile", icon='SCREEN_BACK', text="Reload Trusted")
- props.filepath = bpy.data.filepath
+ props = row.operator("wm.revert_mainfile", icon='SCREEN_BACK', text="Reload Trusted")
props.use_scripts = True
row.operator("script.autoexec_warn_clear", text="Ignore")
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index fea40564454..2730442096f 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -2376,8 +2376,8 @@ static void WM_OT_open_mainfile(wmOperatorType *ot)
WM_operator_properties_filesel(ot, FOLDERFILE | BLENDERFILE, FILE_BLENDER, FILE_OPENFILE,
WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
- RNA_def_boolean(ot->srna, "load_ui", 1, "Load UI", "Load user interface setup in the .blend file");
- RNA_def_boolean(ot->srna, "use_scripts", 1, "Trusted Source",
+ RNA_def_boolean(ot->srna, "load_ui", true, "Load UI", "Load user interface setup in the .blend file");
+ RNA_def_boolean(ot->srna, "use_scripts", true, "Trusted Source",
"Allow .blend file to execute scripts automatically, default available from system preferences");
}
@@ -2388,7 +2388,14 @@ static int wm_revert_mainfile_exec(bContext *C, wmOperator *op)
{
bool success;
- success = wm_file_read_opwrap(C, G.main->name, op->reports, true);
+ wm_open_init_use_scripts(op, false);
+
+ if (RNA_boolean_get(op->ptr, "use_scripts"))
+ G.f |= G_SCRIPT_AUTOEXEC;
+ else
+ G.f &= ~G_SCRIPT_AUTOEXEC;
+
+ success = wm_file_read_opwrap(C, G.main->name, op->reports, !(G.f & G_SCRIPT_AUTOEXEC));
if (success) {
return OPERATOR_FINISHED;
@@ -2410,6 +2417,9 @@ static void WM_OT_revert_mainfile(wmOperatorType *ot)
ot->description = "Reload the saved file";
ot->invoke = WM_operator_confirm;
+ RNA_def_boolean(ot->srna, "use_scripts", true, "Trusted Source",
+ "Allow .blend file to execute scripts automatically, default available from system preferences");
+
ot->exec = wm_revert_mainfile_exec;
ot->poll = wm_revert_mainfile_poll;
}