Files
test/scripts
Falk David 889751b0c5 Grease Pencil: Add Convert Curve Type operator
Adds a new operator in Grease Pencil edit mode to convert between curve
types. This acts as a replacment for the `Set Curve Type` operator as
the new operator better aligns with previous workflows and artist
expectations. Specifically using a threshold to adjust how well the
resulting curves fit to the original.

It can be found in the `Stroke` > `Convert Type` menu.

This operator aims at keeping visual fidelity between the curves. When
converting to a non-poly curve type, there's a `threshold` parameter
that dictates how closley the shapes will match (a value of zero meaning
an almost perfect match, and higher values will result in less accuracy
but lower control point count).

The conversion to `Catmull-Rom` does not do an actual curve fitting.
For now, this will resample the curves and then do an adaptive
simplification of the line (using the threshold parameter)
to simulate a curve fitting.

The `Set Curve Type` operator is no longer exposed in the
`Stroke` menu.

This also adds a new `geometry::fit_curves` function.

The function will fit a selection of curves to bézier curves. The
selected curves are treated as if they were poly curves.

The `thresholds` virtual array is the error threshold distance
 for each curve that the fit should be within. The size of the virtual
 array is assumed to have the same size as the total number of
 input curves.

The `corners` virtual array allows specific input points to be treated
as sharp corners. The resulting bezier curve will have this point and
the handles will be set to "free".

There are two fitting methods:
* **Split**: Uses a least squares solver to find the control
                     points (faster, but less accurate).
* **Refit**: Iteratively removes knots with the least error starting
                     with a dense curve (slower, more accurate fit).

Co-authored-by: Casey Bianco-Davis <caseycasey739@gmail.com>
Co-authored-by: Hans Goudey <hans@blender.org>

Pull Request: https://projects.blender.org/blender/blender/pulls/137808
2025-06-04 11:48:15 +02:00
..