[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34658] trunk/blender/source/blender/ windowmanager/intern/wm_operators.c: Bugfix, own todo

Ton Roosendaal ton at blender.org
Sat Feb 5 16:05:17 CET 2011


Revision: 34658
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34658
Author:   ton
Date:     2011-02-05 15:05:17 +0000 (Sat, 05 Feb 2011)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/windowmanager/intern/wm_operators.c

Modified: trunk/blender/source/blender/windowmanager/intern/wm_operators.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_operators.c	2011-02-05 14:04:59 UTC (rev 34657)
+++ trunk/blender/source/blender/windowmanager/intern/wm_operators.c	2011-02-05 15:05:17 UTC (rev 34658)
@@ -1721,7 +1721,14 @@
 
 	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 @@
 		return OPERATOR_CANCELLED;
 
 	save_set_compress(op);
+
+	/* 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);
 	
-	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"))




More information about the Bf-blender-cvs mailing list