Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Dobarro <pablodp606@gmail.com>2020-08-06 19:03:11 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-08-06 19:03:56 +0300
commitd693d77fed968c126dbde62c73bbaffc5b14b43c (patch)
tree18dd4d34d1fec8a7a3c70f1005afcc68659fbd36 /source/blender/editors/sculpt_paint/sculpt_cloth.c
parent97c56b7628d100990bb49ee6749374b15001d46e (diff)
Sculpt: Cloth Brush simulation area property
This makes possible to choose between a local and a global simulation when the cloth brush is used. Local simulation is the current default. When global simulation is enabled, the cloth brush simulates the entire mesh without taking any simulation limits into account. This was possible before by setting the simulation limits to 10 (the current maximum value allowed) so the entire mesh was inside the limits, but this was a hack as the limits scale with the radius and there should not be any limitation on how big the simulated area can be to be able to simulate an entire object. This also allows to make a more clear distinction between cloth brush presets that are intended to be used in local areas to add details or globally to generate the base shape of the mesh. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8481
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_cloth.c')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_cloth.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_cloth.c b/source/blender/editors/sculpt_paint/sculpt_cloth.c
index dac8ef99fc0..c0862795594 100644
--- a/source/blender/editors/sculpt_paint/sculpt_cloth.c
+++ b/source/blender/editors/sculpt_paint/sculpt_cloth.c
@@ -108,6 +108,11 @@ static float cloth_brush_simulation_falloff_get(const Brush *brush,
const float location[3],
const float co[3])
{
+ /* Global simulation does not have any falloff as the entire mesh is being simulated. */
+ if (brush->cloth_simulation_area_type == BRUSH_CLOTH_SIMULATION_AREA_GLOBAL) {
+ return 1.0f;
+ }
+
const float distance = len_v3v3(location, co);
const float limit = radius + (radius * brush->cloth_sim_limit);
const float falloff = radius + (radius * brush->cloth_sim_limit * brush->cloth_sim_falloff);
@@ -249,7 +254,11 @@ static void do_cloth_brush_build_constraints_task_cb_ex(
radius_squared = ss->cache->initial_radius * ss->cache->initial_radius;
}
- const float cloth_sim_radius_squared = data->cloth_sim_radius * data->cloth_sim_radius;
+ /* Only limit the contraint creation to a radius when the simulation is local. */
+ const float cloth_sim_radius_squared = brush->cloth_simulation_area_type ==
+ BRUSH_CLOTH_SIMULATION_AREA_LOCAL ?
+ data->cloth_sim_radius * data->cloth_sim_radius :
+ FLT_MAX;
BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)
{