Blender Git Loki

Git Commits -> Revision 07332dd

Revision 07332dd by Bastien Montagne (master)
October 12, 2015, 10:15 (GMT)
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

Commit Details:

Full Hash: 07332dd2bbe62506bef89ffad22ad01766922c8e
Parent Commit: 9cea429
Lines Changed: +111, -46

3 Modified Paths:

/source/blender/blenloader/intern/readblenentry.c (+40, -15) (Diff)
/source/blender/blenloader/intern/readfile.c (+68, -29) (Diff)
/source/blender/blenloader/intern/readfile.h (+3, -2) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021