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:
authorTon Roosendaal <ton@blender.org>2006-11-25 16:07:28 +0300
committerTon Roosendaal <ton@blender.org>2006-11-25 16:07:28 +0300
commit604b4230325aa012efb063e0a3fd2ac23809e393 (patch)
tree10d0b42f972550484bde3d9d47a72bbbd68a956e /source/blender/blenloader/intern/readblenentry.c
parentb78b3a4761849bd7e2b368884e05c40ef58d12d0 (diff)
- Library linking feature: global undo/redo now doesn't read the linked
library .blend files anymore, making it a load faster to use. - Fixed ancient annoyance; samples were not properly freed, giving a lot "Error Totblock" when using sound. This fix also involves removing an ancient NaN hack, which treated the samples as fake Library data in the Main database. But still, the Blender Sound and Sample code is horrible... :/
Diffstat (limited to 'source/blender/blenloader/intern/readblenentry.c')
-rw-r--r--source/blender/blenloader/intern/readblenentry.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index 17549485025..1e602285fc0 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -54,6 +54,7 @@
#include "BKE_utildefines.h" // for ENDB
#include "BKE_main.h"
+#include "BKE_global.h"
#include "BKE_library.h" // for free_main
#include "BLO_readfile.h"
@@ -98,7 +99,6 @@ static IDType idtypes[]= {
{ ID_ME, "Mesh", IDTYPE_FLAGS_ISLINKABLE},
{ ID_NT, "NodeTree", IDTYPE_FLAGS_ISLINKABLE},
{ ID_OB, "Object", IDTYPE_FLAGS_ISLINKABLE},
- { ID_SAMPLE, "Sample", 0},
{ ID_SCE, "Scene", IDTYPE_FLAGS_ISLINKABLE},
{ ID_SCR, "Screen", 0},
{ ID_SEQ, "Sequence", 0},
@@ -289,16 +289,21 @@ BlendFileData *BLO_read_from_memory(void *mem, int memsize, BlendReadError *erro
return bfd;
}
-
BlendFileData *BLO_read_from_memfile(const char *filename, MemFile *memfile, BlendReadError *error_r)
{
BlendFileData *bfd = NULL;
FileData *fd;
-
+ ListBase mainlist;
+
fd = blo_openblendermemfile(memfile, error_r);
if (fd) {
strcpy(fd->filename, filename);
+ /* separate libraries from G.main */
+ blo_split_main(&mainlist, G.main);
+ /* 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);
@@ -311,6 +316,19 @@ BlendFileData *BLO_read_from_memfile(const char *filename, MemFile *memfile, Ble
/* ensures relinked images are not freed */
blo_end_image_pointer_map(fd);
+ /* move libraries from G.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;
+
+ /* add the Library mainlist to the new main */
+ BLI_remlink(&mainlist, G.main);
+ BLI_addhead(&mainlist, bfd->main);
+ }
+ blo_join_main(&mainlist);
+
blo_freefiledata(fd);
}