diff --git a/scripts/startup/bl_ui/space_view3d.py b/scripts/startup/bl_ui/space_view3d.py index ccbe271d340..25ca1edabe5 100644 --- a/scripts/startup/bl_ui/space_view3d.py +++ b/scripts/startup/bl_ui/space_view3d.py @@ -959,6 +959,32 @@ class VIEW3D_HT_header(Header): sub.active = overlay.show_overlays sub.popover(panel="VIEW3D_PT_overlay", text="") + show_bone_overlays = ( + (object_mode == 'POSE') or + (object_mode == 'PAINT_WEIGHT' and context.pose_object) or + (object_mode in {'EDIT_ARMATURE', 'OBJECT'} and + VIEW3D_PT_overlay_bones.is_using_wireframe(context)) + ) + + if show_bone_overlays: + sub.popover(panel="VIEW3D_PT_overlay_bones", text="", icon="POSE_HLT") + elif context.mode == 'EDIT_MESH': + sub.popover(panel="VIEW3D_PT_overlay_edit_mesh", text="", icon="EDITMODE_HLT") + if context.mode == 'EDIT_CURVE': + sub.popover(panel="VIEW3D_PT_overlay_edit_curve", text="", icon="EDITMODE_HLT") + elif context.mode == 'SCULPT' and context.sculpt_object: + sub.popover(panel="VIEW3D_PT_overlay_sculpt", text="", icon="SCULPTMODE_HLT") + elif context.mode == 'SCULPT_CURVES' and context.object: + sub.popover(panel="VIEW3D_PT_overlay_sculpt_curves", text="", icon="SCULPTMODE_HLT") + elif context.mode == 'PAINT_WEIGHT': + sub.popover(panel="VIEW3D_PT_overlay_weight_paint", text="", icon="WPAINT_HLT") + elif context.mode == 'PAINT_TEXTURE': + sub.popover(panel="VIEW3D_PT_overlay_texture_paint", text="", icon="TPAINT_HLT") + elif context.mode == 'PAINT_VERTEX': + sub.popover(panel="VIEW3D_PT_overlay_vertex_paint", text="", icon="VPAINT_HLT") + elif context.object and context.object.type == 'GPENCIL': + sub.popover(panel="VIEW3D_PT_overlay_gpencil_options", text="", icon="OUTLINER_DATA_GREASEPENCIL") + row = layout.row() row.active = (object_mode == 'EDIT') or (shading.type in {'WIREFRAME', 'SOLID'}) @@ -6829,8 +6855,8 @@ class VIEW3D_PT_overlay_motion_tracking(Panel): class VIEW3D_PT_overlay_edit_mesh(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'HEADER' - bl_parent_id = 'VIEW3D_PT_overlay' bl_label = "Mesh Edit Mode" + bl_ui_units_x = 12 @classmethod def poll(cls, context): @@ -6838,6 +6864,7 @@ class VIEW3D_PT_overlay_edit_mesh(Panel): def draw(self, context): layout = self.layout + layout.label(text="Mesh Edit Mode Overlays") view = context.space_data shading = view.shading @@ -7017,7 +7044,7 @@ class VIEW3D_PT_overlay_edit_mesh_normals(Panel): class VIEW3D_PT_overlay_edit_mesh_freestyle(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'HEADER' - bl_parent_id = 'VIEW3D_PT_overlay' + bl_parent_id = 'VIEW3D_PT_overlay_edit_mesh' bl_label = "Freestyle" @classmethod @@ -7042,7 +7069,6 @@ class VIEW3D_PT_overlay_edit_mesh_freestyle(Panel): class VIEW3D_PT_overlay_edit_curve(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'HEADER' - bl_parent_id = 'VIEW3D_PT_overlay' bl_label = "Curve Edit Mode" @classmethod @@ -7055,6 +7081,8 @@ class VIEW3D_PT_overlay_edit_curve(Panel): overlay = view.overlay display_all = overlay.show_overlays + layout.label(text="Curve Edit Mode Overlays") + col = layout.column() col.active = display_all @@ -7072,7 +7100,6 @@ class VIEW3D_PT_overlay_sculpt(Panel): bl_space_type = 'VIEW_3D' bl_context = ".sculpt_mode" bl_region_type = 'HEADER' - bl_parent_id = 'VIEW3D_PT_overlay' bl_label = "Sculpt" @classmethod @@ -7088,6 +7115,8 @@ class VIEW3D_PT_overlay_sculpt(Panel): view = context.space_data overlay = view.overlay + layout.label(text="Sculpt Mode Overlays") + row = layout.row(align=True) row.prop(overlay, "show_sculpt_mask", text="") sub = row.row() @@ -7105,7 +7134,6 @@ class VIEW3D_PT_overlay_sculpt_curves(Panel): bl_space_type = 'VIEW_3D' bl_context = ".curves_sculpt" bl_region_type = 'HEADER' - bl_parent_id = 'VIEW3D_PT_overlay' bl_label = "Sculpt" @classmethod @@ -7118,6 +7146,8 @@ class VIEW3D_PT_overlay_sculpt_curves(Panel): view = context.space_data overlay = view.overlay + layout.label(text="Curve Sculpt Overlays") + row = layout.row(align=True) row.active = overlay.show_overlays row.prop(overlay, "sculpt_mode_mask_opacity", text="Selection Opacity") @@ -7133,7 +7163,6 @@ class VIEW3D_PT_overlay_sculpt_curves(Panel): class VIEW3D_PT_overlay_bones(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'HEADER' - bl_parent_id = 'VIEW3D_PT_overlay' bl_label = "Bones" @staticmethod @@ -7171,6 +7200,8 @@ class VIEW3D_PT_overlay_bones(Panel): overlay = view.overlay display_all = overlay.show_overlays + layout.label(text="Armature Overlays") + col = layout.column() col.active = display_all @@ -7191,7 +7222,6 @@ class VIEW3D_PT_overlay_bones(Panel): class VIEW3D_PT_overlay_texture_paint(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'HEADER' - bl_parent_id = 'VIEW3D_PT_overlay' bl_label = "Texture Paint" @classmethod @@ -7204,6 +7234,8 @@ class VIEW3D_PT_overlay_texture_paint(Panel): overlay = view.overlay display_all = overlay.show_overlays + layout.label(text="Texture Paint Overlays") + col = layout.column() col.active = display_all col.prop(overlay, "texture_paint_mode_opacity") @@ -7212,7 +7244,6 @@ class VIEW3D_PT_overlay_texture_paint(Panel): class VIEW3D_PT_overlay_vertex_paint(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'HEADER' - bl_parent_id = 'VIEW3D_PT_overlay' bl_label = "Vertex Paint" @classmethod @@ -7225,6 +7256,8 @@ class VIEW3D_PT_overlay_vertex_paint(Panel): overlay = view.overlay display_all = overlay.show_overlays + layout.label(text="Vertex Paint Overlays") + col = layout.column() col.active = display_all @@ -7235,8 +7268,8 @@ class VIEW3D_PT_overlay_vertex_paint(Panel): class VIEW3D_PT_overlay_weight_paint(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'HEADER' - bl_parent_id = 'VIEW3D_PT_overlay' bl_label = "Weight Paint" + bl_ui_units_x = 12 @classmethod def poll(cls, context): @@ -7249,6 +7282,8 @@ class VIEW3D_PT_overlay_weight_paint(Panel): display_all = overlay.show_overlays tool_settings = context.tool_settings + layout.label(text="Weight Paint Overlays") + col = layout.column() col.active = display_all @@ -7477,15 +7512,18 @@ class VIEW3D_PT_gpencil_guide(Panel): class VIEW3D_PT_overlay_gpencil_options(Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'HEADER' - bl_parent_id = 'VIEW3D_PT_overlay' bl_label = "" + bl_ui_units_x = 13 @classmethod def poll(cls, context): return context.object and context.object.type == 'GPENCIL' - def draw_header(self, context): + def draw(self, context): layout = self.layout + view = context.space_data + overlay = view.overlay + layout.label(text={ 'PAINT_GPENCIL': iface_("Draw Grease Pencil"), 'EDIT_GPENCIL': iface_("Edit Grease Pencil"), @@ -7495,11 +7533,6 @@ class VIEW3D_PT_overlay_gpencil_options(Panel): 'OBJECT': iface_("Grease Pencil"), }[context.mode], translate=False) - def draw(self, context): - layout = self.layout - view = context.space_data - overlay = view.overlay - layout.prop(overlay, "use_gpencil_onion_skin", text="Onion Skin") col = layout.column()