diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2019-12-04 16:13:21 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2019-12-04 16:17:08 +0300 |
commit | 98ff6cfa575bbe9680e5a0abf176a9d748ecc2b8 (patch) | |
tree | 28a74160f60a2bf8972783744334a4511ab92e82 /release/scripts/startup/bl_ui/space_dopesheet.py | |
parent | 541d0fdba61a9c99612f7532207d5ce704f10b43 (diff) |
GPencil: Add Opacity y Onion switch to Dopesheet
Add new icons and panels Grease Pencil Dopesheet to manage layers without having the properties panel visible.
Also, the icons are in the same order in Dopesheet, Layers and Material list to keep consistency.
As the number of columns for icons is limited to 3 and we also need use a factor, I have impleted the change using slider area. Also, the slider option is enabled by default for 2D Template.
See T72026 for more info.
Reviewed By: mendio, pepeland, billreynish
Differential Revision: https://developer.blender.org/D6328
Diffstat (limited to 'release/scripts/startup/bl_ui/space_dopesheet.py')
-rw-r--r-- | release/scripts/startup/bl_ui/space_dopesheet.py | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py index 3b498b834bf..b8f86788b4c 100644 --- a/release/scripts/startup/bl_ui/space_dopesheet.py +++ b/release/scripts/startup/bl_ui/space_dopesheet.py @@ -25,6 +25,12 @@ from bpy.types import ( Panel, ) +from bl_ui.properties_grease_pencil_common import ( + GreasePencilLayerAdjustmentsPanel, + GreasePencilLayerRelationsPanel, + GreasePencilLayerDisplayPanel, +) + ####################################### # DopeSheet Filtering - Header Buttons @@ -243,6 +249,18 @@ class DOPESHEET_HT_editor_buttons(Header): layout.template_ID(st, "action", new="action.new", unlink="action.unlink") + # Layer management + if st.mode == 'GPENCIL': + row = layout.row(align=True) + row.operator("gpencil.layer_move", icon='TRIA_UP', text="").type = 'UP' + row.operator("gpencil.layer_move", icon='TRIA_DOWN', text="").type = 'DOWN' + + row = layout.row(align=True) + row.operator("gpencil.layer_add", icon='ADD', text="") + row.operator("gpencil.layer_remove", icon='REMOVE', text="") + + layout.separator_spacer() + layout.separator_spacer() if st.mode == 'DOPESHEET': @@ -639,6 +657,65 @@ class DOPESHEET_MT_snap_pie(Menu): pie.operator("action.snap", text="Nearest Second").type = 'NEAREST_SECOND' pie.operator("action.snap", text="Nearest Marker").type = 'NEAREST_MARKER' +class LayersDopeSheetPanel: + bl_space_type = 'DOPESHEET_EDITOR' + bl_region_type = 'UI' + bl_category = "View" + + @classmethod + def poll(cls, context): + st = context.space_data + ob = context.object + if st.mode != 'GPENCIL' or ob is None or ob.type != 'GPENCIL': + return False + + gpd = ob.data + gpl = gpd.layers.active + if gpl: + return True + + return False + + +class DOPESHEET_PT_gpencil_mode(LayersDopeSheetPanel, Panel): + # bl_space_type = 'DOPESHEET_EDITOR' + # bl_region_type = 'UI' + # bl_category = "View" + bl_label = "Layer" + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False + + ob = context.object + gpd = ob.data + gpl = gpd.layers.active + if gpl: + row = layout.row(align=True) + row.prop(gpl, "blend_mode", text="Blend") + + row = layout.row(align=True) + row.prop(gpl, "opacity", text="Opacity", slider=True) + + +class DOPESHEET_PT_gpencil_layer_adjustments(LayersDopeSheetPanel, GreasePencilLayerAdjustmentsPanel, Panel): + bl_label = "Adjustments" + bl_parent_id = 'DOPESHEET_PT_gpencil_mode' + bl_options = {'DEFAULT_CLOSED'} + + +class DOPESHEET_PT_gpencil_layer_relations(LayersDopeSheetPanel, GreasePencilLayerRelationsPanel, Panel): + bl_label = "Relations" + bl_parent_id = 'DOPESHEET_PT_gpencil_mode' + bl_options = {'DEFAULT_CLOSED'} + + +class DOPESHEET_PT_gpencil_layer_display(LayersDopeSheetPanel, GreasePencilLayerDisplayPanel, Panel): + bl_label = "Display" + bl_parent_id = 'DOPESHEET_PT_gpencil_mode' + bl_options = {'DEFAULT_CLOSED'} + classes = ( DOPESHEET_HT_header, @@ -657,6 +734,10 @@ classes = ( DOPESHEET_MT_channel_context_menu, DOPESHEET_MT_snap_pie, DOPESHEET_PT_filters, + DOPESHEET_PT_gpencil_mode, + DOPESHEET_PT_gpencil_layer_adjustments, + DOPESHEET_PT_gpencil_layer_relations, + DOPESHEET_PT_gpencil_layer_display, ) if __name__ == "__main__": # only for live edit. |