diff options
author | Joshua Leung <aligorith@gmail.com> | 2015-12-13 11:03:13 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2015-12-13 11:03:13 +0300 |
commit | a1f87064c4c0cd9e8eafc19c599c4ad4ccdba49f (patch) | |
tree | d016e95050f10eda7bc44e1bdfa2f7c4fc0fc024 /release | |
parent | d9ee88d126ddb59b68d2561694b522a99e4923b6 (diff) |
Grease Pencil: Merge GPencil_Editing_Stage3 branch into master
This commit merges all the work done in the GPencil_Editing_Stage3 branch
as of ef2aecf2db981b5344e0d14e7f074f1742b0b2f7 into master. For more details
about the changes that this brings, see the WIP release notes:
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.77/GPencil
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_grease_pencil_common.py | 292 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_clip.py | 5 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_dopesheet.py | 13 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_image.py | 6 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_node.py | 6 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 117 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d_toolbar.py | 8 |
7 files changed, 374 insertions, 73 deletions
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 91a986d8e50..59c05c192fd 100644 --- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py +++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py @@ -22,23 +22,34 @@ from bpy.types import Menu, UIList -def gpencil_stroke_placement_settings(context, layout, gpd): +def gpencil_stroke_placement_settings(context, layout): + if context.space_data.type == 'VIEW_3D': + propname = "gpencil_stroke_placement_view3d" + elif context.space_data.type == 'SEQUENCE_EDITOR': + propname = "gpencil_stroke_placement_sequencer_preview" + elif context.space_data.type == 'IMAGE_EDITOR': + propname = "gpencil_stroke_placement_image_edit" + else: + propname = "gpencil_stroke_placement_view2d" + + ts = context.tool_settings + col = layout.column(align=True) col.label(text="Stroke Placement:") row = col.row(align=True) - row.prop_enum(gpd, "draw_mode", 'VIEW') - row.prop_enum(gpd, "draw_mode", 'CURSOR') + row.prop_enum(ts, propname, 'VIEW') + row.prop_enum(ts, propname, 'CURSOR') if context.space_data.type == 'VIEW_3D': row = col.row(align=True) - row.prop_enum(gpd, "draw_mode", 'SURFACE') - row.prop_enum(gpd, "draw_mode", 'STROKE') + row.prop_enum(ts, propname, 'SURFACE') + row.prop_enum(ts, propname, 'STROKE') row = col.row(align=False) - row.active = gpd.draw_mode in {'SURFACE', 'STROKE'} - row.prop(gpd, "use_stroke_endpoints") + row.active = getattr(ts, propname) in {'SURFACE', 'STROKE'} + row.prop(ts, "use_gpencil_stroke_endpoints") class GreasePencilDrawingToolsPanel: @@ -56,15 +67,19 @@ class GreasePencilDrawingToolsPanel: col.label(text="Draw:") row = col.row(align=True) - row.operator("gpencil.draw", text="Draw").mode = 'DRAW' - row.operator("gpencil.draw", text="Erase").mode = 'ERASER' + row.operator("gpencil.draw", icon='GREASEPENCIL', text="Draw").mode = 'DRAW' + row.operator("gpencil.draw", icon='FORCE_CURVE', text="Erase").mode = 'ERASER' # XXX: Needs a dedicated icon row = col.row(align=True) - row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT' - row.operator("gpencil.draw", text="Poly").mode = 'DRAW_POLY' + row.operator("gpencil.draw", icon='LINE_DATA', text="Line").mode = 'DRAW_STRAIGHT' + row.operator("gpencil.draw", icon='MESH_DATA', text="Poly").mode = 'DRAW_POLY' - row = col.row(align=True) - row.prop(context.tool_settings, "use_grease_pencil_sessions", text="Continuous Drawing") + sub = col.column(align=True) + sub.prop(context.tool_settings, "use_gpencil_additive_drawing", text="Additive Drawing") + sub.prop(context.tool_settings, "use_gpencil_continuous_drawing", text="Continuous Drawing") + + col.separator() + col.separator() if context.space_data.type in {'VIEW_3D', 'CLIP_EDITOR'}: col.separator() @@ -74,11 +89,20 @@ class GreasePencilDrawingToolsPanel: row.prop(context.tool_settings, "grease_pencil_source", expand=True) elif context.space_data.type == 'CLIP_EDITOR': row.prop(context.space_data, "grease_pencil_source", expand=True) + + col.separator() + col.separator() + + gpencil_stroke_placement_settings(context, col) gpd = context.gpencil_data + if gpd: - col.separator() - gpencil_stroke_placement_settings(context, col, gpd) + layout.separator() + layout.separator() + + col = layout.column(align=True) + col.prop(gpd, "use_stroke_edit_mode", text="Enable Editing", icon='EDIT', toggle=True) if context.space_data.type == 'VIEW_3D': col.separator() @@ -95,67 +119,103 @@ class GreasePencilStrokeEditPanel: bl_label = "Edit Strokes" bl_category = "Grease Pencil" bl_region_type = 'TOOLS' + bl_options = {'DEFAULT_CLOSED'} @classmethod def poll(cls, context): - return (context.gpencil_data is not None) + if context.gpencil_data is None: + return False + + gpd = context.gpencil_data + return bool(context.editable_gpencil_strokes) and bool(gpd.use_stroke_edit_mode) @staticmethod def draw(self, context): layout = self.layout - gpd = context.gpencil_data - edit_ok = bool(context.editable_gpencil_strokes) and bool(gpd.use_stroke_edit_mode) + layout.label(text="Select:") + col = layout.column(align=True) + col.operator("gpencil.select_all", text="Select All") + col.operator("gpencil.select_border") + col.operator("gpencil.select_circle") + + layout.separator() col = layout.column(align=True) - col.prop(gpd, "use_stroke_edit_mode", text="Enable Editing", icon='EDIT', toggle=True) + col.operator("gpencil.select_linked") + col.operator("gpencil.select_more") + col.operator("gpencil.select_less") - col.separator() + layout.separator() - col.label(text="Select:") - subcol = col.column(align=True) - subcol.active = edit_ok - subcol.operator("gpencil.select_all", text="Select All") - subcol.operator("gpencil.select_border") - subcol.operator("gpencil.select_circle") + layout.label(text="Edit:") + row = layout.row(align=True) + row.operator("gpencil.copy", text="Copy") + row.operator("gpencil.paste", text="Paste") - col.separator() + col = layout.column(align=True) + col.operator("gpencil.delete", text="Delete") + col.operator("gpencil.duplicate_move", text="Duplicate") + col.operator("transform.mirror", text="Mirror") - subcol = col.column(align=True) - subcol.active = edit_ok - subcol.operator("gpencil.select_linked") - subcol.operator("gpencil.select_more") - subcol.operator("gpencil.select_less") + layout.separator() - col.separator() + col = layout.column(align=True) + col.operator("transform.translate") # icon='MAN_TRANS' + col.operator("transform.rotate") # icon='MAN_ROT' + col.operator("transform.resize", text="Scale") # icon='MAN_SCALE' - col.label(text="Edit:") - row = col.row(align=True) - row.active = edit_ok - row.operator("gpencil.copy", text="Copy") - row.operator("gpencil.paste", text="Paste") + layout.separator() - subcol = col.column(align=True) - subcol.active = edit_ok - subcol.operator("gpencil.delete", text="Delete") - subcol.operator("gpencil.duplicate_move", text="Duplicate") - subcol.operator("transform.mirror", text="Mirror").gpencil_strokes = True + col = layout.column(align=True) + col.operator("transform.bend", text="Bend") + col.operator("transform.shear", text="Shear") + col.operator("transform.tosphere", text="To Sphere") - col.separator() - subcol = col.column(align=True) - subcol.active = edit_ok - subcol.operator("transform.translate").gpencil_strokes = True # icon='MAN_TRANS' - subcol.operator("transform.rotate").gpencil_strokes = True # icon='MAN_ROT' - subcol.operator("transform.resize", text="Scale").gpencil_strokes = True # icon='MAN_SCALE' +class GreasePencilStrokeSculptPanel: + # subclass must set + # bl_space_type = 'IMAGE_EDITOR' + bl_label = "Sculpt Strokes" + bl_category = "Grease Pencil" + bl_region_type = 'TOOLS' + bl_options = {'DEFAULT_CLOSED'} - col.separator() + @classmethod + def poll(cls, context): + if context.gpencil_data is None: + return False + + gpd = context.gpencil_data + return bool(context.editable_gpencil_strokes) and bool(gpd.use_stroke_edit_mode) + + @staticmethod + def draw(self, context): + layout = self.layout + + settings = context.tool_settings.gpencil_sculpt + tool = settings.tool + brush = settings.brush + + layout.column().prop(settings, "tool", expand=True) + + col = layout.column() + col.prop(brush, "size", slider=True) + row = col.row(align=True) + row.prop(brush, "strength", slider=True) + row.prop(brush, "use_pressure_strength", text="") + col.prop(brush, "use_falloff") + + layout.separator() + + if settings.tool in {'THICKNESS', 'PINCH', 'TWIST'}: + layout.row().prop(brush, "direction", expand=True) - subcol = col.column(align=True) - subcol.active = edit_ok - subcol.operator("transform.bend", text="Bend").gpencil_strokes = True - subcol.operator("transform.shear", text="Shear").gpencil_strokes = True - subcol.operator("transform.tosphere", text="To Sphere").gpencil_strokes = True + layout.separator() + layout.prop(settings, "use_select_mask") + + if settings.tool == 'SMOOTH': + layout.prop(brush, "affect_pressure") ############################### @@ -190,14 +250,14 @@ class GPENCIL_PIE_tool_palette(Menu): if gpd: if gpd.use_stroke_edit_mode and context.editable_gpencil_strokes: # S - Exit Edit Mode - pie.prop(gpd, "use_stroke_edit_mode", text="Exit Edit Mode", icon='EDIT') + pie.operator("gpencil.editmode_toggle", text="Exit Edit Mode", icon='EDIT') # N - Transforms col = pie.column() row = col.row(align=True) - row.operator("transform.translate", icon='MAN_TRANS').gpencil_strokes = True - row.operator("transform.rotate", icon='MAN_ROT').gpencil_strokes = True - row.operator("transform.resize", text="Scale", icon='MAN_SCALE').gpencil_strokes = True + row.operator("transform.translate", icon='MAN_TRANS') + row.operator("transform.rotate", icon='MAN_ROT') + row.operator("transform.resize", text="Scale", icon='MAN_SCALE') row = col.row(align=True) row.label("Proportional Edit:") row.prop(context.tool_settings, "proportional_edit", text="", icon_only=True) @@ -224,7 +284,7 @@ class GPENCIL_PIE_tool_palette(Menu): pie.operator("wm.call_menu_pie", text="More...").name = "GPENCIL_PIE_tools_more" else: # Toggle Edit Mode - pie.prop(gpd, "use_stroke_edit_mode", text="Enable Stroke Editing", icon='EDIT') + pie.operator("gpencil.editmode_toggle", text="Enable Stroke Editing", icon='EDIT') class GPENCIL_PIE_settings_palette(Menu): @@ -261,11 +321,15 @@ class GPENCIL_PIE_settings_palette(Menu): col.prop(gpl, "use_onion_skinning") # N - Active Layer - # XXX: this should show an operator to change the active layer instead col = pie.column() col.label("Active Layer: ") - col.prop(gpl, "info", text="") - # col.prop(gpd, "layers") + + row = col.row() + row.operator_context = 'EXEC_REGION_WIN' + row.operator_menu_enum("gpencil.layer_change", "layer", text="", icon='GREASEPENCIL') + row.prop(gpl, "info", text="") + row.operator("gpencil.layer_remove", text="", icon='X') + row = col.row() row.prop(gpl, "lock") row.prop(gpl, "hide") @@ -294,17 +358,82 @@ class GPENCIL_PIE_tools_more(Menu): col.operator("gpencil.select_more", icon='ZOOMIN') col.operator("gpencil.select_less", icon='ZOOMOUT') - pie.operator("transform.mirror", icon='MOD_MIRROR').gpencil_strokes = True - pie.operator("transform.bend", icon='MOD_SIMPLEDEFORM').gpencil_strokes = True - pie.operator("transform.shear", icon='MOD_TRIANGULATE').gpencil_strokes = True - pie.operator("transform.tosphere", icon='MOD_MULTIRES').gpencil_strokes = True + pie.operator("transform.mirror", icon='MOD_MIRROR') + pie.operator("transform.bend", icon='MOD_SIMPLEDEFORM') + pie.operator("transform.shear", icon='MOD_TRIANGULATE') + pie.operator("transform.tosphere", icon='MOD_MULTIRES') pie.operator("gpencil.convert", icon='OUTLINER_OB_CURVE', text="Convert...") pie.operator("wm.call_menu_pie", text="Back to Main Palette...").name = "GPENCIL_PIE_tool_palette" +class GPENCIL_PIE_sculpt(Menu): + """A pie menu for accessing Grease Pencil stroke sculpting settings""" + bl_label = "Grease Pencil Sculpt" + + @classmethod + def poll(cls, context): + gpd = context.gpencil_data + return bool(gpd and gpd.use_stroke_edit_mode and context.editable_gpencil_strokes) + + def draw(self, context): + layout = self.layout + + pie = layout.menu_pie() + + settings = context.tool_settings.gpencil_sculpt + brush = settings.brush + + # W - Launch Sculpt Mode + col = pie.column() + #col.label("Tool:") + col.prop(settings, "tool", text="") + col.operator("gpencil.brush_paint", text="Sculpt", icon='SCULPTMODE_HLT') + + # E - Common Settings + col = pie.column(align=True) + col.prop(brush, "size", slider=True) + row = col.row(align=True) + row.prop(brush, "strength", slider=True) + # row.prop(brush, "use_pressure_strength", text="", icon_only=True) + col.prop(brush, "use_falloff") + + # S - Change Brush Type Shortcuts + row = pie.row() + row.prop_enum(settings, "tool", value='GRAB') + row.prop_enum(settings, "tool", value='PUSH') + row.prop_enum(settings, "tool", value='CLONE') + + # N - Change Brush Type Shortcuts + row = pie.row() + row.prop_enum(settings, "tool", value='SMOOTH') + row.prop_enum(settings, "tool", value='THICKNESS') + row.prop_enum(settings, "tool", value='RANDOMISE') + + +############################### + + +class GPENCIL_MT_snap(Menu): + bl_label = "Snap" + + def draw(self, context): + layout = self.layout + + layout.operator("gpencil.snap_to_grid", text="Selection to Grid") + layout.operator("gpencil.snap_to_cursor", text="Selection to Cursor").use_offset = False + layout.operator("gpencil.snap_to_cursor", text="Selection to Cursor (Offset)").use_offset = True + + layout.separator() + + layout.operator("gpencil.snap_cursor_to_selected", text="Cursor to Selected") + layout.operator("view3d.snap_cursor_to_center", text="Cursor to Center") + layout.operator("view3d.snap_cursor_to_grid", text="Cursor to Grid") + + ############################### + class GPENCIL_UL_layer(UIList): def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): # assert(isinstance(item, bpy.types.GPencilLayer) @@ -328,6 +457,25 @@ class GPENCIL_UL_layer(UIList): layout.label(text="", icon_value=icon) +class GPENCIL_MT_layer_specials(Menu): + bl_label = "Layer" + + def draw(self, context): + layout = self.layout + + layout.operator("gpencil.layer_duplicate", icon='COPY_ID') # XXX: needs a dedicated icon + + layout.separator() + + layout.operator("gpencil.reveal", icon='RESTRICT_VIEW_OFF', text="Show All") + layout.operator("gpencil.hide", icon='RESTRICT_VIEW_ON', text="Hide Others").unselected = True + + layout.separator() + + layout.operator("gpencil.lock_all", icon='LOCKED', text="Lock All") + layout.operator("gpencil.unlock_all", icon='UNLOCKED', text="UnLock All") + + class GreasePencilDataPanel: # subclass must set # bl_space_type = 'IMAGE_EDITOR' @@ -379,7 +527,7 @@ class GreasePencilDataPanel: gpl = context.active_gpencil_layer if gpl: - sub.operator("gpencil.layer_duplicate", icon='COPY_ID', text="") # XXX: needs a dedicated icon + sub.menu("GPENCIL_MT_layer_specials", icon='DOWNARROW_HLT', text="") if len(gpd.layers) > 1: col.separator() @@ -388,6 +536,12 @@ class GreasePencilDataPanel: sub.operator("gpencil.layer_move", icon='TRIA_UP', text="").type = 'UP' sub.operator("gpencil.layer_move", icon='TRIA_DOWN', text="").type = 'DOWN' + col.separator() + + sub = col.column(align=True) + sub.operator("gpencil.layer_isolate", icon='SOLO_OFF', text="").affect_visibility = False + sub.operator("gpencil.layer_isolate", icon='RESTRICT_VIEW_OFF', text="").affect_visibility = True + if gpl: self.draw_layer(layout, gpl) @@ -492,4 +646,4 @@ class GreasePencilToolsPanel: layout.separator() layout.separator() - gpencil_stroke_placement_settings(context, layout, gpd) + gpencil_stroke_placement_settings(context, layout) diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index d0f4b5a0df9..a730ab009db 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -24,6 +24,7 @@ from bpy.app.translations import pgettext_iface as iface_ from bl_ui.properties_grease_pencil_common import ( GreasePencilDrawingToolsPanel, GreasePencilStrokeEditPanel, + GreasePencilStrokeSculptPanel, GreasePencilDataPanel ) @@ -1134,6 +1135,10 @@ class CLIP_PT_tools_grease_pencil_draw(GreasePencilDrawingToolsPanel, Panel): class CLIP_PT_tools_grease_pencil_edit(GreasePencilStrokeEditPanel, Panel): bl_space_type = 'CLIP_EDITOR' +# Grease Pencil stroke sculpting tools +class CLIP_PT_tools_grease_pencil_sculpt(GreasePencilStrokeSculptPanel, Panel): + bl_space_type = 'CLIP_EDITOR' + class CLIP_MT_view(Menu): bl_label = "View" diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py index 34137c8e9d3..47775251955 100644 --- a/release/scripts/startup/bl_ui/space_dopesheet.py +++ b/release/scripts/startup/bl_ui/space_dopesheet.py @@ -138,6 +138,19 @@ class DOPESHEET_HT_header(Header): # 'genericFiltersOnly' limits the options to only the relevant 'generic' subset of # filters which will work here and are useful (especially for character animation) dopesheet_filter(layout, context, genericFiltersOnly=True) + elif st.mode == 'GPENCIL': + row = layout.row(align=True) + row.prop(st.dopesheet, "show_gpencil_3d_only", text="Active Only") + + if st.dopesheet.show_gpencil_3d_only: + row = layout.row(align=True) + row.prop(st.dopesheet, "show_only_selected", text="") + row.prop(st.dopesheet, "show_hidden", text="") + + row = layout.row(align=True) + row.prop(st.dopesheet, "use_filter_text", text="") + if st.dopesheet.use_filter_text: + row.prop(st.dopesheet, "filter_text", text="") row = layout.row(align=True) row.prop(toolsettings, "use_proportional_action", diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index 0ed17341400..0f01956f289 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -28,6 +28,7 @@ from bl_ui.properties_paint_common import ( from bl_ui.properties_grease_pencil_common import ( GreasePencilDrawingToolsPanel, GreasePencilStrokeEditPanel, + GreasePencilStrokeSculptPanel, GreasePencilDataPanel, ) from bpy.app.translations import pgettext_iface as iface_ @@ -1192,5 +1193,10 @@ class IMAGE_PT_tools_grease_pencil_edit(GreasePencilStrokeEditPanel, Panel): bl_space_type = 'IMAGE_EDITOR' +# Grease Pencil stroke sculpting tools +class IMAGE_PT_tools_grease_pencil_sculpt(GreasePencilStrokeSculptPanel, Panel): + bl_space_type = 'IMAGE_EDITOR' + + if __name__ == "__main__": # only for live edit. bpy.utils.register_module(__name__) diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py index 3941e618b5b..d0a2e094f0b 100644 --- a/release/scripts/startup/bl_ui/space_node.py +++ b/release/scripts/startup/bl_ui/space_node.py @@ -24,6 +24,7 @@ from bpy.app.translations import pgettext_iface as iface_ from bl_ui.properties_grease_pencil_common import ( GreasePencilDrawingToolsPanel, GreasePencilStrokeEditPanel, + GreasePencilStrokeSculptPanel, GreasePencilDataPanel, GreasePencilToolsPanel, ) @@ -488,6 +489,11 @@ class NODE_PT_tools_grease_pencil_edit(GreasePencilStrokeEditPanel, Panel): bl_space_type = 'NODE_EDITOR' bl_region_type = 'TOOLS' +# Grease Pencil stroke sculpting tools +class NODE_PT_tools_grease_pencil_sculpt(GreasePencilStrokeSculptPanel, Panel): + bl_space_type = 'NODE_EDITOR' + bl_region_type = 'TOOLS' + # ----------------------------- diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index c8c0c27f9c4..4dc4b667a63 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -118,6 +118,14 @@ class VIEW3D_HT_header(Header): row.operator("pose.paste", text="", icon='PASTEDOWN').flipped = False row.operator("pose.paste", text="", icon='PASTEFLIPDOWN').flipped = True + # GPencil + if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode: + row = layout.row(align=True) + row.operator("gpencil.copy", text="", icon='COPYDOWN') + row.operator("gpencil.paste", text="", icon='PASTEDOWN') + + layout.prop(context.gpencil_data, "use_onion_skinning", text="Onion Skins", icon='PARTICLE_PATH') # XXX: icon + class VIEW3D_MT_editor_menus(Menu): bl_space_type = 'VIEW3D_MT_editor_menus' @@ -131,11 +139,14 @@ class VIEW3D_MT_editor_menus(Menu): obj = context.active_object mode_string = context.mode edit_object = context.edit_object + gp_edit = context.gpencil_data and context.gpencil_data.use_stroke_edit_mode layout.menu("VIEW3D_MT_view") # Select Menu - if mode_string in {'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'}: + if gp_edit: + layout.menu("VIEW3D_MT_select_gpencil") + elif mode_string in {'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'}: mesh = obj.data if mesh.use_paint_mask: layout.menu("VIEW3D_MT_select_paint_mask") @@ -144,7 +155,9 @@ class VIEW3D_MT_editor_menus(Menu): elif mode_string != 'SCULPT': layout.menu("VIEW3D_MT_select_%s" % mode_string.lower()) - if mode_string == 'OBJECT': + if gp_edit: + pass + elif mode_string == 'OBJECT': layout.menu("INFO_MT_add", text="Add") elif mode_string == 'EDIT_MESH': layout.menu("INFO_MT_mesh_add", text="Add") @@ -157,7 +170,9 @@ class VIEW3D_MT_editor_menus(Menu): elif mode_string == 'EDIT_ARMATURE': layout.menu("INFO_MT_edit_armature_add", text="Add") - if edit_object: + if gp_edit: + layout.menu("VIEW3D_MT_edit_gpencil") + elif edit_object: layout.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower()) elif obj: if mode_string != 'PAINT_TEXTURE': @@ -883,6 +898,27 @@ class VIEW3D_MT_select_edit_armature(Menu): layout.operator("object.select_pattern", text="Select Pattern...") +class VIEW3D_MT_select_gpencil(Menu): + bl_label = "Select" + + def draw(self, context): + layout = self.layout + + layout.operator("gpencil.select_border") + layout.operator("gpencil.select_circle") + + layout.separator() + + layout.operator("gpencil.select_all", text="(De)select All").action = 'TOGGLE' + layout.operator("gpencil.select_all", text="Inverse").action = 'INVERT' + layout.operator("gpencil.select_linked", text="Linked") + + layout.separator() + + layout.operator("gpencil.select_more") + layout.operator("gpencil.select_less") + + class VIEW3D_MT_select_paint_mask(Menu): bl_label = "Select" @@ -2822,6 +2858,81 @@ class VIEW3D_MT_edit_armature_delete(Menu): layout.operator("armature.dissolve", text="Dissolve") +# ********** GPencil Stroke Edit menu ********** + + +class VIEW3D_MT_edit_gpencil(Menu): + bl_label = "GPencil" + + def draw(self, context): + toolsettings = context.tool_settings + + layout = self.layout + + layout.operator("ed.undo") + layout.operator("ed.redo") + layout.operator("ed.undo_history") + + layout.separator() + + layout.operator("gpencil.brush_paint", text="Sculpt Strokes").wait_for_input = True + layout.prop_menu_enum(toolsettings.gpencil_sculpt, "tool", text="Sculpt Brush") + + layout.separator() + + layout.menu("VIEW3D_MT_edit_gpencil_transform") + layout.operator("transform.mirror", text="Mirror") + layout.menu("GPENCIL_MT_snap") + + layout.separator() + + layout.menu("VIEW3D_MT_object_animation") # NOTE: provides keyingset access... + + layout.separator() + + layout.menu("VIEW3D_MT_edit_gpencil_delete") + layout.operator("gpencil.duplicate_move", text="Duplicate") + + layout.separator() + + layout.operator("gpencil.copy", text="Copy") + layout.operator("gpencil.paste", text="Paste") + + layout.separator() + + layout.prop_menu_enum(toolsettings, "proportional_edit") + layout.prop_menu_enum(toolsettings, "proportional_edit_falloff") + + layout.separator() + + layout.operator("gpencil.reveal") + layout.operator("gpencil.hide", text="Show Active Layer Only").unselected = True + layout.operator("gpencil.hide", text="Hide Active Layer").unselected = False + + layout.separator() + + layout.operator_menu_enum("gpencil.move_to_layer", "layer", text="Move to Layer") + layout.operator_menu_enum("gpencil.convert", "type", text="Convert to Geometry...") + + +class VIEW3D_MT_edit_gpencil_transform(Menu): + bl_label = "Transform" + + def draw(self, context): + layout = self.layout + + layout.operator("transform.translate") + layout.operator("transform.rotate") + layout.operator("transform.resize", text="Scale") + + layout.separator() + + layout.operator("transform.bend", text="Bend") + layout.operator("transform.shear", text="Shear") + layout.operator("transform.tosphere", text="To Sphere") + layout.operator("transform.transform", text="Shrink Fatten").mode = 'GPENCIL_SHRINKFATTEN' + + # ********** Panel ********** diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index a24dc494c30..cf5e2daf0ce 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -21,7 +21,8 @@ import bpy from bpy.types import Menu, Panel, UIList from bl_ui.properties_grease_pencil_common import ( GreasePencilDrawingToolsPanel, - GreasePencilStrokeEditPanel + GreasePencilStrokeEditPanel, + GreasePencilStrokeSculptPanel ) from bl_ui.properties_paint_common import ( UnifiedPaintPanel, @@ -1875,6 +1876,11 @@ class VIEW3D_PT_tools_grease_pencil_edit(GreasePencilStrokeEditPanel, Panel): bl_space_type = 'VIEW_3D' +# Grease Pencil stroke sculpting tools +class VIEW3D_PT_tools_grease_pencil_sculpt(GreasePencilStrokeSculptPanel, Panel): + bl_space_type = 'VIEW_3D' + + # Note: moved here so that it's always in last position in 'Tools' panels! class VIEW3D_PT_tools_history(View3DPanel, Panel): bl_category = "Tools" |