From febb2351ad35c26e0102f2db655694151eab382d Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 26 Jun 2020 17:57:12 +0200 Subject: Fix ShapeKeys not being deleted together with their owner ID. Consistency with e.g. copying (copying a mesh also duplicates its shapekey typically). Baby step towards getting rid of this horrible ID, some day... Note that for now we only do that when taking BMain into account, fancy code dealing with non-main IDs and such has to deal with those itself. --- source/blender/blenkernel/intern/lib_id_delete.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source/blender/blenkernel/intern/lib_id_delete.c') diff --git a/source/blender/blenkernel/intern/lib_id_delete.c b/source/blender/blenkernel/intern/lib_id_delete.c index 7c96d0a6401..b4f2caac861 100644 --- a/source/blender/blenkernel/intern/lib_id_delete.c +++ b/source/blender/blenkernel/intern/lib_id_delete.c @@ -24,6 +24,7 @@ /* all types are needed here, in order to do memory operations */ #include "DNA_ID.h" +#include "DNA_key_types.h" #include "BLI_utildefines.h" @@ -32,6 +33,7 @@ #include "BKE_anim_data.h" #include "BKE_idprop.h" #include "BKE_idtype.h" +#include "BKE_key.h" #include "BKE_lib_id.h" #include "BKE_lib_override.h" #include "BKE_lib_remap.h" @@ -146,6 +148,13 @@ void BKE_id_free_ex(Main *bmain, void *idv, int flag, const bool use_flag_from_i BKE_libblock_relink_ex(bmain, id, NULL, NULL, 0); } + if ((flag & LIB_ID_FREE_NO_MAIN) == 0) { + Key *key = BKE_key_from_id(id); + if (key != NULL) { + BKE_id_free_ex(bmain, &key->id, flag, use_flag_from_idtag); + } + } + BKE_libblock_free_datablock(id, flag); /* avoid notifying on removed data */ -- cgit v1.2.3