GPv3: Copy and Paste operators for copying strokes and points

This PR implements the Copy and Paste operators for GPv3. The operators
are available in Edit Mode. The Copy operator copies the selected strokes/
points to a clipboard. The Paste operator pastes the  strokes/points from
the clipboard to the active layer.

Keyboard shortcuts:
- `Ctrl`-`C` for copy
- `Ctrl`-`V` for paste
- `Ctrl`-`Shift`-`V` for paste in the back (behind all existing strokes)

Pull Request: https://projects.blender.org/blender/blender/pulls/114145
This commit is contained in:
Sietse Brouwer
2024-03-04 11:02:25 +01:00
committed by Falk David
parent d0c9246fcc
commit ad8180c54c
7 changed files with 320 additions and 26 deletions
+17
View File
@@ -5831,6 +5831,11 @@ class VIEW3D_MT_edit_greasepencil(Menu):
layout.separator()
layout.operator("grease_pencil.copy", text="Copy", icon='COPYDOWN')
layout.operator("grease_pencil.paste", text="Paste", icon='PASTEDOWN')
layout.separator()
layout.menu("VIEW3D_MT_edit_greasepencil_showhide")
layout.operator_menu_enum("grease_pencil.separate", "mode", text="Separate")
layout.operator("grease_pencil.clean_loose")
@@ -8220,6 +8225,12 @@ class VIEW3D_MT_greasepencil_edit_context_menu(Menu):
col = row.column(align=True)
col.label(text="Point", icon='GP_SELECT_POINTS')
# Copy/paste
col.operator("grease_pencil.copy", text="Copy", icon="COPYDOWN")
col.operator("grease_pencil.paste", text="Paste", icon="PASTEDOWN")
col.separator()
# Main Strokes Operators
col.operator("grease_pencil.stroke_subdivide", text="Subdivide")
col.operator("grease_pencil.stroke_subdivide_smooth", text="Subdivide and Smooth")
@@ -8256,6 +8267,12 @@ class VIEW3D_MT_greasepencil_edit_context_menu(Menu):
col = row.column(align=True)
col.label(text="Stroke", icon='GP_SELECT_STROKES')
# Copy/paste
col.operator("grease_pencil.copy", text="Copy", icon="COPYDOWN")
col.operator("grease_pencil.paste", text="Paste", icon="PASTEDOWN")
col.separator()
# Main Strokes Operators
col.operator("grease_pencil.stroke_subdivide", text="Subdivide")
col.operator("grease_pencil.stroke_subdivide_smooth", text="Subdivide and Smooth")