From 814ab72b17e1dcb88d042978e78496b6a858d43a Mon Sep 17 00:00:00 2001 From: casey bianco-davis Date: Thu, 28 Mar 2024 11:54:50 -0700 Subject: [PATCH 1/2] GPv3: smooth modifier handle UVs. --- .../intern/MOD_grease_pencil_smooth.cc | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/source/blender/modifiers/intern/MOD_grease_pencil_smooth.cc b/source/blender/modifiers/intern/MOD_grease_pencil_smooth.cc index 72671bd78c6..14ec744cdd3 100644 --- a/source/blender/modifiers/intern/MOD_grease_pencil_smooth.cc +++ b/source/blender/modifiers/intern/MOD_grease_pencil_smooth.cc @@ -99,12 +99,13 @@ static void deform_drawing(const ModifierData &md, const bool smooth_position = (mmd.flag & MOD_GREASE_PENCIL_SMOOTH_MOD_LOCATION); const bool smooth_radius = (mmd.flag & MOD_GREASE_PENCIL_SMOOTH_MOD_THICKNESS); const bool smooth_opacity = (mmd.flag & MOD_GREASE_PENCIL_SMOOTH_MOD_STRENGTH); + const bool smooth_uv = (mmd.flag & MOD_GREASE_PENCIL_SMOOTH_MOD_UV); if (iterations <= 0 || influence <= 0.0f) { return; } - if (!(smooth_position || smooth_radius || smooth_opacity)) { + if (!(smooth_position || smooth_radius || smooth_opacity || smooth_uv)) { return; } @@ -166,6 +167,21 @@ static void deform_drawing(const ModifierData &md, radii.span); radii.finish(); } + if (smooth_uv) { + bke::GSpanAttributeWriter rotation = attributes.lookup_for_write_span("rotation"); + if (rotation) { + geometry::smooth_curve_attribute(strokes, + points_by_curve, + point_selection, + cyclic, + iterations, + influence, + smooth_ends, + false, + rotation.span); + } + rotation.finish(); + } } static void modify_geometry_set(ModifierData *md, @@ -203,8 +219,7 @@ static void panel_draw(const bContext *C, Panel *panel) uiItemR(row, ptr, "use_edit_strength", UI_ITEM_R_TOGGLE, IFACE_("Strength"), ICON_NONE); uiItemR(row, ptr, "use_edit_thickness", UI_ITEM_R_TOGGLE, IFACE_("Thickness"), ICON_NONE); - /* TODO: UV not implemented yet in GPv3. */ - // uiItemR(row, ptr, "use_edit_uv", UI_ITEM_R_TOGGLE, IFACE_("UV"), ICON_NONE); + uiItemR(row, ptr, "use_edit_uv", UI_ITEM_R_TOGGLE, IFACE_("UV"), ICON_NONE); uiLayoutSetPropSep(layout, true); -- 2.30.2 From ee48acbd6884c2eeafd749cfe8f6e83e9fdfff2b Mon Sep 17 00:00:00 2001 From: casey bianco-davis Date: Thu, 28 Mar 2024 13:53:20 -0700 Subject: [PATCH 2/2] Cleanup: Use float template. --- source/blender/modifiers/intern/MOD_grease_pencil_smooth.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/modifiers/intern/MOD_grease_pencil_smooth.cc b/source/blender/modifiers/intern/MOD_grease_pencil_smooth.cc index 14ec744cdd3..00a4331a935 100644 --- a/source/blender/modifiers/intern/MOD_grease_pencil_smooth.cc +++ b/source/blender/modifiers/intern/MOD_grease_pencil_smooth.cc @@ -168,7 +168,7 @@ static void deform_drawing(const ModifierData &md, radii.finish(); } if (smooth_uv) { - bke::GSpanAttributeWriter rotation = attributes.lookup_for_write_span("rotation"); + bke::SpanAttributeWriter rotation = attributes.lookup_for_write_span("rotation"); if (rotation) { geometry::smooth_curve_attribute(strokes, points_by_curve, -- 2.30.2