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 <b.mont29@gmail.com>2020-03-05 12:54:00 +0300
committerBastien Montagne <b.mont29@gmail.com>2020-03-05 12:58:58 +0300
commitc328049535a4bc9453f5e93365a00759347e3a05 (patch)
treea6a058f3887e81e653c93400ecd163755796bddc /source/blender/blenkernel/intern/lib_id_delete.c
parent6665ce8951b2110e5dbd7126aae3c120bb6205e5 (diff)
Initial step for IDTypeInfo refactor 'cleanup' project.
Introduce new IDTypeInfo structure. Each ID type will have its own, with some minimal basic common info, and ID management callbacks. This patch only does it for Object type, for demo/testing purpose. Moving all existing IDs is a goal of next "cleanup Friday". Note that BKE_idcode features should then be merged back into BKE_idtype - but this will have to be done later, once all ID types have been properly converted to the new system. Another later TODO might be to try and add callbacks for file read/write, and lib_query ID usages looper. This is part of T73719. Thanks to @brecht for initial idea, and reviewing the patch. Differential Revision: https://developer.blender.org/D6966
Diffstat (limited to 'source/blender/blenkernel/intern/lib_id_delete.c')
-rw-r--r--source/blender/blenkernel/intern/lib_id_delete.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/lib_id_delete.c b/source/blender/blenkernel/intern/lib_id_delete.c
index f2fa6946d4b..d47510ea9af 100644
--- a/source/blender/blenkernel/intern/lib_id_delete.c
+++ b/source/blender/blenkernel/intern/lib_id_delete.c
@@ -66,6 +66,7 @@
#include "BKE_font.h"
#include "BKE_gpencil.h"
#include "BKE_idprop.h"
+#include "BKE_idtype.h"
#include "BKE_image.h"
#include "BKE_ipo.h"
#include "BKE_key.h"
@@ -124,6 +125,15 @@ void BKE_libblock_free_data(ID *id, const bool do_id_user)
void BKE_libblock_free_datablock(ID *id, const int UNUSED(flag))
{
+ const IDTypeInfo *idtype_info = BKE_idtype_get_info_from_id(id);
+
+ if (idtype_info != NULL) {
+ if (idtype_info->free_data != NULL) {
+ idtype_info->free_data(id);
+ }
+ return;
+ }
+
const short type = GS(id->name);
switch (type) {
case ID_SCE: