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.
This commit is contained in:
parent
dcdffe719f
commit
febb2351ad
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue