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-11-03 13:39:36 +0300
committerBastien Montagne <bastien@blender.org>2020-11-03 13:40:29 +0300
commit5610ccdc080497042a24592432ade575e2fab489 (patch)
treee911a765f69b0bd2ec143c7f001733885bec76a4 /source/blender/blenkernel/intern/scene.c
parentda03eb854b81f4b8aa94c85e0b87314e2bcd1c88 (diff)
Add a callback to `IDTypeInfo` to allow preservation of some data accross memfile undos
This is essentially adding that new callback, and using it only for already existing Scene's 3DCursor. Note that the place where this is called has been moved again, after all have been lib-linked, such that those callbacks may also work on ID pointers. Maniphest Tasks: T71759 Differential Revision: https://developer.blender.org/D9237
Diffstat (limited to 'source/blender/blenkernel/intern/scene.c')
-rw-r--r--source/blender/blenkernel/intern/scene.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 6a9fe4615f7..69f4584a359 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -104,6 +104,8 @@
#include "SEQ_sequencer.h"
+#include "BLO_read_write.h"
+
#include "engines/eevee/eevee_lightcache.h"
#include "PIL_time.h"
@@ -620,6 +622,15 @@ static void scene_foreach_cache(ID *id,
user_data);
}
+static void scene_undo_preserve(BlendLibReader *UNUSED(reader), ID *id_new, ID *id_old)
+{
+ Scene *scene_new = (Scene *)id_new;
+ Scene *scene_old = (Scene *)id_old;
+
+ SWAP(View3DCursor, scene_old->cursor, scene_new->cursor);
+ /* TODO: handle tool settings here too. */
+}
+
IDTypeInfo IDType_ID_SCE = {
.id_code = ID_SCE,
.id_filter = FILTER_ID_SCE,
@@ -643,6 +654,8 @@ IDTypeInfo IDType_ID_SCE = {
.blend_read_data = NULL,
.blend_read_lib = NULL,
.blend_read_expand = NULL,
+
+ .blend_read_undo_preserve = scene_undo_preserve,
};
const char *RE_engine_id_BLENDER_EEVEE = "BLENDER_EEVEE";