[Bf-blender-cvs] [cd32acefec3] master: UI: Add brush controls to contextual menu for GPencil Draw and Sculpt modes
William Reynish
noreply at git.blender.org
Mon Mar 11 15:51:55 CET 2019
Commit: cd32acefec3977786a2ef1c2f27d85d1a65f8c61
Author: William Reynish
Date: Mon Mar 11 15:51:54 2019 +0100
Branches: master
https://developer.blender.org/rBcd32acefec3977786a2ef1c2f27d85d1a65f8c61
UI: Add brush controls to contextual menu for GPencil Draw and Sculpt modes
Maniphest task: T62130
===================================================================
M release/scripts/presets/keyconfig/keymap_data/blender_default.py
M release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M release/scripts/startup/bl_ui/space_view3d.py
===================================================================
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 793488761f9..474200c5754 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -3047,7 +3047,7 @@ def km_grease_pencil_stroke_paint_mode(params):
("wm.radial_control", {"type": 'F', "value": 'PRESS'},
{"properties": [("data_path_primary", 'tool_settings.gpencil_paint.brush.size')]}),
# Draw context menu
- op_menu("GPENCIL_MT_gpencil_draw_specials", params.context_menu_event),
+ op_panel("VIEW3D_PT_gpencil_draw_specials", params.context_menu_event),
# Draw delete menu
op_menu("GPENCIL_MT_gpencil_draw_delete", {"type": 'X', "value": 'PRESS'}),
])
@@ -3187,7 +3187,7 @@ def km_grease_pencil_stroke_sculpt_mode(params):
("wm.radial_control", {"type": 'F', "value": 'PRESS'},
{"properties": [("data_path_primary", 'tool_settings.gpencil_sculpt.brush.size')]}),
# Context menu
- op_menu("VIEW3D_MT_gpencil_sculpt_specials", params.context_menu_event),
+ op_panel("VIEW3D_PT_gpencil_sculpt_specials", params.context_menu_event),
# Display
*_grease_pencil_display(),
])
diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 68d1c179462..9d2d6e927e9 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -616,24 +616,6 @@ class GPENCIL_MT_separate(Menu):
layout.operator("gpencil.stroke_separate", text="Active Layer").mode = 'LAYER'
-class GPENCIL_MT_gpencil_draw_specials(Menu):
- bl_label = "Draw Context Menu"
-
- def draw(self, context):
- layout = self.layout
-
- layout.operator_context = 'INVOKE_REGION_WIN'
-
- layout.operator("gpencil.blank_frame_add")
- layout.operator("gpencil.frame_duplicate", text="Duplicate Active Frame")
- layout.operator("gpencil.frame_duplicate", text="Duplicate Active Frame All Layers").mode = 'ALL'
-
- layout.separator()
-
- layout.operator("gpencil.active_frames_delete_all")
- layout.operator("gpencil.delete", text="Delete Active Frame").type = 'FRAME'
-
-
class GPENCIL_MT_gpencil_draw_delete(Menu):
bl_label = "GPencil Draw Delete"
@@ -960,7 +942,6 @@ classes = (
GPENCIL_MT_separate,
GPENCIL_MT_cleanup,
- GPENCIL_MT_gpencil_draw_specials,
GPENCIL_MT_gpencil_draw_delete,
GPENCIL_UL_annotation_layer,
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index a2484a39281..472066702a4 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -5655,36 +5655,37 @@ class VIEW3D_MT_gpencil_edit_specials(Menu):
layout.menu("VIEW3D_MT_edit_gpencil_delete")
-class VIEW3D_MT_gpencil_sculpt_specials(Menu):
+class VIEW3D_PT_gpencil_sculpt_specials(Panel):
+ bl_space_type = 'VIEW_3D'
+ bl_region_type = 'WINDOW'
bl_label = "Sculpt Context Menu"
def draw(self, context):
- layout = self.layout
-
- layout.operator_context = 'INVOKE_REGION_WIN'
-
- # Add
- layout.operator("gpencil.stroke_subdivide", text="Subdivide")
+ brush = context.tool_settings.gpencil_sculpt.brush
- layout.separator()
+ layout = self.layout
- # Modify
- layout.menu("VIEW3D_MT_assign_material")
+ if context.mode == 'WEIGHT_GPENCIL':
+ layout.prop(brush, "weight")
+ layout.prop(brush, "size", slider=True)
+ layout.prop(brush, "strength")
- layout.separator()
- layout.operator("gpencil.frame_duplicate", text="Duplicate Active Frame")
- layout.operator("gpencil.frame_duplicate", text="Duplicate Active Frame All Layers").mode = 'ALL'
+class VIEW3D_PT_gpencil_draw_specials(Panel):
+ bl_space_type = 'VIEW_3D'
+ bl_region_type = 'WINDOW'
+ bl_label = "Draw Context Menu"
- if context.mode == 'WEIGHT_GPENCIL':
- layout.separator()
- layout.menu("VIEW3D_MT_gpencil_autoweights")
+ def draw(self, context):
+ brush = context.tool_settings.gpencil_paint.brush
+ gp_settings = brush.gpencil_settings
- layout.separator()
+ layout = self.layout
- # Remove
- layout.operator("gpencil.stroke_simplify_fixed", text="Simplify")
- layout.operator("gpencil.stroke_simplify", text="Simplify Adaptive")
+ if brush.gpencil_tool not in {'FILL', 'CUTTER'}:
+ layout.prop(brush, "size", slider=True)
+ if brush.gpencil_tool not in {'ERASE', 'FILL', 'CUTTER'}:
+ layout.prop(gp_settings, "pen_strength")
class VIEW3D_PT_paint_vertex_specials(Panel):
@@ -5926,7 +5927,6 @@ classes = (
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,
@@ -5999,6 +5999,8 @@ classes = (
VIEW3D_PT_paint_vertex_specials,
VIEW3D_PT_paint_texture_specials,
VIEW3D_PT_paint_weight_specials,
+ VIEW3D_PT_gpencil_sculpt_specials,
+ VIEW3D_PT_gpencil_draw_specials,
VIEW3D_PT_sculpt_specials,
TOPBAR_PT_gpencil_materials,
TOPBAR_PT_annotation_layers,
More information about the Bf-blender-cvs
mailing list