[Bf-blender-cvs] [b9ce21f] master: GPencil UI: Streamline the data panel workflow

Joshua Leung noreply at git.blender.org
Thu Aug 6 15:49:59 CEST 2015


Commit: b9ce21fd0fda385bcafa0e1f17385db97da60c83
Author: Joshua Leung
Date:   Fri Aug 7 01:46:06 2015 +1200
Branches: master
https://developer.blender.org/rBb9ce21fd0fda385bcafa0e1f17385db97da60c83

GPencil UI: Streamline the data panel workflow

Restored the "New Layer" button in the NKEY Grease Pencil panel (as was found
pre-2.73) for two cases:
 1) When no Grease Pencil datablock is active - This shortcut makes it possible to
    add a new layer to start drawing in with a single click again (instead of two
    clicks - one to add a datablock, and a second to add the layer)

 2) When there are no layers - There is no need to display the UI list in this case,
    thus saving a bit more space in the rare cases where this applies.

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

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 e86fc79..9a46e6f 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -303,6 +303,8 @@ class GPENCIL_PIE_tools_more(Menu):
         pie.operator("wm.call_menu_pie", text="Back to Main Palette...").name = "GPENCIL_PIE_tool_palette"
 
 
+###############################
+
 class GPENCIL_UL_layer(UIList):
     def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
         # assert(isinstance(item, bpy.types.GPencilLayer)
@@ -354,7 +356,9 @@ class GreasePencilDataPanel:
         layout.template_ID(gpd_owner, "grease_pencil", new="gpencil.data_add", unlink="gpencil.data_unlink")
 
         # Grease Pencil data...
-        if gpd:
+        if (gpd is None) or len(gpd.layers) == 0:
+            layout.operator("gpencil.layer_add", text="New Layer")
+        else:
             self.draw_layers(context, layout, gpd)
 
     def draw_layers(self, context, layout, gpd):




More information about the Bf-blender-cvs mailing list