From 1785286ecc908366f1c2935cfdc5287571563628 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Thu, 6 Jan 2022 15:42:45 +0300 Subject: Bone Overlay: support changing bone wireframe opacity. When weight painting the bone overlay is extremely intrusive, effectively requiring either extensive use of hiding individual bones, or disabling the whole bone overlay between selections. This addresses the issue by adding a bone opacity slider that is used for the 'wireframe' armature drawing mode. It directly controls the uniform opacity as a straightforward option. Differential Revision: https://developer.blender.org/D11804 --- release/scripts/startup/bl_ui/space_view3d.py | 33 +++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'release/scripts/startup/bl_ui/space_view3d.py') diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 3fd19dd70cf..7d8e74ed7ce 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -6504,18 +6504,38 @@ class VIEW3D_PT_overlay_sculpt(Panel): row.prop(overlay, "sculpt_mode_face_sets_opacity", text="Face Sets") -class VIEW3D_PT_overlay_pose(Panel): +class VIEW3D_PT_overlay_bones(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'HEADER' bl_parent_id = 'VIEW3D_PT_overlay' - bl_label = "Pose Mode" + bl_label = "Bones" + + @staticmethod + def is_using_wireframe(context): + shading = VIEW3D_PT_shading.get_shading(context) + + if shading.type == 'WIREFRAME' or shading.show_xray: + return True + + mode = context.mode + + if mode in ('POSE', 'PAINT_WEIGHT'): + armature = context.pose_object + elif mode == 'EDIT_ARMATURE': + armature = context.edit_object + else: + return False + + return armature and armature.display_type == 'WIRE' @classmethod def poll(cls, context): mode = context.mode return ( (mode == 'POSE') or - (mode == 'PAINT_WEIGHT' and context.pose_object) + (mode == 'PAINT_WEIGHT' and context.pose_object) or + (mode in ('EDIT_ARMATURE', 'OBJECT') and + VIEW3D_PT_overlay_bones.is_using_wireframe(context)) ) def draw(self, context): @@ -6534,10 +6554,13 @@ class VIEW3D_PT_overlay_pose(Panel): sub = row.row() sub.active = display_all and overlay.show_xray_bone sub.prop(overlay, "xray_alpha_bone", text="Fade Geometry") - else: + elif mode == 'PAINT_WEIGHT': row = col.row() row.prop(overlay, "show_xray_bone") + if VIEW3D_PT_overlay_bones.is_using_wireframe(context): + col.prop(overlay, "bone_wire_alpha") + class VIEW3D_PT_overlay_texture_paint(Panel): bl_space_type = 'VIEW_3D' @@ -7705,7 +7728,7 @@ classes = ( VIEW3D_PT_overlay_texture_paint, VIEW3D_PT_overlay_vertex_paint, VIEW3D_PT_overlay_weight_paint, - VIEW3D_PT_overlay_pose, + VIEW3D_PT_overlay_bones, VIEW3D_PT_overlay_sculpt, VIEW3D_PT_snapping, VIEW3D_PT_proportional_edit, -- cgit v1.2.3