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.
This commit is contained in:
parent
cee7c36cbd
commit
4ccaf56814
@ -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")
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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'
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user