GPv3: Convert selection domain on curves when selection mode changes

When the selection mode in the Grease Pencil tool settings changes,
the selection domain of all curves in the active Grease Pencil object
has to change.
This PR handles that conversion. Point selections are converted to
curve selection and vice versa.

Note: this PR only takes care of selection modes 'Point' and 'Stroke'.
'Segment' mode is handled in a separate PR (#109221).

Pull Request: https://projects.blender.org/blender/blender/pulls/109964
This commit is contained in:
Sietse Brouwer
2023-07-12 10:22:46 +02:00
committed by Falk David
parent ac3f4e959f
commit 64887c80a2
4 changed files with 122 additions and 18 deletions

View File

@@ -752,8 +752,18 @@ class VIEW3D_HT_header(Header):
# Select mode for Editing
if object_mode == 'EDIT':
row = layout.row(align=True)
row.prop_enum(tool_settings, "gpencil_selectmode_edit", text="", value='POINT')
row.prop_enum(tool_settings, "gpencil_selectmode_edit", text="", value='STROKE')
row.operator(
"grease_pencil.set_selection_mode",
text="",
icon="GP_SELECT_POINTS",
depress=(tool_settings.gpencil_selectmode_edit == 'POINT'),
).mode = 'POINT'
row.operator(
"grease_pencil.set_selection_mode",
text="",
icon="GP_SELECT_STROKES",
depress=(tool_settings.gpencil_selectmode_edit == 'STROKE'),
).mode = 'STROKE'
# Grease Pencil (legacy)
if obj and obj.type == 'GPENCIL' and context.gpencil_data: