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-06-26 18:57:12 +0300
committerBastien Montagne <bastien@blender.org>2020-06-29 18:28:04 +0300
commitfebb2351ad35c26e0102f2db655694151eab382d (patch)
tree3e625cf31d718645fbe10b9f5b458771345a213d /source/blender/blenkernel/intern/lib_id_delete.c
parentdcdffe719f5e2c5474f26da3c47fb2e147867887 (diff)
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.
Diffstat (limited to 'source/blender/blenkernel/intern/lib_id_delete.c')
-rw-r--r--source/blender/blenkernel/intern/lib_id_delete.c9
1 files changed, 9 insertions, 0 deletions
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 */