Refactor: Anim, move function for setting active bone collection by name
Move the 'set active bone collection by name' functionality from RNA to the ANIM module, so that it can be used in other places. No functional changes.
This commit is contained in:
@@ -105,6 +105,14 @@ void ANIM_armature_bonecoll_active_set(struct bArmature *armature, struct BoneCo
|
||||
void ANIM_armature_bonecoll_active_index_set(struct bArmature *armature,
|
||||
int bone_collection_index);
|
||||
|
||||
/**
|
||||
* Set the bone collection with the given name as the active one.
|
||||
*
|
||||
* Pass an empty name to clear the active bone collection. A non-existent name will also cause the
|
||||
* active bone collection to be cleared.
|
||||
*/
|
||||
void ANIM_armature_bonecoll_active_name_set(struct bArmature *armature, const char *name);
|
||||
|
||||
/**
|
||||
* Determine whether the given bone collection is editable.
|
||||
*
|
||||
|
||||
@@ -204,6 +204,12 @@ void ANIM_armature_bonecoll_active_index_set(bArmature *armature, const int bone
|
||||
armature->runtime.active_collection = bcoll;
|
||||
}
|
||||
|
||||
void ANIM_armature_bonecoll_active_name_set(bArmature *armature, const char *name)
|
||||
{
|
||||
BoneCollection *bcoll = ANIM_armature_bonecoll_get_by_name(armature, name);
|
||||
ANIM_armature_bonecoll_active_set(armature, bcoll);
|
||||
}
|
||||
|
||||
bool ANIM_armature_bonecoll_is_editable(const bArmature *armature, const BoneCollection *bcoll)
|
||||
{
|
||||
const bool is_override = ID_IS_OVERRIDE_LIBRARY(armature);
|
||||
|
||||
@@ -222,8 +222,7 @@ static void rna_BoneCollections_active_index_range(
|
||||
static void rna_BoneCollections_active_name_set(PointerRNA *ptr, const char *name)
|
||||
{
|
||||
bArmature *arm = (bArmature *)ptr->data;
|
||||
BoneCollection *bcoll = ANIM_armature_bonecoll_get_by_name(arm, name);
|
||||
ANIM_armature_bonecoll_active_set(arm, bcoll);
|
||||
ANIM_armature_bonecoll_active_name_set(arm, name);
|
||||
WM_main_add_notifier(NC_OBJECT | ND_BONE_COLLECTION, ptr->data);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user