diff options
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/modules/bpy_extras/keyconfig_utils.py | 5 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/properties_grease_pencil_common.py | 430 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_clip.py | 32 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_dopesheet.py | 10 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_image.py | 23 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_node.py | 45 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_sequencer.py | 29 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 14 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d_toolbar.py | 16 |
9 files changed, 577 insertions, 27 deletions
diff --git a/release/scripts/modules/bpy_extras/keyconfig_utils.py b/release/scripts/modules/bpy_extras/keyconfig_utils.py index c50b320dceb..1903f3c0e09 100644 --- a/release/scripts/modules/bpy_extras/keyconfig_utils.py +++ b/release/scripts/modules/bpy_extras/keyconfig_utils.py @@ -32,7 +32,10 @@ KM_HIERARCHY = [ ('View2D', 'EMPTY', 'WINDOW', []), # view 2d navigation (per region) ('View2D Buttons List', 'EMPTY', 'WINDOW', []), # view 2d with buttons navigation ('Header', 'EMPTY', 'WINDOW', []), # header stuff (per region) - ('Grease Pencil', 'EMPTY', 'WINDOW', []), # grease pencil stuff (per region) + + ('Grease Pencil', 'EMPTY', 'WINDOW', [ # grease pencil stuff (per region) + ('Grease Pencil Stroke Edit Mode', 'EMPTY', 'WINDOW', []), + ]), ('3D View', 'VIEW_3D', 'WINDOW', [ # view 3d navigation and generic stuff (select, transform) ('Object Mode', 'EMPTY', 'WINDOW', []), 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 4789d119192..789d0a10a9e 100644 --- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py +++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py @@ -19,11 +19,35 @@ # <pep8 compliant> -class GreasePencilPanel(): +import bpy +from bpy.types import Menu, UIList + + +def gpencil_stroke_placement_settings(context, layout, gpd): + 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') + + 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 = col.row(align=False) + row.active = gpd.draw_mode in ('SURFACE', 'STROKE') + row.prop(gpd, "use_stroke_endpoints") + + +class GreasePencilDrawingToolsPanel(): # subclass must set # bl_space_type = 'IMAGE_EDITOR' - # bl_region_type = 'TOOLS' bl_label = "Grease Pencil" + bl_category = "Grease Pencil" + bl_region_type = 'TOOLS' @staticmethod def draw(self, context): @@ -31,19 +55,413 @@ class GreasePencilPanel(): col = layout.column(align=True) + col.label(text="Draw:") row = col.row(align=True) row.operator("gpencil.draw", text="Draw").mode = 'DRAW' - row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT' + row.operator("gpencil.draw", text="Erase").mode = 'ERASER' 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", text="Erase").mode = 'ERASER' + row = col.row(align=True) - row.prop(context.tool_settings, "use_grease_pencil_sessions") + row.prop(context.tool_settings, "use_grease_pencil_sessions", text="Continuous Drawing") + + gpd = context.gpencil_data + if gpd: + col.separator() + gpencil_stroke_placement_settings(context, col, gpd) + if context.space_data.type == 'VIEW_3D': col.separator() + col.separator() - col.label(text="Measure:") + col.label(text="Tools:") + col.operator("gpencil.convert", text="Convert...") col.operator("view3d.ruler") + + +class GreasePencilStrokeEditPanel(): + # subclass must set + # bl_space_type = 'IMAGE_EDITOR' + bl_label = "Edit Strokes" + bl_category = "Grease Pencil" + bl_region_type = 'TOOLS' + + @classmethod + def poll(cls, context): + return (context.gpencil_data is not None) + + @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) + + col = layout.column(align=True) + col.prop(gpd, "use_stroke_edit_mode", text="Enable Editing", icon='EDIT', toggle=True) + + col.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") + + col.separator() + + subcol = col.column(align=True) + subcol.active = edit_ok + subcol.operator("gpencil.select_linked") + subcol.operator("gpencil.select_more") + subcol.operator("gpencil.select_less") + + col.separator() + + col.label(text="Edit:") + 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.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' + + col.separator() + + 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 + + +############################### + +class GPENCIL_PIE_tool_palette(Menu): + """A pie menu for quick access to Grease Pencil tools""" + bl_label = "Grease Pencil Tools" + + def draw(self, context): + layout = self.layout + + pie = layout.menu_pie() + gpd = context.gpencil_data + + # W - Drawing Types + col = pie.column() + col.operator("gpencil.draw", text="Draw", icon='GREASEPENCIL').mode = 'DRAW' + col.operator("gpencil.draw", text="Straight Lines", icon='LINE_DATA').mode = 'DRAW_STRAIGHT' + col.operator("gpencil.draw", text="Poly", icon='MESH_DATA').mode = 'DRAW_POLY' + + # E - Eraser + # XXX: needs a dedicated icon... + col = pie.column() + col.operator("gpencil.draw", text="Eraser", icon='FORCE_CURVE').mode = 'ERASER' + + # E - "Settings" Palette is included here too, since it needs to be in a stable position... + if gpd and gpd.layers.active: + col.separator() + col.operator("wm.call_menu_pie", text="Settings...", icon='SCRIPTWIN').name = "GPENCIL_PIE_settings_palette" + + # Editing tools + 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') + + # 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 = col.row(align=True) + row.label("Proportional Edit:") + row.prop(context.tool_settings, "proportional_edit", text="", icon_only=True) + row.prop(context.tool_settings, "proportional_edit_falloff", text="", icon_only=True) + + # NW - Select (Non-Modal) + col = pie.column() + col.operator("gpencil.select_all", text="Select All", icon='PARTICLE_POINT') + col.operator("gpencil.select_linked", text="Select Linked", icon='LINKED') + + # NE - Select (Modal) + col = pie.column() + col.operator("gpencil.select_border", text="Border Select", icon='BORDER_RECT') + col.operator("gpencil.select_circle", text="Circle Select", icon='META_EMPTY') + + # SW - Edit Tools + col = pie.column() + col.operator("gpencil.duplicate_move", icon='PARTICLE_PATH', text="Duplicate") + col.operator("gpencil.delete", icon='X', text="Delete...") + + # SE - More Tools + 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') + + +class GPENCIL_PIE_settings_palette(Menu): + """A pie menu for quick access to Grease Pencil settings""" + bl_label = "Grease Pencil Settings" + + @classmethod + def poll(cls, context): + return bool(context.gpencil_data and context.active_gpencil_layer) + + def draw(self, context): + layout = self.layout + + pie = layout.menu_pie() + gpd = context.gpencil_data + gpl = context.active_gpencil_layer + + # W - Stroke draw settings + col = pie.column(align=True) + col.label(text="Stroke") + col.prop(gpl, "color", text="") + col.prop(gpl, "alpha", text="", slider=True) + + # E - Fill draw settings + col = pie.column(align=True) + col.label(text="Fill") + col.prop(gpl, "fill_color", text="") + col.prop(gpl, "fill_alpha", text="", slider=True) + + # S - Layer settings + col = pie.column() + col.prop(gpl, "line_width", slider=True) + #col.prop(gpl, "use_volumetric_strokes") + 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.prop(gpl, "lock") + row.prop(gpl, "hide") + + +class GPENCIL_PIE_tools_more(Menu): + """A pie menu for accessing more Grease Pencil tools""" + bl_label = "More Grease Pencil Tools" + + @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() + gpd = context.gpencil_data + + pie.operator("gpencil.select_more", icon='ZOOMIN') + pie.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("gpencil.convert", icon='OUTLINER_OB_CURVE') + pie.operator("wm.call_menu_pie", text="Back to Main Palette...").name = "GPENCIL_PIE_tool_palette" + +############################### + +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) + gpl = item + + if self.layout_type in {'DEFAULT', 'COMPACT'}: + if gpl.lock: + layout.active = False + + split = layout.split(percentage=0.2) + split.prop(gpl, "color", text="") + split.prop(gpl, "info", text="", emboss=False) + + row = layout.row(align=True) + row.prop(gpl, "lock", text="", emboss=False) + row.prop(gpl, "hide", text="", emboss=False) + elif self.layout_type in {'GRID'}: + layout.alignment = 'CENTER' + layout.label(text="", icon_value=icon) + + +class GreasePencilDataPanel(): + # subclass must set + # bl_space_type = 'IMAGE_EDITOR' + bl_label = "Grease Pencil" + bl_region_type = 'UI' + + @staticmethod + def draw_header(self, context): + self.layout.prop(context.space_data, "show_grease_pencil", text="") + + @staticmethod + def draw(self, context): + layout = self.layout + + # owner of Grease Pencil data + gpd_owner = context.gpencil_data_owner + gpd = context.gpencil_data + + # Owner Selector + # XXX: add this for 3D view too + if context.space_data.type == 'CLIP_EDITOR': + layout.prop(context.space_data, "grease_pencil_source", expand=True) + + # Grease Pencil data selector + layout.template_ID(gpd_owner, "grease_pencil", new="gpencil.data_add", unlink="gpencil.data_unlink") + + # Grease Pencil data... + if gpd: + self.draw_layers(context, layout, gpd) + + def draw_layers(self, context, layout, gpd): + row = layout.row() + + col = row.column() + col.template_list("GPENCIL_UL_layer", "", gpd, "layers", gpd.layers, "active_index", rows=5) + + col = row.column() + + sub = col.column(align=True) + sub.operator("gpencil.layer_add", icon='ZOOMIN', text="") + sub.operator("gpencil.layer_remove", icon='ZOOMOUT', text="") + + gpl = context.active_gpencil_layer + if gpl: + col.separator() + + sub = col.column(align=True) + sub.operator("gpencil.layer_move", icon='TRIA_UP', text="").type = 'UP' + sub.operator("gpencil.layer_move", icon='TRIA_DOWN', text="").type = 'DOWN' + + if gpl: + self.draw_layer(layout, gpl) + + def draw_layer(self, layout, gpl): + # layer settings + split = layout.split(percentage=0.5) + split.active = not gpl.lock + + # Column 1 - Stroke + col = split.column(align=True) + col.label(text="Stroke:") + col.prop(gpl, "color", text="") + col.prop(gpl, "alpha", slider=True) + + # Column 2 - Fill + col = split.column(align=True) + col.label(text="Fill:") + col.prop(gpl, "fill_color", text="") + col.prop(gpl, "fill_alpha", text="Opacity", slider=True) + + # Options + split = layout.split(percentage=0.5) + split.active = not gpl.lock + + col = split.column(align=True) + col.prop(gpl, "line_width", slider=True) + col.prop(gpl, "use_volumetric_strokes") + + col = split.column(align=True) + col.prop(gpl, "show_x_ray") + + #if debug: + # layout.prop(gpl, "show_points") + + layout.separator() + + # Full-Row - Frame Locking (and Delete Frame) + row = layout.row(align=True) + row.active = not gpl.lock + + if gpl.active_frame: + lock_status = "Locked" if gpl.lock_frame else "Unlocked" + lock_label = "Frame: %d (%s)" % (gpl.active_frame.frame_number, lock_status) + else: + lock_label = "Lock Frame" + row.prop(gpl, "lock_frame", text=lock_label, icon='UNLOCKED') + row.operator("gpencil.active_frame_delete", text="", icon='X') + + layout.separator() + + # Onion skinning + col = layout.column(align=True) + col.active = not gpl.lock + + row = col.row() + row.prop(gpl, "use_onion_skinning") + row.prop(gpl, "use_ghost_custom_colors", text="", icon='COLOR') + + split = col.split(percentage = 0.5) + split.active = gpl.use_onion_skinning + + # - Before Frames + sub = split.column(align=True) + row = sub.row(align=True) + row.active = gpl.use_ghost_custom_colors + row.prop(gpl, "before_color", text="") + sub.prop(gpl, "ghost_before_range", text="Before") + + + # - After Frames + sub = split.column(align=True) + row = sub.row(align=True) + row.active = gpl.use_ghost_custom_colors + row.prop(gpl, "after_color", text="") + sub.prop(gpl, "ghost_after_range", text="After") + + +class GreasePencilToolsPanel(): + # subclass must set + # bl_space_type = 'IMAGE_EDITOR' + # bl_options = {'DEFAULT_CLOSED'} + bl_label = "Grease Pencil Settings" + bl_region_type = 'UI' + + @classmethod + def poll(cls, context): + return (context.gpencil_data is not None) + + @staticmethod + def draw(self, context): + layout = self.layout + + gpd_owner = context.gpencil_data_owner + gpd = context.gpencil_data + + layout.prop(gpd, "use_stroke_edit_mode", text="Enable Editing", icon='EDIT', toggle=True) + + layout.separator() + + layout.label("Proportional Edit:") + row = layout.row() + row.prop(context.tool_settings, "proportional_edit", text="") + row.prop(context.tool_settings, "proportional_edit_falloff", text="") + + layout.separator() + layout.separator() + + gpencil_stroke_placement_settings(context, layout, gpd) diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index d43792bc61d..158de750185 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -21,7 +21,11 @@ import bpy from bpy.types import Panel, Header, Menu, UIList from bpy.app.translations import pgettext_iface as iface_ -from bl_ui.properties_grease_pencil_common import GreasePencilPanel +from bl_ui.properties_grease_pencil_common import ( + GreasePencilDrawingToolsPanel, + GreasePencilStrokeEditPanel, + GreasePencilDataPanel + ) class CLIP_UL_tracking_objects(UIList): @@ -1050,12 +1054,6 @@ class CLIP_PT_tools_mask(MASK_PT_tools, Panel): # --- end mask --- -class CLIP_PT_tools_grease_pencil(GreasePencilPanel, Panel): - bl_space_type = 'CLIP_EDITOR' - bl_region_type = 'TOOLS' - bl_category = "Grease Pencil" - - class CLIP_PT_footage(CLIP_PT_clip_view_panel, Panel): bl_space_type = 'CLIP_EDITOR' bl_region_type = 'UI' @@ -1110,6 +1108,26 @@ class CLIP_PT_tools_scenesetup(Panel): layout.operator("clip.setup_tracking_scene") +# Grease Pencil properties +class CLIP_PT_grease_pencil(GreasePencilDataPanel, CLIP_PT_clip_view_panel, Panel): + bl_space_type = 'CLIP_EDITOR' + bl_region_type = 'UI' + bl_options = {'DEFAULT_CLOSED'} + + # NOTE: this is just a wrapper around the generic GP Panel + # But, this should only be visible in "clip" view + + +# Grease Pencil drawing tools +class CLIP_PT_tools_grease_pencil_draw(GreasePencilDrawingToolsPanel, Panel): + bl_space_type = 'CLIP_EDITOR' + + +# Grease Pencil stroke editing tools +class CLIP_PT_tools_grease_pencil_edit(GreasePencilStrokeEditPanel, 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 79240bbf72a..0458ffe3377 100644 --- a/release/scripts/startup/bl_ui/space_dopesheet.py +++ b/release/scripts/startup/bl_ui/space_dopesheet.py @@ -91,6 +91,8 @@ def dopesheet_filter(layout, context, genericFiltersOnly=False): row.prop(dopesheet, "show_speakers", text="") if bpy.data.linestyles: row.prop(dopesheet, "show_linestyles", text="") + if bpy.data.grease_pencil: + row.prop(dopesheet, "show_gpencil", text="") ####################################### @@ -365,14 +367,16 @@ class DOPESHEET_MT_gpencil_frame(Menu): layout = self.layout layout.menu("DOPESHEET_MT_key_transform", text="Transform") - - #layout.operator_menu_enum("action.snap", "type", text="Snap") - #layout.operator_menu_enum("action.mirror", "type", text="Mirror") + layout.operator_menu_enum("action.snap", "type", text="Snap") + layout.operator_menu_enum("action.mirror", "type", text="Mirror") layout.separator() layout.operator("action.duplicate") layout.operator("action.delete") + layout.separator() + layout.operator("action.keyframe_type") + #layout.separator() #layout.operator("action.copy") #layout.operator("action.paste") diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index 56c0bda5608..a1da262d9f2 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -25,7 +25,11 @@ from bl_ui.properties_paint_common import ( brush_texpaint_common, brush_mask_texture_settings, ) -from bl_ui.properties_grease_pencil_common import GreasePencilPanel +from bl_ui.properties_grease_pencil_common import ( + GreasePencilDrawingToolsPanel, + GreasePencilStrokeEditPanel, + GreasePencilDataPanel + ) from bpy.app.translations import pgettext_iface as iface_ @@ -1149,10 +1153,21 @@ class IMAGE_PT_scope_sample(Panel): sub.prop(sima.scopes, "accuracy") -class IMAGE_PT_tools_grease_pencil(GreasePencilPanel, Panel): +# Grease Pencil properties +class IMAGE_PT_grease_pencil(GreasePencilDataPanel, Panel): + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'UI' + + # NOTE: this is just a wrapper around the generic GP Panel + +# Grease Pencil drawing tools +class IMAGE_PT_tools_grease_pencil_draw(GreasePencilDrawingToolsPanel, Panel): + bl_space_type = 'IMAGE_EDITOR' + + +# Grease Pencil stroke editing tools +class IMAGE_PT_tools_grease_pencil_edit(GreasePencilStrokeEditPanel, Panel): bl_space_type = 'IMAGE_EDITOR' - bl_region_type = 'TOOLS' - bl_category = "Grease Pencil" if __name__ == "__main__": # only for live edit. diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py index 17eeeec2480..4cc72f1dc4b 100644 --- a/release/scripts/startup/bl_ui/space_node.py +++ b/release/scripts/startup/bl_ui/space_node.py @@ -19,6 +19,12 @@ # <pep8 compliant> import bpy from bpy.types import Header, Menu, Panel +from bl_ui.properties_grease_pencil_common import ( + GreasePencilDrawingToolsPanel, + GreasePencilStrokeEditPanel, + GreasePencilDataPanel, + GreasePencilToolsPanel, + ) class NODE_HT_header(Header): @@ -439,6 +445,45 @@ class NODE_UL_interface_sockets(bpy.types.UIList): layout.template_node_socket(color) +# Grease Pencil properties +class NODE_PT_grease_pencil(GreasePencilDataPanel, Panel): + bl_space_type = 'NODE_EDITOR' + bl_region_type = 'UI' + + # NOTE: this is just a wrapper around the generic GP Panel + + @classmethod + def poll(cls, context): + snode = context.space_data + return snode is not None and snode.node_tree is not None + + +class NODE_PT_grease_pencil_tools(GreasePencilToolsPanel, Panel): + bl_space_type = 'NODE_EDITOR' + bl_region_type = 'UI' + bl_options = {'DEFAULT_CLOSED'} + + # NOTE: this is just a wrapper around the generic GP tools panel + # It contains access to some essential tools usually found only in + # toolbar, but which may not necessarily be open + + +# Tool Shelf ------------------ + + +# Grease Pencil drawing tools +class NODE_PT_tools_grease_pencil_draw(GreasePencilDrawingToolsPanel, Panel): + bl_space_type = 'NODE_EDITOR' + bl_region_type = 'TOOLS' + + +# Grease Pencil stroke editing tools +class NODE_PT_tools_grease_pencil_edit(GreasePencilStrokeEditPanel, Panel): + bl_space_type = 'NODE_EDITOR' + bl_region_type = 'TOOLS' + +# ----------------------------- + def node_draw_tree_view(layout, context): pass diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 650c63140d2..d84d7723e19 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -19,6 +19,7 @@ # <pep8 compliant> import bpy from bpy.types import Header, Menu, Panel +from bl_ui.properties_grease_pencil_common import GreasePencilDataPanel, GreasePencilToolsPanel from bpy.app.translations import pgettext_iface as iface_ @@ -103,6 +104,17 @@ class SEQUENCER_HT_header(Header): row = layout.row() row.prop(st, "overlay_type", text="") + if st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'}: + gpd = context.gpencil_data + toolsettings = context.tool_settings + + # Proportional editing + if gpd and gpd.use_stroke_edit_mode: + row = layout.row(align=True) + row.prop(toolsettings, "proportional_edit", icon_only=True) + if toolsettings.proportional_edit != 'DISABLED': + row.prop(toolsettings, "proportional_edit_falloff", icon_only=True) + row = layout.row(align=True) row.operator("render.opengl", text="", icon='RENDER_STILL').sequencer = True props = row.operator("render.opengl", text="", icon='RENDER_ANIMATION') @@ -1017,5 +1029,22 @@ class SEQUENCER_PT_modifiers(SequencerButtonsPanel, Panel): col.prop(mod, "contrast") +class SEQUENCER_PT_grease_pencil(GreasePencilDataPanel, SequencerButtonsPanel_Output, Panel): + bl_space_type = 'SEQUENCE_EDITOR' + bl_region_type = 'UI' + + # NOTE: this is just a wrapper around the generic GP Panel + # But, it should only show up when there are images in the preview region + + +class SEQUENCER_PT_grease_pencil_tools(GreasePencilToolsPanel, SequencerButtonsPanel_Output, Panel): + bl_space_type = 'SEQUENCE_EDITOR' + bl_region_type = 'UI' + + # NOTE: this is just a wrapper around the generic GP tools panel + # It contains access to some essential tools usually found only in + # toolbar, which doesn't exist here... + + if __name__ == "__main__": # only for live edit. bpy.utils.register_module(__name__) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index d0cfd190f0e..cc46f25656b 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -19,6 +19,7 @@ # <pep8 compliant> import bpy from bpy.types import Header, Menu, Panel +from bl_ui.properties_grease_pencil_common import GreasePencilDataPanel from bl_ui.properties_paint_common import UnifiedPaintPanel from bpy.app.translations import contexts as i18n_contexts @@ -56,7 +57,12 @@ class VIEW3D_HT_header(Header): row.prop(view, "use_occlude_geometry", text="") # Proportional editing - if mode in {'EDIT', 'PARTICLE_EDIT'}: + if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode: + row = layout.row(align=True) + row.prop(toolsettings, "proportional_edit", icon_only=True) + if toolsettings.proportional_edit != 'DISABLED': + row.prop(toolsettings, "proportional_edit_falloff", icon_only=True) + elif mode in {'EDIT', 'PARTICLE_EDIT'}: row = layout.row(align=True) row.prop(toolsettings, "proportional_edit", icon_only=True) if toolsettings.proportional_edit != 'DISABLED': @@ -2703,6 +2709,12 @@ class VIEW3D_MT_edit_armature_roll(Menu): # ********** Panel ********** +class VIEW3D_PT_grease_pencil(GreasePencilDataPanel, Panel): + bl_space_type = 'VIEW_3D' + bl_region_type = 'UI' + + # NOTE: this is just a wrapper around the generic GP Panel + class VIEW3D_PT_view3d_properties(Panel): bl_space_type = 'VIEW_3D' diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 990697f74fe..b7fe9c69c1f 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -19,7 +19,10 @@ # <pep8 compliant> import bpy from bpy.types import Menu, Panel, UIList -from bl_ui.properties_grease_pencil_common import GreasePencilPanel +from bl_ui.properties_grease_pencil_common import ( + GreasePencilDrawingToolsPanel, + GreasePencilStrokeEditPanel + ) from bl_ui.properties_paint_common import ( UnifiedPaintPanel, brush_texture_settings, @@ -1805,11 +1808,14 @@ class VIEW3D_PT_tools_particlemode(View3DPanel, Panel): sub.prop(pe, "fade_frames", slider=True) -# Grease Pencil tools -class VIEW3D_PT_tools_grease_pencil(GreasePencilPanel, Panel): +# Grease Pencil drawing tools +class VIEW3D_PT_tools_grease_pencil_draw(GreasePencilDrawingToolsPanel, Panel): + bl_space_type = 'VIEW_3D' + + +# Grease Pencil stroke editing tools +class VIEW3D_PT_tools_grease_pencil_edit(GreasePencilStrokeEditPanel, Panel): bl_space_type = 'VIEW_3D' - bl_region_type = 'TOOLS' - bl_category = "Grease Pencil" # Note: moved here so that it's always in last position in 'Tools' panels! |