GP: Move origin selector to center and convert to popup

This commit is contained in:
Antonioya 2018-09-20 18:50:07 +02:00
parent ce1b57227d
commit 963d668a03
2 changed files with 36 additions and 12 deletions

@ -184,12 +184,6 @@ class TOPBAR_HT_lower_bar(Header):
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".particlemode", category="")
elif mode == 'OBJECT':
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".objectmode", category="")
elif mode in ('GPENCIL_EDIT', 'GPENCIL_WEIGHT'):
layout.label(text="Layer:")
layout.popover(
panel="TOPBAR_PT_gpencil_layers",
text=txt
)
elif mode == 'GPENCIL_PAINT':
layout.label(text="Layer:")
layout.popover(
@ -197,20 +191,15 @@ class TOPBAR_HT_lower_bar(Header):
text=txt
)
layout.prop(context.tool_settings, "gpencil_stroke_placement_view3d", text='')
if context.tool_settings.gpencil_stroke_placement_view3d in ('ORIGIN', 'CURSOR'):
layout.prop(context.tool_settings.gpencil_sculpt, "lockaxis", text='')
layout.prop(context.tool_settings, "use_gpencil_draw_onback", text="", icon='ORTHO')
layout.prop(context.tool_settings, "add_gpencil_weight_data", text="", icon='WPAINT_HLT')
layout.prop(context.tool_settings, "use_gpencil_additive_drawing", text="", icon='FREEZE')
elif mode == 'GPENCIL_SCULPT':
elif mode in ('GPENCIL_EDIT', 'GPENCIL_SCULPT', 'GPENCIL_WEIGHT'):
layout.label(text="Layer:")
layout.popover(
panel="TOPBAR_PT_gpencil_layers",
text=txt
)
layout.prop(context.tool_settings.gpencil_sculpt, "lockaxis", text='')
class _draw_left_context_mode:

@ -215,6 +215,26 @@ class VIEW3D_HT_header(Header):
icon=act_pivot_point.icon,
text="",
)
# grease pencil
if object_mode == 'GPENCIL_PAINT':
origin = tool_settings.gpencil_stroke_placement_view3d
gp_origin = \
tool_settings.bl_rna.properties['gpencil_stroke_placement_view3d'].enum_items[origin]
or_icon = getattr(gp_origin, "icon", "BLANK1")
or_name = getattr(gp_origin, "name", "Origin")
layout.popover(
panel="VIEW3D_PT_gpencil_origin",
text=or_name,
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 == 'GPENCIL_SCULPT':
layout.prop(context.tool_settings.gpencil_sculpt, "lockaxis", text='')
layout.separator_spacer()
@ -4752,6 +4772,20 @@ class VIEW3D_PT_transform_orientations(Panel):
row.operator("transform.delete_orientation", text="", icon='X', emboss=False)
class VIEW3D_PT_gpencil_origin(Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'HEADER'
bl_label = "Origin"
def draw(self, context):
layout = self.layout
layout.label(text="Origin")
row = layout.row()
col = row.column()
col.prop(context.tool_settings, "gpencil_stroke_placement_view3d", expand=True)
class VIEW3D_PT_overlay_gpencil_options(Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'HEADER'
@ -5181,6 +5215,7 @@ classes = (
VIEW3D_PT_overlay_sculpt,
VIEW3D_PT_pivot_point,
VIEW3D_PT_snapping,
VIEW3D_PT_gpencil_origin,
VIEW3D_PT_transform_orientations,
VIEW3D_PT_overlay_gpencil_options,
VIEW3D_PT_context_properties,