10#define DNA_DEPRECATED_ALLOW
105 std::optional<Library *> ,
132 for (
int a = 0; a <
MAX_MTEX; a++) {
133 if (partticle_settings_src->
mtex[a]) {
134 particle_settings_dst->
mtex[a] =
static_cast<MTex *
>(
147 for (
int a = 0; a <
MAX_MTEX; a++) {
182 for (
int i = 0; i <
MAX_MTEX; i++) {
183 if (psett->
mtex[i]) {
231 switch (rule->type) {
254 BoidCondition *cond =
state->conditions.first;
255 for (; cond; cond = cond->next) {
285 if (dw->ob !=
nullptr) {
289 if (
object == dw->ob) {
311 for (
int a = 0; a <
MAX_MTEX; a++) {
383 return std::max(boid_rule_struct_size(eBoidRuleType(rule.type)), sizeof(BoidRule));
399 for (
int a = 0; a <
MAX_MTEX; a++) {
417 ParticleSettings::id_type,
511 else if (p % totgr == cur) {
520#define PATH_CACHE_BUF_SIZE 1024
524 return (
key->segments > 0) ? (
key + (
key->segments - 1)) :
key;
531 int i, totkey, totbufkey;
533 tot = std::max(tot, 1);
537 while (totkey < tot) {
543 for (i = 0; i < totbufkey; i++) {
594 psys = psys->
next, i++)
613 psys = psys->
next, i++)
619 psys->
flag &= ~PSYS_CURRENT;
637 for (; md; md = md->
next) {
639 if (md->
mode & mode) {
679 for (; psys; psys = psys->
next) {
687 for (; psys; psys = psys->
next) {
688 psys->
flag &= ~PSYS_DISABLED;
703 if (object_eval ==
object) {
707 while (psys_eval !=
nullptr) {
711 psys_eval = psys_eval->
next;
730 if (
object ==
nullptr) {
756 if (use_render_params) {
782 ListBase instance_collection_objects = {
nullptr,
nullptr};
789 if (dw->ob ==
nullptr) {
791 if (base !=
nullptr) {
813 if (dw->
ob ==
nullptr ||
829 while (dw && dw->
ob !=
object) {
888 psys->
flag &= ~PSYS_HAIR_DONE;
893 psys->
clmd =
nullptr;
958 psys->
child =
nullptr;
1029 if (psys->
clmd !=
nullptr) {
1041 psys->
child =
nullptr;
1059 psys->
part =
nullptr;
1069 BLI_kdtree_3d_free(psys->
tree);
1135 if (
key !=
nullptr) {
1138 if (boid !=
nullptr) {
1142 if (boid !=
nullptr) {
1145 if (
key !=
nullptr) {
1158 float v1,
float v2,
float v3,
float v4,
const float w[4],
int four)
1243 *cur = (*cur)->
next;
1248 while (*cur && (*cur)->
next &&
float((*cur)->frame) < t) {
1249 *cur = (*cur)->
next;
1288 *r_start = pm->frame;
1297 *r_dietime = pm->frame + 1;
1308 int dietime = 10000000;
1313 dietime = pm->frame + 1;
1318 return float(dietime);
1336 else if (pind->
keyed) {
1344 else if (pind->
cache) {
1345 float start = 0.0f, dietime = 0.0f;
1364 float3 *positions = pind->
mesh->vert_positions_for_write().data();
1398 int point_vel = (point && point->
keys->
vel);
1399 float real_t, dfra, keytime, invdt = 1.0f;
1406 if (
result->time < 0.0f) {
1414 while (*(pind->
ekey[1]->
time) < real_t) {
1420 else if (pind->
keyed) {
1422 if (pind->
kkey[1] ==
nullptr) {
1427 if (
result->time < 0.0f) {
1440 while (pt && pa->
time + pt->
time < real_t) {
1458 while (pind->
kkey[1]->
time < real_t) {
1464 else if (pind->
cache) {
1465 if (
result->time < 0.0f) {
1473 if (
result->time < 0.0f) {
1481 while (pind->
hkey[1]->
time < real_t) {
1496 else if (pind->
mesh) {
1501 else if (pind->
keyed) {
1505 else if (pind->
cache) {
1514 if (!pind->
keyed && !pind->
cache && !point_vel) {
1516 if (pind->
ekey[0] != point->
keys) {
1523 else if (pind->
mesh) {
1548 else if (pind->
mesh) {
1566 dfra = keys[2].
time - keys[1].
time;
1567 keytime = (real_t - keys[1].
time) / dfra;
1570 if (pind->
keyed || pind->
cache || point_vel) {
1571 invdt = dfra * 0.04f * (psys ? psys->
part->
timetweak : 1.0f);
1589 if (pind->
keyed || pind->
cache || point_vel) {
1602 while (i < first->segments && cur->
time < t) {
1606 if (cur->
time == t) {
1610 float dt = (t - (cur - 1)->
time) / (cur->
time - (cur - 1)->
time);
1618 if (cur == first || cur - 1 == first) {
1631 const float (*vert_positions)[3],
1632 const float (*vert_normals)[3],
1635 const float (*orcodata)[3],
1643 const float *v1 =
nullptr, *
v2 =
nullptr, *v3 =
nullptr, *v4 =
nullptr;
1644 float e1[3], e2[3], s1, s2, t1, t2;
1645 float *uv1, *uv2, *uv3, *uv4;
1646 float n1[3], n2[3], n3[3], n4[3];
1648 const float *o1, *o2, *o3, *o4;
1650 v1 = vert_positions[mface->
v1];
1651 v2 = vert_positions[mface->
v2];
1652 v3 = vert_positions[mface->
v3];
1659 v4 = vert_positions[mface->
v4];
1665 if (mface->
flag & ME_SMOOTH) {
1677 if (mface->
flag & ME_SMOOTH) {
1708 s1 = uv3[0] - uv1[0];
1709 s2 = uv4[0] - uv1[0];
1711 t1 = uv3[1] - uv1[1];
1712 t2 = uv4[1] - uv1[1];
1718 s1 = uv2[0] - uv1[0];
1719 s2 = uv3[0] - uv1[0];
1721 t1 = uv2[1] - uv1[1];
1722 t2 = uv3[1] - uv1[1];
1728 vtan[0] = (s1 * e2[0] - s2 * e1[0]);
1729 vtan[1] = (s1 * e2[1] - s2 * e1[1]);
1730 vtan[2] = (s1 * e2[2] - s2 * e1[2]);
1732 utan[0] = (t1 * e2[0] - t2 * e1[0]);
1733 utan[1] = (t1 * e2[1] - t2 * e1[1]);
1734 utan[2] = (t1 * e2[2] - t2 * e1[2]);
1739 o1 = orcodata[mface->
v1];
1740 o2 = orcodata[mface->
v2];
1741 o3 = orcodata[mface->
v3];
1744 o4 = orcodata[mface->
v4];
1760 float v10 = tface->
uv[0][0];
1761 float v11 = tface->
uv[0][1];
1762 float v20 = tface->
uv[1][0];
1763 float v21 = tface->
uv[1][1];
1764 float v30 = tface->
uv[2][0];
1765 float v31 = tface->
uv[2][1];
1769 v40 = tface->
uv[3][0];
1770 v41 = tface->
uv[3][1];
1772 uvco[0] =
w[0] * v10 +
w[1] * v20 +
w[2] * v30 +
w[3] * v40;
1773 uvco[1] =
w[0] * v11 +
w[1] * v21 +
w[2] * v31 +
w[3] * v41;
1776 uvco[0] =
w[0] * v10 +
w[1] * v20 +
w[2] * v30;
1777 uvco[1] =
w[0] * v11 +
w[1] * v21 +
w[2] * v31;
1783 const char *cp1, *cp2, *cp3, *cp4;
1787 cp1 = (
const char *)&mcol[0];
1788 cp2 = (
const char *)&mcol[1];
1789 cp3 = (
const char *)&mcol[2];
1792 cp4 = (
char *)&mcol[3];
1794 cp[0] = int(
w[0] * cp1[0] +
w[1] * cp2[0] +
w[2] * cp3[0] +
w[3] * cp4[0]);
1795 cp[1] = int(
w[0] * cp1[1] +
w[1] * cp2[1] +
w[2] * cp3[1] +
w[3] * cp4[1]);
1796 cp[2] = int(
w[0] * cp1[2] +
w[1] * cp2[2] +
w[2] * cp3[2] +
w[3] * cp4[2]);
1797 cp[3] = int(
w[0] * cp1[3] +
w[1] * cp2[3] +
w[2] * cp3[3] +
w[3] * cp4[3]);
1800 cp[0] = int(
w[0] * cp1[0] +
w[1] * cp2[0] +
w[2] * cp3[0]);
1801 cp[1] = int(
w[0] * cp1[1] +
w[1] * cp2[1] +
w[2] * cp3[1]);
1802 cp[2] = int(
w[0] * cp1[2] +
w[1] * cp2[2] +
w[2] * cp3[2]);
1803 cp[3] = int(
w[0] * cp1[3] +
w[1] * cp2[3] +
w[2] * cp3[3]);
1808 Mesh *
mesh,
short from,
int index,
const float fw[4],
const float *values)
1810 if (values ==
nullptr || index == -1) {
1816 return values[index];
1821 MFace *mf = &mfaces[index];
1823 values[mf->
v1], values[mf->
v2], values[mf->
v3], values[mf->
v4], fw, mf->
v4);
1832 uv[0] =
w[1] +
w[2];
1833 uv[1] =
w[2] +
w[3];
1839 float v[4][3], co[3];
1841 v[0][0] = osface->
uv[0][0];
1842 v[0][1] = osface->
uv[0][1];
1844 v[1][0] = osface->
uv[1][0];
1845 v[1][1] = osface->
uv[1][1];
1847 v[2][0] = osface->
uv[2][0];
1848 v[2][1] = osface->
uv[2][1];
1855 v[3][0] = osface->
uv[3][0];
1856 v[3][1] = osface->
uv[3][1];
1867 Mesh *mesh_original,
1872 MFace *mtessface_final;
1876 const float(*faceuv)[2];
1878 const int *index_mf_to_mpoly_deformed =
nullptr;
1879 const int *index_mf_to_mpoly =
nullptr;
1880 const int *index_mp_to_orig =
nullptr;
1883 const int totface_deformed = mesh_original ? mesh_original->
totface_legacy : totface_final;
1885 if (
ELEM(0, totface_final, totface_deformed)) {
1889 index_mf_to_mpoly =
static_cast<const int *
>(
1891 index_mp_to_orig =
static_cast<const int *
>(
1895 if (mesh_original) {
1896 index_mf_to_mpoly_deformed =
static_cast<const int *
>(
1901 index_mf_to_mpoly_deformed = index_mf_to_mpoly;
1905 pindex_orig = index_mf_to_mpoly_deformed[findex_orig];
1907 if (mesh_original ==
nullptr) {
1908 mesh_original = mesh_final;
1911 index_mf_to_mpoly_deformed =
nullptr;
1918 if (osface_final ==
nullptr) {
1920 if (findex_orig < totface_final) {
1925 printf(
"\tNO CD_ORIGSPACE, error out of range\n");
1936 LinkNode *tessface_node = poly_nodes[pindex_orig];
1938 for (; tessface_node; tessface_node = tessface_node->
next) {
1940 faceuv = osface_final[findex_dst].
uv;
1944 if (mtessface_final[findex_dst].v4) {
1955 for (
int findex_dst = 0; findex_dst < totface_final; findex_dst++) {
1961 faceuv = osface_final[findex_dst].
uv;
1965 if (mtessface_final[findex_dst].v4) {
2021 *mapindex = index_dmcache;
2025 int i = index_dmcache;
2037 const MFace *mfaces =
static_cast<const MFace *
>(
2039 const MFace *mface = &mfaces[i];
2041 if (osface ==
nullptr) {
2042 mapfw[0] = mapfw[1] = mapfw[2] = mapfw[3] = 0.0f;
2065 float tmpnor[3], mapfw[4];
2066 const float(*orcodata)[3];
2072 vec[0] = vec[1] = vec[2] = 0.0;
2079 orco[0] = orco[1] = orco[2] = 0.0;
2082 utan[0] = utan[1] = utan[2] = 0.0;
2085 vtan[0] = vtan[1] = vtan[2] = 0.0;
2113 utan[0] = utan[1] = utan[2] = 0.0f;
2114 vtan[0] = vtan[1] = vtan[2] = 0.0f;
2123 mface = &mfaces[mapindex];
2134 reinterpret_cast<const float(*)[3]
>(vert_positions.
data()),
2135 reinterpret_cast<const float(*)[3]
>(vert_normals.
data()),
2157 reinterpret_cast<const float(*)[3]
>(vert_positions.
data()),
2158 reinterpret_cast<const float(*)[3]
>(vert_normals.
data()),
2193 if (psmd->
psys == psys) {
2216 const float zerovec[3] = {0.0f, 0.0f, 0.0f};
2302 psmd->
mesh_final,
from, index, index_dmcache, fuv, foffset, vec,
nor, utan, vtan, orco);
2351 if (!eff->guide_data) {
2355 data = eff->guide_data + p;
2382 float effect[3] = {0.0f, 0.0f, 0.0f}, veffect[3] = {0.0f, 0.0f, 0.0f};
2383 float guidevec[4], guidedir[3], rot2[4], temp[3];
2384 float guidetime, radius, weight,
angle, totstrength = 0.0f;
2385 float vec_to_point[3];
2395 data = eff->guide_data + index;
2397 if (
data->strength <= 0.0f) {
2403 if (guidetime > 1.0f) {
2407 cu = (
Curve *)eff->ob->data;
2411 data->strength * guidetime,
2422 if (
BKE_where_on_path(eff->ob, guidetime, guidevec, guidedir,
nullptr, &radius, &weight) ==
2429 mul_m4_v3(eff->ob->object_to_world().ptr(), guidevec);
2436 if (guidetime != 0.0f) {
2455 int(
data->strength * guidetime * 100.0f),
2473 const float par_co[3] = {0.0f, 0.0f, 0.0f};
2474 const float par_vel[3] = {0.0f, 0.0f, 0.0f};
2475 const float par_rot[4] = {1.0f, 0.0f, 0.0f, 0.0f};
2476 const float orco_offset[3] = {0.0f, 0.0f, 0.0f};
2510 totstrength +=
data->strength;
2513 totstrength *= weight;
2518 if (totstrength != 0.0f) {
2519 if (totstrength > 1.0f) {
2522 CLAMP(totstrength, 0.0f, 1.0f);
2546 float force[3] = {0.0f, 0.0f, 0.0f};
2596 child->
co[0] *= flat;
2612 float *vg =
nullptr;
2617 else if (psys->
vgroup[vgroup]) {
2622 if (psys->
vg_neg & (1 << vgroup)) {
2623 for (i = 0; i < totvert; i++) {
2628 for (i = 0; i < totvert; i++) {
2644 float co[3], orco[3];
2646 totparent = int(totchild * part->
parents * 0.3f);
2653 totparent = std::min(sim->
psys->
totpart, totparent);
2655 tree = BLI_kdtree_3d_new(totparent);
2657 for (p = 0, cpa = sim->
psys->
child; p < totparent; p++, cpa++) {
2685 BLI_kdtree_3d_insert(
tree, p, orco);
2689 BLI_kdtree_3d_balance(
tree);
2691 for (; p < totchild; p++, cpa++) {
2703 cpa->
parent = BLI_kdtree_3d_find_nearest(
tree, orco,
nullptr);
2706 BLI_kdtree_3d_free(
tree);
2713 const bool editupdate,
2714 const bool use_render_params)
2718 int totparent = 0, between = 0;
2728 if ((use_render_params == 0) &&
2738 totparent = int(totchild * part->
parents * 0.3f);
2748 if (use_render_params) {
2752 totchild = int(
float(totchild) *
float(part->
disp) / 100.0f);
2755 totparent = std::min(totparent, totchild);
2757 if (totchild == 0) {
2841 float *cpa_fuv =
nullptr, *par_rot =
nullptr,
rot[4];
2842 float orco[3], hairmat[4][4], dvec[3], off1[4][3], off2[4][3];
2843 float eff_length, eff_vec[3], weight[4];
2854 float foffset, wsum = 0.0f;
2876 memset(child_keys, 0,
sizeof(*child_keys) * (ctx->
segments + 1));
2880 for (
w = 0;
w < 4;
w++) {
2881 if (cpa->
pa[
w] >= 0) {
2883 weight[
w] = cpa->
w[
w];
2894 for (
w = 0;
w < 4;
w++) {
2895 if (
w && (weight[
w] > 0.0f)) {
2904 d = d1 > 0.0f ? d2 / d1 - 1.0f : 10000.0f;
2916 if (p_max > p_min) {
2917 d = (d - p_min) / (p_max - p_min);
2920 d = (d - p_min) <= 0.0f ? 0.0f : 1.0f;
2923 CLAMP(d, 0.0f, 1.0f);
2926 weight[
w] *= (1.0f - d);
2931 for (
w = 0;
w < 4;
w++) {
2957 mul_m4_v3(ob->object_to_world().ptr(), co);
2959 for (
w = 0;
w < 4;
w++) {
2973 memset(child_keys, 0,
sizeof(*child_keys) * (ctx->
segments + 1));
2980 cpa_from = part->
from;
3024 for (k = 0, child = child_keys; k <= ctx->
segments; k++, child++) {
3032 for (
w = 0;
w < 4;
w++) {
3066 par_rot =
key[0]->rot;
3082 for (k = 0, child = child_keys; k <= ctx->
segments; k++, child++) {
3098 eff_length =
len_v3(eff_vec);
3114 par = cache[cpa->
parent];
3117 else if (cpa->
parent >= 0) {
3119 par = pcache[cpa->
parent];
3124 if (cpa->
pa[k] >= 0) {
3126 par = pcache[cpa->
pa[k]];
3152 ctx, &modifiers, cpa, &ptex, orco, hairmat, child_keys, par, par_orco);
3160 if (i < ctx->totparent) {
3175 for (i = task->
begin; i < task->
end; i++, cpa++) {
3183 const bool editupdate,
3184 const bool use_render_params)
3242 float *prev_tangent,
3245 float cosangle,
angle, tangent[3], normal[3], q[4];
3261 cosangle =
dot_v3v3(tangent, prev_tangent);
3266 if (cosangle > 0.999999f) {
3300 float birthtime = 0.0, dietime = 0.0;
3301 float t,
time = 0.0, dfra = 1.0;
3302 float col[4] = {0.5f, 0.5f, 0.5f, 1.0f};
3303 float prev_tangent[3] = {0.0f, 0.0f, 0.0f}, hairmat[4][4];
3309 float *vg_effector =
nullptr;
3310 float *vg_length =
nullptr, pa_length = 1.0f;
3368 pind.
mesh = hair_mesh;
3370 memset(cache[p], 0,
sizeof(*cache[p]) * (segments + 1));
3393 if (birthtime >= dietime) {
3398 dietime = birthtime + pa_length * (dietime - birthtime);
3401 for (k = 0, ca = cache[p]; k <= segments; k++, ca++) {
3402 time = float(k) / float(segments);
3403 t = birthtime +
time * (dietime - birthtime);
3423 for (k = 0, hkey = pa->hair; k < pa->totkey; k++, hkey++) {
3433 float effector = 1.0f;
3436 psmd->mesh_final, psys->
part->
from, pa, vg_effector);
3439 sub_v3_v3v3(vec, (cache[p] + 1)->co, cache[p]->co);
3442 for (k = 1, ca = cache[p] + 1; k <= segments; k++, ca++) {
3444 sim, p, ca, k, segments, cache[p]->co, effector, dfra, cfra, &
length, vec);
3450 for (k = 0, ca = cache[p]; k <= segments; k++, ca++) {
3457 float(k) /
float(segments));
3464 for (k = 0, ca = cache[p]; k <= segments; k++, ca++) {
3472 for (k = 1, ca = cache[p] + 1; k <= segments; k++, ca++) {
3475 if (k == segments) {
3486 ca->
time = float(k) / float(segments);
3530 if (point->
totkey == 0) {
3539 const int segments = iter_data->
segments;
3540 const bool use_weight = iter_data->
use_weight;
3542 float birthtime = 0.0f, dietime = 0.0f;
3543 float hairmat[4][4], rotmat[3][3], prev_tangent[3] = {0.0f, 0.0f, 0.0f};
3547 pind.
cache =
nullptr;
3550 pind.
mesh =
nullptr;
3554 pind.
hkey[0] =
nullptr;
3560 memset(cache[iter], 0,
sizeof(*cache[iter]) * (segments + 1));
3577 if (birthtime >= dietime) {
3585 float t,
time = 0.0f, keytime = 0.0f;
3586 for (k = 0, ca = cache[iter]; k <= segments; k++, ca++) {
3587 time = float(k) / float(segments);
3588 t = birthtime +
time * (dietime - birthtime);
3601 if (k == segments) {
3614 ca->
vel[0] = ca->
vel[1] = 0.0f;
3626 if (
result.time < 0.0f) {
3634 while (pind.
hkey[1]->
time < real_t) {
3658 ca->
col[0] = 1.0f - keytime;
3664 ca->
col[0] = keytime;
3691 const bool use_render_params)
3701 int totpart = edit->
totpoint, recalc_set = 0;
3707 segments = std::max(segments, 4);
3717 for (i = 0, point = edit->
points; i < totpart; i++, point++) {
3728 iter_data.
edit = edit;
3755 for (i = 0, point = edit->
points; i < totpart; i++, point++) {
3756 point->
flag &= ~PEP_EDIT_RECALC;
3771 float to_time = to->
time;
3792static void triatomat(
float *v1,
float *
v2,
float *v3,
const float (*uv)[2],
float mat[4][4])
3794 float det, w1, w2, d1[2], d2[2];
3796 memset(mat, 0,
sizeof(
float[4][4]));
3804 d1[0] = uv[1][0] - uv[0][0];
3805 d1[1] = uv[1][1] - uv[0][1];
3806 d2[0] = uv[2][0] - uv[0][0];
3807 d2[1] = uv[2][1] - uv[0][1];
3809 det = d2[0] * d1[1] - d2[1] * d1[0];
3816 mat[1][0] = w1 * (
v2[0] - v1[0]) + w2 * (v3[0] - v1[0]);
3817 mat[1][1] = w1 * (
v2[1] - v1[1]) + w2 * (v3[1] - v1[1]);
3818 mat[1][2] = w1 * (
v2[2] - v1[2]) + w2 * (v3[2] - v1[2]);
3822 mat[1][0] = mat[1][1] = mat[1][2] = 0.0f;
3838 const float(*orcodata)[3];
3872 triatomat(
v[0],
v[1],
v[2], (osface) ? osface->
uv :
nullptr, mat);
3904 float vec[3], orco[3];
3934 float facemat[4][4];
3938 mul_m4_m4m4(hairmat, ob->object_to_world().ptr(), facemat);
3956 if (
name ==
nullptr) {
3957 name = (psys_orig !=
nullptr) ? psys_orig->
name :
DATA_(
"ParticleSystem");
3961 for (; psys; psys = psys->
next) {
3962 psys->
flag &= ~PSYS_CURRENT;
3970 if (psys_orig !=
nullptr) {
3989 if (
scene !=
nullptr) {
4109 ob->
mode &= ~OB_MODE_PARTICLE_EDIT;
4188 tf =
static_cast<const MTFace *
>(
4190 if (tf ==
nullptr) {
4193 if (tf ==
nullptr) {
4232 texco[0] = texco[0] * 2.0f - 1.0f;
4233 texco[1] = texco[1] * 2.0f - 1.0f;
4240#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) \
4241 if ((event & mtex->mapto) & type) { \
4242 pvalue = texture_value_blend(def, pvalue, value, texfac, blend); \
4246#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) \
4247 if (event & type) { \
4248 CLAMP(pvalue, 0.0f, 1.0f); \
4252#define CLAMP_WARP_PARTICLE_TEXTURE_POS(type, pvalue) \
4253 if (event & type) { \
4254 if (pvalue < 0.0f) { \
4255 pvalue = 1.0f + pvalue; \
4257 CLAMP(pvalue, 0.0f, 1.0f); \
4261#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) \
4262 if (event & type) { \
4263 CLAMP(pvalue, -1.0f, 1.0f); \
4281 float value, rgba[4], texvec[3];
4291 for (m = 0; m <
MAX_MTEX; m++, mtexp++) {
4293 if (mtex && mtex->
tex && mtex->
mapto) {
4296 short texco = mtex->
texco;
4333 texvec[0] = 2.0f * (cfra - par->
time) / (par->
dietime - par->
time) - 1.0f;
4371 float value, rgba[4], co[3], texvec[3];
4382 for (m = 0; m <
MAX_MTEX; m++, mtexp++) {
4384 if (mtex && mtex->
tex && mtex->
mapto) {
4387 short texco = mtex->
texco;
4445 texvec[0] = 2.0f * (cfra - pa->
time) / (pa->
dietime - pa->
time) - 1.0f;
4461 int flip = (mtex->
timefac < 0.0f);
4463 ptex->
time *= 1.0f - timefac;
4529 *dietime =
time + life;
4532 return (cfra -
time) / life;
4572 int i = cpa - psys->
child;
4600 ctx->
mesh, cpa_from, cpa_num, cpa_fuv, ctx->
vg_kink);
4640 float co[3], orco[3];
4641 float hairmat[4][4];
4644 short between = 0, edit = 0;
4657 CLAMP(t, 0.0f, 1.0f);
4708 else if (totchild) {
4720 float par_co[3], par_orco[3];
4722 cpa = psys->
child + p - totpart;
4724 if (
state->time < 0.0f) {
4798 cpa_from = part->
from;
4836 ctx.
mesh = psmd->mesh_final;
4875 modifier_ctx.
sim = sim;
4876 modifier_ctx.
ptex = &ptex;
4877 modifier_ctx.
cpa = cpa;
4878 modifier_ctx.
orco = orco;
4892 tstate_tmp.
time = t - 0.001f;
4898 tstate_tmp.
time = t + 0.001f;
4936 cpa = psys->
child + p - totpart;
4971 cfra = std::min(cfra, pa->
dietime);
4975 state->time = -cfra;
4984 const float par_orco[3] = {0.0f, 0.0f, 0.0f};
4989 CLAMP(t, 0.0f, 1.0f);
4994 modifier_ctx.
sim = sim;
4995 modifier_ctx.
ptex =
nullptr;
4996 modifier_ctx.
cpa = cpa;
5038 dfra = keys[2].
time - keys[1].
time;
5040 keytime = (
state->time - keys[1].
time) / dfra;
5043 mul_v3_fl(keys[1].vel, dfra * timestep);
5044 mul_v3_fl(keys[2].vel, dfra * timestep);
5099 uv[0] = uv[1] = 0.0f;
5113 if (mtface !=
nullptr) {
5114 const MFace *mface =
static_cast<const MFace *
>(
5193 float loc[3],
nor[3], vec[3], side[3],
len;
5194 float xvec[3] = {-1.0, 0.0, 0.0}, nmat[3][3];
5292 float hairmat[4][4], imat[4][4];
5294 for (p = 0; p < psys->
totpart; p++, pa++) {
5299 for (h = 0; h < pa->
totkey; h++, hkey++) {
5343 for (
int a = 0; a < psys->
totpart; a++, pa++) {
5397 psys->
flag &= ~PSYS_KEYED;
5407 for (a = 1, pa++; a < psys->
totpart; a++, pa++) {
5408 pa->
boid = (pa - 1)->boid + 1;
5425 psys->
edit =
nullptr;
5431 psys->
pdd =
nullptr;
5457 psys->
tree =
nullptr;
bool BKE_where_on_path(const struct Object *ob, float ctime, float r_vec[4], float r_dir[3], float r_quat[4], float *r_radius, float *r_weight)
struct BoidSettings * boid_copy_settings(const struct BoidSettings *boids)
void boid_free_settings(struct BoidSettings *boids)
void cloth_free_modifier(ClothModifierData *clmd)
bool BKE_collection_has_object_recursive(Collection *collection, Object *ob)
#define FOREACH_COLLECTION_OBJECT_RECURSIVE_END
#define FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(_collection, _object)
ListBase BKE_collection_object_cache_get(Collection *collection)
CustomData interface, see also DNA_customdata_types.h.
const void * CustomData_get_layer_n(const CustomData *data, eCustomDataType type, int n)
const void * CustomData_get_layer(const CustomData *data, eCustomDataType type)
const void * CustomData_get_layer_named(const CustomData *data, eCustomDataType type, blender::StringRef name)
void * CustomData_get_layer_for_write(CustomData *data, eCustomDataType type, int totelem)
int CustomData_get_render_layer(const CustomData *data, eCustomDataType type)
void * CustomData_get_for_write(CustomData *data, int index, eCustomDataType type, int totelem)
display list (or rather multi purpose list) stuff.
float BKE_displist_calc_taper(struct Depsgraph *depsgraph, const struct Scene *scene, struct Object *taperobj, int cur, int tot)
void BKE_partdeflect_free(struct PartDeflect *pd)
struct PartDeflect * BKE_partdeflect_new(int type)
struct EffectorWeights * BKE_effector_add_weights(struct Collection *collection)
float effector_falloff(struct EffectorCache *eff, struct EffectorData *efd, struct EffectedPoint *point, struct EffectorWeights *weights)
void BKE_effectors_free(struct ListBase *lb)
void BKE_effectors_apply(struct ListBase *effectors, struct ListBase *colliders, struct EffectorWeights *weights, struct EffectedPoint *point, float *force, float *wind_force, float *impulse)
struct PartDeflect * BKE_partdeflect_copy(const struct PartDeflect *pd_src)
void pd_point_from_particle(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleKey *state, struct EffectedPoint *point)
void key_curve_position_weights(float t, float data[4], KeyInterpolationType type)
LatticeDeformData * BKE_lattice_deform_data_create(const Object *oblatt, const Object *ob) ATTR_WARN_UNUSED_RESULT
void BKE_lattice_deform_data_destroy(LatticeDeformData *lattice_deform_data)
void BKE_lattice_deform_data_eval_co(LatticeDeformData *lattice_deform_data, float co[3], float weight)
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
void BKE_id_free(Main *bmain, void *idv)
void * BKE_id_new(Main *bmain, short type, const char *name)
void BKE_id_blend_write(BlendWriter *writer, ID *id)
#define BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(data_, func_call_)
#define BKE_LIB_FOREACHID_PROCESS_IDSUPER(data_, id_super_, cb_flag_)
LibraryForeachIDFlag BKE_lib_query_foreachid_process_flags_get(const LibraryForeachIDData *data)
@ IDWALK_DO_DEPRECATED_POINTERS
General operations, lookup, etc. for materials.
Material * BKE_object_material_get(Object *ob, short act)
void BKE_mesh_orco_verts_transform(Mesh *mesh, blender::MutableSpan< blender::float3 > orco, bool invert)
void BKE_mesh_texspace_ensure(Mesh *mesh)
BLI_INLINE int BKE_mesh_origindex_mface_mpoly(const int *index_mf_to_mpoly, const int *index_mp_to_orig, const int i)
void BKE_mesh_tessface_ensure(Mesh *mesh)
ModifierData * BKE_modifiers_findby_type(const Object *ob, ModifierType type)
void BKE_modifiers_persistent_uid_init(const Object &object, ModifierData &md)
void BKE_modifier_unique_name(ListBase *modifiers, ModifierData *md)
void BKE_modifier_free(ModifierData *md)
void BKE_modifier_remove_from_list(Object *ob, ModifierData *md)
ModifierData * BKE_modifier_new(int type)
General operations, lookup, etc. for blender objects.
void BKE_object_modifier_set_active(Object *ob, ModifierData *md)
void psys_thread_context_init(struct ParticleThreadContext *ctx, struct ParticleSimulationData *sim)
#define LOOP_SHOWN_PARTICLES
void psys_unique_name(struct Object *object, struct ParticleSystem *psys, const char *defname) ATTR_NONNULL(1
void psys_apply_child_modifiers(struct ParticleThreadContext *ctx, struct ListBase *modifiers, struct ChildParticle *cpa, struct ParticleTexture *ptex, const float orco[3], float hairmat[4][4], struct ParticleCacheKey *keys, struct ParticleCacheKey *parent_keys, const float parent_orco[3])
void psys_thread_context_free(struct ParticleThreadContext *ctx)
blender::Vector< ParticleTask > psys_tasks_create(struct ParticleThreadContext *ctx, int startpart, int endpart)
void psys_tasks_free(blender::Vector< ParticleTask > &tasks)
BLI_INLINE float psys_frand(ParticleSystem *psys, unsigned int seed)
void BKE_ptcache_id_from_particles(PTCacheID *pid, struct Object *ob, struct ParticleSystem *psys)
struct PointCache * BKE_ptcache_add(struct ListBase *ptcaches)
#define PTCACHE_CLEAR_ALL
void BKE_ptcache_blend_read_data(struct BlendDataReader *reader, struct ListBase *ptcaches, struct PointCache **ocache, int force_disk)
int BKE_ptcache_mem_index_find(struct PTCacheMem *pm, unsigned int index)
void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
void BKE_ptcache_make_particle_key(struct ParticleKey *key, int index, void **data, float time)
void BKE_ptcache_free_list(struct ListBase *ptcaches)
void BKE_ptcache_blend_write(struct BlendWriter *writer, struct ListBase *ptcaches)
float BKE_scene_frame_to_ctime(const Scene *scene, int frame)
void BKE_texture_mtex_foreach_id(struct LibraryForeachIDData *data, struct MTex *mtex)
void BLI_bvhtree_free(BVHTree *tree)
A KD-tree for nearest neighbor search.
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE void BLI_listbase_clear(ListBase *lb)
void BLI_freelinkN(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
#define LISTBASE_FOREACH_BACKWARD(type, var, list)
void void BLI_freelistN(ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void void void void void void BLI_duplicatelist(ListBase *dst, const ListBase *src) ATTR_NONNULL(1
MINLINE int max_ii(int a, int b)
MINLINE float safe_acosf(float a)
int isect_point_quad_v2(const float p[2], const float v1[2], const float v2[2], const float v3[2], const float v4[2])
float normal_quad_v3(float n[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3])
void interp_cubic_v3(float x[3], float v[3], const float x1[3], const float v1[3], const float x2[3], const float v2[3], float t)
int isect_point_tri_v2(const float pt[2], const float v1[2], const float v2[2], const float v3[2])
float normal_tri_v3(float n[3], const float v1[3], const float v2[3], const float v3[3])
void interp_weights_poly_v3(float w[], float v[][3], int n, const float co[3])
bool map_to_sphere(float *r_u, float *r_v, float x, float y, float z)
void mul_m3_v3(const float M[3][3], float r[3])
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void mul_m4_v3(const float M[4][4], float r[3])
void transpose_m3_m4(float R[3][3], const float M[4][4])
void mul_v3_m4v3(float r[3], const float mat[4][4], const float vec[3])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
void transpose_m4(float R[4][4])
void mul_mat3_m4_v3(const float mat[4][4], float r[3])
void unit_m4(float m[4][4])
void interp_qt_qtqt(float q[4], const float a[4], const float b[4], float t)
void axis_angle_to_quat(float r[4], const float axis[3], float angle)
void quat_to_mat4(float m[4][4], const float q[4])
void mul_qt_v3(const float q[4], float r[3])
void mat3_to_quat_legacy(float q[4], const float wmat[3][3])
void mul_qt_qtqt(float q[4], const float a[4], const float b[4])
void copy_qt_qt(float q[4], const float a[4])
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void sub_v3_v3(float r[3], const float a[3])
void interp_v3_v3v3v3(float p[3], const float v1[3], const float v2[3], const float v3[3], const float w[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void interp_v4_v4v4(float r[4], const float a[4], const float b[4], float t)
void project_v3_v3v3(float out[3], const float p[3], const float v_proj[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
void interp_v3_v3v3v3v3(float p[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3], const float w[4])
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
MINLINE void zero_v3(float r[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float normalize_v3(float n[3])
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
ATTR_WARN_UNUSED_RESULT const size_t num
void int BLI_rng_get_int(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
struct RNG * BLI_rng_new(unsigned int seed)
void BLI_rng_free(struct RNG *rng) ATTR_NONNULL(1)
struct RNG * BLI_rng_new_srandom(unsigned int seed)
float BLI_rng_get_float(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
char * STRNCPY(char(&dst)[N], const char *src)
void BLI_task_pool_work_and_wait(TaskPool *pool)
void BLI_task_parallel_range(int start, int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
TaskPool * BLI_task_pool_create(void *userdata, eTaskPriority priority)
BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings)
void BLI_task_pool_free(TaskPool *pool)
void BLI_task_pool_push(TaskPool *pool, TaskRunFunction run, void *taskdata, bool free_taskdata, TaskFreeFunction freedata)
#define POINTER_AS_INT(i)
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
#define BLO_write_id_struct(writer, struct_name, id_address, id)
#define BLO_write_struct(writer, struct_name, data_ptr)
void BLO_read_struct_list_with_type_size(BlendDataReader *reader, size_t base_size, ListBase *list, blender::FunctionRef< size_t(const void *data)> type_size_fn)
#define BLO_write_struct_array(writer, struct_name, array_size, data_ptr)
#define BLO_read_struct_list(reader, struct_name, list)
#define BLO_read_struct_array(reader, struct_name, array_size, ptr_p)
#define BLO_read_struct(reader, struct_name, ptr_p)
#define BLT_I18NCONTEXT_ID_PARTICLESETTINGS
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
float DEG_get_ctime(const Depsgraph *graph)
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
ViewLayer * DEG_get_input_view_layer(const Depsgraph *graph)
Scene * DEG_get_input_scene(const Depsgraph *graph)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
struct BoidRuleGoalAvoid BoidRuleGoalAvoid
struct BoidRuleFight BoidRuleFight
struct BoidRuleAvoidCollision BoidRuleAvoidCollision
struct BoidRuleAverageSpeed BoidRuleAverageSpeed
struct BoidRuleFollowLeader BoidRuleFollowLeader
@ eBoidRuleType_FollowLeader
@ eBoidRuleType_AvoidCollision
@ eBoidRuleType_AverageSpeed
Object groups, one object can be in many groups at once.
#define CD_MASK_ORIGINDEX
#define CD_MASK_MDEFORMVERT
#define CD_MASK_ORIGSPACE_MLOOP
#define DNA_struct_default_get(struct_name)
@ SNDPARTICLE_COMBINED_EXPORT_OFF
@ eModifierType_ParticleSystem
@ eModifierType_DynamicPaint
@ PFIELD_GUIDE_PATH_WEIGHT
@ PART_FLUID_SPRAYFOAMBUBBLE
struct ParticleSettings ParticleSettings
@ SPH_VISCOELASTIC_SPRINGS
@ PART_CHILD_USE_TWIST_CURVE
@ PART_CHILD_USE_CLUMP_CURVE
@ PART_CHILD_USE_CLUMP_NOISE
@ PART_CHILD_USE_ROUGH_CURVE
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
Read Guarded memory(de)allocation.
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
static unsigned long seed
SIMD_FORCE_INLINE btScalar length() const
Return the length of the vector.
constexpr const T * data() const
const Depsgraph * depsgraph
blender::gpu::Batch * quad
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_callocN(size_t len, const char *str)
void * MEM_dupallocN(const void *vmemh)
void MEM_freeN(void *vmemh)
void BKE_particle_batch_cache_dirty_tag(ParticleSystem *psys, int mode)
void BKE_particlesettings_clump_curve_init(ParticleSettings *part)
void BKE_particle_system_blend_read_after_liblink(BlendLibReader *, Object *ob, ID *, ListBase *particles)
static int psys_map_index_on_dm(Mesh *mesh, int from, int index, int index_dmcache, const float fw[4], float, int *mapindex, float mapfw[4])
static void psys_free_path_cache_buffers(ParticleCacheKey **cache, ListBase *bufs)
static void particle_settings_blend_read_after_liblink(BlendLibReader *, ID *id)
ParticleSystem * psys_get_current(Object *ob)
void BKE_particle_system_blend_read_data(BlendDataReader *reader, ListBase *particles)
void psys_mat_hair_to_object(Object *, Mesh *mesh, short from, ParticleData *pa, float hairmat[4][4])
void psys_particle_on_emitter(ParticleSystemModifierData *psmd, int from, int index, int index_dmcache, float fuv[4], float foffset, float vec[3], float nor[3], float utan[3], float vtan[3], float orco[3])
void free_hair(Object *object, ParticleSystem *psys, int dynamics)
void object_remove_particle_system(Main *bmain, Scene *, Object *ob, ParticleSystem *psys)
static void psys_w_to_origspace(const float w[4], float uv[2])
void psys_free_particles(ParticleSystem *psys)
float psys_get_timestep(ParticleSimulationData *sim)
float psys_get_child_time(ParticleSystem *psys, ChildParticle *cpa, float cfra, float *birthtime, float *dietime)
static void particle_settings_blend_read_data(BlendDataReader *reader, ID *id)
void precalc_guides(ParticleSimulationData *sim, ListBase *effectors)
#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue)
static void particle_settings_init(ID *id)
ParticleSettings * BKE_particlesettings_add(Main *bmain, const char *name)
void BKE_particle_system_blend_write(BlendWriter *writer, ListBase *particles)
static ParticleCacheKey ** psys_alloc_path_cache_buffers(ListBase *bufs, int tot, int totkeys)
static int get_pointcache_times_for_particle(PointCache *cache, int index, float *r_start, float *r_dietime)
ParticleSystem * psys_eval_get(Depsgraph *depsgraph, Object *object, ParticleSystem *psys)
void psys_interpolate_particle(short type, ParticleKey keys[4], float dt, ParticleKey *result, bool velocity)
static int get_particle_uv(Mesh *mesh, ParticleData *pa, int index, const float fuv[4], const char *name, float *texco, bool from_vert)
static void psys_cache_edit_paths_iter(void *__restrict iter_data_v, const int iter, const TaskParallelTLS *__restrict)
void psys_sim_data_init(ParticleSimulationData *sim)
void copy_particle_key(ParticleKey *to, ParticleKey *from, int time)
void psys_free(Object *ob, ParticleSystem *psys)
void psys_interpolate_mcol(const MCol *mcol, int quad, const float w[4], MCol *mc)
float PSYS_FRAND_BASE[PSYS_FRAND_COUNT]
void psys_interpolate_uvs(const MTFace *tface, int quad, const float w[4], float uvco[2])
void psys_enable_all(Object *ob)
ModifierData * object_add_particle_system(Main *bmain, const Scene *scene, Object *ob, const char *name)
static float interpolate_particle_value(float v1, float v2, float v3, float v4, const float w[4], int four)
static void get_pointcache_keys_for_time(Object *, PointCache *cache, PTCacheMem **cur, int index, float t, ParticleKey *key1, ParticleKey *key2)
static void init_particle_interpolation(Object *ob, ParticleSystem *psys, ParticleData *pa, ParticleInterpolationData *pind)
void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *state, const bool vel)
static PTCacheEdit * psys_orig_edit_get(ParticleSystem *psys)
static void edit_to_particle(ParticleKey *key, PTCacheEditKey *ekey)
void BKE_particlesettings_rough_curve_init(ParticleSettings *part)
int psys_particle_dm_face_lookup(Mesh *mesh_final, Mesh *mesh_original, int findex_orig, const float fw[4], LinkNode **poly_nodes)
static void offset_child(ChildParticle *cpa, ParticleKey *par, float *par_rot, ParticleKey *child, float flat, float radius)
void psys_mat_hair_to_global(Object *ob, Mesh *mesh, short from, ParticleData *pa, float hairmat[4][4])
void psys_emitter_customdata_mask(ParticleSystem *psys, CustomData_MeshMasks *r_cddata_masks)
void BKE_particle_init_rng()
static void get_cpa_texture(Mesh *mesh, ParticleSystem *psys, ParticleSettings *part, ParticleData *par, int child_index, int face_index, const float fw[4], float *orco, ParticleTexture *ptex, int event, float cfra)
#define CLAMP_WARP_PARTICLE_TEXTURE_POS(type, pvalue)
void psys_free_children(ParticleSystem *psys)
ParticleSystemModifierData * psys_get_modifier(Object *ob, ParticleSystem *psys)
static void psys_thread_create_path(ParticleTask *task, ChildParticle *cpa, ParticleCacheKey *child_keys, int i)
bool psys_check_edited(ParticleSystem *psys)
void BKE_particle_partdeflect_blend_read_data(BlendDataReader *, PartDeflect *)
void psys_sim_data_free(ParticleSimulationData *sim)
static ParticleCacheKey * pcache_key_segment_endpoint_safe(ParticleCacheKey *key)
static void interpolate_pathcache(ParticleCacheKey *first, float t, ParticleCacheKey *result)
ModifierData * object_copy_particle_system(Main *bmain, const Scene *scene, Object *ob, const ParticleSystem *psys_orig)
static float psys_interpolate_value_from_verts(Mesh *mesh, short from, int index, const float fw[4], const float *values)
void psys_check_group_weights(ParticleSettings *part)
void psys_apply_hair_lattice(Depsgraph *depsgraph, Scene *scene, Object *ob, ParticleSystem *psys)
void psys_cache_child_paths(ParticleSimulationData *sim, float cfra, const bool editupdate, const bool use_render_params)
void psys_mat_hair_to_orco(Object *ob, Mesh *mesh, short from, ParticleData *pa, float hairmat[4][4])
void psys_find_parents(ParticleSimulationData *sim, const bool use_render_params)
void psys_free_path_cache(ParticleSystem *psys, PTCacheEdit *edit)
static void hair_to_particle(ParticleKey *key, HairKey *hkey)
static void do_particle_interpolation(ParticleSystem *psys, int p, ParticleData *pa, float t, ParticleInterpolationData *pind, ParticleKey *result)
void(* BKE_particle_batch_cache_free_cb)(ParticleSystem *psys)
float * psys_cache_vgroup(Mesh *mesh, ParticleSystem *psys, int vgroup)
static void triatomat(float *v1, float *v2, float *v3, const float(*uv)[2], float mat[4][4])
bool psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *state, const bool always)
static void particle_settings_copy_data(Main *, std::optional< Library * >, ID *id_dst, const ID *id_src, const int)
void(* BKE_particle_batch_cache_dirty_tag_cb)(ParticleSystem *psys, int mode)
static void exec_child_path_cache(TaskPool *__restrict, void *taskdata)
void psys_set_current_num(Object *ob, int index)
void psys_free_pdd(ParticleSystem *psys)
int psys_uses_gravity(ParticleSimulationData *sim)
static void free_child_path_cache(ParticleSystem *psys)
static void fluid_free_settings(SPHFluidSettings *fluid)
void psys_copy_particles(ParticleSystem *psys_dst, ParticleSystem *psys_src)
static void psys_origspace_to_w(OrigSpaceFace *osface, int quad, const float w[4], float neww[4])
float psys_get_dietime_from_cache(PointCache *cache, int index)
static void cache_key_incremental_rotation(ParticleCacheKey *key0, ParticleCacheKey *key1, ParticleCacheKey *key2, float *prev_tangent, int i)
static void particle_settings_free_data(ID *id)
void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part, ParticleSystemModifierData *psmd, ParticleData *pa, ChildParticle *cpa, float uv[2], float orco[3])
static size_t boid_rule_struct_size(const eBoidRuleType type)
short psys_get_current_num(Object *ob)
bool psys_check_enabled(Object *ob, ParticleSystem *psys, const bool use_render_params)
void psys_get_from_key(ParticleKey *key, float loc[3], float vel[3], float rot[4], float *time)
#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue)
void psys_vec_rot_to_face(Mesh *mesh, ParticleData *pa, float vec[3])
static void particle_settings_blend_write(BlendWriter *writer, ID *id, const void *id_address)
void BKE_particle_batch_cache_free(ParticleSystem *psys)
void free_keyed_keys(ParticleSystem *psys)
uint PSYS_FRAND_SEED_MULTIPLIER[PSYS_FRAND_COUNT]
void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_render_params)
float psys_get_child_size(ParticleSystem *psys, ChildParticle *cpa, float, float *)
bool do_guides(Depsgraph *depsgraph, ParticleSettings *part, ListBase *effectors, ParticleKey *state, int index, float time)
static void get_child_modifier_parameters(ParticleSettings *part, ParticleThreadContext *ctx, ChildParticle *cpa, short cpa_from, int cpa_num, float *cpa_fuv, float *orco, ParticleTexture *ptex)
void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa, ChildParticle *cpa, ParticleCacheKey *cache, float mat[4][4], float *scale)
void psys_find_group_weights(ParticleSettings *part)
uint PSYS_FRAND_SEED_OFFSET[PSYS_FRAND_COUNT]
int count_particles_mod(ParticleSystem *psys, int totgr, int cur)
void psys_interpolate_face(Mesh *mesh, const float(*vert_positions)[3], const float(*vert_normals)[3], const MFace *mface, MTFace *tface, const float(*orcodata)[3], float w[4], float vec[3], float nor[3], float utan[3], float vtan[3], float orco[3])
#define PATH_CACHE_BUF_SIZE
static void do_path_effectors(ParticleSimulationData *sim, int i, ParticleCacheKey *ca, int k, int steps, float *, float effector, float, float, float *length, float *vec)
void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTexture *ptex, int event, float cfra)
void psys_cache_edit_paths(Depsgraph *depsgraph, Scene *scene, Object *ob, PTCacheEdit *edit, float cfra, const bool use_render_params)
float psys_particle_value_from_verts(Mesh *mesh, short from, ParticleData *pa, float *values)
static bool psys_thread_context_init_path(ParticleThreadContext *ctx, ParticleSimulationData *sim, Scene *scene, float cfra, const bool editupdate, const bool use_render_params)
void psys_disable_all(Object *ob)
static void write_boid_state(BlendWriter *writer, BoidState *state)
static void mvert_to_particle(ParticleKey *key, float3 *position, HairKey *hkey)
void psys_particle_on_dm(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])
static ModifierData * object_add_or_copy_particle_system(Main *bmain, const Scene *scene, Object *ob, const char *name, const ParticleSystem *psys_orig)
static void psys_face_mat(Object *ob, Mesh *mesh, ParticleData *pa, float mat[4][4], int orco)
ParticleSystem * psys_orig_get(ParticleSystem *psys)
bool psys_in_edit_mode(Depsgraph *depsgraph, const ParticleSystem *psys)
static void particle_settings_foreach_id(ID *id, LibraryForeachIDData *data)
static void psys_particle_on_shape(int, int, float *, float vec[3], float nor[3], float utan[3], float vtan[3], float orco[3])
#define SET_PARTICLE_TEXTURE(type, pvalue, texfac)
int count_particles(ParticleSystem *psys)
void BKE_particlesettings_twist_curve_init(ParticleSettings *part)
static void psys_task_init_path(ParticleTask *task, ParticleSimulationData *sim)
float do_clump(ParticleKey *state, const float par_co[3], float time, const float orco_offset[3], float clumpfac, float clumppow, float pa_clump, bool use_clump_noise, float clump_noise_size, const CurveMapping *clumpcurve)
void do_kink(ParticleKey *state, const float par_co[3], const float par_vel[3], const float par_rot[4], float time, float freq, float shape, float amplitude, float flat, short type, short axis, const float obmat[4][4], int smooth_start)
void do_child_modifiers(const ParticleChildModifierContext *modifier_ctx, float mat[4][4], ParticleKey *state, float t)
ParticleSystemModifierData * psmd
struct ClothSolverResult * solver_result
struct ClothHairData * hairdata
struct Cloth * clothObject
struct PointCache * point_cache
struct ClothSimSettings * sim_parms
struct ClothCollSettings * coll_parms
struct EffectorWeights * effector_weights
struct ParticleSystem * psys
struct DynamicPaintBrushSettings * brush
struct Collection * group
char sndparticle_combined_export
struct ParticleSystem * psys
struct FluidDomainSettings * domain
struct FluidFlowSettings * flow
MeshRuntimeHandle * runtime
float texspace_location[3]
struct ModifierData * next
struct PTCacheEditKey * keys
struct ParticleCacheKey ** pathcache
PTCacheEditPoint * points
struct ParticleSystem * psys
struct ParticleSystemModifierData * psmd_eval
ParticleThreadContext * thread_ctx
ParticleCacheKey * parent_keys
ParticleSimulationData * sim
struct ParticleDupliWeight * next
float3 * vert_positions[2]
PTCacheEditPoint * epoint
struct CurveMapping * clumpcurve
struct Collection * collision_group
struct Collection * instance_collection
struct CurveMapping * roughcurve
struct CurveMapping * twistcurve
struct BoidSettings * boids
struct EffectorWeights * effector_weights
struct ListBase instance_weights
struct Object * instance_object
struct SPHFluidSettings * fluid
struct Depsgraph * depsgraph
struct ParticleSystemModifierData * psmd
struct ParticleSystem * psys
struct ListBase * colliders
struct ParticleSystem * psys
ParticleSpring * fluid_springs
struct PTCacheEdit * edit
struct ListBase * effectors
struct ParticleSystem * next
struct PointCache * pointcache
struct ClothModifierData * clmd
struct LatticeDeformData * lattice_deform_data
struct ParticleCacheKey ** childcache
struct Mesh * hair_in_mesh
struct ParticleSystem * orig_psys
struct Mesh * hair_out_mesh
struct ParticleDrawData * pdd
struct ParticleCacheKey ** pathcache
void(* free_edit)(struct PTCacheEdit *edit)
struct ParticleTarget * prev
struct ParticleTarget * next
ParticleThreadContext * ctx
struct CurveMapping * roughcurve
struct CurveMapping * twistcurve
struct CurveMapping * clumpcurve
struct ParticleSimulationData sim
struct ListBase mem_cache
struct PTCacheEdit * edit
struct PhysicsSettings physics_settings
struct ToolSettings * toolsettings
bool RE_texture_evaluate(const MTex *mtex, const float vec[3], const int thread, ImagePool *pool, const bool skip_load_image, const bool texnode_preview, float *r_intensity, float r_rgba[4])
static int blend(const Tex *tex, const float texvec[3], TexResult *texres)
float texture_value_blend(float tex, float out, float fact, float facg, int blendtype)