diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_screen.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/screen.c | 20 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 21 |
3 files changed, 22 insertions, 20 deletions
diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index fd7f20d8839..7de276bb5fc 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -465,6 +465,7 @@ void BKE_screen_view3d_do_versions_250(struct View3D *v3d, ListBase *regions); void BKE_screen_area_blend_read_lib(struct BlendLibReader *reader, struct ID *parent_id, struct ScrArea *area); +bool BKE_screen_blend_read_lib(struct BlendDataReader *reader, struct bScreen *screen); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index 1b8360a1cec..d23dcfbb00a 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -254,6 +254,26 @@ static void screen_blend_write(BlendWriter *writer, ID *id, const void *id_addre } } +/* Cannot use IDTypeInfo callback yet, because of the return value. */ +bool BKE_screen_blend_read_lib(BlendDataReader *reader, bScreen *screen) +{ + bool success = true; + + screen->regionbase.first = screen->regionbase.last = NULL; + screen->context = NULL; + screen->active_region = NULL; + + BLO_read_data_address(reader, &screen->preview); + BKE_previewimg_blend_read(reader, screen->preview); + + if (!BKE_screen_area_map_blend_read_data(reader, AREAMAP_FROM_SCREEN(screen))) { + printf("Error reading Screen %s... removing it.\n", screen->id.name + 2); + success = false; + } + + return success; +} + /* note: file read without screens option G_FILE_NO_UI; * check lib pointers in call below */ static void screen_blend_read_lib(BlendLibReader *reader, ID *id) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 02b419fc5fc..7c3baae5af5 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3042,25 +3042,6 @@ void blo_lib_link_restore(Main *oldmain, BKE_main_idmap_destroy(id_map); } -static bool direct_link_screen(BlendDataReader *reader, bScreen *screen) -{ - bool success = true; - - screen->regionbase.first = screen->regionbase.last = NULL; - screen->context = NULL; - screen->active_region = NULL; - - BLO_read_data_address(reader, &screen->preview); - BKE_previewimg_blend_read(reader, screen->preview); - - if (!BKE_screen_area_map_blend_read_data(reader, AREAMAP_FROM_SCREEN(screen))) { - printf("Error reading Screen %s... removing it.\n", screen->id.name + 2); - success = false; - } - - return success; -} - /** \} */ /* -------------------------------------------------------------------- */ @@ -3305,7 +3286,7 @@ static bool direct_link_id(FileData *fd, Main *main, const int tag, ID *id, ID * switch (GS(id->name)) { case ID_SCR: - success = direct_link_screen(&reader, (bScreen *)id); + success = BKE_screen_blend_read_lib(&reader, (bScreen *)id); break; case ID_LI: direct_link_library(fd, (Library *)id, main); |