[Bf-blender-cvs] [d92d8c3] master: GPencil: Some tweaks to make GPencil UI more compact when there are 0 or 1 layer(s) only

Joshua Leung noreply at git.blender.org
Thu Feb 12 14:50:11 CET 2015


Commit: d92d8c3768207b99d714cd7d45f9460bc1a67b89
Author: Joshua Leung
Date:   Fri Feb 13 02:24:49 2015 +1300
Branches: master
https://developer.blender.org/rBd92d8c3768207b99d714cd7d45f9460bc1a67b89

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.

===================================================================

M	release/scripts/startup/bl_ui/properties_grease_pencil_common.py

===================================================================

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 9969c56..5b5a764 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)




More information about the Bf-blender-cvs mailing list