99 if (edit ==
nullptr) {
120 if (edit ==
nullptr || edit->
psys ==
nullptr) {
143 if (edit ==
nullptr) {
150 MEM_delete(point->keys);
185 float co[3], mat[4][4];
192 if ((psys = edit->
psys)) {
249 float size = (ups->
flag & UNIFIED_PAINT_SIZE) ? ups->
size :
brush->size;
276 for (
int p = 0; p < edit->
totpoint; p++) {
279 for (
int k = 0; k < point->
totkey; k++) {
281 key->
co = hair_key->
co;
302 ListBaseT<PTCacheID> pidlist;
305 if (pset ==
nullptr || ob ==
nullptr) {
315 if (pidlist.is_single()) {
316 pid = pidlist.first();
330 for (pid = pidlist.first(); pid; pid = pid->
next) {
343 if (create && !psys->
edit) {
395 pidlist.free_no_destruct();
542 data->shape_bvh = MEM_new<bke::BVHTreeFromMesh>(__func__,
mesh->bvh_corner_tris());
543 return data->shape_bvh->tree !=
nullptr;
548 MEM_delete(
data->shape_bvh);
561 if (
data->rng !=
nullptr) {
573 data->depths =
nullptr;
607 if (screen_co[0] >= 0 && screen_co[0] < vd->
w && screen_co[1] >= 0 && screen_co[1] < vd->
h) {
610 depth = vd->
depths[screen_co[1] * vd->
w + screen_co[0]];
619 if (win[2] - 0.00001f > depth) {
637 dx =
data->mval[0] - screen_co[0];
638 dy =
data->mval[1] - screen_co[1];
639 dist =
sqrtf(dx * dx + dy * dy);
666 if (screen_co[0] >
data->rect->xmin && screen_co[0] <
data->rect->xmax &&
667 screen_co[1] >
data->rect->ymin && screen_co[1] <
data->rect->ymax)
710 const float mat[4][4],
711 const float imat[4][4],
721 float mouse_distance);
734 int nearest_point, nearest_key;
735 float dist =
data->rad;
749 key = point->keys + point->totkey - 1;
754 nearest_key = point->totkey - 1;
760 func(
data, p, point->totkey - 1, is_inside);
777 func(
data, p, k, is_inside);
786 if (nearest_point != -1) {
787 func(
data, nearest_point, nearest_key,
true);
808 key = point->keys + point->totkey - 1;
810 if (selected == 0 || key->flag &
PEK_SELECT) {
811 float mouse_distance;
813 func(
data, p, mouse_distance);
821 if (selected == 0 || key->flag &
PEK_SELECT) {
822 float mouse_distance;
824 func(
data, p, mouse_distance);
854 const int selected = iter_data->
selected;
855 float mat[4][4], imat[4][4];
864 float mouse_distance;
871 iter_data->
func(
data, mat, imat, iter, point->
totkey - 1, key, mouse_distance);
882 float mouse_distance;
889 iter_data->
func(
data, mat, imat, iter, k, key, mouse_distance);
907 iter_data.
edit = edit;
909 iter_data.
func = func;
934 func(
data, p, k,
true);
964 key = point->keys + point->totkey - 1;
989 float mat[4][4], co[3];
1059 float mat[4][4], mmat[4][4], immat[4][4];
1085 point = edit->
points + i;
1086 mpoint = edit->
points + mi;
1091 MEM_delete(mpa->
hair);
1094 MEM_delete(mpoint->
keys);
1097 mpa->
hair = MEM_dupalloc(pa->
hair);
1099 mpoint->
keys = MEM_dupalloc(point->
keys);
1103 mkey = mpoint->
keys;
1104 for (k = 0; k < mpa->
totkey; k++, mkey++, mhkey++) {
1105 mkey->co = mhkey->
co;
1106 mkey->time = &mhkey->
time;
1119 mkey = mpoint->
keys;
1120 for (k = 0; k < pa->
totkey; k++, hkey++, mhkey++, key++, mkey++) {
1123 mhkey->
co[0] = -mhkey->
co[0];
1154 if (psmd_eval ==
nullptr || psmd_eval->
mesh_final ==
nullptr) {
1216 float hairimat[4][4], hairmat[4][4];
1218 float *vec, *nor, dvec[3],
dot, dist_1st = 0.0f;
1219 const float dist = iter_data->
dist;
1231 dist_1st *= dist * emitterdist;
1245 if (
dot < dist_1st) {
1257 dist_1st *= 1.3333f;
1290 iter_data.
psys = psys;
1291 iter_data.
edit = edit;
1292 iter_data.
dist = dist;
1341 iter_data.
edit = edit;
1365 float dv0[3] = {0.0f, 0.0f, 0.0f};
1366 float dv1[3] = {0.0f, 0.0f, 0.0f};
1367 float dv2[3] = {0.0f, 0.0f, 0.0f};
1368 for (
int j = 1; j < point->
totkey; j++) {
1373 key = point->
keys + 1;
1375 dv1[0] = dv1[1] = dv1[2] = 0.0;
1380 dv0[0] = dv0[1] = dv0[2] = 0.0;
1383 for (; k < point->
totkey; k++, key++) {
1389 if (k < point->totkey - 1) {
1414 iter_data.
edit = edit;
1415 iter_data.
pset = pset;
1427 if (edit ==
nullptr) {
1433 for (k = 0; k < point->totkey - 1; k++, key++) {
1434 key->length =
len_v3v3(key->co, (key + 1)->co);
1456 totface =
mesh->totface_legacy;
1468 const MFace *mfaces =
static_cast<const MFace *
>(
1470 for (i = 0; i < totface; i++, vec += 6, nor += 6) {
1471 const MFace *mface = &mfaces[i];
1542 float hairmat[4][4];
1544 if (psys ==
nullptr || psys->
edit ==
nullptr || psmd_eval ==
nullptr ||
1567 float vec1[3], vec2[3], frs_sec, dfra;
1581 dfra = *(key + 1)->time - *key->time;
1589 if (point->totkey > 2) {
1596 else if (k == point->totkey - 1) {
1597 dfra = *key->time - *(key - 1)->time;
1605 if (point->totkey > 2) {
1613 dfra = *(key + 1)->time - *(key - 1)->time;
1619 sub_v3_v3v3(key->vel, (key + 1)->co, (key - 1)->co);
1699 data->is_changed =
true;
1709 if (sel_op_result != -1) {
1712 data->is_changed =
true;
1742 bool changed =
false;
1798 bool changed =
false;
1815 ot->
name =
"(De)select All";
1816 ot->
idname =
"PARTICLE_OT_select_all";
1817 ot->
description =
"(De)select all particles' keys";
1847 user_data->
point = point;
1848 user_data->
key = key;
1849 data->is_changed =
true;
1864 data.user_data = &user_data;
1866 bool found =
data.is_changed;
1869 *r_point = user_data.
point;
1870 *r_key = user_data.
key;
1889 bool changed =
false;
1946 return changed || found;
1985 action =
data.select_toggle_action;
1988 data.select_action = action;
1991 if (
data.is_changed) {
2001 ot->
name =
"Select Roots";
2002 ot->
idname =
"PARTICLE_OT_select_roots";
2003 ot->
description =
"Select roots of all visible particles";
2027 if (point->
totkey == 0) {
2058 action =
data.select_toggle_action;
2061 data.select_action = action;
2064 if (
data.is_changed) {
2076 ot->
name =
"Select Tips";
2077 ot->
idname =
"PARTICLE_OT_select_tips";
2078 ot->
description =
"Select tips of all visible particles";
2102 {0,
nullptr, 0,
nullptr,
nullptr},
2151 if (
data.is_changed) {
2161 ot->
name =
"Select Random";
2162 ot->
idname =
"PARTICLE_OT_select_random";
2163 ot->
description =
"Select a randomly distributed set of hair or points";
2179 "Select either hair or points");
2205 ot->
name =
"Select Linked All";
2206 ot->
idname =
"PARTICLE_OT_select_linked";
2207 ot->
description =
"Select all keys linked to already selected ones";
2226 mval[0] = location[0];
2227 mval[1] = location[1];
2253 ot->
name =
"Select Linked";
2254 ot->
idname =
"PARTICLE_OT_select_linked_pick";
2255 ot->
description =
"Select nearest particle from mouse pointer";
2267 ot->
srna,
"deselect",
false,
"Deselect",
"Deselect linked keys rather than selecting them");
2279 bool changed =
false;
2334 bool is_changed =
data.is_changed;
2378 if (wm_userdata->
data ==
nullptr) {
2392 if (
data->is_changed) {
2396 return data->is_changed;
2415 float co[3], mat[4][4];
2445 const bool is_select = key->flag &
PEK_SELECT;
2446 const bool is_inside =
2455 eSelectOp(sel_op), is_select, is_inside);
2456 if (sel_op_result != -1) {
2459 data.is_changed =
true;
2464 if (point->totkey) {
2465 key = point->keys + point->totkey - 1;
2468 const bool is_select = key->flag &
PEK_SELECT;
2469 const bool is_inside =
2478 eSelectOp(sel_op), is_select, is_inside);
2479 if (sel_op_result != -1) {
2482 data.is_changed =
true;
2488 bool is_changed =
data.is_changed;
2545 ot->
name =
"Hide Selected";
2546 ot->
idname =
"PARTICLE_OT_hide";
2558 ot->
srna,
"unselected",
false,
"Unselected",
"Hide unselected rather than selected");
2597 ot->
name =
"Reveal";
2598 ot->
idname =
"PARTICLE_OT_reveal";
2630 else if (k == point->
totkey - 1) {
2636 if ((((key - 1)->flag & (key + 1)->flag) &
PEK_SELECT) == 0) {
2646 data->is_changed =
true;
2667 ot->
name =
"Select Less";
2668 ot->
idname =
"PARTICLE_OT_select_less";
2669 ot->
description =
"Deselect boundary selected keys of each particle";
2701 else if (k == point->
totkey - 1) {
2707 if (((key - 1)->flag | (key + 1)->flag) &
PEK_SELECT) {
2718 data->is_changed =
true;
2739 ot->
name =
"Select More";
2740 ot->
idname =
"PARTICLE_OT_select_more";
2741 ot->
description =
"Select keys linked to boundary selected keys of each particle";
2765 HairKey *key, *new_keys, *okey;
2767 float dval, sta, end;
2785 end = (key +
data->totrekey - 1)->time = (okey + pa->
totkey - 1)->time;
2786 dval = (end - sta) /
float(
data->totrekey - 1);
2789 for (k = 1, key++; k <
data->totrekey - 1; k++, key++) {
2793 key->
time = sta + k * dval;
2797 MEM_delete(pa->
hair);
2798 pa->
hair = new_keys;
2803 MEM_delete(point->
keys);
2807 for (k = 0, key = pa->
hair; k < pa->totkey; k++, key++, ekey++) {
2842 ot->
idname =
"PARTICLE_OT_rekey";
2843 ot->
description =
"Change the number of keys of selected particles (root and tip keys included)";
2870 if (!edit || !edit->
psys) {
2885 key = new_keys = MEM_dupalloc(pa->
hair);
2888 for (k = 1, key++; k < pa->
totkey; k++, key++) {
2896 MEM_delete(pa->
hair);
2898 pa->
hair = new_keys;
2901 for (k = 0, key = pa->
hair, ekey = edit->
points[pa_index].
keys; k < pa->totkey;
2924 int i, new_totpart = psys->
totpart, removed = 0;
2940 if (new_totpart != psys->
totpart) {
2942 npa = new_pars = MEM_new_array<ParticleData>(new_totpart,
"ParticleData array");
2944 "PTCacheEditKey array");
2946 if (
ELEM(
nullptr, new_pars, new_points)) {
2949 MEM_delete(new_pars);
2952 MEM_delete(new_points);
2960 for (i = 0; i < psys->
totpart; i++, pa++, point++) {
2963 MEM_delete(point->keys);
2966 MEM_delete(pa->hair);
2983 MEM_delete(edit->
points);
2985 edit->
points = new_points;
2990 MEM_delete(psys->
child);
2991 psys->
child =
nullptr;
3005 HairKey *hkey, *nhkey, *new_hkeys =
nullptr;
3026 new_totkey = point->totkey;
3031 if (new_totkey < 2) {
3045 if (new_totkey != pa->
totkey) {
3051 while (key->flag &
PEK_TAG && hkey < pa->hair + pa->
totkey) {
3056 if (hkey < pa->hair + pa->
totkey) {
3062 nkey->
co = nhkey->
co;
3065 nkey->
flag = key->flag;
3066 nkey->
ftime = key->ftime;
3067 nkey->
length = key->length;
3076 MEM_delete(pa->
hair);
3080 MEM_delete(point->keys);
3083 pa->
hair = new_hkeys;
3084 point->keys = new_keys;
3086 point->totkey = pa->
totkey = new_totkey;
3109 HairKey *key, *nkey, *new_keys;
3113 short totnewkey = 0;
3121 for (k = 0, ekey = point->
keys; k < pa->totkey - 1; k++, ekey++) {
3127 if (totnewkey == 0) {
3135 "Hair subdivide edit keys");
3140 for (k = 0, ekey = point->
keys; k < pa->totkey - 1; k++, key++, ekey++) {
3142 memcpy(nkey, key,
sizeof(
HairKey));
3145 nekey->
co = nkey->
co;
3152 nkey->
time = (key->
time + (key + 1)->time) * 0.5f;
3153 state.time = (endtime != 0.0f) ? nkey->
time / endtime : 0.0f;
3157 nekey->
co = nkey->
co;
3169 memcpy(nkey, key,
sizeof(
HairKey));
3172 nekey->
co = nkey->
co;
3175 MEM_delete(pa->
hair);
3176 pa->
hair = new_keys;
3179 MEM_delete(point->
keys);
3181 point->
keys = new_ekeys;
3207 ot->
name =
"Subdivide";
3208 ot->
idname =
"PARTICLE_OT_subdivide";
3209 ot->
description =
"Subdivide selected particles segments (adds keys)";
3237 int n, totn, removed, totremoved;
3272 for (n = 0; n < totn; n++) {
3274 if (nearest[n].
index > p && nearest[n].dist < threshold) {
3275 if (!(point->flag &
PEP_TAG)) {
3287 totremoved += removed;
3290 if (totremoved == 0) {
3305 ot->
name =
"Remove Doubles";
3306 ot->
idname =
"PARTICLE_OT_remove_doubles";
3307 ot->
description =
"Remove selected particles close enough to others";
3323 "Threshold distance within which particles are removed",
3343 weight =
brush->strength;
3350 hkey = pa->
hair + k;
3364 ot->
name =
"Weight Set";
3365 ot->
idname =
"PARTICLE_OT_weight_set";
3366 ot->
description =
"Set the weight of selected keys";
3381 "Interpolation factor between current brush weight, and keys' weights",
3449 {
DEL_KEY,
"KEY", 0,
"Key",
""},
3450 {0,
nullptr, 0,
nullptr,
nullptr},
3495 ot->
name =
"Delete";
3496 ot->
idname =
"PARTICLE_OT_delete";
3497 ot->
description =
"Delete selected particles or keys";
3513 "Delete a full particle or only keys");
3533 int *mirrorfaces =
nullptr;
3534 int rotation, totpart, newtotpart;
3554 use_dm_final_indices ? psmd_eval->
mesh_final :
nullptr);
3576 if ((point->flag &
PEP_TAG) && mirrorfaces[pa->
num * 2] != -1) {
3581 if (newtotpart != psys->
totpart) {
3582 const MFace *mtessface = use_dm_final_indices ?
3585 static_cast<const MFace *
>(
3589 new_pars = MEM_new_array<ParticleData>(newtotpart,
"ParticleData new");
3600 MEM_delete(edit->
points);
3602 edit->
points = new_points;
3610 newpoint = edit->
points + totpart;
3612 for (p = 0, point = edit->
points; p < totpart; p++, point++) {
3614 const int pa_num = pa->
num;
3620 if (!(point->flag &
PEP_TAG) || mirrorfaces[pa_num * 2] == -1) {
3628 newpa->
hair = MEM_dupalloc(pa->
hair);
3631 newpoint->
keys = MEM_dupalloc(point->keys);
3635 rotation = mirrorfaces[pa_num * 2 + 1];
3636 newpa->
fuv[0] = pa->
fuv[2];
3637 newpa->
fuv[1] = pa->
fuv[1];
3638 newpa->
fuv[2] = pa->
fuv[0];
3639 newpa->
fuv[3] = pa->
fuv[3];
3640 while (rotation--) {
3641 if (mtessface[pa_num].v4) {
3652 newpa->
num = mirrorfaces[pa_num * 2];
3654 if (use_dm_final_indices) {
3663 key = newpoint->
keys;
3664 for (k = 0, hkey = newpa->
hair; k < newpa->totkey; k++, hkey++, key++) {
3666 key->time = &hkey->
time;
3681 MEM_delete(mirrorfaces);
3721 ot->
name =
"Mirror";
3726 ot->
idname =
"PARTICLE_OT_mirror";
3727 ot->
description =
"Duplicate and mirror the selected particles along the local X axis";
3749 float mouse_distance)
3758 fac =
float(
pow(
double(1.0f - mouse_distance /
data->rad),
double(
data->combfac)));
3775 float rad2, cut_time = 1.0;
3776 float x0, x1, v0, v1, o0, o1, xo0, xo1, d, dv;
3777 int k, cut, keys = int(
pow(2.0,
double(pset->
draw_step)));
3801 x0 =
float(screen_co[0]);
3802 x1 =
float(screen_co[1]);
3817 for (k = 1, key++; k <= keys; k++, key++) {
3823 x0 =
float(screen_co[0]);
3824 x1 =
float(screen_co[1]);
3831 v0 =
float(screen_co[0]) - x0;
3832 v1 =
float(screen_co[1]) - x1;
3834 dv = v0 * v0 + v1 * v1;
3836 d = (v0 * xo1 - v1 * xo0);
3838 d = dv * rad2 - d * d;
3843 cut_time = -(v0 * xo0 + v1 * xo1 + d);
3845 if (cut_time > 0.0f) {
3848 if (cut_time < 1.0f) {
3849 cut_time +=
float(k - 1);
3850 cut_time /=
float(keys);
3857 x0 =
float(screen_co[0]);
3858 x1 =
float(screen_co[1]);
3866 if (cut_time < 0.0f) {
3881 float dvec[3], pvec[3] = {0.0f, 0.0f, 0.0f};
3904 float mat[4][4], imat[4][4];
3908 float co_root[3], no_root[3];
3909 float co_prev[3], co[3];
3910 float fac = 0.0f, length_accum = 0.0f;
3911 bool puff_volume =
false;
3912 bool changed =
false;
3945 if (point_index == -1) {
3960 fac =
float(
pow(
double(1.0f - mouse_distance /
data->rad),
double(
data->pufffac)));
4026 float oco[3], onor[3];
4035 if (point_index != -1) {
4112 float vec[3], dvec[3];
4131 const float v1[3],
const float v2[3],
const float v3[3],
const float v4[3],
float w[4])
4133 float co[3], vert[4][3];
4140 co[0] = v1[0] *
w[0] +
v2[0] *
w[1] + v3[0] *
w[2] + v4[0] *
w[3];
4141 co[1] = v1[1] *
w[0] +
v2[1] *
w[1] + v3[1] *
w[2] + v4[1] *
w[3];
4142 co[2] = v1[2] *
w[0] +
v2[2] *
w[1] + v3[2] *
w[2] + v4[2] *
w[3];
4163 const MFace *mface =
nullptr;
4168 float cur_ipoint[3];
4170 if (
mesh ==
nullptr) {
4175 if (
mesh ==
nullptr) {
4181 if (
mesh ==
nullptr) {
4189 if (pa_minmax ==
nullptr) {
4199 totface =
mesh->totface_legacy;
4204 for (i = 0; i < totface; i++, mface++) {
4222 if (face_minmax ==
nullptr) {
4242 if (radius > 0.0f) {
4244 if (cur_d < *min_d) {
4253 if (cur_d < *min_d) {
4264 if (cur_d < *min_d) {
4266 min_w[0] = 1.0f - cur_uv[0] - cur_uv[1];
4267 min_w[1] = cur_uv[0];
4268 min_w[2] = cur_uv[1];
4279 if (cur_d < *min_d) {
4281 min_w[0] = 1.0f - cur_uv[0] - cur_uv[1];
4283 min_w[2] = cur_uv[0];
4284 min_w[3] = cur_uv[1];
4318 Depsgraph *depsgraph = iter_data->
depsgraph;
4325 const int number = iter_data->
number;
4326 const short size = iter_data->
size;
4327 const int size2 = size * size;
4332 if (tls->
rng ==
nullptr) {
4337 while (dmx * dmx + dmy * dmy > size2) {
4348 mco[0] =
data->mval[0] + dmx;
4349 mco[1] =
data->mval[1] + dmy;
4351 float co1[3], co2[3];
4399 void *__restrict join_v,
4400 void *__restrict chunk_v)
4408 void *__restrict chunk_v)
4411 if (tls->
rng !=
nullptr) {
4428 int i, k, n = 0, totpart = psys->
totpart;
4429 float co1[3], imat[4][4];
4430 float framestep, timestep;
4440 add_pars = MEM_new_array<ParticleData>(number,
"ParticleData add");
4448 sim.
psmd = psmd_eval;
4467 iter_data.
scene = scene;
4471 iter_data.
number = number;
4472 iter_data.
size = size;
4490 for (
int current_iter = 0, new_index = 0; current_iter < number; current_iter++) {
4494 if (new_index != current_iter) {
4498 memcpy(add_pars + new_index, add_pars + current_iter,
sizeof(
ParticleData));
4504 int newtotpart = totpart + n;
4505 float hairmat[4][4], cur_co[3];
4507 ParticleData *pa, *new_pars = MEM_new_array<ParticleData>(newtotpart,
"ParticleData new");
4509 newtotpart,
"PTCacheEditPoint array new");
4524 MEM_delete(edit->
points);
4526 edit->
points = new_points;
4534 for (i = 0, pa = psys->
particles; i < totpart; i++, pa++) {
4556 point = edit->
points + totpart;
4558 for (i = totpart; i < newtotpart; i++, pa++, point++) {
4559 memcpy(pa, add_pars + i - totpart,
sizeof(
ParticleData));
4562 "PTCacheEditKey add");
4565 for (k = 0, hkey = pa->
hair; k < pa->totkey; k++, hkey++, key++) {
4590 float maxd, totw = 0.0, weight[3];
4605 maxd = ptn[maxw - 1].
dist;
4607 for (
w = 0;
w < maxw;
w++) {
4608 weight[
w] =
float(
pow(2.0,
double(-6.0f * ptn[
w].dist / maxd)));
4611 for (;
w < 3;
w++) {
4616 for (
w = 0;
w < maxw;
w++) {
4621 for (
w = 0;
w < maxw;
w++) {
4622 weight[
w] = 1.0f / maxw;
4629 thkey = pa->
hair + k;
4630 thkey->
time = pa->
time + k * framestep;
4632 key3[0].
time = thkey->
time / 100.0f;
4663 for (k = 0, hkey = pa->
hair; k < pset->totaddkey; k++, hkey++) {
4665 hkey->
time += k * framestep;
4669 for (k = 0, hkey = pa->
hair; k < pset->totaddkey; k++, hkey++) {
4681 MEM_delete(add_pars);
4728 bedit->
scene = scene;
4753 float vec[3], mousef[2];
4755 int flip, mouse[2], removed = 0, added = 0, selected = 0, tot_steps = 1,
step = 1;
4764 mouse[0] = mousef[0];
4765 mouse[1] = mousef[1];
4786 (dx != 0 || dy != 0)) ||
4798 dx /=
float(tot_steps);
4799 dy /=
float(tot_steps);
4807 const float xy_delta[2] = {dx, dy};
4811 data.combfac = (
brush->strength - 0.5f) * 2.0f;
4812 if (
data.combfac < 0.0f) {
4813 data.combfac = 1.0f - 9.0f *
data.combfac;
4816 data.combfac = 1.0f -
data.combfac;
4857 if (
brush->invert ^ flip) {
4858 data.growfac = 1.0f -
data.growfac;
4861 data.growfac = 1.0f +
data.growfac;
4876 data.select = selected;
4878 data.pufffac = (
brush->strength - 0.5f) * 2.0f;
4879 if (
data.pufffac < 0.0f) {
4880 data.pufffac = 1.0f - 9.0f *
data.pufffac;
4883 data.pufffac = 1.0f -
data.pufffac;
4975 pset->
flag |= lock_root;
5035 switch (event->
type) {
5068 ot->
name =
"Brush Edit";
5069 ot->
idname =
"PARTICLE_OT_brush_edit";
5070 ot->
description =
"Apply a stroke of brush to the particles";
5087 ot->
srna,
"pen_flip",
false,
"Pen Flip",
"Whether a tablet's eraser mode is being used");
5123 data->bvhdata->raycast_callback(
data->bvhdata,
index, ray, hit);
5125 if (hit->
index != -1) {
5134 const float dir[3] = {1.0f, 0.0f, 0.0f};
5147 return (userdata.
num_hits % 2) == 1;
5158 float cut_time = 1.0;
5175 for (k = 0; k < totkeys; k++, key++) {
5178 float co_curr_shape[3], co_next_shape[3];
5185 sub_v3_v3v3(dir_shape, co_next_shape, co_curr_shape);
5188 memset(&hit, 0,
sizeof(hit));
5190 hit.
dist = len_shape;
5196 data->shape_bvh->raycast_callback,
5198 if (hit.
index >= 0) {
5199 if (hit.
dist < len_shape) {
5200 cut_time = ((hit.
dist / len_shape) +
float(k)) /
float(totkeys);
5209 if (cut_time < 0.0f) {
5281 pset->
flag |= lock_root;
5289 ot->
name =
"Shape Cut";
5290 ot->
idname =
"PARTICLE_OT_shape_cut";
5291 ot->
description =
"Cut hair to conform to the set shape object";
5320 if (psmd !=
nullptr) {
5326 if (!(psys && psmd && psmd_eval->
mesh_final) && !cache) {
5334 if (psys ==
nullptr && (cache && cache->
mem_cache.is_empty())) {
5338 edit = (psys) ? psys->
edit : cache->
edit;
5347 totpoint = psys ? psys->
totpart : int((cache->
mem_cache.first())->totpoint);
5353 if (psys && !cache) {
5367 point->totkey = pa->
totkey;
5374 key->time = &hkey->
time;
5392 edit->
psys =
nullptr;
5403 if (!point->totkey) {
5408 key = point->keys + point->totkey;
5415 key->time = &key->ftime;
5425 if (psys && !cache) {
5449 for (
ParticleSystem *psys =
object->particlesystem.first(); psys !=
nullptr; psys = psys->next) {
5450 if (psys->edit !=
nullptr) {
5452 psys->free_edit(psys->edit);
5453 psys->free_edit =
nullptr;
5454 psys->edit =
nullptr;
5479 if (edit && edit->
psys) {
5525 const bool is_mode_set = (ob->
mode & mode_flag) != 0;
5551 ot->
name =
"Particle Edit Toggle";
5552 ot->
idname =
"PARTICLE_OT_particle_edit_toggle";
5574 if (psys ==
nullptr) {
5582 psys->
edit =
nullptr;
5609 ot->
name =
"Clear Edited";
5610 ot->
idname =
"PARTICLE_OT_edited_clear";
5611 ot->
description =
"Undo all edition performed on the particle system";
5641 int num_selected = 0;
5642 float total_length = 0;
5648 if (num_selected == 0) {
5651 return total_length / num_selected;
5656 float orig_prev_co[3], prev_co[3];
5682 if (point_length != 0.0f) {
5683 const float factor =
length / point_length;
5706 if (average_length == 0.0f) {
5726 ot->
name =
"Unify Length";
5727 ot->
idname =
"PARTICLE_OT_unify_length";
5728 ot->
description =
"Make selected hair the same length";
CustomData interface, see also DNA_customdata_types.h.
General operations, lookup, etc. for blender objects.
#define PSYS_RESET_DEPSGRAPH
#define PTCACHE_VEL_PER_SEC
#define PTCACHE_TYPE_CLOTH
#define PTCACHE_TYPE_PARTICLES
#define PTCACHE_TYPE_SOFTBODY
#define BVH_RAYCAST_DIST_MAX
A KD-tree for nearest neighbor search.
Platform independent time functions.
#define BLT_I18NCONTEXT_DEFAULT
#define ID_IS_EDITABLE(_id)
#define ID_IS_OVERRIDE_LIBRARY(_id)
#define SEL_OP_USE_PRE_DESELECT(sel_op)
#define XRAY_ENABLED(v3d)
Read Blender memory allocation and freeing.
#define RNA_BEGIN(sptr, itemptr, propname)
#define SHIFT4(type, a, b, c, d)
#define INIT_MINMAX(min, max)
#define BLI_assert_unreachable()
#define POINTER_AS_UINT(i)
#define SHIFT3(type, a, b, c)
#define SET_FLAG_FROM_TEST(value, test, flag)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
bool intersect(IsectPyramid i_pyramid, Box box)
float dot(VecOp< float, D >, VecOp< float, D >) RET
float distance(float, float) RET
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
float length(VecOp< float, D >) RET
bool mode_compat_set(bContext *C, Object *ob, eObjectMode mode, ReportList *reports)
void min_max(const T &value, T &min, T &max)
void psys_free_path_cache(struct ParticleSystem *psys, struct PTCacheEdit *edit)
void WM_main_add_notifier(uint type, void *reference)
eV3DProjStatus ED_view3d_project_int_global(const ARegion *region, const float co[3], int r_co[2], eV3DProjTest flag)
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
static wmOperatorStatus hide_exec(bContext *C, wmOperator *op)
static void free_all_psys_edit(Object *object)
static void brush_edit_apply_event(bContext *C, wmOperator *op, const wmEvent *event)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
static void brush_smooth_do(PEData *data, float[4][4], float imat[4][4], int point_index, int key_index, PTCacheEditKey *key, float)
static bool point_is_selected(PTCacheEditPoint *point)
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
static bool particle_edit_toggle_poll(bContext *C)
static int remove_tagged_particles(Object *ob, ParticleSystem *psys, int mirror)
void kdtree_balance(KDTree< CoordT > *tree)
static void foreach_mouse_hit_point(PEData *data, ForHitPointFunc func, int selected)
wmOperatorStatus WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *)
static void PE_free_shape_tree(PEData *data)
ModifierData * BKE_modifiers_findby_name(const Object *ob, const char *name)
ScrArea * CTX_wm_area(const bContext *C)
void PARTICLE_OT_rekey(wmOperatorType *ot)
void PARTICLE_OT_particle_edit_toggle(wmOperatorType *ot)
static wmOperatorStatus select_linked_pick_exec(bContext *C, wmOperator *op)
bool PE_hair_poll(bContext *C)
int RNA_enum_get(PointerRNA *ptr, const char *name)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
bool isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], float radius, const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float ipoint[3])
void PARTICLE_OT_delete(wmOperatorType *ot)
static void select_more_keys(PEData *data, int point_index)
static void brush_length(PEData *data, int point_index, float)
void BKE_particle_batch_cache_dirty_tag(struct ParticleSystem *psys, int mode)
static bool pe_nearest_point_and_key(bContext *C, const int mval[2], PTCacheEditPoint **r_point, PTCacheEditKey **r_key)
void WM_operator_properties_select_random(wmOperatorType *ot)
BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings)
ViewContext ED_view3d_viewcontext_init(bContext *C, Depsgraph *depsgraph)
MINLINE void copy_v3_v3(float r[3], const float a[3])
int64_t BLI_time_now_seconds_i()
static int brush_edit_init(bContext *C, wmOperator *op)
struct ParticleSystem * psys_get_current(struct Object *ob)
void minmax_v3v3_v3(float min[3], float max[3], const float vec[3])
static int particle_intersect_mesh(Depsgraph *depsgraph, Scene *, Object *ob, Mesh *mesh, float *vert_cos, const float co1[3], const float co2[3], float *min_d, int *min_face, float *min_w, float *face_minmax, float *pa_minmax, float radius, float *ipoint)
bool DEG_is_active(const Depsgraph *depsgraph)
void ED_view3d_depths_free(ViewDepths *depths)
static void PE_set_data(bContext *C, PEData *data)
static void point_inside_bvh_cb(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit)
PTCacheEdit * PE_get_current_from_psys(ParticleSystem *psys)
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
void immUniformColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
void PARTICLE_OT_select_roots(wmOperatorType *ot)
bool PE_box_select(bContext *C, const rcti *rect, int sel_op)
static void foreach_mouse_hit_key(PEData *data, ForHitKeyMatFunc func, int selected)
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
void mul_v3_m4v3(float r[3], const float mat[4][4], const float vec[3])
struct RNG * BLI_rng_new_srandom(unsigned int seed)
GPUVertFormat * immVertexFormat()
int WM_operator_properties_select_random_seed_increment_get(wmOperator *op)
static wmOperatorStatus select_linked_exec(bContext *C, wmOperator *)
void PARTICLE_OT_select_tips(wmOperatorType *ot)
static void foreach_mouse_hit_key_iter(void *__restrict iter_data_v, const int iter, const TaskParallelTLS *__restrict)
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
static void apply_lengths_iter(void *__restrict iter_data_v, const int iter, const TaskParallelTLS *__restrict)
static void brush_add_count_iter_reduce(const void *__restrict, void *__restrict join_v, void *__restrict chunk_v)
static wmOperatorStatus brush_edit_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void select_key_op(PEData *data, int point_index, int key_index, bool is_inside)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
void PE_hide_keys_time(Scene *scene, PTCacheEdit *edit, float cfra)
PropertyRNA * RNA_def_int_vector(StructOrFunctionRNA *cont_, const char *identifier, const int len, const int *default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void PE_current_changed(Depsgraph *depsgraph, Scene *scene, Object *ob)
void reset_particle(struct ParticleSimulationData *sim, struct ParticleData *pa, float dtime, float cfra)
void GPU_line_smooth(bool enable)
static void PE_data_free(PEData *data)
int RNA_int_get(PointerRNA *ptr, const char *name)
static wmOperatorStatus select_less_exec(bContext *C, wmOperator *)
static void PE_apply_mirror(Object *ob, ParticleSystem *psys)
void(*)(PEData *data, int point_index, float mouse_distance) ForHitPointFunc
ModifierData * BKE_modifier_get_evaluated(Depsgraph *depsgraph, Object *object, ModifierData *md)
static wmOperatorStatus remove_doubles_exec(bContext *C, wmOperator *op)
void view3d_operator_needs_gpu(const bContext *C)
static void PE_create_random_generator(PEData *data)
static wmOperatorStatus delete_exec(bContext *C, wmOperator *op)
bool PE_deselect_all_visible(bContext *C)
PropertyRNA * RNA_def_collection_runtime(StructOrFunctionRNA *cont, const char *identifier, StructRNA *type, const char *ui_name, const char *ui_description)
void BLI_task_parallel_range(int start, int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
static void foreach_selected_key(PEData *data, ForKeyFunc func)
void ED_object_particle_edit_mode_exit(bContext *C)
static void update_velocities(PTCacheEdit *edit)
void PARTICLE_OT_select_less(wmOperatorType *ot)
static void shape_cut(PEData *data, int pa_index)
static void pe_select_cache_init_with_generic_userdata(bContext *C, wmGenericUserData *wm_userdata)
struct ParticleSystemModifierData * psys_get_modifier(struct Object *ob, struct ParticleSystem *psys)
static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
void PARTICLE_OT_mirror(wmOperatorType *ot)
bool BLI_lasso_is_point_inside(Span< int2 > mcoords, int sx, int sy, int error_value)
static bool shape_cut_test_point(PEData *data, ParticleEditSettings *pset, ParticleCacheKey *key)
int BLI_bvhtree_ray_cast(const BVHTree *tree, const float co[3], const float dir[3], float radius, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata)
float psys_get_timestep(struct ParticleSimulationData *sim)
static void deflect_emitter_iter(void *__restrict iter_data_v, const int iter, const TaskParallelTLS *__restrict)
struct RNG * BLI_rng_new(unsigned int seed)
static wmOperatorStatus pe_select_all_exec(bContext *C, wmOperator *op)
static void pe_iterate_lengths(Scene *scene, PTCacheEdit *edit)
int PE_minmax(Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, float3 &min, float3 &max)
void init_particle(struct ParticleSimulationData *sim, struct ParticleData *pa)
static wmOperatorStatus brush_edit_modal(bContext *C, wmOperator *op, const wmEvent *event)
bool isect_line_segment_tri_v3(const float p1[3], const float p2[3], const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2])
void PARTICLE_OT_select_random(wmOperatorType *ot)
ViewLayer * CTX_data_view_layer(const bContext *C)
void WM_operator_properties_select_all(wmOperatorType *ot)
void PE_update_object(Depsgraph *depsgraph, Scene *scene, Object *ob, int useflag)
void BKE_scene_graph_evaluated_ensure(Depsgraph *depsgraph, Main *bmain)
MINLINE void mul_v3_fl(float r[3], float f)
@ PE_BRUSH_DATA_PUFF_VOLUME
static void brush_edit_exit(wmOperator *op)
void PARTICLE_OT_select_all(wmOperatorType *ot)
int * mesh_get_x_mirror_faces(Object *ob, Mesh *mesh_eval)
void project_v3_v3v3(float out[3], const float p[3], const float v_proj[3])
void psys_get_particle_on_path(struct ParticleSimulationData *sim, int pa_num, struct ParticleKey *state, bool vel)
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
static int count_selected_keys(Scene *scene, PTCacheEdit *edit)
static void brush_drawcursor(bContext *C, const int2 &xy, const float2 &, void *)
KDTree< CoordT > * kdtree_new(uint nodes_len_capacity)
void imm_draw_circle_wire_2d(uint shdr_pos, float x, float y, float radius, int nsegments)
void mul_m4_v3(const float M[4][4], float r[3])
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
void PARTICLE_OT_hide(wmOperatorType *ot)
static void intersect_dm_quad_weights(const float v1[3], const float v2[3], const float v3[3], const float v4[3], float w[4])
int PE_lasso_select(bContext *C, const int mcoords[][2], int mcoords_len, int sel_op)
void ED_object_particle_edit_mode_exit_ex(Scene *scene, Object *ob)
void BKE_object_minmax(Object *ob, float3 &r_min, float3 &r_max)
static void remove_tagged_keys(Depsgraph *depsgraph, Object *ob, ParticleSystem *psys)
void RNA_int_set_array(PointerRNA *ptr, const char *name, const int *values)
static wmOperatorStatus subdivide_exec(bContext *C, wmOperator *op)
void BKE_ptcache_mem_pointers_incr(void *cur[BPHYS_TOT_DATA])
void recalc_lengths(PTCacheEdit *edit)
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
void recalc_emitter_field(Depsgraph *, Object *, ParticleSystem *psys)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
void WM_operator_properties_select_action(wmOperatorType *ot, int default_action, bool hide_gui)
PTCacheEdit * PE_get_current(Depsgraph *depsgraph, Scene *scene, Object *ob)
void dist_ensure_v3_v3fl(float v1[3], const float v2[3], float dist)
static float calculate_average_length(PTCacheEdit *edit)
static bool key_inside_test(PEData *data, const float co[3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
static void PE_mirror_particle(Object *ob, Mesh *mesh, ParticleSystem *psys, ParticleData *pa, ParticleData *mpa)
int ED_select_op_action_deselected(eSelectOp sel_op, bool is_select, bool is_inside)
static int pe_x_mirror(Object *ob)
Main * DEG_get_bmain(const Depsgraph *graph)
void DEG_id_tag_update(ID *id, unsigned int flags)
BMesh const char void * data
void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values)
static bool PE_create_shape_tree(PEData *data, Object *shapeob)
static void for_mouse_hit_keys(PEData *data, ForKeyFunc func, const enum eParticleSelectFlag flag)
static void select_tip(PEData *data, int point_index)
static wmOperatorStatus select_more_exec(bContext *C, wmOperator *)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
static float calculate_point_length(PTCacheEditPoint *point)
static bool select_action_apply(PTCacheEditPoint *point, PTCacheEditKey *key, int action)
int kdtree_find_nearest_n(const KDTree< CoordT > *tree, const CoordT &co, KDTreeNearest< CoordT > r_nearest[], uint nearest_len_capacity)
@ GPU_SHADER_3D_UNIFORM_COLOR
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C, bool rna_write_check=false)
void psys_particle_on_dm(struct Mesh *mesh_final, int from, int index, int index_dmcache, const float fw[4], float foffset, float vec[3], float nor[3], float utan[3], float vtan[3], float orco[3])
void PARTICLE_OT_select_linked_pick(wmOperatorType *ot)
void PARTICLE_OT_select_linked(wmOperatorType *ot)
bool PE_poll_view3d(bContext *C)
static const EnumPropertyItem select_random_type_items[]
void kdtree_insert(KDTree< CoordT > *tree, int index, const CoordT &co)
@ PT_CACHE_EDIT_UPDATE_PARTICLE_FROM_EVAL
static void set_delete_particle_key(PEData *data, int pa_index, int key_index, bool)
static void select_keys(PEData *data, int point_index, int, bool)
static void brush_cut(PEData *data, int pa_index)
static wmOperatorStatus rekey_exec(bContext *C, wmOperator *op)
static float pe_brush_size_get(const Scene *, ParticleBrushData *brush)
void PARTICLE_OT_subdivide(wmOperatorType *ot)
void PARTICLE_OT_remove_doubles(wmOperatorType *ot)
void WM_toolsystem_update_from_context_view3d(bContext *C)
static wmOperatorStatus shape_cut_exec(bContext *C, wmOperator *)
wmOperatorStatus WM_operator_props_popup(bContext *C, wmOperator *op, const wmEvent *)
static bool brush_edit_poll(bContext *C)
int kdtree_find_nearest(const KDTree< CoordT > *tree, const CoordT &co, KDTreeNearest< CoordT > *r_nearest)
bool BKE_view_layer_synced_ensure(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
static void PE_apply_lengths(Scene *scene, PTCacheEdit *edit)
static wmOperatorStatus select_random_exec(bContext *C, wmOperator *op)
static void brush_add_count_iter(void *__restrict iter_data_v, const int iter, const TaskParallelTLS *__restrict tls_v)
void unit_m4(float m[4][4])
static void rekey_particle_to_time(const bContext *C, Scene *scene, Object *ob, int pa_index, float path_time)
static void brush_comb(PEData *data, float[4][4], float imat[4][4], int point_index, int key_index, PTCacheEditKey *key, float mouse_distance)
bool ED_object_particle_edit_mode_supported(const Object *ob)
float ED_view3d_calc_zfac(const RegionView3D *rv3d, const float co[3])
bool PE_circle_select(bContext *C, wmGenericUserData *wm_userdata, int sel_op, const int mval[2], float rad)
void psys_mat_hair_to_object(struct Object *ob, struct Mesh *mesh, short from, struct ParticleData *pa, float hairmat[4][4])
static void nearest_key_fn(PEData *data, int point_index, int key_index, bool)
void BKE_ptcache_ids_from_object(ListBaseT< PTCacheID > *lb, struct Object *ob, struct Scene *scene, int duplis)
static bool key_inside_circle(const PEData *data, float rad, const float co[3], float *distance)
void BLI_rng_free(struct RNG *rng) ATTR_NONNULL(1)
const void * CustomData_get_layer(const CustomData *data, eCustomDataType type)
ATTR_WARN_UNUSED_RESULT const size_t num
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
int BLI_task_parallel_thread_id(const TaskParallelTLS *tls)
bool BLI_rcti_is_empty(const struct rcti *rect)
void interp_weights_poly_v3(float w[], float v[][3], int n, const float co[3])
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void ED_view3d_project_v3(const ARegion *region, const float world[3], float r_region_co[3])
void BLI_bvhtree_ray_cast_all(const BVHTree *tree, const float co[3], const float dir[3], float radius, float hit_dist, BVHTree_RayCastCallback callback, void *userdata)
static void select_less_keys(PEData *data, int point_index)
void ED_object_particle_edit_mode_enter(bContext *C)
MINLINE void zero_v3(float r[3])
static void set_delete_particle(PEData *data, int pa_index)
uint GPU_vertformat_attr_add(GPUVertFormat *format, StringRef name, gpu::VertAttrType type)
bool PE_mouse_particles(bContext *C, const int mval[2], const SelectPick_Params ¶ms)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
static wmOperatorStatus weight_set_exec(bContext *C, wmOperator *op)
wmMsgBus * CTX_wm_message_bus(const bContext *C)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
static void PE_update_selection(Depsgraph *depsgraph, Scene *scene, Object *ob, int useflag)
static wmOperatorStatus reveal_exec(bContext *C, wmOperator *op)
wmPaintCursor * WM_paint_cursor_activate(short space_type, short region_type, wmPaintCursorPoll poll, wmPaintCursorDraw draw, void *customdata)
static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
static void PE_set_view3d_data(bContext *C, PEData *data)
static void select_root(PEData *data, int point_index)
float BLI_rng_get_float(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void mul_mat3_m4_v3(const float mat[4][4], float r[3])
void(*)(PEData *data, int point_index) ForPointFunc
void PARTICLE_OT_brush_edit(wmOperatorType *ot)
MINLINE float normalize_v3(float n[3])
ModifierData * BKE_modifiers_findby_type(const Object *ob, ModifierType type)
static void scale_points_to_length(PTCacheEdit *edit, float length)
static void foreach_point(PEData *data, ForPointFunc func)
MINLINE void add_v3_v3(float r[3], const float a[3])
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void kdtree_free(KDTree< CoordT > *tree)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
void mid_v3_v3v3(float r[3], const float a[3], const float b[3])
void psys_disable_all(struct Object *ob)
static wmOperatorStatus particle_edit_toggle_exec(bContext *C, wmOperator *op)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
static void rekey_particle(PEData *data, int pa_index)
void psys_mat_hair_to_global(struct Object *ob, struct Mesh *mesh, short from, struct ParticleData *pa, float hairmat[4][4])
void PARTICLE_OT_select_more(wmOperatorType *ot)
void(*)(PEData *data, int point_index, int key_index, bool is_inside) ForKeyFunc
void PARTICLE_OT_reveal(wmOperatorType *ot)
Main * CTX_data_main(const bContext *C)
int psys_particle_dm_face_lookup(struct Mesh *mesh_final, struct Mesh *mesh_original, int findex_orig, const float fw[4], struct LinkNode **poly_nodes)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
bool WM_toolsystem_active_tool_is_brush(const bContext *C)
void PE_free_ptcache_edit(PTCacheEdit *edit)
static void pe_update_hair_particle_edit_pointers(PTCacheEdit *edit)
bool ED_view3d_win_to_segment_clipped(const Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, const float mval[2], float r_ray_start[3], float r_ray_end[3], bool do_clip_planes)
MINLINE float max_ff(float a, float b)
void ED_view3d_depth_override(Depsgraph *depsgraph, ARegion *region, View3D *v3d, Object *obact, eV3DDepthOverrideMode mode, bool use_overlay, ViewDepths **r_depths)
void PARTICLE_OT_unify_length(wmOperatorType *ot)
static void scale_point_factor(PTCacheEditPoint *point, float factor)
static wmOperatorStatus select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void update_world_cos(Object *ob, PTCacheEdit *edit)
@ V3D_PROJ_TEST_CLIP_NEAR
static void brush_add_count_iter_free(const void *__restrict, void *__restrict chunk_v)
void BKE_mesh_tessface_ensure(Mesh *mesh)
static void pe_select_cache_free_generic_userdata(void *data)
void psys_cache_edit_paths(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct PTCacheEdit *edit, float cfra, bool use_render_params)
static void scale_point_to_length(PTCacheEditPoint *point, float length)
void PE_create_particle_edit(Depsgraph *depsgraph, Scene *scene, Object *ob, PointCache *cache, ParticleSystem *psys)
static PTCacheEdit * pe_get_current(Depsgraph *depsgraph, Scene *scene, Object *ob, bool create)
void psys_copy_particles(struct ParticleSystem *psys_dst, struct ParticleSystem *psys_src)
static bool mirror_poll(bContext *C)
MINLINE float interpf(float target, float origin, float t)
static void PE_mirror_x(Depsgraph *depsgraph, Scene *scene, Object *ob, int tagged)
static void PE_free_random_generator(PEData *data)
Scene * CTX_data_scene(const bContext *C)
void psys_reset(struct ParticleSystem *psys, int mode)
static void iterate_lengths_iter(void *__restrict iter_data_v, const int iter, const TaskParallelTLS *__restrict)
void PARTICLE_OT_weight_set(wmOperatorType *ot)
void PARTICLE_OT_edited_clear(wmOperatorType *ot)
bool PE_poll(bContext *C)
static bool key_test_depth(const PEData *data, const float co[3], const int screen_co[2])
void GPU_blend(GPUBlend blend)
void psys_enable_all(struct Object *ob)
static wmOperatorStatus brush_edit_exec(bContext *C, wmOperator *op)
void copy_m4_m4(float m1[4][4], const float m2[4][4])
int PE_start_edit(PTCacheEdit *edit)
float BKE_brush_weight_get(const Paint *paint, const Brush *brush)
static void brush_puff(PEData *data, int point_index, float mouse_distance)
VecBase< float, 3 > float3
static void brush_smooth_get(PEData *data, float mat[4][4], float[4][4], int, int key_index, PTCacheEditKey *key, float)
PTCacheEdit * PE_create_current(Depsgraph *depsgraph, Scene *scene, Object *ob)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
float ED_view3d_select_dist_px()
void psys_mat_hair_to_orco(struct Object *ob, struct Mesh *mesh, short from, struct ParticleData *pa, float hairmat[4][4])
static wmOperatorStatus select_roots_exec(bContext *C, wmOperator *op)
static bool shape_cut_poll(bContext *C)
MINLINE void copy_v2fl_v2i(float r[2], const int a[2])
void ED_object_particle_edit_mode_enter_ex(Depsgraph *depsgraph, Scene *scene, Object *ob)
static void select_key(PEData *data, int point_index, int key_index, bool)
void RNA_collection_add(PointerRNA *ptr, const char *name, PointerRNA *r_value)
int BKE_ptcache_mem_pointers_seek(int point_index, struct PTCacheMem *pm, void *cur[BPHYS_TOT_DATA])
static bool key_inside_rect(PEData *data, const float co[3])
bool isect_aabb_aabb_v3(const float min1[3], const float max1[3], const float min2[3], const float max2[3])
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
Object * CTX_data_active_object(const bContext *C)
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
ARegion * CTX_wm_region(const bContext *C)
struct ParticleSystem * psys_eval_get(struct Depsgraph *depsgraph, struct Object *object, struct ParticleSystem *psys)
void PARTICLE_OT_shape_cut(wmOperatorType *ot)
static wmOperatorStatus unify_length_exec(bContext *C, wmOperator *)
float RNA_float_get(PointerRNA *ptr, const char *name)
MINLINE bool is_zero_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
void(*)(PEData *data, float mat[4][4], float imat[4][4], int point_index, int key_index, PTCacheEditKey *key, float mouse_distance) ForHitKeyMatFunc
static const EnumPropertyItem delete_type_items[]
void ED_view3d_win_to_delta(const ARegion *region, const float xy_delta[2], float zfac, float r_out[3], bool precise=false)
static wmOperatorStatus clear_edited_exec(bContext *C, wmOperator *)
static wmOperatorStatus mirror_exec(bContext *C, wmOperator *)
static void toggle_particle_cursor(Scene *scene, bool enable)
static void subdivide_particle(PEData *data, int pa_index)
void(*)(PEData *data, const float mat[4][4], const float imat[4][4], int point_index, int key_index, PTCacheEditKey *key) ForKeyMatFunc
bool PE_deselect_all_visible_ex(PTCacheEdit *edit)
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
@ BKE_PARTICLE_BATCH_DIRTY_ALL
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
Mesh * BKE_object_get_evaluated_mesh(const Object *object_eval)
static void foreach_selected_point(PEData *data, ForPointFunc func)
static int brush_add(const bContext *C, PEData *data, short number)
ParticleEditSettings * PE_settings(Scene *scene)
bool WM_paint_cursor_end(wmPaintCursor *handle)
static wmOperatorStatus select_tips_exec(bContext *C, wmOperator *op)
static void brush_edit_cancel(bContext *, wmOperator *op)
#define LOOP_UNSELECTED_POINTS
#define LOOP_SELECTED_POINTS
#define LOOP_SELECTED_KEYS
#define LOOP_TAGGED_POINTS
#define LOOP_EDITED_POINTS
#define LOOP_VISIBLE_KEYS
#define LOOP_VISIBLE_POINTS
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
ParticleEditSettings * pset
const c_style_mat & ptr() const
bke::MeshRuntime * runtime
bke::ObjectRuntime * runtime
ListBaseT< struct ParticleSystem > particlesystem
bke::BVHTreeFromMesh * shape_bvh
struct PTCacheEditKey * keys
ListBaseT< LinkData > pathcachebufs
PTCacheEditPoint * points
struct ParticleSystemModifierData * psmd
struct ParticleSystem * psys
struct ParticleSystem * psys_eval
struct ParticleSystemModifierData * psmd_eval
struct ParticleCacheKey ** pathcache
struct PointCache * cache
ParticleBrushData brush[7]
struct Object * shape_object
struct Depsgraph * depsgraph
struct ParticleSystem * psys
struct ParticleSystemModifierData * psmd
struct Mesh * mesh_original
struct PTCacheEdit * edit
void(*) free_edit(struct PTCacheEdit *edit)
eParticleSystem_Flag flag
struct PointCache * pointcache
ListBaseT< PTCacheMem > mem_cache
void(*) free_edit(struct PTCacheEdit *edit)
struct PTCacheEdit * edit
bke::BVHTreeFromMesh * bvhdata
struct ToolSettings * toolsettings
TaskParallelReduceFunc func_reduce
size_t userdata_chunk_size
TaskParallelFreeFunc func_free
eUnifiedPaintSettingsFlags flag
wmEventModifierFlag modifier
wmGenericUserDataFreeFn free_fn
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
void(*) cancel(bContext *C, wmOperator *op)
const char * translation_context
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) modal(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
#define WM_msg_publish_rna_prop(mbus, id_, data_, type_, prop_)