forked from bartvdbraak/blender
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...
This commit is contained in:
parent
45ce1c003d
commit
9acba540db
@ -133,8 +133,10 @@ class ProjectEdit(bpy.types.Operator):
|
||||
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
|
||||
|
||||
|
@ -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 <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)
|
||||
|
Loading…
Reference in New Issue
Block a user