[Bf-blender-cvs] [8c7cbad5427] master: Gpencil: Splitting and rearranging Context Menu in Edit Mode
Matias Mendiola
noreply at git.blender.org
Mon Aug 26 20:53:20 CEST 2019
Commit: 8c7cbad5427419dc33b0648dfaff6a0da5b0f5cd
Author: Matias Mendiola
Date: Mon Aug 26 20:31:16 2019 +0200
Branches: master
https://developer.blender.org/rB8c7cbad5427419dc33b0648dfaff6a0da5b0f5cd
Gpencil: Splitting and rearranging Context Menu in Edit Mode
Following the changes in the Edit Mode menus on the header, this patch split the current context menus into Point and Stroke and also rearrange the operators.
{F7704949}
Reviewers: antoniov, pepeland, billreynish
Reviewed By: billreynish
Tags: #bf_blender, #grease_pencil
Differential Revision: https://developer.blender.org/D5596
===================================================================
M release/scripts/startup/bl_ui/space_view3d.py
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 22c1a74b7e4..694acbf145c 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -6276,66 +6276,123 @@ class VIEW3D_PT_gpencil_multi_frame(Panel):
class VIEW3D_MT_gpencil_edit_context_menu(Menu):
- bl_label = "Edit Context Menu"
+ bl_label = ""
def draw(self, context):
- layout = self.layout
+
+ is_point_mode = context.tool_settings.gpencil_selectmode_edit == 'POINT'
+ is_stroke_mode = context.tool_settings.gpencil_selectmode_edit == 'STROKE'
+ is_segment_mode = context.tool_settings.gpencil_selectmode_edit == 'SEGMENT'
+
is_3d_view = context.space_data.type == 'VIEW_3D'
+ layout = self.layout
+
layout.operator_context = 'INVOKE_REGION_WIN'
- # Add
- layout.operator("gpencil.stroke_subdivide", text="Subdivide")
+ row = layout.row()
- layout.separator()
+ if is_point_mode or is_segment_mode:
+ col = row.column()
- # Transform
- layout.operator("transform.transform", text="Shrink/Fatten").mode = 'GPENCIL_SHRINKFATTEN'
- layout.operator("gpencil.stroke_smooth", text="Smooth")
- layout.operator("gpencil.stroke_trim", text="Trim")
+ col.label(text="Point Context Menu", icon='GP_SELECT_POINTS')
+ col.separator()
- layout.separator()
+ # Additive Operators
+ col.operator("gpencil.stroke_subdivide", text="Subdivide").only_selected = True
- # Modify
- layout.menu("VIEW3D_MT_assign_material")
- layout.operator_menu_enum("gpencil.stroke_arrange", "direction", text="Arrange Strokes")
- layout.operator("gpencil.stroke_flip", text="Flip Direction")
- layout.operator_menu_enum("gpencil.stroke_caps_set", text="Toggle Caps", property="type")
+ col.separator()
- layout.separator()
+ col.operator("gpencil.extrude_move", text="Extrude Points")
- layout.operator("gpencil.duplicate_move", text="Duplicate")
- layout.operator("gpencil.copy", text="Copy", icon='COPYDOWN')
- layout.operator("gpencil.paste", text="Paste", icon='PASTEDOWN').type = 'ACTIVE'
- layout.operator("gpencil.paste", text="Paste by Layer").type = 'LAYER'
- layout.menu("VIEW3D_MT_gpencil_copy_layer")
- layout.operator("gpencil.frame_duplicate", text="Duplicate Active Frame")
- layout.operator("gpencil.frame_duplicate", text="Duplicate Active Frame All Layers").mode = 'ALL'
+ col.separator()
- layout.separator()
+ # Deform Operators
+ col.operator("gpencil.stroke_smooth", text="Smooth Points").only_selected = True
+ col.operator("transform.bend", text="Bend")
+ col.operator("transform.shear", text="Shear")
+ col.operator("transform.tosphere", text="To Sphere")
+ col.operator("transform.transform", text="Shrink Fatten").mode = 'GPENCIL_SHRINKFATTEN'
- layout.operator("gpencil.stroke_join", text="Join").type = 'JOIN'
- layout.operator("gpencil.stroke_join", text="Join & Copy").type = 'JOINCOPY'
- layout.operator_menu_enum("gpencil.stroke_separate", "mode")
- layout.operator("gpencil.stroke_split", text="Split")
- op = layout.operator("gpencil.stroke_cyclical_set", text="Close")
- op.type = 'CLOSE'
- op.geometry = True
+ col.separator()
- layout.separator()
+ col.menu("VIEW3D_MT_mirror", text="Mirror Points")
+ col.menu("VIEW3D_MT_snap", text="Snap Points")
- layout.menu("VIEW3D_MT_mirror")
- layout.menu("VIEW3D_MT_snap")
+ col.separator()
- layout.separator()
+ # Duplicate operators
+ col.operator("gpencil.duplicate_move", text="Duplicate")
+ col.operator("gpencil.copy", text="Copy", icon='COPYDOWN')
+ col.operator("gpencil.paste", text="Paste", icon='PASTEDOWN').type = 'ACTIVE'
+ col.operator("gpencil.paste", text="Paste by Layer").type = 'LAYER'
- # Remove
- if is_3d_view:
- layout.menu("GPENCIL_MT_cleanup")
+ col.separator()
- layout.menu("VIEW3D_MT_gpencil_simplify")
- layout.operator("gpencil.stroke_merge", text="Merge")
- layout.menu("VIEW3D_MT_edit_gpencil_delete")
+ # Removal Operators
+ col.operator("gpencil.stroke_merge", text="Merge Points")
+ col.operator("gpencil.stroke_merge_by_distance").use_unselected = False
+ col.operator("gpencil.stroke_split", text="Split")
+ col.operator("gpencil.stroke_separate", text="Separate").mode = 'POINT'
+
+ col.separator()
+
+ col.operator("gpencil.delete", text="Delete Points").type = 'POINTS'
+ col.operator("gpencil.dissolve", text="Dissolve Points").type = 'POINTS'
+ col.operator("gpencil.dissolve", text="Dissolve Between").type = 'BETWEEN'
+ col.operator("gpencil.dissolve", text="Dissolve Unselected").type = 'UNSELECTED'
+
+ if is_stroke_mode:
+
+ col = row.column()
+ col.label(text="Stroke Context Menu", icon='GP_SELECT_STROKES')
+ col.separator()
+
+ # Main Strokes Operators
+ col.operator("gpencil.stroke_subdivide", text="Subdivide").only_selected = False
+ col.menu("VIEW3D_MT_gpencil_simplify")
+ col.operator("gpencil.stroke_trim", text="Trim")
+
+ col.separator()
+
+ col.operator("gpencil.stroke_smooth", text="Smooth Stroke").only_selected = False
+ col.operator("transform.transform", text="Shrink Fatten").mode = 'GPENCIL_SHRINKFATTEN'
+
+ col.separator()
+
+ # Layer and Materials operators
+ col.operator_menu_enum("gpencil.move_to_layer", "layer", text="Move to Layer")
+ col.menu("VIEW3D_MT_assign_material")
+ col.operator_menu_enum("gpencil.stroke_arrange", "direction", text="Arrange Strokes")
+
+ col.separator()
+
+ col.menu("VIEW3D_MT_mirror", text="Mirror Stroke")
+ col.menu("VIEW3D_MT_snap", text="Snap Stroke")
+
+ col.separator()
+
+ # Duplicate operators
+ col.operator("gpencil.duplicate_move", text="Duplicate")
+ col.operator("gpencil.copy", text="Copy", icon='COPYDOWN')
+ col.operator("gpencil.paste", text="Paste", icon='PASTEDOWN').type = 'ACTIVE'
+ col.operator("gpencil.paste", text="Paste by Layer").type = 'LAYER'
+
+ col.separator()
+
+ # Removal Operators
+ col.operator("gpencil.stroke_merge_by_distance").use_unselected = True
+ col.operator_menu_enum("gpencil.stroke_join", "type", text="Join...")
+ col.operator("gpencil.stroke_split", text="Split")
+ col.operator("gpencil.stroke_separate", text="Separate").mode = 'STROKE'
+
+ col.separator()
+
+ col.operator("gpencil.delete", text="Delete Strokes").type = 'STROKES'
+
+ col.separator()
+
+ col.operator("gpencil.reproject", text="Reproject Strokes")
class VIEW3D_PT_gpencil_sculpt_context_menu(Panel):
More information about the Bf-blender-cvs
mailing list