GOOENGINE: Isolate bones overlay

Hides non selected bones while moving selected ones
This commit is contained in:
2025-09-29 09:41:17 -05:00
parent 994df7af73
commit b7a2ca25b0
4 changed files with 15 additions and 4 deletions
@@ -3117,11 +3117,13 @@ void Armatures::draw_armature_pose(Armatures::DrawContext *ctx)
if (!is_pose_select) {
draw_bone_relations(ctx, draw_strat, bone_ptr, boneflag);
}
draw_strat.update_display_matrix(bone_ptr);
if (!is_pose_select || draw_strat.culling_test(view, ob, pchan)) {
draw_strat.draw_bone(ctx, bone_ptr, boneflag, select_id);
}
if (!((G.moving & (G_TRANSFORM_OBJ | G_TRANSFORM_EDIT)) != 0 && ctx->isolate_bones && !(bone->flag & BONE_SELECTED))) {
if (!is_pose_select || draw_strat.culling_test(view, ob, pchan)) {
draw_strat.draw_bone(ctx, bone_ptr, boneflag, select_id);
}
}
/* Below this point nothing is used for selection queries. */
if (is_pose_select) {
@@ -3174,6 +3176,7 @@ static void armature_context_setup(Armatures::DrawContext *ctx,
ctx->show_relations = pd->armature.show_relations;
ctx->do_relations = !DRW_state_is_select() && pd->armature.show_relations &&
is_edit_or_pose_mode;
ctx->isolate_bones = pd->overlay.flag & V3D_OVERLAY_ISOLATE_BONES && draw_mode == ARM_DRAW_MODE_POSE;
ctx->const_color = DRW_state_is_select() ? select_const_color : const_color;
ctx->const_wire = ((ob->base_flag & BASE_SELECTED) && (pd->v3d_flag & V3D_SELECT_OUTLINE) ?
1.5f :
@@ -486,6 +486,7 @@ class Armatures {
float const_wire = 0.0f;
bool do_relations = false;
bool isolate_bones = false;
bool transparent = false;
bool show_relations = false;
bool draw_envelope_distance = false;
@@ -599,6 +599,7 @@ enum {
V3D_OVERLAY_SCULPT_CURVES_CAGE = (1 << 16),
V3D_OVERLAY_SHOW_LIGHT_COLORS = (1 << 17),
V3D_OVERLAY_VIEWER_ATTRIBUTE_TEXT = (1 << 18),
V3D_OVERLAY_ISOLATE_BONES = (1 << 19),
};
/** #View3DOverlay.edit_flag */
@@ -4637,6 +4637,12 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
prop, "Show Bones", "Display bones (disable to show motion paths only)");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, nullptr);
prop = RNA_def_property(srna, "isolate_bones", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, nullptr, "overlay.flag", V3D_OVERLAY_ISOLATE_BONES);
RNA_def_property_ui_text(
prop, "Isolate Bones", "Hide non selected bones when in a moving modal");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, nullptr);
prop = RNA_def_property(srna, "show_face_orientation", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, nullptr, "overlay.flag", V3D_OVERLAY_FACE_ORIENTATION);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);