UI: improve categorization in Grease Pencil Layers sub-panels

The "Layers" panel for Grease Pencil objects uses sub-panels to organize
their properties in categories. Currently, this isn't so clear.
This patch cleans up these sub-panels with clearer categorization.

Reviewed By: #grease_pencil, antoniov, Blendify, HooglyBoogly

Ref D10184
This commit is contained in:
William Reynish 2021-01-25 23:39:20 +11:00 committed by Campbell Barton
parent 06fdbe6664
commit da2955fdf6
3 changed files with 48 additions and 20 deletions

View File

@ -23,6 +23,7 @@ from rna_prop_ui import PropertyPanel
from bl_ui.properties_grease_pencil_common import (
GreasePencilLayerMasksPanel,
GreasePencilLayerTransformPanel,
GreasePencilLayerAdjustmentsPanel,
GreasePencilLayerRelationsPanel,
GreasePencilLayerDisplayPanel,
@ -90,6 +91,7 @@ class GPENCIL_MT_layer_context_menu(Menu):
layout = self.layout
ob = context.object
gpd = ob.data
gpl = gpd.layers.active
layout.operator("gpencil.layer_duplicate", text="Duplicate", icon='DUPLICATE').mode='ALL'
layout.operator("gpencil.layer_duplicate", text="Duplicate Empty Keyframes").mode='EMPTY'
@ -104,6 +106,7 @@ class GPENCIL_MT_layer_context_menu(Menu):
layout.operator("gpencil.lock_all", icon='LOCKED', text="Lock All")
layout.operator("gpencil.unlock_all", icon='UNLOCKED', text="Unlock All")
layout.prop(gpd, "use_autolock_layers", text="Autolock Inactive Layers")
layout.prop(gpl, "lock_material")
layout.separator()
@ -189,6 +192,12 @@ class DATA_PT_gpencil_layer_masks(LayerDataButtonsPanel, GreasePencilLayerMasksP
bl_options = {'DEFAULT_CLOSED'}
class DATA_PT_gpencil_layer_transform(LayerDataButtonsPanel, GreasePencilLayerTransformPanel, Panel):
bl_label = "Transform"
bl_parent_id = 'DATA_PT_gpencil_layers'
bl_options = {'DEFAULT_CLOSED'}
class DATA_PT_gpencil_layer_adjustments(LayerDataButtonsPanel, GreasePencilLayerAdjustmentsPanel, Panel):
bl_label = "Adjustments"
bl_parent_id = 'DATA_PT_gpencil_layers'
@ -425,6 +434,7 @@ classes = (
DATA_PT_gpencil_onion_skinning_custom_colors,
DATA_PT_gpencil_onion_skinning_display,
DATA_PT_gpencil_layer_masks,
DATA_PT_gpencil_layer_transform,
DATA_PT_gpencil_layer_adjustments,
DATA_PT_gpencil_layer_relations,
DATA_PT_gpencil_layer_display,

View File

@ -727,12 +727,32 @@ class GreasePencilSimplifyPanel:
col.prop(rd, "simplify_gpencil_antialiasing")
class GreasePencilLayerTransformPanel:
def draw(self, context):
layout = self.layout
layout.use_property_split = True
ob = context.object
gpd = ob.data
gpl = gpd.layers.active
layout.active = not gpl.lock
row = layout.row(align=True)
row.prop(gpl, "location")
row = layout.row(align=True)
row.prop(gpl, "rotation")
row = layout.row(align=True)
row.prop(gpl, "scale")
class GreasePencilLayerAdjustmentsPanel:
def draw(self, context):
layout = self.layout
layout.use_property_split = True
scene = context.scene
ob = context.object
gpd = ob.data
@ -750,25 +770,6 @@ class GreasePencilLayerAdjustmentsPanel:
col = layout.row(align=True)
col.prop(gpl, "line_change", text="Stroke Thickness")
col = layout.row(align=True)
col.prop(gpl, "pass_index")
col = layout.row(align=True)
col.prop_search(gpl, "viewlayer_render", scene, "view_layers", text="View Layer")
col = layout.row(align=True)
col.prop(gpl, "lock_material")
# Transforms
row = layout.row(align=True)
row.prop(gpl, "location")
row = layout.row(align=True)
row.prop(gpl, "rotation")
row = layout.row(align=True)
row.prop(gpl, "scale")
class GPENCIL_UL_masks(UIList):
def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index):
@ -836,6 +837,7 @@ class GreasePencilLayerRelationsPanel:
layout.use_property_split = True
layout.use_property_decorate = False
scene = context.scene
ob = context.object
gpd = ob.data
gpl = gpd.layers.active
@ -849,6 +851,14 @@ class GreasePencilLayerRelationsPanel:
if parent and gpl.parent_type == 'BONE' and parent.type == 'ARMATURE':
col.prop_search(gpl, "parent_bone", parent.data, "bones", text="Bone")
layout.separator()
col = layout.row(align=True)
col.prop(gpl, "pass_index")
col = layout.row(align=True)
col.prop_search(gpl, "viewlayer_render", scene, "view_layers", text="View Layer")
class GreasePencilLayerDisplayPanel:

View File

@ -27,6 +27,7 @@ from bpy.types import (
from bl_ui.properties_grease_pencil_common import (
GreasePencilLayerMasksPanel,
GreasePencilLayerTransformPanel,
GreasePencilLayerAdjustmentsPanel,
GreasePencilLayerRelationsPanel,
GreasePencilLayerDisplayPanel,
@ -726,6 +727,12 @@ class DOPESHEET_PT_gpencil_layer_masks(LayersDopeSheetPanel, GreasePencilLayerMa
bl_options = {'DEFAULT_CLOSED'}
class DOPESHEET_PT_gpencil_layer_transform(LayersDopeSheetPanel, GreasePencilLayerTransformPanel, Panel):
bl_label = "Transform"
bl_parent_id = 'DOPESHEET_PT_gpencil_mode'
bl_options = {'DEFAULT_CLOSED'}
class DOPESHEET_PT_gpencil_layer_adjustments(LayersDopeSheetPanel, GreasePencilLayerAdjustmentsPanel, Panel):
bl_label = "Adjustments"
bl_parent_id = 'DOPESHEET_PT_gpencil_mode'
@ -762,6 +769,7 @@ classes = (
DOPESHEET_PT_filters,
DOPESHEET_PT_gpencil_mode,
DOPESHEET_PT_gpencil_layer_masks,
DOPESHEET_PT_gpencil_layer_transform,
DOPESHEET_PT_gpencil_layer_adjustments,
DOPESHEET_PT_gpencil_layer_relations,
DOPESHEET_PT_gpencil_layer_display,