GPv3: Menus updates
Adds context menus and updates existing menus with newly added operators - Updates menu texts and separators - Add Point Menu - Add Stroke and Point Context Menu Pull Request: https://projects.blender.org/blender/blender/pulls/114172
This commit is contained in:
committed by
Antonio Vazquez
parent
d7c2ef16fe
commit
fbb3726f68
@@ -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
|
||||
|
||||
@@ -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'}:
|
||||
@@ -5022,6 +5023,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)",
|
||||
@@ -5823,13 +5826,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"
|
||||
@@ -8040,6 +8049,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")
|
||||
|
||||
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:
|
||||
@@ -8730,9 +8798,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,
|
||||
|
||||
Reference in New Issue
Block a user