diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-06-24 08:30:54 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-06-24 08:31:10 +0300 |
commit | 5c8e349c28582fa86e767cafcbd6e8474300d81f (patch) | |
tree | 0c45b20353bf1f226e251d405f4712e27bd8247f /source/blender/editors/sculpt_paint/sculpt_cloth.c | |
parent | d295261330d58708c70531b4cd6509e2bea0dd64 (diff) |
Cleanup: Replace GSet with Edgeset in Cloth Brush
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_cloth.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_cloth.c | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_cloth.c b/source/blender/editors/sculpt_paint/sculpt_cloth.c index 318919f0d48..552080fce9d 100644 --- a/source/blender/editors/sculpt_paint/sculpt_cloth.c +++ b/source/blender/editors/sculpt_paint/sculpt_cloth.c @@ -25,7 +25,7 @@ #include "BLI_blenlib.h" #include "BLI_dial_2d.h" -#include "BLI_ghash.h" +#include "BLI_edgehash.h" #include "BLI_gsqueue.h" #include "BLI_hash.h" #include "BLI_math.h" @@ -106,25 +106,11 @@ #define CLOTH_MAX_CONSTRAINTS_PER_VERTEX 1024 #define CLOTH_SIMULATION_TIME_STEP 0.01f -static void cloth_brush_constraint_key_get(int r_key[2], const int v1, const int v2) -{ - if (v1 < v2) { - r_key[0] = v1; - r_key[1] = v2; - } - else { - r_key[0] = v2; - r_key[1] = v1; - } -} - static bool cloth_brush_sim_has_length_constraint(SculptClothSimulation *cloth_sim, const int v1, const int v2) { - int constraint[2]; - cloth_brush_constraint_key_get(constraint, v1, v2); - return BLI_gset_haskey(cloth_sim->created_length_constraints, constraint); + return BLI_edgeset_haskey(cloth_sim->created_length_constraints, v1, v2); } static void cloth_brush_add_length_constraint(SculptSession *ss, @@ -149,9 +135,7 @@ static void cloth_brush_add_length_constraint(SculptSession *ss, } /* Add the constraint to the GSet to avoid creating it again. */ - int constraint[2]; - cloth_brush_constraint_key_get(constraint, v1, v2); - BLI_gset_add(cloth_sim->created_length_constraints, constraint); + BLI_edgeset_add(cloth_sim->created_length_constraints, v1, v2); } static void do_cloth_brush_build_constraints_task_cb_ex( @@ -472,8 +456,7 @@ static void cloth_brush_build_nodes_constraints(Sculpt *sd, TaskParallelSettings settings; BKE_pbvh_parallel_range_settings(&settings, false, totnode); - cloth_sim->created_length_constraints = BLI_gset_new( - BLI_ghashutil_inthash_v2_p, BLI_ghashutil_inthash_v2_cmp, "created length constraints"); + cloth_sim->created_length_constraints = BLI_edgeset_new("created length constraints"); SculptThreadedTaskData build_constraints_data = { .sd = sd, @@ -487,7 +470,7 @@ static void cloth_brush_build_nodes_constraints(Sculpt *sd, BLI_task_parallel_range( 0, totnode, &build_constraints_data, do_cloth_brush_build_constraints_task_cb_ex, &settings); - BLI_gset_free(cloth_sim->created_length_constraints, NULL); + BLI_edgeset_free(cloth_sim->created_length_constraints); } static void cloth_brush_satisfy_constraints(SculptSession *ss, |