Refactor: Move bone functions to separate file and into namespace

No functional changes intended.

This moves the functions
* ANIM_bone_is_visible
* ANIM_bone_is_visible_ebone
* ANIM_bone_is_visible_pchan

into new files `ANIM_armature.hh`/`armature.cc`.
They were previously in `ANIM_bone_collections.hh` but don't
directly have anything to do with bone collections.

It also puts the functions into the `blender::animrig::` namespace
and removes the `ANIM_` prefix as is the standard for C++ files.

Part of #138482

Pull Request: https://projects.blender.org/blender/blender/pulls/138833
This commit is contained in:
Christoph Lendenfeld
2025-05-16 14:45:46 +02:00
committed by Christoph Lendenfeld
parent e4aa758d70
commit 9c35656766
34 changed files with 198 additions and 120 deletions

View File

@@ -0,0 +1,39 @@
/* SPDX-FileCopyrightText: 2025 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup animrig
*
* \brief Functions to deal with Armatures.
*/
#pragma once
#include "ANIM_bone_collections.hh"
#include "DNA_armature_types.h"
namespace blender::animrig {
/**
* Returns true if the given Bone is visible. This includes bone collection visibility.
*/
inline bool bone_is_visible(const bArmature *armature, const Bone *bone)
{
const bool bone_itself_visible = (bone->flag & BONE_HIDDEN_P) == 0;
return bone_itself_visible && ANIM_bone_in_visible_collection(armature, bone);
}
inline bool bone_is_visible_pchan(const bArmature *armature, const bPoseChannel *pchan)
{
return bone_is_visible(armature, pchan->bone);
}
inline bool bone_is_visible_editbone(const bArmature *armature, const EditBone *ebone)
{
const bool bone_itself_visible = (ebone->flag & BONE_HIDDEN_A) == 0;
return bone_itself_visible && ANIM_bonecoll_is_visible_editbone(armature, ebone);
}
} // namespace blender::animrig

View File

