Fix T81345: Part one: Missing handling of ID pointers from EditBone IDProperties.

So far data management code would simply fully ignore potential ID
pointers in custom properties of edit bones (which are a copy of those
from regular `Bone`). This would lead to all kind of issues, among which
refcounting inconsistencies, missing clearing of data uppon deletion,
etc.
This commit is contained in:
Bastien Montagne 2020-10-02 15:38:02 +02:00
parent 5fc992e76a
commit 619e52eb82
Notes: blender-bot 2023-02-14 03:00:45 +01:00
Referenced by issue #81345, ID user decrement error when removing object which is referred to with a PointerProperty
1 changed files with 12 additions and 0 deletions

View File

@ -160,12 +160,24 @@ static void armature_foreach_id_bone(Bone *bone, LibraryForeachIDData *data)
}
}
static void armature_foreach_id_editbone(EditBone *edit_bone, LibraryForeachIDData *data)
{
IDP_foreach_property(
edit_bone->prop, IDP_TYPE_FILTER_ID, BKE_lib_query_idpropertiesForeachIDLink_callback, data);
}
static void armature_foreach_id(ID *id, LibraryForeachIDData *data)
{
bArmature *arm = (bArmature *)id;
LISTBASE_FOREACH (Bone *, bone, &arm->bonebase) {
armature_foreach_id_bone(bone, data);
}
if (arm->edbo != NULL) {
LISTBASE_FOREACH (EditBone *, edit_bone, arm->edbo) {
armature_foreach_id_editbone(edit_bone, data);
}
}
}
static void write_bone(BlendWriter *writer, Bone *bone)