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:
authorBastien Montagne <montagne29@wanadoo.fr>2015-10-12 13:15:05 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-10-12 13:15:05 +0300
commit07332dd2bbe62506bef89ffad22ad01766922c8e (patch)
tree274cffe797a273d9ab24834aeefcb8757d1ec7bc /source/blender/blenloader/intern/readfile.h
parent9cea429f787727d8a19b9dfe179a5b7ba2d92fd0 (diff)
Fix T34446: Make Local on linked mesh object: object gets removed if redo function is used.
Root of the issue is that we do not re-read lib data blocks and ID placholders (ID_ID bheads) in undo context (in `blo_read_file_internal`), because `BLO_read_from_memfile` copies lib datablocks and Main data directly from oldmain. The idea being, linked data do not change from undo/redo. This is valid as long as linked data was not changed by the undo step - but if some was deleted or localized, it will be missing from oldmain, leading to data loss (note that does not only concern objects, all linkable data types can be affected, at least in theory). This commit addresses that issue by carefully mixing reuse of needed data from oldmain, and "normal" re-reading of missing one. Makes us swimming in some rather dark waters, and gives a rather non-easy-to-follow code, but it seems to work quite well, and only other solution would be to get rid of that optimization (not re-reading all libs on undo/redo), which is not acceptable. Also, thanks to @carlosdp for initial investigation of the issue. Differential Revision: https://developer.blender.org/D1485
Diffstat (limited to 'source/blender/blenloader/intern/readfile.h')
-rw-r--r--source/blender/blenloader/intern/readfile.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h
index ed22daef9ec..f6c3b69c414 100644
--- a/source/blender/blenloader/intern/readfile.h
+++ b/source/blender/blenloader/intern/readfile.h
@@ -96,7 +96,8 @@ typedef struct FileData {
struct GHash *bhead_idname_hash;
ListBase *mainlist;
-
+ ListBase *old_mainlist; /* Used for undo. */
+
/* ick ick, used to return
* data through streamglue.
*/
@@ -139,7 +140,7 @@ void blo_make_sound_pointer_map(FileData *fd, Main *oldmain);
void blo_end_sound_pointer_map(FileData *fd, Main *oldmain);
void blo_make_packed_pointer_map(FileData *fd, Main *oldmain);
void blo_end_packed_pointer_map(FileData *fd, Main *oldmain);
-void blo_add_library_pointer_map(ListBase *mainlist, FileData *fd);
+void blo_add_library_pointer_map(ListBase *old_mainlist, FileData *fd);
void blo_freefiledata(FileData *fd);