diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-19 19:36:15 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-19 19:36:15 +0300 |
commit | 92b1d3f9461e6d122d6523955cc8124559e5f36e (patch) | |
tree | fd93ba4c70fb8b693aae3784ba1068d0f098e178 /source/blender/blenloader/intern/readblenentry.c | |
parent | 62a03ea1b6ef84ac80e40ab092393214c6032b88 (diff) |
2.5: blenloader/ cleaning:
- removed context usage, should not be in this module
- remove G.main usage, now is passed along
- still some globals in use here, goal is to get rid of those too,
so that it's possible to load/save blendfiles without having to
think about some global state.
Diffstat (limited to 'source/blender/blenloader/intern/readblenentry.c')
-rw-r--r-- | source/blender/blenloader/intern/readblenentry.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index d7acfc7eed0..e7e45597887 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -53,7 +53,6 @@ #include "BKE_utildefines.h" // for ENDB #include "BKE_main.h" -#include "BKE_global.h" #include "BKE_library.h" // for free_main #include "BKE_report.h" @@ -360,7 +359,7 @@ BlendFileData *BLO_read_from_memory(void *mem, int memsize, ReportList *reports) return bfd; } -BlendFileData *BLO_read_from_memfile(const char *filename, MemFile *memfile, ReportList *reports) +BlendFileData *BLO_read_from_memfile(Main *oldmain, const char *filename, MemFile *memfile, ReportList *reports) { BlendFileData *bfd = NULL; FileData *fd; @@ -370,16 +369,16 @@ BlendFileData *BLO_read_from_memfile(const char *filename, MemFile *memfile, Rep if (fd) { strcpy(fd->filename, filename); - /* clear ob->proxy_from pointers in G.main */ - blo_clear_proxy_pointers_from_lib(fd); + /* clear ob->proxy_from pointers in old main */ + blo_clear_proxy_pointers_from_lib(fd, oldmain); - /* separate libraries from G.main */ - blo_split_main(&mainlist, G.main); + /* separate libraries from old main */ + blo_split_main(&mainlist, oldmain); /* add the library pointers in oldmap lookup */ blo_add_library_pointer_map(&mainlist, fd); - /* makes lookup of existing images in G.main */ - blo_make_image_pointer_map(fd); + /* makes lookup of existing images in old main */ + blo_make_image_pointer_map(fd, oldmain); bfd= blo_read_file_internal(fd, reports); if (bfd) { @@ -388,17 +387,17 @@ BlendFileData *BLO_read_from_memfile(const char *filename, MemFile *memfile, Rep } /* ensures relinked images are not freed */ - blo_end_image_pointer_map(fd); + blo_end_image_pointer_map(fd, oldmain); - /* move libraries from G.main to new main */ + /* move libraries from old main to new main */ if(bfd && mainlist.first!=mainlist.last) { /* Library structs themselves */ - bfd->main->library= G.main->library; - G.main->library.first= G.main->library.last= NULL; + bfd->main->library= oldmain->library; + oldmain->library.first= oldmain->library.last= NULL; /* add the Library mainlist to the new main */ - BLI_remlink(&mainlist, G.main); + BLI_remlink(&mainlist, oldmain); BLI_addhead(&mainlist, bfd->main); } blo_join_main(&mainlist); |