UI: move 3D view display options into popover
authorCampbell Barton <ideasman42@gmail.com>
Tue, 5 Jun 2018 13:34:37 +0000 (15:34 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 5 Jun 2018 13:35:57 +0000 (15:35 +0200)
- Moved Mesh Display, Mesh Analysis & Motion Tracking
  display panels to Overlays.
- Removed Item panel from sidebar (buttons available elsewhere).

Patch by @billreynish w/ edits

release/scripts/startup/bl_ui/space_view3d.py

index 68719170a7040c184773c5c96eb53851b940d84b..4d680477151688978021821cbb4164fbc9abdb3e 100644 (file)
@@ -3476,31 +3476,6 @@ class VIEW3D_PT_view3d_cursor(Panel):
         layout.column().prop(view, "cursor_location", text="Location")
 
 
-class VIEW3D_PT_view3d_name(Panel):
-    bl_space_type = 'VIEW_3D'
-    bl_region_type = 'UI'
-    bl_label = "Item"
-
-    @classmethod
-    def poll(cls, context):
-        return (context.space_data and context.active_object)
-
-    def draw(self, context):
-        layout = self.layout
-
-        ob = context.active_object
-        row = layout.row()
-        row.label(text="", icon='OBJECT_DATA')
-        row.prop(ob, "name", text="")
-
-        if ob.type == 'ARMATURE' and ob.mode in {'EDIT', 'POSE'}:
-            bone = context.active_bone
-            if bone:
-                row = layout.row()
-                row.label(text="", icon='BONE_DATA')
-                row.prop(bone, "name", text="")
-
-
 class VIEW3D_PT_shading(Panel):
     bl_space_type = 'VIEW_3D'
     bl_region_type = 'HEADER'
@@ -3583,7 +3558,6 @@ class VIEW3D_PT_overlay(Panel):
         view = context.space_data
         shading = view.shading
         overlay = view.overlay
-        scene = context.scene
         toolsettings = context.tool_settings
         display_all = overlay.show_overlays
 
@@ -3619,12 +3593,27 @@ class VIEW3D_PT_overlay(Panel):
         sub.active = bool(overlay.show_floor or view.region_quadviews or not view.region_3d.is_perspective)
         subsub = sub.column(align=True)
         subsub.active = overlay.show_floor
-        sub.prop(overlay, "grid_scale", text="Scale")
-        sub.prop(overlay, "grid_subdivisions", text="Subdivisions")
+        subsub.prop(overlay, "grid_scale", text="Scale")
+        subsub.prop(overlay, "grid_subdivisions", text="Subdivisions")
+
+        col.prop(view, "show_reconstruction", text="Motion Tracking")
+        sub = col.column(align=True)
+
+        sub.active = view.show_reconstruction
+        sub.prop(view, "show_camera_path", text="Camera Path")
+        sub.prop(view, "show_bundle_names", text="3D Marker Names")
+        sub.label(text="Track Type and Size:")
+        row = sub.row(align=True)
+        row.prop(view, "tracks_draw_type", text="")
+        row.prop(view, "tracks_draw_size", text="")
+        col.separator()
 
         if context.mode == 'EDIT_MESH':
+            data = context.active_object.data
+            statvis = context.tool_settings.statvis
+            with_freestyle = bpy.app.build_options.freestyle
             col.separator()
-            col.label(text="Edit Mode:")
+            col.label(text="Edit Mesh:")
 
             col.prop(overlay, "show_occlude_wire")
 
@@ -3643,6 +3632,72 @@ class VIEW3D_PT_overlay(Panel):
             sub.active = overlay.show_vertex_normals or overlay.show_face_normals or overlay.show_split_normals
             sub.prop(overlay, "normals_length", text="Size")
 
+            split = col.split()
+
+            sub = split.column()
+            sub.prop(data, "show_faces", text="Faces")
+            sub.prop(data, "show_edges", text="Edges")
+            sub.prop(data, "show_edge_crease", text="Creases")
+
+            if with_freestyle:
+                sub.prop(data, "show_edge_seams", text="Seams")
+
+            sub = split.column()
+            if not with_freestyle:
+                sub.prop(data, "show_edge_seams", text="Seams")
+            sub.prop(data, "show_edge_sharp", text="Sharp", text_ctxt=i18n_contexts.plural)
+            col.prop(data, "show_edge_bevel_weight", text="Bevel")
+            if with_freestyle:
+                sub.prop(data, "show_freestyle_edge_marks", text="Edge Marks")
+                sub.prop(data, "show_freestyle_face_marks", text="Face Marks")
+
+            col.separator()
+            split = col.split()
+            sub = split.column()
+            sub.label(text="Edge Info:")
+            sub.prop(data, "show_extra_edge_length", text="Length")
+            sub.prop(data, "show_extra_edge_angle", text="Angle")
+            sub = split.column()
+            sub.label(text="Face Info:")
+            sub.prop(data, "show_extra_face_area", text="Area")
+            sub.prop(data, "show_extra_face_angle", text="Angle")
+            if bpy.app.debug:
+                sub.prop(data, "show_extra_indices", text="Indices")
+
+            col.prop(data, "show_statvis", text="Mesh Analysis")
+            sub = col.column()
+            sub.active = data.show_statvis
+            sub.prop(statvis, "type")
+            statvis_type = statvis.type
+            if statvis_type == 'OVERHANG':
+                row = sub.row(align=True)
+                row.prop(statvis, "overhang_min", text="")
+                row.prop(statvis, "overhang_max", text="")
+                layout.row().prop(statvis, "overhang_axis", expand=True)
+            elif statvis_type == 'THICKNESS':
+                row = sub.row(align=True)
+                row.prop(statvis, "thickness_min", text="")
+                row.prop(statvis, "thickness_max", text="")
+                layout.prop(statvis, "thickness_samples")
+            elif statvis_type == 'INTERSECT':
+                pass
+            elif statvis_type == 'DISTORT':
+                row = sub.row(align=True)
+                row.prop(statvis, "distort_min", text="")
+                row.prop(statvis, "distort_max", text="")
+            elif statvis_type == 'SHARP':
+                row = sub.row(align=True)
+                row.prop(statvis, "sharp_min", text="")
+                row.prop(statvis, "sharp_max", text="")
+
+        elif context.mode == 'EDIT_CURVE':
+            data = context.active_object.data
+            col.separator()
+            col.label(text="Edit Curve:")
+            row = col.row()
+            row.prop(data, "show_handles", text="Handles")
+            row.prop(data, "show_normal_face", text="Normals")
+
         elif context.mode == 'POSE':
             col.separator()
             col.label(text="Pose Mode:")
@@ -3737,157 +3792,6 @@ class VIEW3D_PT_view3d_stereo(Panel):
         split.prop(view, "stereo_3d_volume_alpha", text="Alpha")
 
 
-class VIEW3D_PT_view3d_motion_tracking(Panel):
-    bl_space_type = 'VIEW_3D'
-    bl_region_type = 'UI'
-    bl_label = "Motion Tracking"
-    bl_options = {'DEFAULT_CLOSED'}
-
-    @classmethod
-    def poll(cls, context):
-        view = context.space_data
-        return (view)
-
-    def draw_header(self, context):
-        view = context.space_data
-
-        self.layout.prop(view, "show_reconstruction", text="")
-
-    def draw(self, context):
-        layout = self.layout
-
-        view = context.space_data
-
-        col = layout.column()
-        col.active = view.show_reconstruction
-        col.prop(view, "show_camera_path", text="Camera Path")
-        col.prop(view, "show_bundle_names", text="3D Marker Names")
-        col.label(text="Track Type and Size:")
-        row = col.row(align=True)
-        row.prop(view, "tracks_draw_type", text="")
-        row.prop(view, "tracks_draw_size", text="")
-
-
-class VIEW3D_PT_view3d_meshdisplay(Panel):
-    bl_space_type = 'VIEW_3D'
-    bl_region_type = 'UI'
-    bl_label = "Mesh Display"
-
-    @classmethod
-    def poll(cls, context):
-        # The active object check is needed because of local-mode
-        return (context.active_object and (context.mode == 'EDIT_MESH'))
-
-    def draw(self, context):
-        layout = self.layout
-        with_freestyle = bpy.app.build_options.freestyle
-
-        mesh = context.active_object.data
-        scene = context.scene
-
-        split = layout.split()
-
-        col = split.column()
-        col.label(text="Overlays:")
-        col.prop(mesh, "show_faces", text="Faces")
-        col.prop(mesh, "show_edges", text="Edges")
-        col.prop(mesh, "show_edge_crease", text="Creases")
-        if with_freestyle:
-            col.prop(mesh, "show_edge_seams", text="Seams")
-
-        col = split.column()
-        col.label()
-        if not with_freestyle:
-            col.prop(mesh, "show_edge_seams", text="Seams")
-        col.prop(mesh, "show_edge_sharp", text="Sharp", text_ctxt=i18n_contexts.plural)
-        col.prop(mesh, "show_edge_bevel_weight", text="Bevel")
-        if with_freestyle:
-            col.prop(mesh, "show_freestyle_edge_marks", text="Edge Marks")
-            col.prop(mesh, "show_freestyle_face_marks", text="Face Marks")
-
-        col = layout.column()
-
-        col.separator()
-        split = layout.split()
-        col = split.column()
-        col.label(text="Edge Info:")
-        col.prop(mesh, "show_extra_edge_length", text="Length")
-        col.prop(mesh, "show_extra_edge_angle", text="Angle")
-        col = split.column()
-        col.label(text="Face Info:")
-        col.prop(mesh, "show_extra_face_area", text="Area")
-        col.prop(mesh, "show_extra_face_angle", text="Angle")
-        if bpy.app.debug:
-            layout.prop(mesh, "show_extra_indices", text="Indices")
-
-
-class VIEW3D_PT_view3d_meshstatvis(Panel):
-    bl_space_type = 'VIEW_3D'
-    bl_region_type = 'UI'
-    bl_label = "Mesh Analysis"
-
-    @classmethod
-    def poll(cls, context):
-        # The active object check is needed because of local-mode
-        return (context.active_object and (context.mode == 'EDIT_MESH'))
-
-    def draw_header(self, context):
-        mesh = context.active_object.data
-
-        self.layout.prop(mesh, "show_statvis", text="")
-
-    def draw(self, context):
-        layout = self.layout
-
-        mesh = context.active_object.data
-        statvis = context.tool_settings.statvis
-        layout.active = mesh.show_statvis
-
-        layout.prop(statvis, "type")
-        statvis_type = statvis.type
-        if statvis_type == 'OVERHANG':
-            row = layout.row(align=True)
-            row.prop(statvis, "overhang_min", text="")
-            row.prop(statvis, "overhang_max", text="")
-            layout.row().prop(statvis, "overhang_axis", expand=True)
-        elif statvis_type == 'THICKNESS':
-            row = layout.row(align=True)
-            row.prop(statvis, "thickness_min", text="")
-            row.prop(statvis, "thickness_max", text="")
-            layout.prop(statvis, "thickness_samples")
-        elif statvis_type == 'INTERSECT':
-            pass
-        elif statvis_type == 'DISTORT':
-            row = layout.row(align=True)
-            row.prop(statvis, "distort_min", text="")
-            row.prop(statvis, "distort_max", text="")
-        elif statvis_type == 'SHARP':
-            row = layout.row(align=True)
-            row.prop(statvis, "sharp_min", text="")
-            row.prop(statvis, "sharp_max", text="")
-
-
-class VIEW3D_PT_view3d_curvedisplay(Panel):
-    bl_space_type = 'VIEW_3D'
-    bl_region_type = 'UI'
-    bl_label = "Curve Display"
-
-    @classmethod
-    def poll(cls, context):
-        editmesh = context.mode == 'EDIT_CURVE'
-        return (editmesh)
-
-    def draw(self, context):
-        layout = self.layout
-
-        curve = context.active_object.data
-
-        col = layout.column()
-        row = col.row()
-        row.prop(curve, "show_handles", text="Handles")
-        row.prop(curve, "show_normal_face", text="Normals")
-
-
 class VIEW3D_PT_transform_orientations(Panel):
     bl_space_type = 'VIEW_3D'
     bl_region_type = 'UI'
@@ -4086,13 +3990,8 @@ classes = (
     VIEW3D_PT_grease_pencil_palettecolor,
     VIEW3D_PT_view3d_properties,
     VIEW3D_PT_view3d_cursor,
-    VIEW3D_PT_view3d_name,
     VIEW3D_PT_quad_view,
     VIEW3D_PT_view3d_stereo,
-    VIEW3D_PT_view3d_motion_tracking,
-    VIEW3D_PT_view3d_meshdisplay,
-    VIEW3D_PT_view3d_meshstatvis,
-    VIEW3D_PT_view3d_curvedisplay,
     VIEW3D_PT_shading,
     VIEW3D_PT_overlay,
     VIEW3D_PT_transform_orientations,