Refactor: Anim, rename function to ANIM_bone_in_visible_collection()
Rename `ANIM_bonecoll_is_visible(armature, bone)` to `ANIM_bone_in_visible_collection(armature, bone)`, as that reflects the actual functionality. No functional changes.
This commit is contained in:
parent
86555838f1
commit
d12fa306f7
@ -265,12 +265,12 @@ void ANIM_armature_bonecoll_reconstruct(struct bArmature *armature);
|
||||
*/
|
||||
|
||||
/** Return true when any of the bone's collections is visible. */
|
||||
bool ANIM_bonecoll_is_visible(const struct bArmature *armature, const struct Bone *bone);
|
||||
bool ANIM_bone_in_visible_collection(const struct bArmature *armature, const struct Bone *bone);
|
||||
|
||||
inline bool ANIM_bone_is_visible(const struct bArmature *armature, const struct Bone *bone)
|
||||
{
|
||||
const bool bone_itself_visible = (bone->flag & (BONE_HIDDEN_P | BONE_HIDDEN_PG)) == 0;
|
||||
return bone_itself_visible && ANIM_bonecoll_is_visible(armature, bone);
|
||||
return bone_itself_visible && ANIM_bone_in_visible_collection(armature, bone);
|
||||
}
|
||||
|
||||
bool ANIM_bonecoll_is_visible_editbone(const struct bArmature *armature,
|
||||
@ -286,12 +286,12 @@ inline bool ANIM_bone_is_visible_editbone(const struct bArmature *armature,
|
||||
inline bool ANIM_bonecoll_is_visible_pchan(const struct bArmature *armature,
|
||||
const struct bPoseChannel *pchan)
|
||||
{
|
||||
return ANIM_bonecoll_is_visible(armature, pchan->bone);
|
||||
return ANIM_bone_in_visible_collection(armature, pchan->bone);
|
||||
}
|
||||
|
||||
inline bool ANIM_bonecoll_is_visible_actbone(const struct bArmature *armature)
|
||||
{
|
||||
return ANIM_bonecoll_is_visible(armature, armature->act_bone);
|
||||
return ANIM_bone_in_visible_collection(armature, armature->act_bone);
|
||||
}
|
||||
|
||||
void ANIM_armature_bonecoll_show_all(struct bArmature *armature);
|
||||
|
@ -869,7 +869,7 @@ static bool any_bone_collection_visible(const ListBase /*BoneCollectionRef*/ *co
|
||||
/* TODO: these two functions were originally implemented for armature layers, hence the armature
|
||||
* parameters. These should be removed at some point. */
|
||||
|
||||
bool ANIM_bonecoll_is_visible(const bArmature * /*armature*/, const Bone *bone)
|
||||
bool ANIM_bone_in_visible_collection(const bArmature * /*armature*/, const Bone *bone)
|
||||
{
|
||||
return any_bone_collection_visible(&bone->runtime.collections);
|
||||
}
|
||||
@ -934,7 +934,7 @@ bool ANIM_armature_bonecoll_contains_active_bone(const struct bArmature *armatur
|
||||
|
||||
void ANIM_armature_bonecoll_show_from_bone(bArmature *armature, const Bone *bone)
|
||||
{
|
||||
if (ANIM_bonecoll_is_visible(armature, bone)) {
|
||||
if (ANIM_bone_in_visible_collection(armature, bone)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -680,7 +680,7 @@ bool BKE_pose_channels_is_valid(const bPose *pose)
|
||||
|
||||
bool BKE_pose_is_bonecoll_visible(const bArmature *arm, const bPoseChannel *pchan)
|
||||
{
|
||||
return pchan->bone && ANIM_bonecoll_is_visible(arm, pchan->bone);
|
||||
return pchan->bone && ANIM_bone_in_visible_collection(arm, pchan->bone);
|
||||
}
|
||||
|
||||
bPoseChannel *BKE_pose_channel_active(Object *ob, const bool check_bonecoll)
|
||||
@ -693,7 +693,7 @@ bPoseChannel *BKE_pose_channel_active(Object *ob, const bool check_bonecoll)
|
||||
/* find active */
|
||||
LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
|
||||
if ((pchan->bone) && (pchan->bone == arm->act_bone)) {
|
||||
if (!check_bonecoll || ANIM_bonecoll_is_visible(arm, pchan->bone)) {
|
||||
if (!check_bonecoll || ANIM_bone_in_visible_collection(arm, pchan->bone)) {
|
||||
return pchan;
|
||||
}
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ static int dgroup_skinnable_cb(Object *ob, Bone *bone, void *datap)
|
||||
}
|
||||
|
||||
if (!data->is_weight_paint ||
|
||||
(ANIM_bonecoll_is_visible(arm, bone) && (bone->flag & BONE_SELECTED)))
|
||||
(ANIM_bone_in_visible_collection(arm, bone) && (bone->flag & BONE_SELECTED)))
|
||||
{
|
||||
if (!(defgroup = BKE_object_defgroup_find_name(ob, bone->name))) {
|
||||
defgroup = BKE_object_defgroup_add_name(ob, bone->name);
|
||||
@ -385,7 +385,7 @@ static void add_verts_to_dgroups(ReportList *reports,
|
||||
|
||||
/* set selected */
|
||||
if (wpmode) {
|
||||
if (ANIM_bonecoll_is_visible(arm, bone) && (bone->flag & BONE_SELECTED)) {
|
||||
if (ANIM_bone_in_visible_collection(arm, bone) && (bone->flag & BONE_SELECTED)) {
|
||||
selected[j] = 1;
|
||||
}
|
||||
}
|
||||
|
@ -674,7 +674,7 @@ static int hide_pose_bone_fn(Object *ob, Bone *bone, void *ptr)
|
||||
bArmature *arm = static_cast<bArmature *>(ob->data);
|
||||
const bool hide_select = bool(POINTER_AS_INT(ptr));
|
||||
int count = 0;
|
||||
if (ANIM_bonecoll_is_visible(arm, bone)) {
|
||||
if (ANIM_bone_in_visible_collection(arm, bone)) {
|
||||
if (((bone->flag & BONE_SELECTED) != 0) == hide_select) {
|
||||
bone->flag |= BONE_HIDDEN_P;
|
||||
/* only needed when 'hide_select' is true, but harmless. */
|
||||
@ -744,7 +744,7 @@ static int show_pose_bone_cb(Object *ob, Bone *bone, void *data)
|
||||
|
||||
bArmature *arm = static_cast<bArmature *>(ob->data);
|
||||
int count = 0;
|
||||
if (ANIM_bonecoll_is_visible(arm, bone)) {
|
||||
if (ANIM_bone_in_visible_collection(arm, bone)) {
|
||||
if (bone->flag & BONE_HIDDEN_P) {
|
||||
if (!(bone->flag & BONE_UNSELECTABLE)) {
|
||||
SET_FLAG_FROM_TEST(bone->flag, select, BONE_SELECTED);
|
||||
|
@ -606,7 +606,7 @@ static void set_pose_keys(Object *ob)
|
||||
if (ob->pose) {
|
||||
LISTBASE_FOREACH (bPoseChannel *, chan, &ob->pose->chanbase) {
|
||||
Bone *bone = chan->bone;
|
||||
if ((bone) && (bone->flag & BONE_SELECTED) && ANIM_bonecoll_is_visible(arm, bone)) {
|
||||
if ((bone) && (bone->flag & BONE_SELECTED) && ANIM_bone_in_visible_collection(arm, bone)) {
|
||||
chan->flag |= POSE_KEY;
|
||||
}
|
||||
else {
|
||||
|
@ -209,7 +209,7 @@ static int dgroup_skinnable_cb(Object *ob, Bone *bone, void *datap)
|
||||
segments = 1;
|
||||
}
|
||||
|
||||
if (ANIM_bonecoll_is_visible(arm, bone)) {
|
||||
if (ANIM_bone_in_visible_collection(arm, bone)) {
|
||||
if (!(defgroup = BKE_object_defgroup_find_name(ob, bone->name))) {
|
||||
defgroup = BKE_object_defgroup_add_name(ob, bone->name);
|
||||
}
|
||||
|
@ -555,7 +555,7 @@ static int armature_bone_transflags_update_recursive(bArmature *arm,
|
||||
bone->flag &= ~BONE_TRANSFORM;
|
||||
do_next = do_it;
|
||||
if (do_it) {
|
||||
if (ANIM_bonecoll_is_visible(arm, bone)) {
|
||||
if (ANIM_bone_in_visible_collection(arm, bone)) {
|
||||
if (bone->flag & BONE_SELECTED) {
|
||||
bone->flag |= BONE_TRANSFORM;
|
||||
total++;
|
||||
|
Loading…
Reference in New Issue
Block a user