[Bf-blender-cvs] [c73d6162be6] blender-v2.83-release: Fix T75920: Add object - Align to 3D cursor not working.

Bastien Montagne noreply at git.blender.org
Tue Apr 21 12:55:21 CEST 2020


Commit: c73d6162be6437a76da94a36502770b440edc454
Author: Bastien Montagne
Date:   Tue Apr 21 12:52:18 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rBc73d6162be6437a76da94a36502770b440edc454

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.

===================================================================

M	source/blender/blenloader/intern/readfile.c

===================================================================

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);



More information about the Bf-blender-cvs mailing list