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.
This commit is contained in:
Joshua Leung 2015-08-07 01:46:06 +12:00
parent 376e729de0
commit b9ce21fd0f
1 changed files with 5 additions and 1 deletions

View File

@ -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):