Anim: Use bone_is_visible_... functions

This is mostly a non-functional change except for

* `overlay_armature.cc` was drawing relationship lines to bone
hidden by collection logic (except that doesn't seem to work anyway,
relationship lines are drawn regardless)
* `transform_snap_armature.cc` it was possible to snap to pose bones
hidden by collection logic.

I assumed those to be oversights so I changed them in this PR.

This does *not* remove all usages of `BONE_HIDDEN_P`
and `BONE_HIDDEN_A`. Some direct access is required in
the UI and for cases where we explicitly don't want to check
collection visibility.

Part of #138482

Pull Request: https://projects.blender.org/blender/blender/pulls/139151
This commit is contained in:
Christoph Lendenfeld
2025-05-20 12:58:53 +02:00
committed by Christoph Lendenfeld
parent 8bc70f24a1
commit b690e9d4db
4 changed files with 8 additions and 15 deletions

View File

@@ -2042,7 +2042,7 @@ void Armatures::draw_armature_pose(Armatures::DrawContext *ctx)
}
eBone_Flag boneflag = eBone_Flag(bone->flag);
if (bone->parent && (bone->parent->flag & BONE_HIDDEN_P)) {
if (bone->parent && !blender::animrig::bone_is_visible(&arm, bone->parent)) {
/* Avoid drawing connection line to hidden parent. */
boneflag &= ~BONE_CONNECTED;
}

View File

@@ -91,6 +91,7 @@
#include "SEQ_utils.hh"
#include "ANIM_action.hh"
#include "ANIM_armature.hh"
#include "ANIM_bone_collections.hh"
#include "anim_intern.hh"
@@ -987,12 +988,8 @@ static bool skip_fcurve_selected_data(bAnimContext *ac,
if (skip_hidden) {
bArmature *arm = static_cast<bArmature *>(ob->data);
/* skipping - not visible on currently visible layers */
if (!ANIM_bonecoll_is_visible_pchan(arm, pchan)) {
return true;
}
/* skipping - is currently hidden */
if (pchan->bone->flag & BONE_HIDDEN_P) {
/* Skipping - is currently hidden. */
if (!blender::animrig::bone_is_visible_pchan(arm, pchan)) {
return true;
}
}

View File

@@ -45,6 +45,7 @@
#include "ANIM_action.hh"
#include "ANIM_action_iterators.hh"
#include "ANIM_animdata.hh"
#include "ANIM_armature.hh"
#include "ANIM_bone_collections.hh"
#include "ANIM_driver.hh"
#include "ANIM_fcurve.hh"
@@ -809,15 +810,10 @@ static bool can_delete_key(FCurve *fcu, Object *ob, ReportList *reports)
/* skip if bone is not selected */
if ((pchan) && (pchan->bone)) {
/* bones are only selected/editable if visible... */
bArmature *arm = static_cast<bArmature *>(ob->data);
/* skipping - not visible on currently visible layers */
if (!ANIM_bonecoll_is_visible_pchan(arm, pchan)) {
return false;
}
/* skipping - is currently hidden */
if (pchan->bone->flag & BONE_HIDDEN_P) {
/* Invisible bones should not be modified. */
if (!blender::animrig::bone_is_visible_pchan(arm, pchan)) {
return false;
}

View File

@@ -65,7 +65,7 @@ eSnapMode snapArmature(SnapObjectContext *sctx,
else if (ob_eval->pose && ob_eval->pose->chanbase.first) {
LISTBASE_FOREACH (bPoseChannel *, pchan, &ob_eval->pose->chanbase) {
Bone *bone = pchan->bone;
if (!bone || (bone->flag & BONE_HIDDEN_P)) {
if (!bone || !blender::animrig::bone_is_visible_pchan(arm, pchan)) {
/* Skip hidden bones. */
continue;
}