diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2019-02-27 01:40:07 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2019-02-27 01:51:13 +0300 |
commit | ce104ca89643c4b0e6358fd22a2b056ecd603e62 (patch) | |
tree | 933f0e3f097c0bb3db4df855739e15f385159413 /release/scripts/startup/bl_ui/properties_data_gpencil.py | |
parent | 1beada2c62dfc36fb0250dfbbc85c1745ae7325b (diff) |
Fix: Grease Pencil data panels not working with pinning
Note: Things were working fine if you were to pin the Grease Pencil
object, but not if you were pinning the GP data.
In too many poll functions context.object was being requested when
a simple context.gpencil_data would suffit.
Panels that are still not showing in pinning:
* DATA_PT_gpencil_display.
The panel needs to be split in sub-panels, leaving all object-dependent
properties in its own panel so we can poll it away, while showing the
rest.
* * *
This commit doesn't handle greasepencil material. In this case I
recommend we do as properties_material.py and have a generous poll(),
followed by different drawing logics whether or not we have an object.
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_data_gpencil.py')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_data_gpencil.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py b/release/scripts/startup/bl_ui/properties_data_gpencil.py index 8b4b927ffde..7a723901e4b 100644 --- a/release/scripts/startup/bl_ui/properties_data_gpencil.py +++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py @@ -36,6 +36,16 @@ class DataButtonsPanel: @classmethod def poll(cls, context): + return context.gpencil_data + + +class ObjectButtonsPanel: + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "data" + + @classmethod + def poll(cls, context): return context.object and context.object.type == 'GPENCIL' @@ -46,8 +56,7 @@ class LayerDataButtonsPanel: @classmethod def poll(cls, context): - return (context.object and - context.object.type == 'GPENCIL' and + return (context.gpencil_data and context.active_gpencil_layer) @@ -103,14 +112,7 @@ class DATA_PT_gpencil_datapanel(Panel): @classmethod def poll(cls, context): - if context.gpencil_data is None: - return False - - ob = context.object - if ob is not None and ob.type == 'GPENCIL': - return True - - return False + return context.gpencil_data @staticmethod def draw(self, context): @@ -294,7 +296,7 @@ class GPENCIL_UL_vgroups(UIList): layout.label(text="", icon_value=icon) -class DATA_PT_gpencil_vertexpanel(DataButtonsPanel, Panel): +class DATA_PT_gpencil_vertexpanel(ObjectButtonsPanel, Panel): bl_space_type = 'PROPERTIES' bl_region_type = 'WINDOW' bl_context = "data" @@ -359,7 +361,7 @@ class DATA_PT_gpencil_strokes(DataButtonsPanel, Panel): layout.prop(gpd, "use_adaptive_uv", text="Adaptive UVs") -class DATA_PT_gpencil_display(DataButtonsPanel, Panel): +class DATA_PT_gpencil_display(ObjectButtonsPanel, Panel): bl_label = "Viewport Display" bl_options = {'DEFAULT_CLOSED'} |