Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2016-09-14 12:35:16 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2016-09-14 12:35:16 +0300
commit443b3ca9b9cb665ed1debdc1794852d963ef917b (patch)
tree5bfad95affc670f31b356aa213c2cc3d41d3cae4 /source/blender/blenkernel/intern/blendfile.c
parenta2677100fef06afdbede1985028520be6646efc2 (diff)
Fix two issues related to 'partial' .blend files:
I) Filename was not put in temp Main generated to save selected data only, this was breaking readcode when trying to open partial file, leading to missing filename in final loaded Main data. II) Read code would confuse partial .blend files with Undo ones, when they had no screen in them (which happens to 99.999% of partial .blend files I guess). Reported by @sybren, thanks. Should be safe enough for 2.78 release.
Diffstat (limited to 'source/blender/blenkernel/intern/blendfile.c')
-rw-r--r--source/blender/blenkernel/intern/blendfile.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c
index bedf262541f..94f762f6617 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -121,7 +121,12 @@ static void setup_app_data(
LOAD_UNDO,
} mode;
- if (BLI_listbase_is_empty(&bfd->main->screen)) {
+ /* may happen with library files - UNDO file should never have NULL cursccene... */
+ if (ELEM(NULL, bfd->curscreen, bfd->curscene)) {
+ BKE_report(reports, RPT_WARNING, "Library file, loading empty scene");
+ mode = LOAD_UI_OFF;
+ }
+ else if (BLI_listbase_is_empty(&bfd->main->screen)) {
mode = LOAD_UNDO;
}
else if (G.fileflags & G_FILE_NO_UI) {
@@ -131,14 +136,6 @@ static void setup_app_data(
mode = LOAD_UI;
}
- if (mode != LOAD_UNDO) {
- /* may happen with library files */
- if (ELEM(NULL, bfd->curscreen, bfd->curscene)) {
- BKE_report(reports, RPT_WARNING, "Library file, loading empty scene");
- mode = LOAD_UI_OFF;
- }
- }
-
/* Free all render results, without this stale data gets displayed after loading files */
if (mode != LOAD_UNDO) {
RE_FreeAllRenderResults();
@@ -511,6 +508,10 @@ bool BKE_blendfile_write_partial(
void *path_list_backup = NULL;
const int path_list_flag = (BKE_BPATH_TRAVERSE_SKIP_LIBRARY | BKE_BPATH_TRAVERSE_SKIP_MULTIFILE);
+ /* This is needed to be able to load that file as a real one later
+ * (otherwise main->name will not be set at read time). */
+ BLI_strncpy(bmain_dst->name, filepath, sizeof(bmain_dst->name));
+
if (write_flags & G_FILE_RELATIVE_REMAP) {
path_list_backup = BKE_bpath_list_backup(bmain_src, path_list_flag);
}