From 9acba540dbc3114e7d2d236684d6cd8b308e0a37 Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Wed, 7 Apr 2010 09:07:06 +0000 Subject: [PATCH] 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 "". This is a good candidate for consistent file path api, retrieving temp dirs / project- specific temp dirs / etc... --- release/scripts/op/image.py | 6 ++++-- source/blender/blenkernel/intern/blender.c | 10 +++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/release/scripts/op/image.py b/release/scripts/op/image.py index f362f55d37e..e043e7dad61 100644 --- a/release/scripts/op/image.py +++ b/release/scripts/op/image.py @@ -133,8 +133,10 @@ class ProjectEdit(bpy.types.Operator): filename = os.path.splitext(filename)[0] # filename = bpy.utils.clean_name(filename) # fixes 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 diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index d7f8d73e31f..48fe93af418 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -287,10 +287,14 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename) 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 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 in the filename */ filename= bfd->filename; + } else if (!G.relbase_valid) { + /* otherwise, use an empty string as filename, rather than */ + filename=""; + } /* these are the same at times, should never copy to the same location */ if(G.sce != filename)