GPv3: Draw Tool: Use input_samples tool setting

This uses the `input_samples` tool setting as a minimum distance
in pixels (screen space) for newly created points.
By default this is 10, which means that the points in a drawn stroke
will all be at a distance of 10px or less (in screen space when
the stroke is drawn).
This commit is contained in:
Falk David
2024-05-27 16:53:24 +02:00
parent 76ed87bcf9
commit bf7e3e9256

View File

@@ -38,7 +38,6 @@
namespace blender::ed::sculpt_paint::greasepencil {
static constexpr float POINT_OVERRIDE_THRESHOLD_PX = 3.0f;
static constexpr float POINT_RESAMPLE_MIN_DISTANCE_PX = 10.0f;
template<typename T>
static inline void linear_interpolation(const T &a,
@@ -542,8 +541,8 @@ struct PaintOperationExecutor {
/* If the next sample is far away, we subdivide the segment to add more points. */
int new_points_num = 1;
const float distance_px = math::distance(coords, prev_coords);
if (distance_px > POINT_RESAMPLE_MIN_DISTANCE_PX) {
const int subdivisions = int(math::floor(distance_px / POINT_RESAMPLE_MIN_DISTANCE_PX)) - 1;
if (distance_px > float(settings_->input_samples)) {
const int subdivisions = int(math::floor(distance_px / float(settings_->input_samples))) - 1;
new_points_num += subdivisions;
}