[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55921] trunk/blender/source/blender/ windowmanager/intern/wm_operators.c: temporary fix for saving custom template files similar to startup . blend file

Gaia Clary gaia.clary at machinimatrix.org
Tue Apr 9 17:18:31 CEST 2013


Revision: 55921
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55921
Author:   gaiaclary
Date:     2013-04-09 15:18:31 +0000 (Tue, 09 Apr 2013)
Log Message:
-----------
temporary fix for saving custom template files similar to startup .blend file

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	2013-04-09 08:56:35 UTC (rev 55920)
+++ trunk/blender/source/blender/windowmanager/intern/wm_operators.c	2013-04-09 15:18:31 UTC (rev 55921)
@@ -2376,6 +2376,7 @@
 }
 
 /* function used for WM_OT_save_mainfile too */
+static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event));
 static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
 {
 	char path[FILE_MAX];
@@ -2386,7 +2387,13 @@
 	if (RNA_struct_property_is_set(op->ptr, "filepath"))
 		RNA_string_get(op->ptr, "filepath", path);
 	else {
-		BLI_strncpy(path, G.main->name, FILE_MAX);
+		/* if file has no name, then treat like startup file */
+		if (G.main->name[0] == 0) {
+			G.save_over = false;
+			return wm_save_mainfile_invoke(C, op, (wmEvent *)NULL);
+		}
+		else
+			BLI_strncpy(path, G.main->name, FILE_MAX);
 		untitled(path);
 	}
 	




More information about the Bf-blender-cvs mailing list