GPv3: Handle UVs in Smooth Modifier #120032
|
@ -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_position = (mmd.flag & MOD_GREASE_PENCIL_SMOOTH_MOD_LOCATION);
|
||||||
const bool smooth_radius = (mmd.flag & MOD_GREASE_PENCIL_SMOOTH_MOD_THICKNESS);
|
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_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) {
|
if (iterations <= 0 || influence <= 0.0f) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(smooth_position || smooth_radius || smooth_opacity)) {
|
if (!(smooth_position || smooth_radius || smooth_opacity || smooth_uv)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,6 +167,21 @@ static void deform_drawing(const ModifierData &md,
|
||||||
radii.span);
|
radii.span);
|
||||||
radii.finish();
|
radii.finish();
|
||||||
}
|
}
|
||||||
|
if (smooth_uv) {
|
||||||
|
bke::SpanAttributeWriter<float> rotation = attributes.lookup_for_write_span<float>("rotation");
|
||||||
casey-bianco-davis marked this conversation as resolved
Outdated
|
|||||||
|
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,
|
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_strength", UI_ITEM_R_TOGGLE, IFACE_("Strength"), ICON_NONE);
|
||||||
uiItemR(row, ptr, "use_edit_thickness", UI_ITEM_R_TOGGLE, IFACE_("Thickness"), 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);
|
uiLayoutSetPropSep(layout, true);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
I'd include the expected type in the attribute lookup, since it's not guaranteed and the smoothing currently only supports float, float2, and float3