[Bf-blender-cvs] [5fd46d27f57] master: Fix failing assert on directory auto-creation

Julian Eisel noreply at git.blender.org
Fri Sep 6 11:24:50 CEST 2019


Commit: 5fd46d27f57f0abacf202cc6d147191998133557
Author: Julian Eisel
Date:   Fri Sep 6 11:21:47 2019 +0200
Branches: master
https://developer.blender.org/rB5fd46d27f57f0abacf202cc6d147191998133557

Fix failing assert on directory auto-creation

The failing assert was there before the recent file browser design
overhaul. Might have been in there for quite a while in fact.

Auto-creation in this case means that the file path would be created if
a non-existent path was entered in the file browser path button.

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

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 cb3b11fb8e6..9939351ee45 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -1976,6 +1976,7 @@ int file_directory_new_exec(bContext *C, wmOperator *op)
   wmWindowManager *wm = CTX_wm_manager(C);
   SpaceFile *sfile = CTX_wm_space_file(C);
   ScrArea *sa = CTX_wm_area(C);
+  const bool do_diropen = RNA_boolean_get(op->ptr, "open");
 
   if (!sfile->params) {
     BKE_report(op->reports, RPT_WARNING, "No parent directory given");
@@ -2024,9 +2025,11 @@ int file_directory_new_exec(bContext *C, wmOperator *op)
     return OPERATOR_CANCELLED;
   }
 
-  /* now remember file to jump into editing */
-  BLI_strncpy(sfile->params->renamefile, name, FILE_MAXFILE);
-  sfile->params->rename_flag = FILE_PARAMS_RENAME_PENDING;
+  /* If we don't enter the directory directly, remember file to jump into editing. */
+  if (do_diropen == false) {
+    BLI_strncpy(sfile->params->renamefile, name, FILE_MAXFILE);
+    sfile->params->rename_flag = FILE_PARAMS_RENAME_PENDING;
+  }
 
   /* set timer to smoothly view newly generated file */
   /* max 30 frs/sec */
@@ -2039,7 +2042,7 @@ int file_directory_new_exec(bContext *C, wmOperator *op)
   /* reload dir to make sure we're seeing what's in the directory */
   ED_fileselect_clear(wm, sa, sfile);
 
-  if (RNA_boolean_get(op->ptr, "open")) {
+  if (do_diropen) {
     BLI_strncpy(sfile->params->dir, path, sizeof(sfile->params->dir));
     ED_file_change_dir(C);
   }



More information about the Bf-blender-cvs mailing list