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:
authorCampbell Barton <ideasman42@gmail.com>2018-11-22 06:57:41 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-11-22 07:06:14 +0300
commitc66570f519fb24e0c3fb724d7b6d38f4b6fd7ffc (patch)
tree78d0c03da4ada3bfb64e39b8f686a419f2c84395 /source/blender/blenkernel/intern/blendfile.c
parent968bf0df148c6fac7567860a64433daa97d042c9 (diff)
Fix T57989: File loaded as startup
The file contents was used to check if the file was a startup file. Now pass in an argument from startup loading code instead.
Diffstat (limited to 'source/blender/blenkernel/intern/blendfile.c')
-rw-r--r--source/blender/blenkernel/intern/blendfile.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c
index c92648da67c..c6cb8a412fe 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -111,11 +111,12 @@ static bool wm_scene_is_visible(wmWindowManager *wm, Scene *scene)
*/
static void setup_app_data(
bContext *C, BlendFileData *bfd,
- const char *filepath, ReportList *reports)
+ const char *filepath,
+ const bool is_startup,
+ ReportList *reports)
{
Main *bmain = G_MAIN;
Scene *curscene = NULL;
- const bool is_startup = (bfd->filename[0] == '\0');
const bool recover = (G.fileflags & G_FILE_RECOVER) != 0;
enum {
LOAD_UI = 1,
@@ -296,7 +297,7 @@ static void setup_app_data(
bmain->recovered = 0;
/* startup.blend or recovered startup */
- if (bfd->filename[0] == 0) {
+ if (is_startup) {
bmain->name[0] = '\0';
}
else if (recover && G.relbase_valid) {
@@ -351,7 +352,8 @@ static int handle_subversion_warning(Main *main, ReportList *reports)
int BKE_blendfile_read(
bContext *C, const char *filepath,
- ReportList *reports, int skip_flags)
+ const struct BlendFileReadParams *params,
+ ReportList *reports)
{
BlendFileData *bfd;
int retval = BKE_BLENDFILE_READ_OK;
@@ -361,7 +363,7 @@ int BKE_blendfile_read(
printf("Read blend: %s\n", filepath);
}
- bfd = BLO_read_from_file(filepath, reports, skip_flags);
+ bfd = BLO_read_from_file(filepath, params->skip_flags, reports);
if (bfd) {
if (bfd->user) {
retval = BKE_BLENDFILE_READ_OK_USERPREFS;
@@ -374,7 +376,7 @@ int BKE_blendfile_read(
retval = BKE_BLENDFILE_READ_FAIL;
}
else {
- setup_app_data(C, bfd, filepath, reports);
+ setup_app_data(C, bfd, filepath, params->is_startup, reports);
}
}
else
@@ -384,16 +386,17 @@ int BKE_blendfile_read(
}
bool BKE_blendfile_read_from_memory(
- bContext *C, const void *filebuf, int filelength,
- ReportList *reports, int skip_flags, bool update_defaults)
+ bContext *C, const void *filebuf, int filelength, bool update_defaults,
+ const struct BlendFileReadParams *params,
+ ReportList *reports)
{
BlendFileData *bfd;
- bfd = BLO_read_from_memory(filebuf, filelength, reports, skip_flags);
+ bfd = BLO_read_from_memory(filebuf, filelength, params->skip_flags, reports);
if (bfd) {
if (update_defaults)
BLO_update_defaults_startup_blend(bfd->main);
- setup_app_data(C, bfd, "<memory2>", reports);
+ setup_app_data(C, bfd, "<memory2>", params->is_startup, reports);
}
else {
BKE_reports_prepend(reports, "Loading failed: ");
@@ -405,12 +408,13 @@ bool BKE_blendfile_read_from_memory(
/* memfile is the undo buffer */
bool BKE_blendfile_read_from_memfile(
bContext *C, struct MemFile *memfile,
- ReportList *reports, int skip_flags)
+ const struct BlendFileReadParams *params,
+ ReportList *reports)
{
Main *bmain = CTX_data_main(C);
BlendFileData *bfd;
- bfd = BLO_read_from_memfile(bmain, BKE_main_blendfile_path(bmain), memfile, reports, skip_flags);
+ bfd = BLO_read_from_memfile(bmain, BKE_main_blendfile_path(bmain), memfile, params->skip_flags, reports);
if (bfd) {
/* remove the unused screens and wm */
while (bfd->main->wm.first)
@@ -418,7 +422,7 @@ bool BKE_blendfile_read_from_memfile(
while (bfd->main->screen.first)
BKE_libblock_free(bfd->main, bfd->main->screen.first);
- setup_app_data(C, bfd, "<memory1>", reports);
+ setup_app_data(C, bfd, "<memory1>", params->is_startup, reports);
}
else {
BKE_reports_prepend(reports, "Loading failed: ");
@@ -459,7 +463,7 @@ UserDef *BKE_blendfile_userdef_read(const char *filepath, ReportList *reports)
BlendFileData *bfd;
UserDef *userdef = NULL;
- bfd = BLO_read_from_file(filepath, reports, BLO_READ_SKIP_ALL & ~BLO_READ_SKIP_USERDEF);
+ bfd = BLO_read_from_file(filepath, BLO_READ_SKIP_ALL & ~BLO_READ_SKIP_USERDEF, reports);
if (bfd) {
if (bfd->user) {
userdef = bfd->user;
@@ -479,7 +483,10 @@ UserDef *BKE_blendfile_userdef_read_from_memory(
BlendFileData *bfd;
UserDef *userdef = NULL;
- bfd = BLO_read_from_memory(filebuf, filelength, reports, BLO_READ_SKIP_ALL & ~BLO_READ_SKIP_USERDEF);
+ bfd = BLO_read_from_memory(
+ filebuf, filelength,
+ BLO_READ_SKIP_ALL & ~BLO_READ_SKIP_USERDEF,
+ reports);
if (bfd) {
if (bfd->user) {
userdef = bfd->user;