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>2020-10-02 18:02:31 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-10-03 00:25:36 +0300
commit8cd8b3e9bda443ec8f560117d93a4f06fe91cb11 (patch)
tree85da60d080519404fc18fc63d17ca733d75ae4a3 /source/blender/blenkernel/intern
parentb13459f9e585bcb0e4ba61e391e59a888f5042f2 (diff)
readfile: always run setup_app_data after updating defaults
When blend files were loaded with app-templates, setup_app_data was running before defaults were updated. This is likely to cause problems with order of initialization so always update the startup file beforehand.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/blendfile.c52
1 files changed, 39 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c
index 4ea8ae555e3..fc1911d0394 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -428,10 +428,13 @@ static bool handle_subversion_warning(Main *main, ReportList *reports)
return true;
}
-int BKE_blendfile_read(bContext *C,
- const char *filepath,
- const struct BlendFileReadParams *params,
- ReportList *reports)
+bool BKE_blendfile_read_ex(bContext *C,
+ const char *filepath,
+ const struct BlendFileReadParams *params,
+ ReportList *reports,
+ /* Extra args. */
+ const bool startup_update_defaults,
+ const char *startup_app_template)
{
BlendFileData *bfd;
bool success = false;
@@ -449,6 +452,11 @@ int BKE_blendfile_read(bContext *C,
bfd = NULL;
}
else {
+ if (startup_update_defaults) {
+ if ((params->skip_flags & BLO_READ_SKIP_DATA) == 0) {
+ BLO_update_defaults_startup_blend(bfd->main, startup_app_template);
+ }
+ }
setup_app_blend_file_data(C, bfd, filepath, params, reports);
BLO_blendfiledata_free(bfd);
success = true;
@@ -461,23 +469,32 @@ int BKE_blendfile_read(bContext *C,
return success;
}
-bool BKE_blendfile_read_from_memory(bContext *C,
- const void *filebuf,
- int filelength,
- bool update_defaults,
- const struct BlendFileReadParams *params,
- ReportList *reports)
+bool BKE_blendfile_read(bContext *C,
+ const char *filepath,
+ const struct BlendFileReadParams *params,
+ ReportList *reports)
+{
+ return BKE_blendfile_read_ex(C, filepath, params, reports, false, NULL);
+}
+
+bool BKE_blendfile_read_from_memory_ex(bContext *C,
+ const void *filebuf,
+ int filelength,
+ const struct BlendFileReadParams *params,
+ ReportList *reports,
+ /* Extra args. */
+ const bool startup_update_defaults,
+ const char *startup_app_template)
{
BlendFileData *bfd;
bfd = BLO_read_from_memory(filebuf, filelength, params->skip_flags, reports);
if (bfd) {
- if (update_defaults) {
+ if (startup_update_defaults) {
if ((params->skip_flags & BLO_READ_SKIP_DATA) == 0) {
- BLO_update_defaults_startup_blend(bfd->main, NULL);
+ BLO_update_defaults_startup_blend(bfd->main, startup_app_template);
}
}
-
setup_app_blend_file_data(C, bfd, "<memory2>", params, reports);
BLO_blendfiledata_free(bfd);
}
@@ -488,6 +505,15 @@ bool BKE_blendfile_read_from_memory(bContext *C,
return (bfd != NULL);
}
+bool BKE_blendfile_read_from_memory(bContext *C,
+ const void *filebuf,
+ int filelength,
+ const struct BlendFileReadParams *params,
+ ReportList *reports)
+{
+ return BKE_blendfile_read_from_memory_ex(C, filebuf, filelength, params, reports, false, NULL);
+}
+
/* memfile is the undo buffer */
bool BKE_blendfile_read_from_memfile(bContext *C,
struct MemFile *memfile,