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 <bastien@blender.org>2020-04-21 13:52:18 +0300
committerBastien Montagne <bastien@blender.org>2020-04-21 13:52:18 +0300
commitc73d6162be6437a76da94a36502770b440edc454 (patch)
tree5b9b5f0502c98bcbf611fe9134d01e85688b563c /source/blender/blenloader/intern/readfile.c
parentbe7c51d076be4c826e0b7c1afec59b86b4edc33b (diff)
Fix T75920: Add object - Align to 3D cursor not working.
3DCursor is UI data (hence not expected to be affected by undo) that is stored in actual data (Scene)... So it needs some special care during undo. New undo code now re-reads data into existing memory, which means copying of 3DCursor data has to happen earlier in that case, when we still have both old and newly read data available.
Diffstat (limited to 'source/blender/blenloader/intern/readfile.c')
-rw-r--r--source/blender/blenloader/intern/readfile.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 232cf3d73df..f64a0e48855 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -9581,6 +9581,15 @@ static void read_libblock_undo_restore_at_old_address(FileData *fd, Main *main,
const short idcode = GS(id->name);
+ /* XXX 3DCursor (witch is UI data and as such should not be affected by undo) is stored in
+ * Scene... So this requires some special handling, previously done in `blo_lib_link_restore()`,
+ * but this cannot work anymore when we overwrite existing memory... */
+ if (idcode == ID_SCE) {
+ Scene *scene_old = (Scene *)id_old;
+ Scene *scene = (Scene *)id;
+ SWAP(View3DCursor, scene_old->cursor, scene->cursor);
+ }
+
Main *old_bmain = fd->old_mainlist->first;
ListBase *old_lb = which_libbase(old_bmain, idcode);
ListBase *new_lb = which_libbase(main, idcode);