GPv3: Menus updates #114172

Merged
Antonio Vazquez merged 4 commits from mendio/blender:GPv3_Menus_updates into main 2023-10-26 16:52:38 +02:00
2 changed files with 78 additions and 4 deletions

View File

@ -4626,6 +4626,10 @@ def km_grease_pencil_edit(params):
("grease_pencil.cyclical_set", {"type": 'F', "value": 'PRESS'}, {"properties": [("type", "CLOSE")]}),
("grease_pencil.cyclical_set", {"type": 'C', "value": 'PRESS',
"alt": True}, {"properties": [("type", "TOGGLE")]}),
# Context menu
*_template_items_context_menu("VIEW3D_MT_greasepencil_edit_context_menu", params.context_menu_event),
])
return keymap

View File

@ -1153,6 +1153,7 @@ class VIEW3D_MT_editor_menus(Menu):
layout.template_node_operator_asset_root_items()
elif mode_string == 'EDIT_GREASE_PENCIL':
layout.menu("VIEW3D_MT_edit_greasepencil_stroke")
layout.menu("VIEW3D_MT_edit_greasepencil_point")
elif obj:
if mode_string not in {'PAINT_TEXTURE', 'SCULPT_CURVES'}:
@ -5017,6 +5018,8 @@ class VIEW3D_MT_edit_greasepencil_delete(Menu):
layout.operator_enum("grease_pencil.dissolve", "type")
layout.separator()
layout.operator(
"grease_pencil.delete_frame",
text="Delete Active Keyframe (Active Layer)",
@ -5807,9 +5810,9 @@ class VIEW3D_MT_edit_greasepencil(Menu):
layout = self.layout
layout.menu("VIEW3D_MT_transform")
layout.menu("VIEW3D_MT_mirror")
layout.separator()
layout.menu("VIEW3D_MT_edit_greasepencil_delete")
@ -5818,13 +5821,19 @@ class VIEW3D_MT_edit_greasepencil_stroke(Menu):
def draw(self, _context):
layout = self.layout
layout.operator("grease_pencil.stroke_smooth")
layout.operator("grease_pencil.stroke_simplify")
layout.operator("grease_pencil.stroke_simplify", text="Simplify")
layout.separator()
layout.operator("grease_pencil.cyclical_set", text="Toggle Cyclic").type='TOGGLE'
class VIEW3D_MT_edit_greasepencil_point(Menu):
bl_label = "Point"
def draw(self, _context):
layout = self.layout
layout.operator("grease_pencil.stroke_smooth", text="Smooth Points")
class VIEW3D_MT_edit_curves(Menu):
bl_label = "Curves"
@ -8035,6 +8044,65 @@ class VIEW3D_MT_gpencil_edit_context_menu(Menu):
col.operator("gpencil.reproject", text="Reproject")
class VIEW3D_MT_greasepencil_edit_context_menu(Menu):
bl_label = ""
def draw(self, context):
layout = self.layout
tool_settings = context.tool_settings
is_point_mode = tool_settings.gpencil_selectmode_edit == 'POINT'
is_stroke_mode = tool_settings.gpencil_selectmode_edit == 'STROKE'
layout.operator_context = 'INVOKE_REGION_WIN'
row = layout.row()
if is_point_mode:
col = row.column(align=True)
col.label(text="Point", icon='GP_SELECT_POINTS')
# Main Strokes Operators
col.operator("grease_pencil.stroke_simplify", text="Simplify")
col.separator()
# Deform Operators
col.operator("transform.tosphere", text="To Sphere")
col.operator("transform.shear", text="Shear")
col.operator("transform.bend", text="Bend")
col.operator("transform.push_pull", text="Push/Pull")
col.operator("transform.transform", text="Radius").mode = 'GPENCIL_SHRINKFATTEN'
col.operator("grease_pencil.stroke_smooth", text="Smooth Points")
col.separator()
col.menu("VIEW3D_MT_mirror", text="Mirror Points")
# Removal Operators
col.separator()
col.operator_enum("grease_pencil.dissolve", "type")
mendio marked this conversation as resolved
Review

The menus work but there is a warning.

image

The menus work but there is a warning. ![image](/attachments/c3ef6d80-4868-4914-8719-8e95dc21f74d)
if is_stroke_mode:
col = row.column(align=True)
col.label(text="Stroke", icon='GP_SELECT_STROKES')
# Main Strokes Operators
col.operator("grease_pencil.stroke_simplify", text="Simplify")
col.separator()
# Deform Operators
col.operator("grease_pencil.stroke_smooth", text="Smooth Points")
col.operator("transform.transform", text="Radius").mode = 'CURVE_SHRINKFATTEN'
col.separator()
col.menu("VIEW3D_MT_mirror")
def draw_gpencil_layer_active(context, layout):
gpl = context.active_gpencil_layer
if gpl:
@ -8725,9 +8793,11 @@ classes = (
VIEW3D_MT_gpencil_simplify,
VIEW3D_MT_gpencil_autoweights,
VIEW3D_MT_gpencil_edit_context_menu,
VIEW3D_MT_greasepencil_edit_context_menu,
VIEW3D_MT_edit_greasepencil,
VIEW3D_MT_edit_greasepencil_delete,
VIEW3D_MT_edit_greasepencil_stroke,
VIEW3D_MT_edit_greasepencil_point,
VIEW3D_MT_edit_greasepencil_animation,
VIEW3D_MT_edit_curve,
VIEW3D_MT_edit_curve_ctrlpoints,