GPv3: Overlay: Show edit lines option
Adds option to only show edit mode lines overlay, and also adds overlay options panel. Pull Request: https://projects.blender.org/blender/blender/pulls/115739
This commit is contained in:
parent
5a2b8da619
commit
4dcda1ec12
@ -1042,6 +1042,8 @@ class VIEW3D_HT_header(Header):
|
||||
sub.popover(panel="VIEW3D_PT_overlay_vertex_paint", text="", icon='VPAINT_HLT')
|
||||
elif obj is not None and obj.type == 'GPENCIL':
|
||||
sub.popover(panel="VIEW3D_PT_overlay_gpencil_options", text="", icon='OUTLINER_DATA_GREASEPENCIL')
|
||||
elif obj is not None and obj.type == 'GREASEPENCIL':
|
||||
sub.popover(panel="VIEW3D_PT_overlay_grease_pencil_options", text="", icon='OUTLINER_DATA_GREASEPENCIL')
|
||||
|
||||
# Separate from `elif` chain because it may coexist with weight-paint.
|
||||
if (
|
||||
@ -7788,6 +7790,33 @@ class VIEW3D_PT_overlay_gpencil_options(Panel):
|
||||
row.prop(overlay, "gpencil_vertex_paint_opacity", text="Opacity", slider=True)
|
||||
|
||||
|
||||
class VIEW3D_PT_overlay_grease_pencil_options(Panel):
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'HEADER'
|
||||
bl_label = ""
|
||||
bl_ui_units_x = 13
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.object and context.object.type == 'GREASEPENCIL'
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
view = context.space_data
|
||||
overlay = view.overlay
|
||||
|
||||
layout.label(text={
|
||||
'PAINT_GREASE_PENCIL': iface_("Draw Grease Pencil"),
|
||||
'EDIT_GREASE_PENCIL': iface_("Edit Grease Pencil"),
|
||||
'OBJECT': iface_("Grease Pencil"),
|
||||
}[context.mode], translate=False)
|
||||
|
||||
if context.object.mode in {'EDIT'}:
|
||||
split = layout.split()
|
||||
col = split.column()
|
||||
col.prop(overlay, "use_gpencil_edit_lines", text="Edit Lines")
|
||||
|
||||
|
||||
class VIEW3D_PT_quad_view(Panel):
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
@ -8953,6 +8982,7 @@ classes = (
|
||||
VIEW3D_PT_gpencil_guide,
|
||||
VIEW3D_PT_transform_orientations,
|
||||
VIEW3D_PT_overlay_gpencil_options,
|
||||
VIEW3D_PT_overlay_grease_pencil_options,
|
||||
VIEW3D_PT_context_properties,
|
||||
VIEW3D_PT_paint_vertex_context_menu,
|
||||
VIEW3D_PT_paint_texture_context_menu,
|
||||
|
@ -21,6 +21,7 @@ void OVERLAY_edit_grease_pencil_cache_init(OVERLAY_Data *vedata)
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
const eAttrDomain selection_domain = ED_grease_pencil_selection_domain_get(
|
||||
draw_ctx->scene->toolsettings);
|
||||
const View3D *v3d = draw_ctx->v3d;
|
||||
|
||||
GPUShader *sh;
|
||||
DRWShadingGroup *grp;
|
||||
@ -29,11 +30,16 @@ void OVERLAY_edit_grease_pencil_cache_init(OVERLAY_Data *vedata)
|
||||
DRW_STATE_BLEND_ALPHA;
|
||||
DRW_PASS_CREATE(psl->edit_grease_pencil_ps, (state | pd->clipping_state));
|
||||
|
||||
sh = OVERLAY_shader_edit_particle_strand();
|
||||
grp = pd->edit_grease_pencil_wires_grp = DRW_shgroup_create(sh, psl->edit_grease_pencil_ps);
|
||||
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
|
||||
const bool show_points = selection_domain == ATTR_DOMAIN_POINT;
|
||||
const bool show_lines = (v3d->gp_flag & V3D_GP_SHOW_EDIT_LINES) != 0;
|
||||
|
||||
if (selection_domain == ATTR_DOMAIN_POINT) {
|
||||
if (show_lines) {
|
||||
sh = OVERLAY_shader_edit_particle_strand();
|
||||
grp = pd->edit_grease_pencil_wires_grp = DRW_shgroup_create(sh, psl->edit_grease_pencil_ps);
|
||||
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
|
||||
}
|
||||
|
||||
if (show_points) {
|
||||
sh = OVERLAY_shader_edit_particle_point();
|
||||
grp = pd->edit_grease_pencil_points_grp = DRW_shgroup_create(sh, psl->edit_grease_pencil_ps);
|
||||
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
|
||||
|
Loading…
Reference in New Issue
Block a user