@@ -305,36 +305,19 @@ void ANIM_armature_bonecoll_reconstruct(bArmature *armature);
/** Return true when any of the bone's collections is visible. */
bool ANIM_bone_in_visible_collection(const bArmature *armature, const Bone *bone);
inline bool ANIM_bone_is_visible(const bArmature *armature, const Bone *bone)
{
const bool bone_itself_visible = (bone->flag & BONE_HIDDEN_P) == 0;
return bone_itself_visible && ANIM_bone_in_visible_collection(armature, bone);
}
/**
* Returns true when the edit-bone's collection is visible.
*
* \note This alone is not enough to check bone visibility since the user may have hidden the bone.
* Use `ANIM_bone_is_visible_editbone` to check bone visibility.
* Use `blender::animrig::bone_is_visible_editbone` to check bone visibility.
*/
bool ANIM_bonecoll_is_visible_editbone(const bArmature *armature, const EditBone *ebone);
inline bool ANIM_bone_is_visible_editbone(const bArmature *armature, const EditBone *ebone)
{
const bool bone_itself_visible = (ebone->flag & BONE_HIDDEN_A) == 0;
return bone_itself_visible && ANIM_bonecoll_is_visible_editbone(armature, ebone);
}
inline bool ANIM_bonecoll_is_visible_pchan(const bArmature *armature, const bPoseChannel *pchan)
{
return ANIM_bone_in_visible_collection(armature, pchan->bone);
}
inline bool ANIM_bone_is_visible_pchan(const bArmature *armature, const bPoseChannel *pchan)
{
return ANIM_bone_is_visible(armature, pchan->bone);
}
inline bool ANIM_bonecoll_is_visible_actbone(const bArmature *armature)
{
return ANIM_bone_in_visible_collection(armature, armature->act_bone);

View File

@@ -41,6 +41,7 @@ set(SRC
ANIM_action_iterators.hh
ANIM_action_legacy.hh
ANIM_animdata.hh
ANIM_armature.hh
ANIM_armature_iter.hh
ANIM_bone_collections.hh
ANIM_bonecolor.hh

View File

@@ -563,17 +563,17 @@ void BKE_pchan_bbone_deform_segment_index(const bPoseChannel *pchan,
float *r_blend_next);
#define PBONE_SELECTABLE(arm, bone) \
(ANIM_bone_is_visible(arm, bone) && !((bone)->flag & BONE_UNSELECTABLE))
(blender::animrig::bone_is_visible(arm, bone) && !((bone)->flag & BONE_UNSELECTABLE))
#define PBONE_SELECTED(arm, bone) \
(((bone)->flag & BONE_SELECTED) & ANIM_bone_is_visible(arm, bone))
(((bone)->flag & BONE_SELECTED) & blender::animrig::bone_is_visible(arm, bone))
/* context.selected_pose_bones */
#define FOREACH_PCHAN_SELECTED_IN_OBJECT_BEGIN(_ob, _pchan) \
for (bPoseChannel *_pchan = (bPoseChannel *)(_ob)->pose->chanbase.first; _pchan; \
_pchan = _pchan->next) \
{ \
if (ANIM_bone_is_visible(((bArmature *)(_ob)->data), (_pchan)->bone) && \
if (blender::animrig::bone_is_visible(((bArmature *)(_ob)->data), (_pchan)->bone) && \
((_pchan)->bone->flag & BONE_SELECTED)) \
{
#define FOREACH_PCHAN_SELECTED_IN_OBJECT_END \
@@ -585,7 +585,7 @@ void BKE_pchan_bbone_deform_segment_index(const bPoseChannel *pchan,
for (bPoseChannel *_pchan = (bPoseChannel *)(_ob)->pose->chanbase.first; _pchan; \
_pchan = _pchan->next) \
{ \
if (ANIM_bone_is_visible(((bArmature *)(_ob)->data), (_pchan)->bone)) {
if (blender::animrig::bone_is_visible(((bArmature *)(_ob)->data), (_pchan)->bone)) {
#define FOREACH_PCHAN_VISIBLE_IN_OBJECT_END \
} \
} \

View File

@@ -69,6 +69,7 @@
#include "ANIM_action.hh"
#include "ANIM_action_legacy.hh"
#include "ANIM_armature.hh"
#include "ANIM_bone_collections.hh"
#include "ANIM_bonecolor.hh"
#include "ANIM_versioning.hh"
@@ -1230,13 +1231,17 @@ bPoseChannel *BKE_pose_channel_active_or_first_selected(Object *ob)
}
bPoseChannel *pchan = BKE_pose_channel_active_if_bonecoll_visible(ob);
if (pchan && (pchan->bone->flag & BONE_SELECTED) && ANIM_bone_is_visible_pchan(arm, pchan)) {
if (pchan && (pchan->bone->flag & BONE_SELECTED) &&
blender::animrig::bone_is_visible_pchan(arm, pchan))
{
return pchan;
}
LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
if (pchan->bone != nullptr) {
if ((pchan->bone->flag & BONE_SELECTED) && ANIM_bone_is_visible_pchan(arm, pchan)) {
if ((pchan->bone->flag & BONE_SELECTED) &&
blender::animrig::bone_is_visible_pchan(arm, pchan))
{
return pchan;
}
}

View File

@@ -51,6 +51,7 @@
#include "BKE_object.hh"
#include "BKE_scene.hh"
#include "ANIM_armature.hh"
#include "ANIM_bone_collections.hh"
#include "DEG_depsgraph_build.hh"
@@ -3164,7 +3165,7 @@ std::optional<blender::Bounds<blender::float3>> BKE_pose_minmax(const Object *ob
if (!pchan->bone) {
continue;
}
if (!ANIM_bone_is_visible_pchan(arm, pchan)) {
if (!blender::animrig::bone_is_visible_pchan(arm, pchan)) {
continue;
}
if (use_select && !(pchan->bone->flag & BONE_SELECTED)) {

View File

@@ -6,7 +6,7 @@
* \ingroup bke
*/
#include "ANIM_bone_collections.hh"
#include "ANIM_armature.hh"
#include "BKE_armature.hh"

View File

@@ -36,7 +36,7 @@
#include "ED_armature.hh"
#include "ED_view3d.hh"
#include "ANIM_bone_collections.hh"
#include "ANIM_armature.hh"
#include "ANIM_bonecolor.hh"
#include "UI_resources.hh"
@@ -2039,7 +2039,7 @@ void Armatures::draw_armature_edit(Armatures::DrawContext *ctx)
eBone;
eBone = eBone->next, index += 0x10000)
{
if (!ANIM_bone_is_visible_editbone(&arm, eBone)) {
if (!blender::animrig::bone_is_visible_editbone(&arm, eBone)) {
continue;
}
@@ -2047,7 +2047,7 @@ void Armatures::draw_armature_edit(Armatures::DrawContext *ctx)
/* catch exception for bone with hidden parent */
eBone_Flag boneflag = eBone_Flag(eBone->flag);
if ((eBone->parent) && !ANIM_bone_is_visible_editbone(&arm, eBone->parent)) {
if ((eBone->parent) && !blender::animrig::bone_is_visible_editbone(&arm, eBone->parent)) {
boneflag &= ~BONE_CONNECTED;
}
@@ -2164,7 +2164,7 @@ void Armatures::draw_armature_pose(Armatures::DrawContext *ctx)
pchan = pchan->next, index += 0x10000)
{
Bone *bone = pchan->bone;
if (!ANIM_bone_is_visible(&arm, bone)) {
if (!blender::animrig::bone_is_visible(&arm, bone)) {
continue;
}

View File

@@ -37,7 +37,7 @@
#include "ANIM_action.hh"
#include "ANIM_action_iterators.hh"
#include "ANIM_bone_collections.hh"
#include "ANIM_armature.hh"
#include "ANIM_keyframing.hh"
#include "ANIM_pose.hh"
#include "ANIM_rna.hh"
@@ -124,7 +124,7 @@ static blender::animrig::Action &extract_pose(Main &bmain,
const bArmature *armature = static_cast<bArmature *>(pose_object->data);
LISTBASE_FOREACH (bPoseChannel *, pose_bone, &pose_object->pose->chanbase) {
if (!(pose_bone->bone->flag & BONE_SELECTED) ||
!ANIM_bone_is_visible(armature, pose_bone->bone))
!blender::animrig::bone_is_visible(armature, pose_bone->bone))
{
continue;
}
@@ -496,7 +496,7 @@ static Vector<PathValue> generate_path_values(Object &pose_object)
const bArmature *armature = static_cast<bArmature *>(pose_object.data);
LISTBASE_FOREACH (bPoseChannel *, pose_bone, &pose_object.pose->chanbase) {
if (!(pose_bone->bone->flag & BONE_SELECTED) ||
!ANIM_bone_is_visible(armature, pose_bone->bone))
!blender::animrig::bone_is_visible(armature, pose_bone->bone))
{
continue;
}

View File

@@ -49,6 +49,7 @@
#include "ED_screen.hh"
#include "ED_view3d.hh"
#include "ANIM_armature.hh"
#include "ANIM_bone_collections.hh"
#include "DEG_depsgraph.hh"
@@ -148,7 +149,7 @@ static wmOperatorStatus armature_click_extrude_exec(bContext *C, wmOperator * /*
/* find the active or selected bone */
for (ebone = static_cast<EditBone *>(arm->edbo->first); ebone; ebone = ebone->next) {
if (!ANIM_bone_is_visible_editbone(arm, ebone)) {
if (!blender::animrig::bone_is_visible_editbone(arm, ebone)) {
continue;
}
if (ebone->flag & BONE_TIPSEL || arm->act_edbone == ebone) {
@@ -158,7 +159,7 @@ static wmOperatorStatus armature_click_extrude_exec(bContext *C, wmOperator * /*
if (ebone == nullptr) {
for (ebone = static_cast<EditBone *>(arm->edbo->first); ebone; ebone = ebone->next) {
if (!ANIM_bone_is_visible_editbone(arm, ebone)) {
if (!blender::animrig::bone_is_visible_editbone(arm, ebone)) {
continue;
}
if (ebone->flag & BONE_ROOTSEL || arm->act_edbone == ebone) {
@@ -1128,7 +1129,9 @@ static wmOperatorStatus armature_duplicate_selected_exec(bContext *C, wmOperator
/* Select mirrored bones */
if (arm->flag & ARM_MIRROR_EDIT) {
LISTBASE_FOREACH (EditBone *, ebone_iter, arm->edbo) {
if (ANIM_bone_is_visible_editbone(arm, ebone_iter) && (ebone_iter->flag & BONE_SELECTED)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebone_iter) &&
(ebone_iter->flag & BONE_SELECTED))
{
EditBone *ebone;
ebone = ED_armature_ebone_get_mirrored(arm->edbo, ebone_iter);
@@ -1144,7 +1147,9 @@ static wmOperatorStatus armature_duplicate_selected_exec(bContext *C, wmOperator
ebone_iter && ebone_iter != ebone_first_dupe;
ebone_iter = ebone_iter->next)
{
if (ANIM_bone_is_visible_editbone(arm, ebone_iter) && (ebone_iter->flag & BONE_SELECTED)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebone_iter) &&
(ebone_iter->flag & BONE_SELECTED))
{
EditBone *ebone;
char new_bone_name_buff[MAXBONENAME];
const char *new_bone_name = ebone_iter->name;
@@ -1173,7 +1178,9 @@ static wmOperatorStatus armature_duplicate_selected_exec(bContext *C, wmOperator
ebone_iter && ebone_iter != ebone_first_dupe;
ebone_iter = ebone_iter->next)
{
if (ANIM_bone_is_visible_editbone(arm, ebone_iter) && (ebone_iter->flag & BONE_SELECTED)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebone_iter) &&
(ebone_iter->flag & BONE_SELECTED))
{
EditBone *ebone = ebone_iter->temp.ebone;
if (!ebone_iter->parent) {
@@ -1219,7 +1226,7 @@ static wmOperatorStatus armature_duplicate_selected_exec(bContext *C, wmOperator
ebone_iter && ebone_iter != ebone_first_dupe;
ebone_iter = ebone_iter->next)
{
if (ANIM_bone_is_visible_editbone(arm, ebone_iter)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebone_iter)) {
ebone_iter->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
}
}
@@ -1306,7 +1313,8 @@ static wmOperatorStatus armature_symmetrize_exec(bContext *C, wmOperator *op)
*
* Storing temp pointers to mirrored unselected ebones. */
LISTBASE_FOREACH (EditBone *, ebone_iter, arm->edbo) {
if (!(ANIM_bone_is_visible_editbone(arm, ebone_iter) && (ebone_iter->flag & BONE_SELECTED)))
if (!(blender::animrig::bone_is_visible_editbone(arm, ebone_iter) &&
(ebone_iter->flag & BONE_SELECTED)))
{
/* Skipping invisible selected bones. */
continue;
@@ -1371,7 +1379,9 @@ static wmOperatorStatus armature_symmetrize_exec(bContext *C, wmOperator *op)
ebone_iter && ebone_iter != ebone_first_dupe;
ebone_iter = ebone_iter->next)
{
if (ANIM_bone_is_visible_editbone(arm, ebone_iter) && (ebone_iter->flag & BONE_SELECTED)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebone_iter) &&
(ebone_iter->flag & BONE_SELECTED))
{
if (ebone_iter->temp.ebone != nullptr) {
/* This will be set if the mirror bone already exists (no need to make a new one)
* but we do need to make sure that the 'pchan' settings (constraints etc)
@@ -1481,7 +1491,7 @@ static wmOperatorStatus armature_symmetrize_exec(bContext *C, wmOperator *op)
ebone_iter && ebone_iter != ebone_first_dupe;
ebone_iter = ebone_iter->next)
{
if (ANIM_bone_is_visible_editbone(arm, ebone_iter)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebone_iter)) {
ebone_iter->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
}
}
@@ -1572,7 +1582,7 @@ static wmOperatorStatus armature_extrude_exec(bContext *C, wmOperator *op)
/* since we allow root extrude too, we have to make sure selection is OK */
LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
if (ANIM_bone_is_visible_editbone(arm, ebone)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebone)) {
if (ebone->flag & BONE_ROOTSEL) {
if (ebone->parent && (ebone->flag & BONE_CONNECTED)) {
if (ebone->parent->flag & BONE_TIPSEL) {
@@ -1587,7 +1597,7 @@ static wmOperatorStatus armature_extrude_exec(bContext *C, wmOperator *op)
for (ebone = static_cast<EditBone *>(arm->edbo->first); ((ebone) && (ebone != first));
ebone = ebone->next)
{
if (!ANIM_bone_is_visible_editbone(arm, ebone)) {
if (!blender::animrig::bone_is_visible_editbone(arm, ebone)) {
continue;
}
/* We extrude per definition the tip. */

View File

@@ -46,7 +46,7 @@
#include "ED_screen.hh"
#include "ED_view3d.hh"
#include "ANIM_bone_collections.hh"
#include "ANIM_armature.hh"
#include "DEG_depsgraph.hh"
@@ -316,7 +316,7 @@ static wmOperatorStatus armature_calc_roll_exec(bContext *C, wmOperator *op)
/* cursor */
LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
if (ANIM_bone_is_visible_editbone(arm, ebone) && EBONE_EDITABLE(ebone)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebone) && EBONE_EDITABLE(ebone)) {
float cursor_rel[3];
sub_v3_v3v3(cursor_rel, cursor_local, ebone->head);
if (axis_flip) {
@@ -332,8 +332,9 @@ static wmOperatorStatus armature_calc_roll_exec(bContext *C, wmOperator *op)
else if (ELEM(type, CALC_ROLL_TAN_POS_X, CALC_ROLL_TAN_POS_Z)) {
LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
if (ebone->parent) {
bool is_edit = (ANIM_bone_is_visible_editbone(arm, ebone) && EBONE_EDITABLE(ebone));
bool is_edit_parent = (ANIM_bone_is_visible_editbone(arm, ebone->parent) &&
bool is_edit = (blender::animrig::bone_is_visible_editbone(arm, ebone) &&
EBONE_EDITABLE(ebone));
bool is_edit_parent = (blender::animrig::bone_is_visible_editbone(arm, ebone->parent) &&
EBONE_EDITABLE(ebone->parent));
if (is_edit || is_edit_parent) {
@@ -428,7 +429,7 @@ static wmOperatorStatus armature_calc_roll_exec(bContext *C, wmOperator *op)
}
LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
if (ANIM_bone_is_visible_editbone(arm, ebone) && EBONE_EDITABLE(ebone)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebone) && EBONE_EDITABLE(ebone)) {
/* roll func is a callback which assumes that all is well */
ebone->roll = ED_armature_ebone_roll_to_vector(ebone, vec, axis_only);
changed = true;
@@ -438,10 +439,11 @@ static wmOperatorStatus armature_calc_roll_exec(bContext *C, wmOperator *op)
if (arm->flag & ARM_MIRROR_EDIT) {
LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
if ((ANIM_bone_is_visible_editbone(arm, ebone) && EBONE_EDITABLE(ebone)) == 0) {
if ((blender::animrig::bone_is_visible_editbone(arm, ebone) && EBONE_EDITABLE(ebone)) == 0)
{
EditBone *ebone_mirr = ED_armature_ebone_get_mirrored(arm->edbo, ebone);
if (ebone_mirr &&
(ANIM_bone_is_visible_editbone(arm, ebone_mirr) && EBONE_EDITABLE(ebone_mirr)))
if (ebone_mirr && (blender::animrig::bone_is_visible_editbone(arm, ebone_mirr) &&
EBONE_EDITABLE(ebone_mirr)))
{
ebone->roll = -ebone_mirr->roll;
}
@@ -497,7 +499,7 @@ static wmOperatorStatus armature_roll_clear_exec(bContext *C, wmOperator *op)
bool changed = false;
LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
if (ANIM_bone_is_visible_editbone(arm, ebone) && EBONE_EDITABLE(ebone)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebone) && EBONE_EDITABLE(ebone)) {
/* Roll func is a callback which assumes that all is well. */
ebone->roll = roll;
changed = true;
@@ -506,10 +508,11 @@ static wmOperatorStatus armature_roll_clear_exec(bContext *C, wmOperator *op)
if (arm->flag & ARM_MIRROR_EDIT) {
LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
if ((ANIM_bone_is_visible_editbone(arm, ebone) && EBONE_EDITABLE(ebone)) == 0) {
if ((blender::animrig::bone_is_visible_editbone(arm, ebone) && EBONE_EDITABLE(ebone)) == 0)
{
EditBone *ebone_mirr = ED_armature_ebone_get_mirrored(arm->edbo, ebone);
if (ebone_mirr &&
(ANIM_bone_is_visible_editbone(arm, ebone_mirr) && EBONE_EDITABLE(ebone_mirr)))
if (ebone_mirr && (blender::animrig::bone_is_visible_editbone(arm, ebone_mirr) &&
EBONE_EDITABLE(ebone_mirr)))
{
ebone->roll = -ebone_mirr->roll;
changed = true;
@@ -945,7 +948,7 @@ static wmOperatorStatus armature_switch_direction_exec(bContext *C, wmOperator *
/* skip bone if already handled, see #34123. */
if ((ebo->flag & BONE_TRANSFORM) == 0) {
/* only if selected and editable */
if (ANIM_bone_is_visible_editbone(arm, ebo) && EBONE_EDITABLE(ebo)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebo) && EBONE_EDITABLE(ebo)) {
/* swap head and tail coordinates */
swap_v3_v3(ebo->head, ebo->tail);
@@ -970,7 +973,8 @@ static wmOperatorStatus armature_switch_direction_exec(bContext *C, wmOperator *
/* not swapping this bone, however, if its 'parent' got swapped, unparent us from it
* as it will be facing in opposite direction
*/
if ((parent) && (ANIM_bone_is_visible_editbone(arm, parent) && EBONE_EDITABLE(parent)))
if ((parent) && (blender::animrig::bone_is_visible_editbone(arm, parent) &&
EBONE_EDITABLE(parent)))
{
ebo->parent = nullptr;
ebo->flag &= ~BONE_CONNECTED;
@@ -1227,7 +1231,8 @@ static bool armature_delete_ebone_cb(const char *bone_name, void *arm_p)
EditBone *ebone;
ebone = ED_armature_ebone_find_name(arm->edbo, bone_name);
return (ebone && (ebone->flag & BONE_SELECTED) && ANIM_bonecoll_is_visible_editbone(arm, ebone));
return (ebone && (ebone->flag & BONE_SELECTED) &&
blender::animrig::bone_is_visible_editbone(arm, ebone));
}
/* previously delete_armature */
@@ -1256,7 +1261,7 @@ static wmOperatorStatus armature_delete_selected_exec(bContext *C, wmOperator *
for (curBone = static_cast<EditBone *>(arm->edbo->first); curBone; curBone = ebone_next) {
ebone_next = curBone->next;
if (ANIM_bone_is_visible_editbone(arm, curBone)) {
if (blender::animrig::bone_is_visible_editbone(arm, curBone)) {
if (curBone->flag & BONE_SELECTED) {
if (curBone == arm->act_edbone) {
arm->act_edbone = nullptr;
@@ -1400,13 +1405,13 @@ static wmOperatorStatus armature_dissolve_selected_exec(bContext *C, wmOperator
LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
/* break connections for unseen bones */
if ((ANIM_bone_is_visible_editbone(arm, ebone) &&
if ((blender::animrig::bone_is_visible_editbone(arm, ebone) &&
(ED_armature_ebone_selectflag_get(ebone) & (BONE_TIPSEL | BONE_SELECTED))) == 0)
{
ebone->temp.ebone = nullptr;
}
if ((ANIM_bone_is_visible_editbone(arm, ebone) &&
if ((blender::animrig::bone_is_visible_editbone(arm, ebone) &&
(ED_armature_ebone_selectflag_get(ebone) & (BONE_ROOTSEL | BONE_SELECTED))) == 0)
{
if (ebone->parent && (ebone->flag & BONE_CONNECTED)) {
@@ -1516,7 +1521,7 @@ static wmOperatorStatus armature_hide_exec(bContext *C, wmOperator *op)
bool changed = false;
LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
if (ANIM_bone_is_visible_editbone(arm, ebone)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebone)) {
if ((ebone->flag & BONE_SELECTED) != invert) {
ebone->flag &= ~(BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL);
ebone->flag |= BONE_HIDDEN_A;
@@ -1573,7 +1578,7 @@ static wmOperatorStatus armature_reveal_exec(bContext *C, wmOperator *op)
bool changed = false;
LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
if (ANIM_bonecoll_is_visible_editbone(arm, ebone)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebone)) {
if (ebone->flag & BONE_HIDDEN_A) {
if (!(ebone->flag & BONE_UNSELECTABLE)) {
SET_FLAG_FROM_TEST(ebone->flag, select, (BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL));

View File

@@ -46,7 +46,7 @@
#include "ED_armature.hh"
#include "ED_screen.hh"
#include "ANIM_bone_collections.hh"
#include "ANIM_armature.hh"
#include "armature_intern.hh"
@@ -451,7 +451,7 @@ static wmOperatorStatus armature_flip_names_exec(bContext *C, wmOperator *op)
ListBase bones_names = {nullptr};
LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
if (ANIM_bone_is_visible_editbone(arm, ebone)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebone)) {
if (ebone->flag & BONE_SELECTED) {
BLI_addtail(&bones_names, BLI_genericNodeN(ebone->name));

View File

@@ -53,6 +53,7 @@
#include "UI_interface.hh"
#include "UI_resources.hh"
#include "ANIM_armature.hh"
#include "ANIM_bone_collections.hh"
#include "armature_intern.hh"
@@ -621,8 +622,8 @@ static void separate_armature_bones(Main *bmain, Object *ob, const bool is_selec
curbone = ED_armature_ebone_find_name(arm->edbo, pchan->name);
/* check if bone needs to be removed */
if (is_select ==
(ANIM_bone_is_visible_editbone(arm, curbone) && (curbone->flag & BONE_SELECTED)))
if (is_select == (blender::animrig::bone_is_visible_editbone(arm, curbone) &&
(curbone->flag & BONE_SELECTED)))
{
/* Clear the bone->parent var of any bone that had this as its parent. */
@@ -686,7 +687,7 @@ static wmOperatorStatus separate_armature_exec(bContext *C, wmOperator *op)
bool has_selected_bone = false;
bool has_selected_any = false;
LISTBASE_FOREACH (EditBone *, ebone, arm_old->edbo) {
if (ANIM_bone_is_visible_editbone(arm_old, ebone)) {
if (blender::animrig::bone_is_visible_editbone(arm_old, ebone)) {
if (ebone->flag & BONE_SELECTED) {
has_selected_bone = true;
break;

View File

@@ -42,6 +42,7 @@
#include "GPU_select.hh"
#include "ANIM_armature.hh"
#include "ANIM_bone_collections.hh"
#include "ANIM_bonecolor.hh"
@@ -504,7 +505,7 @@ static wmOperatorStatus armature_select_linked_exec(bContext *C, wmOperator *op)
bool found = false;
LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
if (ANIM_bone_is_visible_editbone(arm, ebone) &&
if (blender::animrig::bone_is_visible_editbone(arm, ebone) &&
(ebone->flag & (BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL)))
{
ebone->flag |= BONE_DONE;
@@ -907,7 +908,7 @@ bool ED_armature_edit_deselect_all_visible(Object *obedit)
bool changed = false;
LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
/* first and foremost, bone must be visible and selected */
if (ANIM_bone_is_visible_editbone(arm, ebone)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebone)) {
if (ebone->flag & (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL)) {
ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
changed = true;
@@ -1160,7 +1161,7 @@ static bool armature_edit_select_op_apply(bArmature *arm,
{
BLI_assert(!(is_ignore_flag & ~(BONESEL_ROOT | BONESEL_TIP)));
BLI_assert(!(is_inside_flag & ~(BONESEL_ROOT | BONESEL_TIP | BONESEL_BONE)));
BLI_assert(ANIM_bone_is_visible_editbone(arm, ebone));
BLI_assert(blender::animrig::bone_is_visible_editbone(arm, ebone));
bool changed = false;
bool is_point_done = false;
int points_proj_tot = 0;
@@ -1466,7 +1467,7 @@ static void armature_select_more_less(Object *ob, bool more)
/* do selection */
LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
if (ANIM_bone_is_visible_editbone(arm, ebone)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebone)) {
if (more) {
armature_select_more(arm, ebone);
}
@@ -1477,7 +1478,7 @@ static void armature_select_more_less(Object *ob, bool more)
}
LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
if (ANIM_bone_is_visible_editbone(arm, ebone)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebone)) {
if (more == false) {
if (ebone->flag & BONE_SELECTED) {
ED_armature_ebone_select_set(ebone, true);
@@ -2166,7 +2167,7 @@ static wmOperatorStatus armature_select_mirror_exec(bContext *C, wmOperator *op)
int flag_new = extend ? EBONE_PREV_FLAG_GET(ebone) : 0;
if ((ebone_mirror = ED_armature_ebone_get_mirrored(arm->edbo, ebone)) &&
ANIM_bone_is_visible_editbone(arm, ebone_mirror))
blender::animrig::bone_is_visible_editbone(arm, ebone_mirror))
{
const int flag_mirror = EBONE_PREV_FLAG_GET(ebone_mirror);
flag_new |= flag_mirror;

View File

@@ -27,6 +27,7 @@
#include "ED_armature.hh"
#include "ANIM_armature.hh"
#include "ANIM_bone_collections.hh"
#include "armature_intern.hh"
@@ -277,7 +278,7 @@ void armature_select_mirrored_ex(bArmature *arm, const int flag)
/* Select mirrored bones */
if (arm->flag & ARM_MIRROR_EDIT) {
LISTBASE_FOREACH (EditBone *, curBone, arm->edbo) {
if (ANIM_bone_is_visible_editbone(arm, curBone)) {
if (blender::animrig::bone_is_visible_editbone(arm, curBone)) {
if (curBone->flag & flag) {
EditBone *ebone_mirr = ED_armature_ebone_get_mirrored(arm->edbo, curBone);
if (ebone_mirr) {
@@ -304,7 +305,7 @@ void armature_tag_select_mirrored(bArmature *arm)
/* Select mirrored bones */
if (arm->flag & ARM_MIRROR_EDIT) {
LISTBASE_FOREACH (EditBone *, curBone, arm->edbo) {
if (ANIM_bone_is_visible_editbone(arm, curBone)) {
if (blender::animrig::bone_is_visible_editbone(arm, curBone)) {
if (curBone->flag & (BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL)) {
EditBone *ebone_mirr = ED_armature_ebone_get_mirrored(arm->edbo, curBone);
if (ebone_mirr && (ebone_mirr->flag & BONE_SELECTED) == 0) {
@@ -343,8 +344,8 @@ void ED_armature_ebone_transform_mirror_update(bArmature *arm, EditBone *ebo, bo
* eg. from 3d viewport. */
/* no layer check, correct mirror is more important */
if (!check_select ||
(ANIM_bone_is_visible_editbone(arm, ebo) && (ebo->flag & (BONE_TIPSEL | BONE_ROOTSEL))))
if (!check_select || (blender::animrig::bone_is_visible_editbone(arm, ebo) &&
(ebo->flag & (BONE_TIPSEL | BONE_ROOTSEL))))
{
EditBone *eboflip = ED_armature_ebone_get_mirrored(arm->edbo, ebo);
if (eboflip) {

View File

@@ -9,6 +9,7 @@
#include <cstring>
#include "ANIM_armature.hh"
#include "ANIM_bone_collections.hh"
#include "DNA_ID.h"
@@ -271,7 +272,7 @@ static void bone_collection_assign_editbones(bContext *C,
ED_armature_edit_sync_selection(arm->edbo);
LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
if (!EBONE_EDITABLE(ebone) || !ANIM_bone_is_visible_editbone(arm, ebone)) {
if (!EBONE_EDITABLE(ebone) || !blender::animrig::bone_is_visible_editbone(arm, ebone)) {
continue;
}
*made_any_changes |= assign_func(bcoll, ebone);
@@ -778,7 +779,7 @@ static void bone_collection_select(bContext *C,
else {
LISTBASE_FOREACH (BoneCollectionMember *, member, &bcoll->bones) {
Bone *bone = member->bone;
if (!ANIM_bone_is_visible(armature, bone)) {
if (!blender::animrig::bone_is_visible(armature, bone)) {
continue;
}
if (bone->flag & BONE_UNSELECTABLE) {

View File

@@ -41,6 +41,7 @@
#include "ED_object.hh"
#include "ED_screen.hh"
#include "ANIM_armature.hh"
#include "ANIM_bone_collections.hh"
#include "ANIM_keyframing.hh"

View File

@@ -44,7 +44,7 @@
#include "ANIM_action.hh"
#include "ANIM_action_legacy.hh"
#include "ANIM_bone_collections.hh"
#include "ANIM_armature.hh"
#include "ANIM_keyframing.hh"
#include "ANIM_keyingsets.hh"
#include "ANIM_pose.hh"

View File

@@ -8,6 +8,7 @@
#include <cstring>
#include "DNA_action_types.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_constraint_types.h"
@@ -15,6 +16,7 @@
#include "DNA_scene_types.h"
#include "BLI_listbase.h"
#include "BLI_map.hh"
#include "BLI_string.h"
#include "BKE_action.hh"
@@ -44,7 +46,7 @@
#include "ED_select_utils.hh"
#include "ED_view3d.hh"
#include "ANIM_bone_collections.hh"
#include "ANIM_armature.hh"
#include "ANIM_bonecolor.hh"
#include "ANIM_keyingsets.hh"
@@ -318,7 +320,7 @@ bool ED_pose_deselect_all(Object *ob, int select_mode, const bool ignore_visibil
if (select_mode == SEL_TOGGLE) {
select_mode = SEL_SELECT;
LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
if (ignore_visibility || ANIM_bone_is_visible_pchan(arm, pchan)) {
if (ignore_visibility || blender::animrig::bone_is_visible_pchan(arm, pchan)) {
if (pchan->bone->flag & BONE_SELECTED) {
select_mode = SEL_DESELECT;
break;
@@ -331,7 +333,7 @@ bool ED_pose_deselect_all(Object *ob, int select_mode, const bool ignore_visibil
bool changed = false;
LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
/* ignore the pchan if it isn't visible or if its selection cannot be changed */
if (ignore_visibility || ANIM_bone_is_visible_pchan(arm, pchan)) {
if (ignore_visibility || blender::animrig::bone_is_visible_pchan(arm, pchan)) {
int flag_prev = pchan->bone->flag;
pose_do_bone_select(pchan, select_mode);
changed = (changed || flag_prev != pchan->bone->flag);
@@ -344,7 +346,7 @@ static bool ed_pose_is_any_selected(Object *ob, bool ignore_visibility)
{
bArmature *arm = static_cast<bArmature *>(ob->data);
LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
if (ignore_visibility || ANIM_bone_is_visible_pchan(arm, pchan)) {
if (ignore_visibility || blender::animrig::bone_is_visible_pchan(arm, pchan)) {
if (pchan->bone->flag & BONE_SELECTED) {
return true;
}
@@ -1140,7 +1142,8 @@ static wmOperatorStatus pose_select_mirror_exec(bContext *C, wmOperator *op)
blender::Map<bPoseChannel *, eBone_Flag> old_selection_flags;
LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
/* Treat invisible bones as deselected. */
const int flags = ANIM_bone_is_visible_pchan(arm, pchan) ? pchan->bone->flag : 0;
const int flags = blender::animrig::bone_is_visible_pchan(arm, pchan) ? pchan->bone->flag :
0;
old_selection_flags.add_new(pchan, eBone_Flag(flags));
}

View File

@@ -50,6 +50,7 @@
#include "ED_keyframing.hh"
#include "ED_screen.hh"
#include "ANIM_armature.hh"
#include "ANIM_bone_collections.hh"
#include "ANIM_keyframing.hh"
#include "ANIM_keyingsets.hh"
@@ -535,7 +536,9 @@ static wmOperatorStatus pose_visual_transform_apply_exec(bContext *C, wmOperator
int i;
LISTBASE_FOREACH_INDEX (bPoseChannel *, pchan, &ob->pose->chanbase, i) {
if (!((pchan->bone->flag & BONE_SELECTED) && ANIM_bone_is_visible_pchan(arm, pchan))) {
if (!((pchan->bone->flag & BONE_SELECTED) &&
blender::animrig::bone_is_visible_pchan(arm, pchan)))
{
pchan_xform_array[i].is_set = false;
continue;
}

View File

@@ -41,7 +41,7 @@ struct wmOperator;
#define BONESEL_ANY (BONESEL_TIP | BONESEL_ROOT | BONESEL_BONE)
#define EBONE_SELECTABLE(arm, ebone) \
(ANIM_bone_is_visible_editbone(arm, ebone) && !((ebone)->flag & BONE_UNSELECTABLE))
(blender::animrig::bone_is_visible_editbone(arm, ebone) && !((ebone)->flag & BONE_UNSELECTABLE))
#define EBONE_EDITABLE(ebone) \
(CHECK_TYPE_INLINE(ebone, EditBone *), \

View File

@@ -52,6 +52,7 @@
#include "ED_screen.hh"
#include "ED_select_utils.hh"
#include "ANIM_armature.hh"
#include "ANIM_bone_collections.hh"
#include "ANIM_keyingsets.hh"

View File

@@ -51,6 +51,7 @@
#include "UI_interface.hh"
#include "WM_api.hh"
#include "ANIM_armature.hh"
#include "ANIM_bone_collections.hh"
#include "screen_intern.hh"
@@ -279,7 +280,7 @@ static eContextResult screen_ctx_visible_or_editable_bones_(const bContext *C,
/* Attention: X-Axis Mirroring is also handled here... */
LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
/* first and foremost, bone must be visible and selected */
if (ANIM_bone_is_visible_editbone(arm, ebone)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebone)) {
/* Get 'x-axis mirror equivalent' bone if the X-Axis Mirroring option is enabled
* so that most users of this data don't need to explicitly check for it themselves.
*
@@ -306,7 +307,7 @@ static eContextResult screen_ctx_visible_or_editable_bones_(const bContext *C,
/* only include bones if visible */
CTX_data_list_add(result, &arm->id, &RNA_EditBone, ebone);
if ((flipbone) && ANIM_bone_is_visible_editbone(arm, flipbone) == 0) {
if ((flipbone) && blender::animrig::bone_is_visible_editbone(arm, flipbone) == 0) {
CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone);
}
}
@@ -349,7 +350,9 @@ static eContextResult screen_ctx_selected_bones_(const bContext *C,
/* Attention: X-Axis Mirroring is also handled here... */
LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
/* first and foremost, bone must be visible and selected */
if (ANIM_bone_is_visible_editbone(arm, ebone) && (ebone->flag & BONE_SELECTED)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebone) &&
(ebone->flag & BONE_SELECTED))
{
/* Get 'x-axis mirror equivalent' bone if the X-Axis Mirroring option is enabled
* so that most users of this data don't need to explicitly check for it themselves.
*

View File

@@ -63,6 +63,7 @@
#include "RNA_define.hh"
#include "RNA_prototypes.hh"
#include "ANIM_armature.hh"
#include "ANIM_bone_collections.hh"
#include "outliner_intern.hh"
@@ -576,7 +577,7 @@ static void tree_element_posechannel_activate(bContext *C,
pchan->bone->flag &= ~BONE_SELECTED;
}
else {
if (ANIM_bone_is_visible(arm, pchan->bone)) {
if (blender::animrig::bone_is_visible(arm, pchan->bone)) {
pchan->bone->flag |= BONE_SELECTED;
}
arm->act_bone = pchan->bone;
@@ -620,7 +621,7 @@ static void tree_element_bone_activate(bContext *C,
bone->flag &= ~BONE_SELECTED;
}
else {
if (ANIM_bone_is_visible(arm, bone) && ((bone->flag & BONE_UNSELECTABLE) == 0)) {
if (blender::animrig::bone_is_visible(arm, bone) && ((bone->flag & BONE_UNSELECTABLE) == 0)) {
bone->flag |= BONE_SELECTED;
}
arm->act_bone = bone;

View File

@@ -31,7 +31,7 @@
#include "WM_api.hh"
#include "WM_types.hh"
#include "ANIM_bone_collections.hh"
#include "ANIM_armature.hh"
#include "tree/tree_element_seq.hh"

View File

@@ -32,7 +32,7 @@
#include "DEG_depsgraph_query.hh"
#include "ANIM_bone_collections.hh"
#include "ANIM_armature.hh"
#include "bmesh.hh"
@@ -795,7 +795,7 @@ void armature_foreachScreenBone(const ViewContext *vc,
}
LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
if (!ANIM_bone_is_visible_editbone(arm, ebone)) {
if (!blender::animrig::bone_is_visible_editbone(arm, ebone)) {
continue;
}
@@ -867,7 +867,7 @@ void pose_foreachScreenBone(const ViewContext *vc,
}
LISTBASE_FOREACH (bPoseChannel *, pchan, &pose->chanbase) {
if (!ANIM_bone_is_visible_pchan(arm_eval, pchan)) {
if (!blender::animrig::bone_is_visible_pchan(arm_eval, pchan)) {
continue;
}

View File

@@ -98,6 +98,7 @@
#include "DRW_engine.hh"
#include "DRW_select_buffer.hh"
#include "ANIM_armature.hh"
#include "ANIM_bone_collections.hh"
#include "view3d_intern.hh" /* own include */
@@ -1015,7 +1016,7 @@ static void do_lasso_select_armature__doSelectBone(void *user_data,
{
LassoSelectUserData *data = static_cast<LassoSelectUserData *>(user_data);
const bArmature *arm = static_cast<const bArmature *>(data->vc->obedit->data);
if (!ANIM_bone_is_visible_editbone(arm, ebone)) {
if (!blender::animrig::bone_is_visible_editbone(arm, ebone)) {
return;
}
@@ -1062,7 +1063,7 @@ static void do_lasso_select_armature__doSelectBone_clip_content(void *user_data,
{
LassoSelectUserData *data = static_cast<LassoSelectUserData *>(user_data);
bArmature *arm = static_cast<bArmature *>(data->vc->obedit->data);
if (!ANIM_bone_is_visible_editbone(arm, ebone)) {
if (!blender::animrig::bone_is_visible_editbone(arm, ebone)) {
return;
}
@@ -5129,7 +5130,9 @@ static void do_circle_select_armature__doSelectBone(void *user_data,
{
CircleSelectUserData *data = static_cast<CircleSelectUserData *>(user_data);
const bArmature *arm = static_cast<const bArmature *>(data->vc->obedit->data);
if (!(data->select ? EBONE_SELECTABLE(arm, ebone) : ANIM_bone_is_visible_editbone(arm, ebone))) {
if (!(data->select ? EBONE_SELECTABLE(arm, ebone) :
blender::animrig::bone_is_visible_editbone(arm, ebone)))
{
return;
}
@@ -5185,7 +5188,9 @@ static void do_circle_select_armature__doSelectBone_clip_content(void *user_data
CircleSelectUserData *data = static_cast<CircleSelectUserData *>(user_data);
bArmature *arm = static_cast<bArmature *>(data->vc->obedit->data);
if (!(data->select ? EBONE_SELECTABLE(arm, ebone) : ANIM_bone_is_visible_editbone(arm, ebone))) {
if (!(data->select ? EBONE_SELECTABLE(arm, ebone) :
blender::animrig::bone_is_visible_editbone(arm, ebone)))
{
return;
}

View File

@@ -52,6 +52,7 @@
#include "ED_transverts.hh"
#include "ANIM_action.hh"
#include "ANIM_armature.hh"
#include "ANIM_bone_collections.hh"
#include "ANIM_keyframing.hh"
#include "ANIM_keyingsets.hh"
@@ -403,7 +404,8 @@ static bool snap_selected_to_location_rotation(bContext *C,
mul_v3_m4v3(target_loc_local, ob->world_to_object().ptr(), target_loc_global);
LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
if ((pchan->bone->flag & BONE_SELECTED) && ANIM_bone_is_visible_pchan(arm, pchan) &&
if ((pchan->bone->flag & BONE_SELECTED) &&
blender::animrig::bone_is_visible_pchan(arm, pchan) &&
/* if the bone has a parent and is connected to the parent,
* don't do anything - will break chain unless we do auto-ik.
*/

View File

@@ -34,6 +34,7 @@
#include "DEG_depsgraph_build.hh"
#include "ANIM_action.hh"
#include "ANIM_armature.hh"
#include "ANIM_bone_collections.hh"
#include "ANIM_keyframing.hh"
#include "ANIM_rna.hh"
@@ -747,7 +748,9 @@ static void createTransArmatureVerts(bContext * /*C*/, TransInfo *t)
LISTBASE_FOREACH (EditBone *, ebo, edbo) {
const int data_len_prev = tc->data_len;
if (ANIM_bone_is_visible_editbone(arm, ebo) && !(ebo->flag & BONE_EDITMODE_LOCKED)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebo) &&
!(ebo->flag & BONE_EDITMODE_LOCKED))
{
if (ELEM(t->mode, TFM_BONESIZE, TFM_BONE_ENVELOPE_DIST)) {
if (ebo->flag & BONE_SELECTED) {
tc->data_len++;
@@ -818,7 +821,9 @@ static void createTransArmatureVerts(bContext * /*C*/, TransInfo *t)
/* (length == 0.0) on extrude, used for scaling radius of bone points. */
ebo->oldlength = ebo->length;
if (ANIM_bone_is_visible_editbone(arm, ebo) && !(ebo->flag & BONE_EDITMODE_LOCKED)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebo) &&
!(ebo->flag & BONE_EDITMODE_LOCKED))
{
if (t->mode == TFM_BONE_ENVELOPE) {
if (ebo->flag & BONE_ROOTSEL) {
td->val = &ebo->rad_head;
@@ -1053,7 +1058,9 @@ static void recalcData_edit_armature(TransInfo *t)
if (ebo_parent) {
/* If this bone has a parent tip that has been moved. */
if (ANIM_bone_is_visible_editbone(arm, ebo_parent) && (ebo_parent->flag & BONE_TIPSEL)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebo_parent) &&
(ebo_parent->flag & BONE_TIPSEL))
{
copy_v3_v3(ebo->head, ebo_parent->tail);
if (t->mode == TFM_BONE_ENVELOPE) {
ebo->rad_head = ebo_parent->rad_tail;
@@ -1485,7 +1492,7 @@ void transform_convert_pose_transflags_update(Object *ob, const int mode, const
LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
bone = pchan->bone;
if (ANIM_bone_is_visible_pchan(arm, pchan)) {
if (blender::animrig::bone_is_visible_pchan(arm, pchan)) {
if (bone->flag & BONE_SELECTED) {
bone->flag |= BONE_TRANSFORM;
}

View File

@@ -56,7 +56,7 @@
#include "RNA_access.hh"
#include "RNA_define.hh"
#include "ANIM_bone_collections.hh"
#include "ANIM_armature.hh"
/* Local module include. */
#include "transform.hh"
@@ -603,7 +603,7 @@ static int gizmo_3d_foreach_selected(const bContext *C,
mat_local, obedit->world_to_object().ptr(), ob_iter->object_to_world().ptr());
}
LISTBASE_FOREACH (EditBone *, ebo, arm->edbo) {
if (ANIM_bone_is_visible_editbone(arm, ebo)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebo)) {
if (ebo->flag & BONE_TIPSEL) {
run_coord_with_matrix(ebo->tail, use_mat_local, mat_local);
totsel++;
@@ -612,7 +612,7 @@ static int gizmo_3d_foreach_selected(const bContext *C,
/* Don't include same point multiple times. */
((ebo->flag & BONE_CONNECTED) && (ebo->parent != nullptr) &&
(ebo->parent->flag & BONE_TIPSEL) &&
ANIM_bone_is_visible_editbone(arm, ebo->parent)) == 0)
blender::animrig::bone_is_visible_editbone(arm, ebo->parent)) == 0)
{
run_coord_with_matrix(ebo->head, use_mat_local, mat_local);
totsel++;

View File

@@ -44,6 +44,7 @@
#include "ED_armature.hh"
#include "ANIM_armature.hh"
#include "ANIM_bone_collections.hh"
#include "SEQ_select.hh"
@@ -1370,7 +1371,7 @@ int getTransformOrientation_ex(const Scene *scene,
zero_v3(fallback_plane);
LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) {
if (ANIM_bone_is_visible_editbone(arm, ebone)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebone)) {
if (ebone->flag & BONE_SELECTED) {
ED_armature_ebone_to_mat3(ebone, tmat);
add_v3_v3(r_normal, tmat[2]);

View File

@@ -15,7 +15,7 @@
#include "ED_armature.hh"
#include "ED_transform_snap_object_context.hh"
#include "ANIM_bone_collections.hh"
#include "ANIM_armature.hh"
#include "transform_snap_object.hh"
@@ -49,7 +49,7 @@ eSnapMode snapArmature(SnapObjectContext *sctx,
if (arm->edbo) {
LISTBASE_FOREACH (EditBone *, eBone, arm->edbo) {
if (ANIM_bone_is_visible_editbone(arm, eBone)) {
if (blender::animrig::bone_is_visible_editbone(arm, eBone)) {
const bool is_selected = (eBone->flag & (BONE_ROOTSEL | BONE_TIPSEL)) != 0;
if (is_selected && skip_selected) {
continue;

View File

@@ -37,7 +37,7 @@
#include "ED_curves.hh"
#include "ED_pointcloud.hh"
#include "ANIM_bone_collections.hh"
#include "ANIM_armature.hh"
#include "ED_transverts.hh" /* own include */
@@ -119,7 +119,7 @@ void ED_transverts_update_obedit(TransVertStore *tvs, Object *obedit)
/* Ensure all bone tails are correctly adjusted */
LISTBASE_FOREACH (EditBone *, ebo, arm->edbo) {
if (!ANIM_bone_is_visible_editbone(arm, ebo)) {
if (!blender::animrig::bone_is_visible_editbone(arm, ebo)) {
continue;
}
/* adjust tip if both ends selected */
@@ -142,7 +142,9 @@ void ED_transverts_update_obedit(TransVertStore *tvs, Object *obedit)
LISTBASE_FOREACH (EditBone *, ebo, arm->edbo) {
if ((ebo->flag & BONE_CONNECTED) && ebo->parent) {
/* If this bone has a parent tip that has been moved */
if (ANIM_bone_is_visible_editbone(arm, ebo->parent) && (ebo->parent->flag & BONE_TIPSEL)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebo->parent) &&
(ebo->parent->flag & BONE_TIPSEL))
{
copy_v3_v3(ebo->head, ebo->parent->tail);
}
/* If this bone has a parent tip that has NOT been moved */
@@ -346,11 +348,11 @@ void ED_transverts_create_from_obedit(TransVertStore *tvs, const Object *obedit,
tv = tvs->transverts = MEM_calloc_arrayN<TransVert>(totmalloc, __func__);
LISTBASE_FOREACH (EditBone *, ebo, arm->edbo) {
if (ANIM_bone_is_visible_editbone(arm, ebo)) {
if (blender::animrig::bone_is_visible_editbone(arm, ebo)) {
const bool tipsel = (ebo->flag & BONE_TIPSEL) != 0;
const bool rootsel = (ebo->flag & BONE_ROOTSEL) != 0;
const bool rootok = !(ebo->parent && (ebo->flag & BONE_CONNECTED) &&
(ANIM_bone_is_visible_editbone(arm, ebo->parent) &&
(blender::animrig::bone_is_visible_editbone(arm, ebo->parent) &&
(ebo->parent->flag & BONE_TIPSEL)));
if ((tipsel && rootsel) || (rootsel)) {

View File

@@ -411,8 +411,9 @@ typedef enum eBone_Flag {
*
* However the bone may not be visible to the user since the bones collection
* may be hidden.
* In most cases `ANIM_bone_is_visible_editbone` or `ANIM_bone_is_visible_pchan` should be used
* to check if the bone is visible to the user before operating on them.
* In most cases `blender::animrig::bone_is_visible_editbone` or
* `blender::animrig::bone_is_visible_pchan` should be used to check if the bone is visible to
* the user before operating on them.
*/
BONE_SELECTED = (1 << 0),
BONE_ROOTSEL = (1 << 1),