diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2014-08-18 14:43:08 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2014-08-18 16:13:55 +0400 |
commit | 71ce415f4a48cf8915ba921594c96c09b54191a3 (patch) | |
tree | 69b3fc71f6d1546317bb366de88336805e7badd4 /source/blender | |
parent | dc05d817eb2d37b3d65ced0fcefa96f23548d2f3 (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).
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 16 |
1 files changed, 13 insertions, 3 deletions
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; } |