GP: Convert lock axis to popover

This commit is contained in:
2018-09-21 08:51:04 +02:00
parent 391536ef12
commit cf34c165ea
2 changed files with 29 additions and 8 deletions

View File

@@ -229,12 +229,18 @@ class VIEW3D_HT_header(Header):
icon=or_icon,
)
row = layout.row()
row.enabled = context.tool_settings.gpencil_stroke_placement_view3d in ('ORIGIN', 'CURSOR')
row.prop(context.tool_settings.gpencil_sculpt, "lockaxis", text='')
if object_mode in ('GPENCIL_PAINT', 'GPENCIL_SCULPT'):
lock = tool_settings.gpencil_sculpt.lockaxis
gp_lock = \
tool_settings.gpencil_sculpt.bl_rna.properties['lockaxis'].enum_items[lock]
if object_mode == 'GPENCIL_SCULPT':
layout.prop(context.tool_settings.gpencil_sculpt, "lockaxis", text='')
lk_icon = getattr(gp_lock, "icon", "BLANK1")
lk_name = getattr(gp_lock, "name", "None")
layout.popover(
panel="VIEW3D_PT_gpencil_lock",
text=lk_name,
icon=lk_icon,
)
layout.separator_spacer()
@@ -4786,6 +4792,20 @@ class VIEW3D_PT_gpencil_origin(Panel):
col.prop(context.tool_settings, "gpencil_stroke_placement_view3d", expand=True)
class VIEW3D_PT_gpencil_lock(Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'HEADER'
bl_label = "Lock Axis"
def draw(self, context):
layout = self.layout
layout.label(text="Drawing Plane Lock")
row = layout.row()
col = row.column()
col.prop(context.tool_settings.gpencil_sculpt, "lockaxis", expand=True)
class VIEW3D_PT_overlay_gpencil_options(Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'HEADER'
@@ -5216,6 +5236,7 @@ classes = (
VIEW3D_PT_pivot_point,
VIEW3D_PT_snapping,
VIEW3D_PT_gpencil_origin,
VIEW3D_PT_gpencil_lock,
VIEW3D_PT_transform_orientations,
VIEW3D_PT_overlay_gpencil_options,
VIEW3D_PT_context_properties,

View File

@@ -85,9 +85,9 @@ static EnumPropertyItem rna_enum_gpencil_weight_brush_items[] = {
static const EnumPropertyItem rna_enum_gpencil_lockaxis_items[] = {
{ GP_LOCKAXIS_NONE, "GP_LOCKAXIS_NONE", ICON_UNLOCKED, "None", "" },
{ GP_LOCKAXIS_X, "GP_LOCKAXIS_X", ICON_NDOF_DOM, "X", "Project strokes to plane locked to X" },
{ GP_LOCKAXIS_Y, "GP_LOCKAXIS_Y", ICON_NDOF_DOM, "Y", "Project strokes to plane locked to Y" },
{ GP_LOCKAXIS_Z, "GP_LOCKAXIS_Z", ICON_NDOF_DOM, "Z", "Project strokes to plane locked to Z" },
{ GP_LOCKAXIS_X, "GP_LOCKAXIS_X", ICON_NDOF_DOM, "Y-Z Plane", "Project strokes to plane locked to X" },
{ GP_LOCKAXIS_Y, "GP_LOCKAXIS_Y", ICON_NDOF_DOM, "X-Z Plane", "Project strokes to plane locked to Y" },
{ GP_LOCKAXIS_Z, "GP_LOCKAXIS_Z", ICON_NDOF_DOM, "X-Y Plane", "Project strokes to plane locked to Z" },
{ 0, NULL, 0, NULL, NULL }
};
#endif