UI: Move paint context menus to panels
authorCampbell Barton <ideasman42@gmail.com>
Mon, 4 Mar 2019 09:10:11 +0000 (20:10 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 4 Mar 2019 09:13:07 +0000 (20:13 +1100)
See proposal: T62130

release/scripts/presets/keyconfig/keymap_data/blender_default.py
release/scripts/startup/bl_ui/space_view3d.py

index 9c3c2b2..72d57f8 100644 (file)
@@ -3605,7 +3605,7 @@ def km_image_paint(params):
         op_menu("VIEW3D_MT_angle_control", {"type": 'R', "value": 'PRESS'}),
         ("wm.context_menu_enum", {"type": 'E', "value": 'PRESS'},
          {"properties": [("data_path", 'tool_settings.image_paint.brush.stroke_method')]}),
-        op_menu("VIEW3D_MT_paint_texture_specials", params.context_menu_event),
+        op_panel("VIEW3D_PT_paint_texture_specials", params.context_menu_event),
     ])
 
     return keymap
@@ -3648,7 +3648,7 @@ def km_vertex_paint(params):
         op_menu("VIEW3D_MT_angle_control", {"type": 'R', "value": 'PRESS'}),
         ("wm.context_menu_enum", {"type": 'E', "value": 'PRESS'},
          {"properties": [("data_path", 'tool_settings.vertex_paint.brush.stroke_method')]}),
-        op_menu("VIEW3D_MT_paint_vertex_specials", params.context_menu_event),
+        op_panel("VIEW3D_PT_paint_vertex_specials", params.context_menu_event),
     ])
 
     return keymap
@@ -3686,7 +3686,7 @@ def km_weight_paint(params):
          {"properties": [("data_path", 'weight_paint_object.data.use_paint_mask_vertex')]}),
         ("wm.context_toggle", {"type": 'S', "value": 'PRESS', "shift": True},
          {"properties": [("data_path", 'tool_settings.weight_paint.brush.use_smooth_stroke')]}),
-        op_menu("VIEW3D_MT_paint_weight_specials", params.context_menu_event),
+        op_panel("VIEW3D_PT_paint_weight_specials", params.context_menu_event),
     ])
 
     if params.select_mouse == 'LEFTMOUSE':
@@ -3786,7 +3786,7 @@ def km_sculpt(params):
         ("wm.context_toggle", {"type": 'S', "value": 'PRESS', "shift": True},
          {"properties": [("data_path", 'tool_settings.sculpt.brush.use_smooth_stroke')]}),
         op_menu("VIEW3D_MT_angle_control", {"type": 'R', "value": 'PRESS'}),
-        op_menu("VIEW3D_MT_sculpt_specials", params.context_menu_event),
+        op_panel("VIEW3D_PT_sculpt_specials", params.context_menu_event),
     ])
 
     return keymap
index 0aa8bd1..cff9cb4 100644 (file)
@@ -2257,34 +2257,6 @@ class VIEW3D_MT_paint_vertex(Menu):
         layout.operator("paint.vertex_color_brightness_contrast", text="Bright/Contrast")
 
 
-class VIEW3D_MT_paint_vertex_specials(Menu):
-    bl_label = "Vertex Paint Context Menu"
-
-    def draw(self, context):
-        layout = self.layout
-        # TODO: populate with useful items.
-        layout.operator("paint.vertex_color_set")
-        layout.operator("paint.vertex_color_smooth")
-        layout.operator("paint.vertex_color_dirt")
-        layout.operator("paint.vertex_color_from_weight")
-
-        layout.separator()
-
-        layout.operator("paint.vertex_color_invert", text="Invert")
-        layout.operator("paint.vertex_color_levels", text="Levels")
-        layout.operator("paint.vertex_color_hsv", text="Hue Saturation Value")
-        layout.operator("paint.vertex_color_brightness_contrast", text="Bright/Contrast")
-
-
-class VIEW3D_MT_paint_texture_specials(Menu):
-    bl_label = "Texture Paint Context Menu"
-
-    def draw(self, context):
-        layout = self.layout
-        # TODO: populate with useful items.
-        layout.operator("image.save_dirty")
-
-
 class VIEW3D_MT_hook(Menu):
     bl_label = "Hooks"
 
@@ -2382,29 +2354,6 @@ class VIEW3D_MT_paint_weight(Menu):
         self.draw_generic(self.layout, is_editmode=False)
 
 
-class VIEW3D_MT_paint_weight_specials(Menu):
-    bl_label = "Weights Context Menu"
-
-    def draw(self, context):
-        layout = self.layout
-        # TODO: populate with useful items.
-        layout.operator("paint.weight_set")
-        layout.separator()
-        layout.operator("object.vertex_group_normalize", text="Normalize")
-        layout.operator("object.vertex_group_clean", text="Clean")
-
-        layout.separator()
-
-        layout.operator("object.vertex_group_quantize", text="Quantize")
-        layout.operator("object.vertex_group_levels", text="Levels")
-        layout.operator("object.vertex_group_smooth", text="Smooth")
-
-        layout.separator()
-
-        layout.operator("object.vertex_group_limit_total", text="Limit Total")
-        layout.operator("object.vertex_group_fix", text="Fix Deforms")
-
-
 class VIEW3D_MT_sculpt(Menu):
     bl_label = "Sculpt"
 
@@ -2438,16 +2387,6 @@ class VIEW3D_MT_sculpt(Menu):
         layout.prop(sculpt, "show_mask")
 
 
