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
path: root/source
diff options
context:
space:
mode:
authorPablo Dobarro <pablodp606@gmail.com>2020-06-24 08:30:54 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-06-24 08:31:10 +0300
commit5c8e349c28582fa86e767cafcbd6e8474300d81f (patch)
tree0c45b20353bf1f226e251d405f4712e27bd8247f /source
parentd295261330d58708c70531b4cd6509e2bea0dd64 (diff)
Cleanup: Replace GSet with Edgeset in Cloth Brush
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_paint.h4
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_cloth.c27
2 files changed, 7 insertions, 24 deletions
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 56503a0bcc6..d3718b70c96 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -37,8 +37,8 @@ struct Brush;
struct CurveMapping;
struct Depsgraph;
struct EnumPropertyItem;
+struct EdgeSet;
struct GHash;
-struct GSet;
struct GridPaintMask;
struct ImagePool;
struct MLoop;
@@ -269,7 +269,7 @@ typedef struct SculptClothLengthConstraint {
typedef struct SculptClothSimulation {
SculptClothLengthConstraint *length_constraints;
int tot_length_constraints;
- struct GSet *created_length_constraints;
+ struct EdgeSet *created_length_constraints;
int capacity_length_constraints;
float *length_constraint_tweak;
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,