[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28064] trunk/blender: Fix [#21756] Texture paint "quick edit" sending wrong path on unsaved scenes

Matt Ebb matt at mke3.net
Wed Apr 7 11:07:06 CEST 2010


Revision: 28064
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28064
Author:   broken
Date:     2010-04-07 11:07:06 +0200 (Wed, 07 Apr 2010)

Log Message:
-----------
Fix [#21756] Texture paint "quick edit" sending wrong path on unsaved scenes

* Made it use the temp directory in user preferences when the .blend file hasn't been saved yet
* Made bmain->name (wrapped as bpy.data.filename) contain an empty string when 
there's no .B25.blend and no file saved, rather than "<memory2>".

This is a good candidate for consistent file path api, retrieving temp dirs / project-
specific temp dirs / etc...

Modified Paths:
--------------
    trunk/blender/release/scripts/op/image.py
    trunk/blender/source/blender/blenkernel/intern/blender.c

Modified: trunk/blender/release/scripts/op/image.py
===================================================================
--- trunk/blender/release/scripts/op/image.py	2010-04-07 08:27:13 UTC (rev 28063)
+++ trunk/blender/release/scripts/op/image.py	2010-04-07 09:07:06 UTC (rev 28064)
@@ -133,8 +133,10 @@
         filename = os.path.splitext(filename)[0]
         # filename = bpy.utils.clean_name(filename) # fixes <memory> rubbish, needs checking
 
-        if filename.startswith("."): # TODO, have a way to check if the file is saved, assuem .B25.blend
-            filename = os.path.join(os.path.dirname(bpy.data.filename), filename)
+        if filename.startswith(".") or filename == "":
+            # TODO, have a way to check if the file is saved, assume .B25.blend
+            tmpdir = context.user_preferences.filepaths.temporary_directory
+            filename = os.path.join(tmpdir, "project_edit")
         else:
             filename = "//" + filename
 

Modified: trunk/blender/source/blender/blenkernel/intern/blender.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/blender.c	2010-04-07 08:27:13 UTC (rev 28063)
+++ trunk/blender/source/blender/blenkernel/intern/blender.c	2010-04-07 09:07:06 UTC (rev 28064)
@@ -287,10 +287,14 @@
 	if(G.main->versionfile < 250)
 		do_versions_ipos_to_animato(G.main); // XXX fixme... complicated versionpatching
 	
-	/* in case of autosave or quit.blend, use original filename instead
-	 * use relbase_valid to make sure the file is saved, else we get <memory2> in the filename */
-	if(recover && bfd->filename[0] && G.relbase_valid)
+	if(recover && bfd->filename[0] && G.relbase_valid) {
+		/* in case of autosave or quit.blend, use original filename instead
+		 * use relbase_valid to make sure the file is saved, else we get <memory2> in the filename */
 		filename= bfd->filename;
+	} else if (!G.relbase_valid) {
+		/* otherwise, use an empty string as filename, rather than <memory2> */
+		filename="";
+	}
 	
 	/* these are the same at times, should never copy to the same location */
 	if(G.sce != filename)





More information about the Bf-blender-cvs mailing list