-class VIEW3D_MT_sculpt_specials(Menu):
-    bl_label = "Sculpt Context Menu"
-
-    def draw(self, context):
-        layout = self.layout
-        # TODO: populate with useful items.
-        layout.operator("object.shade_smooth")
-        layout.operator("object.shade_flat")
-
-
 class VIEW3D_MT_hide_mask(Menu):
     bl_label = "Hide/Mask"
 
@@ -5752,6 +5691,79 @@ class VIEW3D_MT_gpencil_sculpt_specials(Menu):
         layout.operator("gpencil.stroke_simplify", text="Simplify Adaptive")
 
 
+class VIEW3D_PT_paint_vertex_specials(Panel):
+    # Only for popover, these are dummy values.
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'WINDOW'
+    bl_label = "Vertex Paint Context Menu"
+
+    def draw(self, context):
+        layout = self.layout
+        # TODO: populate with useful items.
+        layout.operator("paint.vertex_color_set")
+        layout.operator("paint.vertex_color_smooth")
+        layout.operator("paint.vertex_color_dirt")
+        layout.operator("paint.vertex_color_from_weight")
+
+        layout.separator()
+
+        layout.operator("paint.vertex_color_invert", text="Invert")
+        layout.operator("paint.vertex_color_levels", text="Levels")
+        layout.operator("paint.vertex_color_hsv", text="Hue Saturation Value")
+        layout.operator("paint.vertex_color_brightness_contrast", text="Bright/Contrast")
+
+
+class VIEW3D_PT_paint_texture_specials(Panel):
+    # Only for popover, these are dummy values.
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'WINDOW'
+    bl_label = "Texture Paint Context Menu"
+
+    def draw(self, context):
+        layout = self.layout
+        # TODO: populate with useful items.
+        layout.operator("image.save_dirty")
+
+
+class VIEW3D_PT_paint_weight_specials(Panel):
+    # Only for popover, these are dummy values.
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'WINDOW'
+    bl_label = "Weights Context Menu"
+
+    def draw(self, context):
+        layout = self.layout
+        # TODO: populate with useful items.
+        layout.operator("paint.weight_set")
+        layout.separator()
+        layout.operator("object.vertex_group_normalize", text="Normalize")
+        layout.operator("object.vertex_group_clean", text="Clean")
+
+        layout.separator()
+
+        layout.operator("object.vertex_group_quantize", text="Quantize")
+        layout.operator("object.vertex_group_levels", text="Levels")
+        layout.operator("object.vertex_group_smooth", text="Smooth")
+
+        layout.separator()
+
+        layout.operator("object.vertex_group_limit_total", text="Limit Total")
+        layout.operator("object.vertex_group_fix", text="Fix Deforms")
+
+
+class VIEW3D_PT_sculpt_specials(Panel):
+    # Only for popover, these are dummy values.
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'WINDOW'
+    bl_label = "Sculpt Context Menu"
+
+    def draw(self, context):
+        layout = self.layout
+        # TODO: populate with useful items.
+        layout.operator("object.shade_smooth")
+        layout.operator("object.shade_flat")
+
+
 class TOPBAR_PT_gpencil_materials(GreasePencilMaterialsPanel, Panel):
     bl_space_type = 'VIEW_3D'
     bl_region_type = 'HEADER'
@@ -5829,14 +5841,10 @@ classes = (
     VIEW3D_MT_brush,
     VIEW3D_MT_brush_paint_modes,
     VIEW3D_MT_paint_vertex,
-    VIEW3D_MT_paint_vertex_specials,
-    VIEW3D_MT_paint_texture_specials,
     VIEW3D_MT_hook,
     VIEW3D_MT_vertex_group,
     VIEW3D_MT_paint_weight,
-    VIEW3D_MT_paint_weight_specials,
     VIEW3D_MT_sculpt,
-    VIEW3D_MT_sculpt_specials,
     VIEW3D_MT_hide_mask,
     VIEW3D_MT_particle,
     VIEW3D_MT_particle_specials,
@@ -5880,6 +5888,9 @@ classes = (
     VIEW3D_MT_gpencil_animation,
     VIEW3D_MT_gpencil_simplify,
     VIEW3D_MT_gpencil_copy_layer,
+    VIEW3D_MT_gpencil_autoweights,
+    VIEW3D_MT_gpencil_edit_specials,
+    VIEW3D_MT_gpencil_sculpt_specials,
     VIEW3D_MT_edit_curve,
     VIEW3D_MT_edit_curve_ctrlpoints,
     VIEW3D_MT_edit_curve_segments,
@@ -5917,9 +5928,6 @@ classes = (
     VIEW3D_PT_grease_pencil,
     VIEW3D_PT_annotation_onion,
     VIEW3D_PT_gpencil_multi_frame,
-    VIEW3D_MT_gpencil_autoweights,
-    VIEW3D_MT_gpencil_edit_specials,
-    VIEW3D_MT_gpencil_sculpt_specials,
     VIEW3D_PT_quad_view,
     VIEW3D_PT_view3d_stereo,
     VIEW3D_PT_shading,
@@ -5952,6 +5960,10 @@ classes = (
     VIEW3D_PT_transform_orientations,
     VIEW3D_PT_overlay_gpencil_options,
     VIEW3D_PT_context_properties,
+    VIEW3D_PT_paint_vertex_specials,
+    VIEW3D_PT_paint_texture_specials,
+    VIEW3D_PT_paint_weight_specials,
+    VIEW3D_PT_sculpt_specials,
     TOPBAR_PT_gpencil_materials,
     TOPBAR_PT_annotation_layers,
 )