diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2019-03-08 21:30:22 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2019-03-08 21:36:31 +0300 |
commit | 4ccaf56814a1389516dba7b2eb8fde0944dfccd8 (patch) | |
tree | 0318c455da798488bea5c0aa225fc8220f41fec5 /release/scripts/startup/bl_ui | |
parent | cee7c36cbddc47fbf257a8b9fdca9c424b684c91 (diff) |
Fix T62349: Grease Pencil top material list not working
This is a fixup for my own: 92d185faebe.
I'm also fixing the poll of the EEVEE_MATERIAL_PT_context_material
which would fail when we had no context.material available.
Diffstat (limited to 'release/scripts/startup/bl_ui')
4 files changed, 17 insertions, 11 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 d65d494630a..6b3660d85c6 100644 --- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py +++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py @@ -856,21 +856,16 @@ class GreasePencilToolsPanel: class GreasePencilMaterialsPanel: # Mix-in, use for properties editor and top-bar. - - @classmethod - def poll(cls, context): - ob = context.object - ma = context.material - return (ob and ob.type == 'GPENCIL') or (ma and ma.grease_pencil) - @staticmethod def draw(self, context): layout = self.layout show_full_ui = (self.bl_space_type == 'PROPERTIES') ob = context.object - gpd = context.gpencil - space = context.space_data + if hasattr(context, "gpencil"): + gpd = context.gpencil + else: + gpd = context.gpencil_data row = layout.row() @@ -916,6 +911,7 @@ class GreasePencilMaterialsPanel: row.operator("gpencil.color_select", text="Deselect").deselect = True else: + space = context.space_data row.template_ID(space, "pin_id") diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py index 07c94c90738..b05955e3598 100644 --- a/release/scripts/startup/bl_ui/properties_material.py +++ b/release/scripts/startup/bl_ui/properties_material.py @@ -87,8 +87,13 @@ class EEVEE_MATERIAL_PT_context_material(MaterialButtonsPanel, Panel): @classmethod def poll(cls, context): + ob = context.object mat = context.material - return (context.object or mat) and (context.engine in cls.COMPAT_ENGINES) and not mat.grease_pencil + + if (ob and ob.type == 'GPENCIL') or (mat and mat.grease_pencil): + return False + + return (ob or mat) and (context.engine in cls.COMPAT_ENGINES) def draw(self, context): layout = self.layout diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py b/release/scripts/startup/bl_ui/properties_material_gpencil.py index c8691d15cc4..a27d2ff9b84 100644 --- a/release/scripts/startup/bl_ui/properties_material_gpencil.py +++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py @@ -85,7 +85,7 @@ class GPMaterialButtonsPanel: return ma and ma.grease_pencil -class MATERIAL_PT_gpencil_slots(GreasePencilMaterialsPanel, Panel): +class MATERIAL_PT_gpencil_slots(GreasePencilMaterialsPanel, GPMaterialButtonsPanel, Panel): bl_label = "Grease Pencil Material Slots" bl_space_type = 'PROPERTIES' bl_region_type = 'WINDOW' diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 8b6634acbcd..9fcc8b9e251 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -5766,6 +5766,11 @@ class TOPBAR_PT_gpencil_materials(GreasePencilMaterialsPanel, Panel): bl_label = "Materials" bl_ui_units_x = 14 + @classmethod + def poll(cls, context): + ob = context.object + return ob and ob.type == 'GPENCIL' + classes = ( VIEW3D_HT_header, |