GPv3: Set Uniform operator for Thickness and Opacity #114006

Merged
Antonio Vazquez merged 20 commits from antoniov/blender:GPv3_normalize into main 2023-11-08 16:19:10 +01:00
Showing only changes of commit b4a2847f23 - Show all commits

View File

@ -974,9 +974,9 @@ static int grease_pencil_set_uniform_thickness_exec(bContext *C, wmOperator *op)
const float radius = RNA_float_get(op->ptr, "radius"); const float radius = RNA_float_get(op->ptr, "radius");
bool changed = false; bool changed = false;
grease_pencil.foreach_editable_drawing( const Array<MutableDrawingInfo> drawings = retrieve_editable_drawings(*scene, grease_pencil);
scene->r.cfra, [&](int /*layer_index*/, bke::greasepencil::Drawing &drawing) { threading::parallel_for_each(drawings, [&](const MutableDrawingInfo &info) {
bke::CurvesGeometry &curves = drawing.strokes_for_write(); bke::CurvesGeometry &curves = info.drawing.strokes_for_write();
IndexMaskMemory memory; IndexMaskMemory memory;
const IndexMask selected_curves = ed::curves::retrieve_selected_curves(curves, memory); const IndexMask selected_curves = ed::curves::retrieve_selected_curves(curves, memory);
@ -986,7 +986,7 @@ static int grease_pencil_set_uniform_thickness_exec(bContext *C, wmOperator *op)
} }
const OffsetIndices<int> points_by_curve = curves.points_by_curve(); const OffsetIndices<int> points_by_curve = curves.points_by_curve();
MutableSpan<float> radii = drawing.radii_for_write(); MutableSpan<float> radii = info.drawing.radii_for_write();
bke::curves::fill_points<float>(points_by_curve, selected_curves, radius, radii); bke::curves::fill_points<float>(points_by_curve, selected_curves, radius, radii);
changed = true; changed = true;
}); });
@ -1032,9 +1032,9 @@ static int grease_pencil_set_uniform_opacity_exec(bContext *C, wmOperator *op)
const float opacity = RNA_float_get(op->ptr, "opacity"); const float opacity = RNA_float_get(op->ptr, "opacity");
bool changed = false; bool changed = false;
grease_pencil.foreach_editable_drawing( const Array<MutableDrawingInfo> drawings = retrieve_editable_drawings(*scene, grease_pencil);
scene->r.cfra, [&](int /*layer_index*/, bke::greasepencil::Drawing &drawing) { threading::parallel_for_each(drawings, [&](const MutableDrawingInfo &info) {
antoniov marked this conversation as resolved Outdated

Use math::clamp(...)

Use `math::clamp(...)`

Removed the line because the paramter is filtered already.

Removed the line because the paramter is filtered already.
bke::CurvesGeometry &curves = drawing.strokes_for_write(); bke::CurvesGeometry &curves = info.drawing.strokes_for_write();
IndexMaskMemory memory; IndexMaskMemory memory;
const IndexMask selected_curves = ed::curves::retrieve_selected_curves(curves, memory); const IndexMask selected_curves = ed::curves::retrieve_selected_curves(curves, memory);
@ -1044,7 +1044,7 @@ static int grease_pencil_set_uniform_opacity_exec(bContext *C, wmOperator *op)
} }
const OffsetIndices<int> points_by_curve = curves.points_by_curve(); const OffsetIndices<int> points_by_curve = curves.points_by_curve();
MutableSpan<float> opacities = drawing.opacities_for_write(); MutableSpan<float> opacities = info.drawing.opacities_for_write();
bke::curves::fill_points<float>(points_by_curve, selected_curves, opacity, opacities); bke::curves::fill_points<float>(points_by_curve, selected_curves, opacity, opacities);
changed = true; changed = true;
}); });