Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFalk David <falkdavid@gmx.de>2020-11-13 23:43:00 +0300
committerFalk David <falkdavid@gmx.de>2020-11-13 23:43:00 +0300
commit0be88c7d15d2ad1af284c6283370173647ae74eb (patch)
tree5fff573c512e284547ebe0c921ecffdae2c377c4 /release
parent9d28353b525ecfbcca1501be72e4276dfb2bbc2a (diff)
GPencil: Merge GSoC curve edit mode
Differential Revision: https://developer.blender.org/D8660 This patch is the result of the GSoC 2020 "Editing Grease Pencil Strokes Using Curves" project. It adds a submode to greasepencil edit mode that allows for the transformation of greasepencil strokes using bezier curves. More information about the project can be found here: https://wiki.blender.org/wiki/User:Filedescriptor/GSoC_2020.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py1
-rw-r--r--release/scripts/presets/keyconfig/keymap_data/blender_default.py18
-rw-r--r--release/scripts/startup/bl_ui/properties_data_gpencil.py2
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py45
4 files changed, 64 insertions, 2 deletions
diff --git a/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py b/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py
index 52b9f1601d5..f92a478fb66 100644
--- a/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py
+++ b/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py
@@ -191,6 +191,7 @@ _km_hierarchy = [
]),
('Grease Pencil', 'EMPTY', 'WINDOW', [ # grease pencil stuff (per region)
+ ('Grease Pencil Stroke Curve Edit Mode', 'EMPTY', 'WINDOW', []),
('Grease Pencil Stroke Edit Mode', 'EMPTY', 'WINDOW', []),
('Grease Pencil Stroke Paint (Draw brush)', 'EMPTY', 'WINDOW', []),
('Grease Pencil Stroke Paint (Fill)', 'EMPTY', 'WINDOW', []),
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 174ab6fd28b..d66d7c45dd4 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -3226,6 +3226,9 @@ def km_grease_pencil_stroke_edit_mode(params):
{"properties": [("mode", 'GPENCIL_OPACITY')]}),
# Proportional editing.
*_template_items_proportional_editing(connected=True),
+ # Curve edit mode toggle.
+ ("wm.context_toggle", {"type": 'U', "value": 'PRESS'},
+ {"properties": [("data_path", 'gpencil_data.use_curve_edit')]}),
# Add menu
("object.gpencil_add", {"type": 'A', "value": 'PRESS', "shift": True}, None),
# Vertex group menu
@@ -3253,6 +3256,20 @@ def km_grease_pencil_stroke_edit_mode(params):
return keymap
+def km_grease_pencil_stroke_curve_edit_mode(params):
+ items = []
+ keymap = (
+ "Grease Pencil Stroke Curve Edit Mode",
+ {"space_type": 'EMPTY', "region_type": 'WINDOW'},
+ {"items": items},
+ )
+
+ items.extend([
+ # Set handle type
+ ("gpencil.stroke_editcurve_set_handle_type", {"type": 'V', "value": 'PRESS'}, None),
+ ])
+
+ return keymap
def km_grease_pencil_stroke_paint_mode(params):
items = []
@@ -6890,6 +6907,7 @@ def generate_keymaps(params=None):
# Modes.
km_grease_pencil(params),
+ km_grease_pencil_stroke_curve_edit_mode(params),
km_grease_pencil_stroke_edit_mode(params),
km_grease_pencil_stroke_paint_mode(params),
km_grease_pencil_stroke_paint_draw_brush(params),
diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py b/release/scripts/startup/bl_ui/properties_data_gpencil.py
index affdba6f693..398bf60c493 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -369,6 +369,8 @@ class DATA_PT_gpencil_strokes(DataButtonsPanel, Panel):
sub.active = gpd.stroke_thickness_space == 'WORLDSPACE'
sub.prop(gpd, "pixel_factor", text="Thickness Scale")
+ col.prop(gpd, "edit_curve_resolution")
+
class DATA_PT_gpencil_display(DataButtonsPanel, Panel):
bl_label = "Viewport Display"
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 1b5a7da61b0..9dbb56e7e45 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -661,7 +661,23 @@ class VIEW3D_HT_header(Header):
# Select mode for Editing
if gpd.use_stroke_edit_mode:
row = layout.row(align=True)
- row.prop(tool_settings, "gpencil_selectmode_edit", text="", expand=True)
+ row.prop_enum(tool_settings, "gpencil_selectmode_edit", text="", value='POINT')
+ row.prop_enum(tool_settings, "gpencil_selectmode_edit", text="", value='STROKE')
+
+ subrow = row.row(align=True)
+ subrow.enabled = not gpd.use_curve_edit
+ subrow.prop_enum(tool_settings, "gpencil_selectmode_edit", text="", value='SEGMENT')
+
+ # Curve edit submode
+ row = layout.row(align=True)
+ row.prop(gpd, "use_curve_edit", text="",
+ icon='IPO_BEZIER')
+ sub = row.row(align=True)
+ sub.active = gpd.use_curve_edit
+ sub.popover(
+ panel="VIEW3D_PT_gpencil_curve_edit",
+ text="Curve Editing",
+ )
# Select mode for Sculpt
if gpd.is_stroke_sculpt_mode:
@@ -687,7 +703,7 @@ class VIEW3D_HT_header(Header):
row.prop(gpd, "use_multiedit", text="", icon='GP_MULTIFRAME_EDITING')
sub = row.row(align=True)
- sub.active = gpd.use_multiedit
+ sub.enabled = gpd.use_multiedit
sub.popover(
panel="VIEW3D_PT_gpencil_multi_frame",
text="Multiframe",
@@ -6802,6 +6818,12 @@ class VIEW3D_PT_overlay_gpencil_options(Panel):
layout.prop(overlay, "vertex_opacity", text="Vertex Opacity", slider=True)
+ # Handles for Curve Edit
+ if context.object.mode == 'EDIT_GPENCIL':
+ gpd = context.object.data
+ if gpd.use_curve_edit:
+ layout.prop(overlay, "display_handle", text="Handles")
+
if context.object.mode in {'PAINT_GPENCIL', 'VERTEX_GPENCIL'}:
layout.label(text="Vertex Paint")
row = layout.row()
@@ -6965,6 +6987,24 @@ class VIEW3D_PT_gpencil_multi_frame(Panel):
layout.template_curve_mapping(settings, "multiframe_falloff_curve", brush=True)
+# Grease Pencil Object - Curve Editing tools
+class VIEW3D_PT_gpencil_curve_edit(Panel):
+ bl_space_type = 'VIEW_3D'
+ bl_region_type = 'HEADER'
+ bl_label = "Curve Editing"
+
+ def draw(self, context):
+ gpd = context.gpencil_data
+ settings = context.tool_settings.gpencil_sculpt
+
+ layout = self.layout
+ col = layout.column(align=True)
+ col.prop(gpd, "edit_curve_resolution")
+ col.prop(gpd, "curve_edit_threshold")
+ col.prop(gpd, "curve_edit_corner_angle")
+ col.prop(gpd, "use_adaptive_curve_resolution")
+
+
class VIEW3D_MT_gpencil_edit_context_menu(Menu):
bl_label = ""
@@ -7606,6 +7646,7 @@ classes = (
VIEW3D_PT_grease_pencil,
VIEW3D_PT_annotation_onion,
VIEW3D_PT_gpencil_multi_frame,
+ VIEW3D_PT_gpencil_curve_edit,
VIEW3D_PT_quad_view,
VIEW3D_PT_view3d_stereo,
VIEW3D_PT_shading,