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:
authorTon Roosendaal <ton@blender.org>2011-02-05 18:05:17 +0300
committerTon Roosendaal <ton@blender.org>2011-02-05 18:05:17 +0300
commit626de1f3a222a288e926f6a9351360f9391dff43 (patch)
treeead8a410ad71cf5ea5f77740cdcbd4e8d37c2f49 /source/blender/windowmanager
parent04299657a7eaee212b983b27bed6b66793f7a985 (diff)
Bugfix, own todo
Saving a file for the first time (after opening blender) didn't use the last directory as saved/loaded from in a previous session.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 43c4551d0dc..36e770db91a 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1721,7 +1721,14 @@ static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
save_set_compress(op);
- BLI_strncpy(name, G.main->name, FILE_MAX);
+ /* if not saved before, get the name of the most recently used .blend file */
+ if(G.main->name[0]==0 && G.recent_files.first) {
+ struct RecentFile *recent = G.recent_files.first;
+ BLI_strncpy(name, recent->filepath, FILE_MAX);
+ }
+ else
+ BLI_strncpy(name, G.main->name, FILE_MAX);
+
untitled(name);
RNA_string_set(op->ptr, "filepath", name);
@@ -1806,9 +1813,17 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(
return OPERATOR_CANCELLED;
save_set_compress(op);
-
- BLI_strncpy(name, G.main->name, FILE_MAX);
+
+ /* if not saved before, get the name of the most recently used .blend file */
+ if(G.main->name[0]==0 && G.recent_files.first) {
+ struct RecentFile *recent = G.recent_files.first;
+ BLI_strncpy(name, recent->filepath, FILE_MAX);
+ }
+ else
+ BLI_strncpy(name, G.main->name, FILE_MAX);
+
untitled(name);
+
RNA_string_set(op->ptr, "filepath", name);
if (RNA_struct_find_property(op->ptr, "check_existing"))