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:
-rw-r--r--source/blender/blenloader/intern/readblenentry.c35
-rw-r--r--source/blender/blenloader/intern/writefile.c5
2 files changed, 5 insertions, 35 deletions
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index adf7db0267e..1309b3e3c33 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -428,41 +428,6 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain,
* but oldmain itself shall *never* be 'transferred' to new mainlist! */
BLI_assert(old_mainlist.first == oldmain);
- if (bfd && old_mainlist.first != old_mainlist.last) {
- /* Even though directly used libs have been already moved to new main,
- * indirect ones have not.
- * This is a bit annoying, but we have no choice but to keep them all for now -
- * means some now unused data may remain in memory, but think we'll have to live with it. */
- Main *libmain, *libmain_next;
- Main *newmain = bfd->main;
- ListBase new_mainlist = {newmain, newmain};
-
- for (libmain = oldmain->next; libmain; libmain = libmain_next) {
- libmain_next = libmain->next;
- /* Note that LIB_INDIRECT does not work with libraries themselves, so we use non-NULL
- * parent to detect indirect-linked ones. */
- if (libmain->curlib && (libmain->curlib->parent != NULL)) {
- BLI_remlink(&old_mainlist, libmain);
- BLI_addtail(&new_mainlist, libmain);
- }
- else {
-#ifdef PRINT_DEBUG
- printf("Dropped Main for lib: %s\n", libmain->curlib->id.name);
-#endif
- }
- }
- /* In any case, we need to move all lib data-blocks themselves - those are
- * 'first level data', getting rid of them would imply updating spaces & co
- * to prevent invalid pointers access. */
- BLI_movelisttolist(&newmain->libraries, &oldmain->libraries);
-
- blo_join_main(&new_mainlist);
- }
-
-#if 0
- printf("Remaining mains/libs in oldmain: %d\n", BLI_listbase_count(&fd->old_mainlist) - 1);
-#endif
-
/* That way, libs (aka mains) we did not reuse in new undone/redone state
* will be cleared together with oldmain... */
blo_join_main(&old_mainlist);
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index a54085b3036..5550c4ab6c6 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -3917,6 +3917,11 @@ static void write_libraries(WriteData *wd, Main *main)
if (main->curlib && main->curlib->packedfile) {
found_one = true;
}
+ else if (wd->use_memfile) {
+ /* When writing undo step we always write all existing libraries, makes reading undo step
+ * much easier when dealing with purely indirectly used libraries. */
+ found_one = true;
+ }
else {
found_one = false;
while (!found_one && tot--) {