diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-12-02 05:26:10 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-12-02 05:26:39 +0300 |
commit | 7be9bf43a4854e085ba828cc5682a739a52163a6 (patch) | |
tree | ec46cf145993b38d38d3118728018824aa5023cc /release/scripts/startup/bl_ui/properties_material_gpencil.py | |
parent | 4320adbf860a47d2557ec9486e4fb3b0684fe27a (diff) |
Cleanup: de-duplicate gpencil material UI
Top-bar and properties-editor were near duplicates.
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_material_gpencil.py')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_material_gpencil.py | 58 |
1 files changed, 5 insertions, 53 deletions
diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py b/release/scripts/startup/bl_ui/properties_material_gpencil.py index fc25b70b36a..b62b251163e 100644 --- a/release/scripts/startup/bl_ui/properties_material_gpencil.py +++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py @@ -22,6 +22,10 @@ from bpy.types import Menu, Panel, UIList from rna_prop_ui import PropertyPanel from bl_operators.presets import PresetMenu +from .properties_grease_pencil_common import ( + GreasePencilMaterialsPanel, +) + class GPENCIL_MT_color_specials(Menu): bl_label = "Layer" @@ -83,65 +87,13 @@ class GPMaterialButtonsPanel: ob.active_material.grease_pencil) -class MATERIAL_PT_gpencil_slots(Panel): +class MATERIAL_PT_gpencil_slots(GreasePencilMaterialsPanel, Panel): bl_label = "Grease Pencil Material Slots" bl_space_type = 'PROPERTIES' bl_region_type = 'WINDOW' bl_context = "material" bl_options = {'HIDE_HEADER'} - @classmethod - def poll(cls, context): - ob = context.object - return ob and ob.type == 'GPENCIL' - - @staticmethod - def draw(self, context): - layout = self.layout - gpd = context.gpencil_data - - ob = context.object - slot = context.material_slot - - is_sortable = len(ob.material_slots) > 1 - rows = 7 - - row = layout.row() - - row.template_list("GPENCIL_UL_matslots", "", ob, "material_slots", ob, "active_material_index", rows=rows) - - col = row.column(align=True) - col.operator("object.material_slot_add", icon='ADD', text="") - col.operator("object.material_slot_remove", icon='REMOVE', text="") - - col.menu("GPENCIL_MT_color_specials", icon='DOWNARROW_HLT', text="") - - if is_sortable: - col.separator() - - col.operator("object.material_slot_move", icon='TRIA_UP', text="").direction = 'UP' - col.operator("object.material_slot_move", icon='TRIA_DOWN', text="").direction = 'DOWN' - - col.separator() - - sub = col.column(align=True) - sub.operator("gpencil.color_isolate", icon='LOCKED', text="").affect_visibility = False - sub.operator("gpencil.color_isolate", icon='RESTRICT_VIEW_ON', text="").affect_visibility = True - - row = layout.row() - - row.template_ID(ob, "active_material", new="material.new", live_icon=True) - - if slot: - icon_link = 'MESH_DATA' if slot.link == 'DATA' else 'OBJECT_DATA' - row.prop(slot, "link", icon=icon_link, icon_only=True) - - if gpd.use_stroke_edit_mode: - row = layout.row(align=True) - row.operator("gpencil.stroke_change_color", text="Assign") - row.operator("gpencil.color_select", text="Select").deselect = False - row.operator("gpencil.color_select", text="Deselect").deselect = True - # Used as parent for "Stroke" and "Fill" panels class MATERIAL_PT_gpencil_surface(GPMaterialButtonsPanel, Panel): |