[Bf-blender-cvs] [e10f8c27a25] master: UI: Confirmation prompt for file path auto-create

Julian Eisel noreply at git.blender.org
Fri Sep 6 11:09:07 CEST 2019


Commit: e10f8c27a256eb8881bb17eb1ba7426573ff208a
Author: Julian Eisel
Date:   Fri Sep 6 11:06:32 2019 +0200
Branches: master
https://developer.blender.org/rBe10f8c27a256eb8881bb17eb1ba7426573ff208a

UI: Confirmation prompt for file path auto-create

This confirmation prompt was there earlier, we removed the prompts for
creating new directories all together, but in this case it's reasonable.
Without it, it's simply too easy to create new directories by accident.

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

M	source/blender/editors/space_file/file_ops.c

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

diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 5168300d21e..cb3b11fb8e6 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -2059,6 +2059,7 @@ void FILE_OT_directory_new(struct wmOperatorType *ot)
   ot->idname = "FILE_OT_directory_new";
 
   /* api callbacks */
+  ot->invoke = WM_operator_confirm_or_exec;
   ot->exec = file_directory_new_exec;
   ot->poll = ED_operator_file_active; /* <- important, handler is on window level */
 
@@ -2067,6 +2068,7 @@ void FILE_OT_directory_new(struct wmOperatorType *ot)
   RNA_def_property_flag(prop, PROP_SKIP_SAVE);
   prop = RNA_def_boolean(ot->srna, "open", false, "Open", "Open new directory");
   RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+  WM_operator_properties_confirm_or_exec(ot);
 }
 
 /* TODO This should go to BLI_path_utils. */
@@ -2198,6 +2200,8 @@ void file_directory_enter_handle(bContext *C, void *UNUSED(arg_unused), void *UN
         WM_operator_properties_create_ptr(&ptr, ot);
         RNA_string_set(&ptr, "directory", sfile->params->dir);
         RNA_boolean_set(&ptr, "open", true);
+        /* Enable confirmation prompt, else it's too easy to accidentaly create new directories. */
+        RNA_boolean_set(&ptr, "confirm", true);
 
         if (lastdir) {
           BLI_strncpy(sfile->params->dir, lastdir, sizeof(sfile->params->dir));



More information about the Bf-blender-cvs mailing list