Keymap: add context menus for paint modes

These are place-holders with only a few items in each, as with the rest
of the context menus they need to be populated & organized.

Weight Paint 'weight' shortcut has been changed from W to Ctrl-F,
to co-exist w/ the context menu shortcut.
This commit is contained in:
Campbell Barton 2019-02-21 15:43:39 +11:00
parent a0881a4e94
commit e644da1f8e
2 changed files with 55 additions and 4 deletions

View File

@ -3565,7 +3565,7 @@ def _template_paint_radial_control(paint, rotation=False, secondary_rotation=Fal
return items
def km_image_paint(_params):
def km_image_paint(params):
items = []
keymap = (
"Image Paint",
@ -3605,12 +3605,13 @@ 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),
])
return keymap
def km_vertex_paint(_params):
def km_vertex_paint(params):
items = []
keymap = (
"Vertex Paint",
@ -3647,6 +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),
])
return keymap
@ -3674,7 +3676,7 @@ def km_weight_paint(params):
("brush.scale_size", {"type": 'RIGHT_BRACKET', "value": 'PRESS'},
{"properties": [("scalar", 1.0 / 0.9)]}),
*_template_paint_radial_control("weight_paint"),
("wm.radial_control", {"type": 'W', "value": 'PRESS'},
("wm.radial_control", {"type": 'F', "value": 'PRESS', "ctrl": True},
radial_control_properties("weight_paint", 'weight', 'use_unified_weight')),
("wm.context_menu_enum", {"type": 'E', "value": 'PRESS'},
{"properties": [("data_path", 'tool_settings.vertex_paint.brush.stroke_method')]}),
@ -3684,6 +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),
])
if params.select_mouse == 'LEFTMOUSE':
@ -3695,7 +3698,7 @@ def km_weight_paint(params):
return keymap
def km_sculpt(_params):
def km_sculpt(params):
items = []
keymap = (
"Sculpt",
@ -3783,6 +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),
])
return keymap

View File

@ -2244,6 +2244,26 @@ 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.separator()
layout.operator("paint.vertex_color_smooth")
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"
@ -2341,6 +2361,19 @@ 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.operator("object.vertex_group_smooth", text="Smooth")
class VIEW3D_MT_sculpt(Menu):
bl_label = "Sculpt"
@ -2374,6 +2407,16 @@ 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"
@ -5753,10 +5796,14 @@ 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,