From 5610ccdc080497042a24592432ade575e2fab489 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 3 Nov 2020 11:39:36 +0100 Subject: 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 --- source/blender/blenkernel/BKE_idtype.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source/blender/blenkernel/BKE_idtype.h') diff --git a/source/blender/blenkernel/BKE_idtype.h b/source/blender/blenkernel/BKE_idtype.h index 3caf15d1b50..88b78a1c6cc 100644 --- a/source/blender/blenkernel/BKE_idtype.h +++ b/source/blender/blenkernel/BKE_idtype.h @@ -102,6 +102,10 @@ typedef void (*IDTypeBlendReadDataFunction)(struct BlendDataReader *reader, stru typedef void (*IDTypeBlendReadLibFunction)(struct BlendLibReader *reader, struct ID *id); typedef void (*IDTypeBlendReadExpandFunction)(struct BlendExpander *expander, struct ID *id); +typedef void (*IDTypeBlendReadUndoPreserve)(struct BlendLibReader *reader, + struct ID *id_new, + struct ID *id_old); + typedef struct IDTypeInfo { /* ********** General IDType data. ********** */ @@ -196,6 +200,13 @@ typedef struct IDTypeInfo { * Specify which other id data blocks should be loaded when the current one is loaded. */ IDTypeBlendReadExpandFunction blend_read_expand; + + /** + * Allow an ID type to preserve some of its data accross (memfile) undo steps. + * + * \note Called from #setup_app_data when undoing or redoing a memfile step. + */ + IDTypeBlendReadUndoPreserve blend_read_undo_preserve; } IDTypeInfo; /* ********** Declaration of each IDTypeInfo. ********** */ -- cgit v1.2.3