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:
Diffstat (limited to 'source/blender/editors/physics/particle_edit.c')
-rw-r--r--source/blender/editors/physics/particle_edit.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 78b677677bc..e4f17ca68f0 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -150,7 +150,7 @@ void PE_free_ptcache_edit(PTCacheEdit *edit)
}
if (edit->emitter_field) {
- BLI_kdtree_free(edit->emitter_field);
+ BLI_kdtree_3d_free(edit->emitter_field);
edit->emitter_field = 0;
}
@@ -883,8 +883,8 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
{
PTCacheEdit *edit;
ParticleSystemModifierData *psmd_eval;
- KDTree *tree;
- KDTreeNearest nearest;
+ KDTree_3d *tree;
+ KDTreeNearest_3d nearest;
HairKey *key;
PARTICLE_P;
float mat[4][4], co[3];
@@ -897,7 +897,7 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
if (!psmd_eval->mesh_final)
return;
- tree = BLI_kdtree_new(totpart);
+ tree = BLI_kdtree_3d_new(totpart);
/* insert particles into kd tree */
LOOP_PARTICLES {
@@ -905,10 +905,10 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
psys_mat_hair_to_orco(ob, psmd_eval->mesh_final, psys->part->from, pa, mat);
copy_v3_v3(co, key->co);
mul_m4_v3(mat, co);
- BLI_kdtree_insert(tree, p, co);
+ BLI_kdtree_3d_insert(tree, p, co);
}
- BLI_kdtree_balance(tree);
+ BLI_kdtree_3d_balance(tree);
/* lookup particles and set in mirror cache */
if (!edit->mirror_cache)
@@ -921,7 +921,7 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
mul_m4_v3(mat, co);
co[0] = -co[0];
- index = BLI_kdtree_find_nearest(tree, co, &nearest);
+ index = BLI_kdtree_3d_find_nearest(tree, co, &nearest);
/* this needs a custom threshold still, duplicated for editmode mirror */
if (index != -1 && index != p && (nearest.dist <= 0.0002f))
@@ -939,7 +939,7 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
}
}
- BLI_kdtree_free(tree);
+ BLI_kdtree_3d_free(tree);
}
static void PE_mirror_particle(Object *ob, Mesh *mesh, ParticleSystem *psys, ParticleData *pa, ParticleData *mpa)
@@ -1107,7 +1107,7 @@ static void deflect_emitter_iter(
dist_1st *= dist * emitterdist;
}
else {
- index = BLI_kdtree_find_nearest(edit->emitter_field, key->co, NULL);
+ index = BLI_kdtree_3d_find_nearest(edit->emitter_field, key->co, NULL);
vec = edit->emitter_cosnos + index * 6;
nor = vec + 3;
@@ -1329,14 +1329,14 @@ void recalc_emitter_field(Depsgraph *UNUSED(depsgraph), Object *UNUSED(ob), Part
if (edit->emitter_cosnos)
MEM_freeN(edit->emitter_cosnos);
- BLI_kdtree_free(edit->emitter_field);
+ BLI_kdtree_3d_free(edit->emitter_field);
totface = mesh->totface;
/*totvert=dm->getNumVerts(dm);*/ /*UNUSED*/
edit->emitter_cosnos = MEM_callocN(totface * 6 * sizeof(float), "emitter cosnos");
- edit->emitter_field = BLI_kdtree_new(totface);
+ edit->emitter_field = BLI_kdtree_3d_new(totface);
vec = edit->emitter_cosnos;
nor = vec + 3;
@@ -1370,10 +1370,10 @@ void recalc_emitter_field(Depsgraph *UNUSED(depsgraph), Object *UNUSED(ob), Part
normalize_v3(nor);
- BLI_kdtree_insert(edit->emitter_field, i, vec);
+ BLI_kdtree_3d_insert(edit->emitter_field, i, vec);
}
- BLI_kdtree_balance(edit->emitter_field);
+ BLI_kdtree_3d_balance(edit->emitter_field);
}
static void PE_update_selection(Depsgraph *depsgraph, Scene *scene, Object *ob, int useflag)
@@ -2803,8 +2803,8 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
PTCacheEdit *edit = PE_get_current(scene, ob);
ParticleSystem *psys = edit->psys;
ParticleSystemModifierData *psmd_eval;
- KDTree *tree;
- KDTreeNearest nearest[10];
+ KDTree_3d *tree;
+ KDTreeNearest_3d nearest[10];
POINT_P;
float mat[4][4], co[3], threshold = RNA_float_get(op->ptr, "threshold");
int n, totn, removed, totremoved;
@@ -2819,17 +2819,17 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
do {
removed = 0;
- tree = BLI_kdtree_new(psys->totpart);
+ tree = BLI_kdtree_3d_new(psys->totpart);
/* insert particles into kd tree */
LOOP_SELECTED_POINTS {
psys_mat_hair_to_object(ob, psmd_eval->mesh_final, psys->part->from, psys->particles + p, mat);
copy_v3_v3(co, point->keys->co);
mul_m4_v3(mat, co);
- BLI_kdtree_insert(tree, p, co);
+ BLI_kdtree_3d_insert(tree, p, co);
}
- BLI_kdtree_balance(tree);
+ BLI_kdtree_3d_balance(tree);
/* tag particles to be removed */
LOOP_SELECTED_POINTS {
@@ -2837,7 +2837,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
copy_v3_v3(co, point->keys->co);
mul_m4_v3(mat, co);
- totn = BLI_kdtree_find_nearest_n(tree, co, nearest, 10);
+ totn = BLI_kdtree_3d_find_nearest_n(tree, co, nearest, 10);
for (n = 0; n < totn; n++) {
/* this needs a custom threshold still */
@@ -2850,7 +2850,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
}
}
- BLI_kdtree_free(tree);
+ BLI_kdtree_3d_free(tree);
/* remove tagged particles - don't do mirror here! */
remove_tagged_particles(ob, psys, 0);
@@ -3431,7 +3431,7 @@ static void brush_puff(PEData *data, int point_index, float mouse_distance)
* ob->imat is set before calling */
mul_v3_m4v3(kco, data->ob->imat, co);
- point_index = BLI_kdtree_find_nearest(edit->emitter_field, kco, NULL);
+ point_index = BLI_kdtree_3d_find_nearest(edit->emitter_field, kco, NULL);
if (point_index == -1) return;
copy_v3_v3(co_root, co);
@@ -3518,7 +3518,7 @@ static void brush_puff(PEData *data, int point_index, float mouse_distance)
* ob->imat is set before calling */
mul_v3_m4v3(kco, data->ob->imat, oco);
- point_index = BLI_kdtree_find_nearest(edit->emitter_field, kco, NULL);
+ point_index = BLI_kdtree_3d_find_nearest(edit->emitter_field, kco, NULL);
if (point_index != -1) {
copy_v3_v3(onor, &edit->emitter_cosnos[point_index * 6 + 3]);
mul_mat3_m4_v3(data->ob->obmat, onor); /* normal into worldspace */
@@ -3963,7 +3963,7 @@ static int brush_add(const bContext *C, PEData *data, short number)
if (n) {
int newtotpart = totpart + n;
float hairmat[4][4], cur_co[3];
- KDTree *tree = 0;
+ KDTree_3d *tree = 0;
ParticleData *pa, *new_pars = MEM_callocN(newtotpart * sizeof(ParticleData), "ParticleData new");
PTCacheEditPoint *point, *new_points = MEM_callocN(newtotpart * sizeof(PTCacheEditPoint), "PTCacheEditPoint array new");
PTCacheEditKey *key;
@@ -3987,14 +3987,14 @@ static int brush_add(const bContext *C, PEData *data, short number)
/* create tree for interpolation */
if (pset->flag & PE_INTERPOLATE_ADDED && psys->totpart) {
- tree = BLI_kdtree_new(psys->totpart);
+ tree = BLI_kdtree_3d_new(psys->totpart);
for (i = 0, pa = psys->particles; i < totpart; i++, pa++) {
psys_particle_on_dm(psmd_eval->mesh_final, psys->part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, cur_co, 0, 0, 0, 0);
- BLI_kdtree_insert(tree, i, cur_co);
+ BLI_kdtree_3d_insert(tree, i, cur_co);
}
- BLI_kdtree_balance(tree);
+ BLI_kdtree_3d_balance(tree);
}
edit->totpoint = psys->totpart = newtotpart;
@@ -4030,12 +4030,12 @@ static int brush_add(const bContext *C, PEData *data, short number)
ParticleData *ppa;
HairKey *thkey;
ParticleKey key3[3];
- KDTreeNearest ptn[3];
+ KDTreeNearest_3d ptn[3];
int w, maxw;
float maxd, totw = 0.0, weight[3];
psys_particle_on_dm(psmd_eval->mesh_final, psys->part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co1, 0, 0, 0, 0);
- maxw = BLI_kdtree_find_nearest_n(tree, co1, ptn, 3);
+ maxw = BLI_kdtree_3d_find_nearest_n(tree, co1, ptn, 3);
maxd = ptn[maxw - 1].dist;
@@ -4106,7 +4106,7 @@ static int brush_add(const bContext *C, PEData *data, short number)
}
if (tree)
- BLI_kdtree_free(tree);
+ BLI_kdtree_3d_free(tree);
}
MEM_freeN(add_pars);