diff options
author | Joshua Leung <aligorith@gmail.com> | 2015-02-12 16:24:49 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2015-02-12 16:48:49 +0300 |
commit | d92d8c3768207b99d714cd7d45f9460bc1a67b89 (patch) | |
tree | a5f86b4ec45cea4f40f36f258db349f31394acbf /release/scripts/startup | |
parent | 4f3f9cb2806ad0434ec853c5a63849fce68a9def (diff) |
GPencil: Some tweaks to make GPencil UI more compact when there are 0 or 1 layer(s) only
As brought up in T43595, the Grease Pencil layers list could sometimes end up
taking up too much space when there are no layers. Another issue raised there
was that the up/down buttons are redundant when there is only a single layer.
This commit makes some changes to get these a bit more compact for the case where
you have an empty GPencil datablock left over from previous work.
Diffstat (limited to 'release/scripts/startup')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_grease_pencil_common.py | 15 |
1 files changed, 10 insertions, 5 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 9969c568bf9..5b5a7648d83 100644 --- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py +++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py @@ -361,7 +361,11 @@ class GreasePencilDataPanel: row = layout.row() col = row.column() - col.template_list("GPENCIL_UL_layer", "", gpd, "layers", gpd.layers, "active_index", rows=5) + if len(gpd.layers) >= 2: + layer_rows = 5 + else: + layer_rows = 2 + col.template_list("GPENCIL_UL_layer", "", gpd, "layers", gpd.layers, "active_index", rows=layer_rows) col = row.column() @@ -373,11 +377,12 @@ class GreasePencilDataPanel: if gpl: sub.operator("gpencil.layer_duplicate", icon='COPY_ID', text="") # XXX: needs a dedicated icon - col.separator() + if len(gpd.layers) > 1: + col.separator() - sub = col.column(align=True) - sub.operator("gpencil.layer_move", icon='TRIA_UP', text="").type = 'UP' - sub.operator("gpencil.layer_move", icon='TRIA_DOWN', text="").type = 'DOWN' + sub = col.column(align=True) + sub.operator("gpencil.layer_move", icon='TRIA_UP', text="").type = 'UP' + sub.operator("gpencil.layer_move", icon='TRIA_DOWN', text="").type = 'DOWN' if gpl: self.draw_layer(layout, gpl) |