diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2019-03-07 17:55:03 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2019-03-07 23:28:25 +0300 |
commit | 92d185faebeac60ec2591c2a7c0f870e7726593d (patch) | |
tree | 4e49a15d3c4e3f0c45cd9089fdf4567084b4e26e /release/scripts/startup/bl_ui/properties_material.py | |
parent | 81a09628c29d788affb0686e9ebdce7dc6a09d2d (diff) |
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_material.py')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_material.py | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py index 8d7e7ac266d..07c94c90738 100644 --- a/release/scripts/startup/bl_ui/properties_material.py +++ b/release/scripts/startup/bl_ui/properties_material.py @@ -60,7 +60,8 @@ class MaterialButtonsPanel: @classmethod def poll(cls, context): - return context.material and (context.engine in cls.COMPAT_ENGINES) + mat = context.material + return mat and (context.engine in cls.COMPAT_ENGINES) and not mat.grease_pencil class MATERIAL_PT_preview(MaterialButtonsPanel, Panel): @@ -86,11 +87,8 @@ class EEVEE_MATERIAL_PT_context_material(MaterialButtonsPanel, Panel): @classmethod def poll(cls, context): - if context.active_object and context.active_object.type == 'GPENCIL': - return False - else: - engine = context.engine - return (context.material or context.object) and (engine in cls.COMPAT_ENGINES) + mat = context.material + return (context.object or mat) and (context.engine in cls.COMPAT_ENGINES) and not mat.grease_pencil def draw(self, context): layout = self.layout @@ -161,11 +159,6 @@ class EEVEE_MATERIAL_PT_surface(MaterialButtonsPanel, Panel): bl_context = "material" COMPAT_ENGINES = {'BLENDER_EEVEE'} - @classmethod - def poll(cls, context): - engine = context.engine - return context.material and (engine in cls.COMPAT_ENGINES) - def draw(self, context): layout = self.layout @@ -194,7 +187,7 @@ class EEVEE_MATERIAL_PT_volume(MaterialButtonsPanel, Panel): def poll(cls, context): engine = context.engine mat = context.material - return mat and mat.use_nodes and (engine in cls.COMPAT_ENGINES) + return mat and mat.use_nodes and (engine in cls.COMPAT_ENGINES) and not mat.grease_pencil def draw(self, context): layout = self.layout @@ -209,11 +202,6 @@ class EEVEE_MATERIAL_PT_settings(MaterialButtonsPanel, Panel): bl_context = "material" COMPAT_ENGINES = {'BLENDER_EEVEE'} - @classmethod - def poll(cls, context): - engine = context.engine - return context.material and (engine in cls.COMPAT_ENGINES) - @staticmethod def draw_shared(self, mat): layout = self.layout @@ -247,7 +235,8 @@ class MATERIAL_PT_viewport(MaterialButtonsPanel, Panel): @classmethod def poll(cls, context): - return context.material + mat = context.material + return mat and not mat.grease_pencil @staticmethod def draw_shared(self, mat): |