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 /intern | |
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 'intern')
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 542f02f1a6d..d0cfb5c5e72 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -1613,7 +1613,8 @@ class CYCLES_MATERIAL_PT_preview(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): - return context.material and CyclesButtonsPanel.poll(context) + mat = context.material + return mat and (not mat.grease_pencil) and CyclesButtonsPanel.poll(context) def draw(self, context): self.layout.template_preview(context.material) @@ -1625,7 +1626,8 @@ class CYCLES_MATERIAL_PT_surface(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): - return context.material and CyclesButtonsPanel.poll(context) + mat = context.material + return mat and (not mat.grease_pencil) and CyclesButtonsPanel.poll(context) def draw(self, context): layout = self.layout @@ -1643,7 +1645,7 @@ class CYCLES_MATERIAL_PT_volume(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): mat = context.material - return mat and mat.node_tree and CyclesButtonsPanel.poll(context) + return mat and (not mat.grease_pencil) and mat.node_tree and CyclesButtonsPanel.poll(context) def draw(self, context): layout = self.layout @@ -1661,7 +1663,7 @@ class CYCLES_MATERIAL_PT_displacement(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): mat = context.material - return mat and mat.node_tree and CyclesButtonsPanel.poll(context) + return mat and (not mat.grease_pencil) and mat.node_tree and CyclesButtonsPanel.poll(context) def draw(self, context): layout = self.layout @@ -1677,7 +1679,8 @@ class CYCLES_MATERIAL_PT_settings(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): - return context.material and CyclesButtonsPanel.poll(context) + mat = context.material + return mat and (not mat.grease_pencil) and CyclesButtonsPanel.poll(context) @staticmethod def draw_shared(self, mat): |