The hardcoded value doesn't work well with real scale human heads for example (was already adjusted once ina76b5d3a07). The result for too high values is a complete "freeze" of the whole curve (since the solution frome7606139bahas the problem that it keeps running into max iterations of the collision solver). As long as no better solver is implemented, it is better to have an adjustable value (to work on differently sizes objects) to not run into the above issue (same as the old particle hair system had) and show it in sculptmode next to the button which enables collision. This is done per `Curves` (same as the flag `CV_SCULPT_COLLISION_ENABLED`), similar to symmetry settings [alternatively, it could be part of `BrushCurvesSculptSettings` but I think it makes more sense in Curves] and then passed on to the `CurvesConstraintSolver`. Includes versioning code (to set the default for old files). Pull Request: https://projects.blender.org/blender/blender/pulls/132997
31 lines
1.3 KiB
C++
31 lines
1.3 KiB
C++
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#pragma once
|
|
|
|
#include "BKE_curves.hh"
|
|
|
|
namespace blender::geometry::curve_constraints {
|
|
|
|
void compute_segment_lengths(OffsetIndices<int> points_by_curve,
|
|
Span<float3> positions,
|
|
const IndexMask &curve_selection,
|
|
MutableSpan<float> r_segment_lengths);
|
|
|
|
void solve_length_constraints(OffsetIndices<int> points_by_curve,
|
|
const IndexMask &curve_selection,
|
|
Span<float> segment_lenghts,
|
|
MutableSpan<float3> positions);
|
|
|
|
void solve_length_and_collision_constraints(OffsetIndices<int> points_by_curve,
|
|
const IndexMask &curve_selection,
|
|
Span<float> segment_lengths,
|
|
Span<float3> start_positions,
|
|
const Mesh &surface,
|
|
const bke::CurvesSurfaceTransforms &transforms,
|
|
MutableSpan<float3> positions,
|
|
const float surface_collision_distance);
|
|
|
|
} // namespace blender::geometry::curve_constraints
|