[Bf-blender-cvs] [109cbdf2e1b] master: Cleanup: use BLI_kdtree_3d prefix

Campbell Barton noreply at git.blender.org
Tue Mar 19 14:50:20 CET 2019


Commit: 109cbdf2e1b609e93270100239906a8e17c64ab5
Author: Campbell Barton
Date:   Wed Mar 20 00:46:33 2019 +1100
Branches: master
https://developer.blender.org/rB109cbdf2e1b609e93270100239906a8e17c64ab5

Cleanup: use BLI_kdtree_3d prefix

Use prefix now there isn't only the 3d version.

===================================================================

M	source/blender/blenkernel/BKE_object.h
M	source/blender/blenkernel/BKE_particle.h
M	source/blender/blenkernel/BKE_pointcache.h
M	source/blender/blenkernel/intern/boids.c
M	source/blender/blenkernel/intern/dynamicpaint.c
M	source/blender/blenkernel/intern/object.c
M	source/blender/blenkernel/intern/particle.c
M	source/blender/blenkernel/intern/particle_distribute.c
M	source/blender/blenkernel/intern/particle_system.c
M	source/blender/blenkernel/intern/smoke.c
M	source/blender/blenlib/BLI_kdtree.h
M	source/blender/blenlib/intern/kdtree_3d.c
M	source/blender/blenlib/intern/kdtree_impl.h
M	source/blender/bmesh/operators/bmo_removedoubles.c
M	source/blender/bmesh/tools/bmesh_decimate_collapse.c
M	source/blender/editors/curve/editcurve_select.c
M	source/blender/editors/include/ED_select_utils.h
M	source/blender/editors/mesh/editmesh_select_similar.c
M	source/blender/editors/mesh/editmesh_utils.c
M	source/blender/editors/mesh/mesh_mirror.c
M	source/blender/editors/metaball/mball_edit.c
M	source/blender/editors/object/object_relations.c
M	source/blender/editors/physics/particle_edit.c
M	source/blender/editors/util/select_utils.c
M	source/blender/editors/uvedit/uvedit_ops.c
M	source/blender/makesdna/DNA_boid_types.h
M	source/blender/makesdna/DNA_particle_types.h
M	source/blender/modifiers/intern/MOD_explode.c
M	source/blender/python/mathutils/mathutils.c
M	source/blender/python/mathutils/mathutils_kdtree.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 9e6366f9992..4a1470797ba 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -339,7 +339,7 @@ struct LinkNode *BKE_object_relational_superset(
 struct LinkNode *BKE_object_groups(struct Main *bmain, struct Scene *scene, struct Object *ob);
 void             BKE_object_groups_clear(struct Main *bmain, struct Scene *scene, struct Object *object);
 
-struct KDTree *BKE_object_as_kdtree(struct Object *ob, int *r_tot);
+struct KDTree_3d *BKE_object_as_kdtree(struct Object *ob, int *r_tot);
 
 bool BKE_object_modifier_use_time(struct Object *ob, struct ModifierData *md);
 
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h
index 56f64829eb1..b2b7f9f9cb5 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -45,7 +45,7 @@ struct CustomData_MeshMasks;
 struct Depsgraph;
 struct Depsgraph;
 struct EdgeHash;
-struct KDTree;
+struct KDTree_3d;
 struct LatticeDeformData;
 struct LinkNode;
 struct MCol;
@@ -136,7 +136,7 @@ typedef struct ParticleThreadContext {
 	struct Material *ma;
 
 	/* distribution */
-	struct KDTree *tree;
+	struct KDTree_3d *tree;
 
 	struct ParticleSeam *seams;
 	int totseam;
diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h
index 6f0145a493d..9cfc43b2e5b 100644
--- a/source/blender/blenkernel/BKE_pointcache.h
+++ b/source/blender/blenkernel/BKE_pointcache.h
@@ -226,7 +226,7 @@ typedef struct PTCacheUndo {
 
 	/* particles stuff */
 	struct ParticleData *particles;
-	struct KDTree *emitter_field;
+	struct KDTree_3d *emitter_field;
 	float *emitter_cosnos;
 	int psys_flag;
 
@@ -257,7 +257,7 @@ typedef struct PTCacheEdit {
 	struct ParticleSystem *psys_eval;
 	struct ParticleSystemModifierData *psmd;
 	struct ParticleSystemModifierData *psmd_eval;
-	struct KDTree *emitter_field;
+	struct KDTree_3d *emitter_field;
 	float *emitter_cosnos; /* localspace face centers and normals (average of its verts), from the derived mesh */
 	int *mirror_cache;
 
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index 8b71aa0fb69..c092b2c7e79 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -206,7 +206,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
 {
 	const int raycast_flag = BVH_RAYCAST_DEFAULT & ~(BVH_RAYCAST_WATERTIGHT);
 	BoidRuleAvoidCollision *acbr = (BoidRuleAvoidCollision*) rule;
-	KDTreeNearest *ptn = NULL;
+	KDTreeNearest_3d *ptn = NULL;
 	ParticleTarget *pt;
 	BoidParticle *bpa = pa->boid;
 	ColliderCache *coll;
@@ -274,7 +274,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
 
 	//check boids in own system
 	if (acbr->options & BRULE_ACOLL_WITH_BOIDS) {
-		neighbors = BLI_kdtree_range_search_with_len_squared_cb(
+		neighbors = BLI_kdtree_3d_range_search_with_len_squared_cb(
 		        bbd->sim->psys->tree, pa->prev_state.co, &ptn, acbr->look_ahead * len_v3(pa->prev_state.vel),
 		        len_squared_v3v3_with_normal_bias, pa->prev_state.ave);
 		if (neighbors > 1) for (n=1; n<neighbors; n++) {
@@ -323,7 +323,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
 
 		if (epsys) {
 			BLI_assert(epsys->tree != NULL);
-			neighbors = BLI_kdtree_range_search_with_len_squared_cb(
+			neighbors = BLI_kdtree_3d_range_search_with_len_squared_cb(
 			        epsys->tree, pa->prev_state.co, &ptn, acbr->look_ahead * len_v3(pa->prev_state.vel),
 			        len_squared_v3v3_with_normal_bias, pa->prev_state.ave);
 
@@ -377,11 +377,11 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
 }
 static int rule_separate(BoidRule *UNUSED(rule), BoidBrainData *bbd, BoidValues *val, ParticleData *pa)
 {
-	KDTreeNearest *ptn = NULL;
+	KDTreeNearest_3d *ptn = NULL;
 	ParticleTarget *pt;
 	float len = 2.0f * val->personal_space * pa->size + 1.0f;
 	float vec[3] = {0.0f, 0.0f, 0.0f};
-	int neighbors = BLI_kdtree_range_search(
+	int neighbors = BLI_kdtree_3d_range_search(
 	            bbd->sim->psys->tree, pa->prev_state.co,
 	            &ptn, 2.0f * val->personal_space * pa->size);
 	int ret = 0;
@@ -401,7 +401,7 @@ static int rule_separate(BoidRule *UNUSED(rule), BoidBrainData *bbd, BoidValues
 		ParticleSystem *epsys = psys_get_target_system(bbd->sim->ob, pt);
 
 		if (epsys) {
-			neighbors = BLI_kdtree_range_search(
+			neighbors = BLI_kdtree_3d_range_search(
 			        epsys->tree, pa->prev_state.co,
 			        &ptn, 2.0f * val->personal_space * pa->size);
 
@@ -421,9 +421,9 @@ static int rule_separate(BoidRule *UNUSED(rule), BoidBrainData *bbd, BoidValues
 }
 static int rule_flock(BoidRule *UNUSED(rule), BoidBrainData *bbd, BoidValues *UNUSED(val), ParticleData *pa)
 {
-	KDTreeNearest ptn[11];
+	KDTreeNearest_3d ptn[11];
 	float vec[3] = {0.0f, 0.0f, 0.0f}, loc[3] = {0.0f, 0.0f, 0.0f};
-	int neighbors = BLI_kdtree_find_nearest_n_with_len_squared_cb(
+	int neighbors = BLI_kdtree_3d_find_nearest_n_with_len_squared_cb(
 	        bbd->sim->psys->tree, pa->state.co, ptn, ARRAY_SIZE(ptn),
 	        len_squared_v3v3_with_normal_bias, pa->prev_state.ave);
 	int n;
@@ -639,7 +639,7 @@ static int rule_average_speed(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
 static int rule_fight(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, ParticleData *pa)
 {
 	BoidRuleFight *fbr = (BoidRuleFight*)rule;
-	KDTreeNearest *ptn = NULL;
+	KDTreeNearest_3d *ptn = NULL;
 	ParticleTarget *pt;
 	ParticleData *epars;
 	ParticleData *enemy_pa = NULL;
@@ -652,7 +652,7 @@ static int rule_fight(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Parti
 	int n, ret = 0;
 
 	/* calculate own group strength */
-	int neighbors = BLI_kdtree_range_search(
+	int neighbors = BLI_kdtree_3d_range_search(
 	            bbd->sim->psys->tree, pa->prev_state.co,
 	            &ptn, fbr->distance);
 	for (n=0; n<neighbors; n++) {
@@ -670,7 +670,7 @@ static int rule_fight(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Parti
 		if (epsys) {
 			epars = epsys->particles;
 
-			neighbors = BLI_kdtree_range_search(
+			neighbors = BLI_kdtree_3d_range_search(
 			        epsys->tree, pa->prev_state.co,
 			        &ptn, fbr->distance);
 
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index eeaf0710a5f..0419a5ac348 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -4237,7 +4237,7 @@ static void dynamic_paint_paint_particle_cell_point_cb_ex(
 	const float timescale = data->timescale;
 	const int c_index = data->c_index;
 
-	KDTree *tree = data->treeData;
+	KDTree_3d *tree = data->treeData;
 
 	const float solidradius = data->solidradius;
 	const float smooth = brush->particle_smooth * surface->radius_scale;
@@ -4255,11 +4255,11 @@ static void dynamic_paint_paint_particle_cell_point_cb_ex(
 	 * It's enough to just find the nearest one.
 	 */
 	{
-		KDTreeNearest nearest;
+		KDTreeNearest_3d nearest;
 		float smooth_range, part_solidradius;
 
 		/* Find nearest particle and get distance to it */
-		BLI_kdtree_find_nearest(tree, bData->realCoord[bData->s_pos[index]].v, &nearest);
+		BLI_kdtree_3d_find_nearest(tree, bData->realCoord[bData->s_pos[index]].v, &nearest);
 		/* if outside maximum range, no other particle can influence either */
 		if (nearest.dist > range)
 			return;
@@ -4291,7 +4291,7 @@ static void dynamic_paint_paint_particle_cell_point_cb_ex(
 		 * If we use per particle radius, we have to sample all particles
 		 * within max radius range
 		 */
-		KDTreeNearest *nearest;
+		KDTreeNearest_3d *nearest;
 
 		float smooth_range = smooth * (1.0f - strength), dist;
 		/* calculate max range that can have particles with higher influence than the nearest one */
@@ -4299,7 +4299,7 @@ static void dynamic_paint_paint_particle_cell_point_cb_ex(
 		/* Make gcc happy! */
 		dist = max_range;
 
-		const int particles = BLI_kdtree_range_search(
+		const int particles = BLI_kdtree_3d_range_search(
 		                          tree, bData->realCoord[bData->s_pos[index]].v, &nearest, max_range);
 
 		/* Find particle that produces highest influence */
@@ -4397,7 +4397,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
 	PaintBakeData *bData = sData->bData;
 	VolumeGrid *grid = bData->grid;
 
-	KDTree *tree;
+	KDTree_3d *tree;
 	int particlesAdded = 0;
 	int invalidParticles = 0;
 	int p = 0;
@@ -4416,7 +4416,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
 	/*
 	 * Build a kd-tree to optimize distance search
 	 */
-	tree = BLI_kdtree_new(psys->totpart);
+	tree = BLI_kdtree_3d_new(psys->totpart);
 
 	/* loop through particles and insert valid ones to the tree */
 	p = 0;
@@ -4440,7 +4440,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
 		if (!boundIntersectPoint(&grid->grid_bounds, pa->state.co, range))
 			continue;
 
-		BLI_kdtree_insert(tree, p, pa->state.co);
+		BLI_kdtree_3d_insert(tree, p, pa->state.co);
 
 		/* calc particle system bounds */
 		boundInsert(&part_bb, pa->state.co);
@@ -4452,7 +4452,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
 
 	/* If no suitable particles were found, exit */
 	if (particlesAdded < 1) {
-		BLI_kdtree_free(tree);
+		BLI_kdtree_3d_free(tree);
 		return 1;
 	}
 
@@ -4465,7 +4465,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
 		int total_cells = grid->dim[0] * grid->dim[1] * grid->dim[2];
 
 		/* balance tree */
-		BLI_kdtree_balance(tree);
+		BLI_kdtree_3d_balance(tree);
 
 		/* loop through space partitioning grid */
 		for (c_index = 0; c_index < total_cells; c_index++) {
@@ -4493,7 +4493,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
 		}
 	}
 	BLI_threaded_malloc_end();
-	BLI_kdtree_free(tree);
+	BLI_kdtree_3d_free(tree);
 
 	return 1;
 }
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 66b8

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list