Anim: ensure active bone collection doesn't change when adding new one

Ensure that the active bone collection doesn't change, when adding a new
bone collection via low-level functions (for example
`armature.collections.new()` in Python).

The change to the active bone collection happened because adding a new
child may change the index of the active bone collection.
This commit is contained in:
Sybren A. Stüvel
2024-01-08 13:03:10 +01:00
parent 4fe6f0b271
commit 687d6932c0
@@ -238,6 +238,9 @@ BoneCollection *ANIM_armature_bonecoll_new(bArmature *armature,
bonecoll_insert_as_child(armature, bcoll, parent_index);
}
/* Restore the active bone collection pointer, as its index might have changed. */
ANIM_armature_bonecoll_active_set(armature, armature->runtime.active_collection);
return bcoll;
}