Blender V4.5
rna_particle.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011 AutoCRC (adaptive time step).
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <climits>
10#include <cstdlib>
11
12#include "DNA_material_types.h"
13#include "DNA_particle_types.h"
14#include "DNA_scene_types.h"
15#include "DNA_texture_types.h"
16
17#include "RNA_define.hh"
18#include "RNA_enum_types.hh"
19
20#include "BLT_translation.hh"
21
22#include "rna_internal.hh"
23
24#include "WM_api.hh"
25#include "WM_types.hh"
26
27#ifdef RNA_RUNTIME
28static const EnumPropertyItem part_from_items[] = {
29 {PART_FROM_VERT, "VERT", 0, "Vertices", ""},
30 {PART_FROM_FACE, "FACE", 0, "Faces", ""},
31 {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
32 {0, nullptr, 0, nullptr, nullptr},
33};
34#endif
35
36#ifndef RNA_RUNTIME
38 {PART_FROM_VERT, "VERT", 0, "Vertices", ""},
39 {PART_FROM_FACE, "FACE", 0, "Faces", ""},
40 {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
41 {0, nullptr, 0, nullptr, nullptr},
42};
43#endif
44
46 {PART_DISTR_JIT, "JIT", 0, "Jittered", ""},
47 {PART_DISTR_RAND, "RAND", 0, "Random", ""},
48 {PART_DISTR_GRID, "GRID", 0, "Grid", ""},
49 {0, nullptr, 0, nullptr, nullptr},
50};
51
52#ifdef RNA_RUNTIME
53static const EnumPropertyItem part_hair_dist_items[] = {
54 {PART_DISTR_JIT, "JIT", 0, "Jittered", ""},
55 {PART_DISTR_RAND, "RAND", 0, "Random", ""},
56 {0, nullptr, 0, nullptr, nullptr},
57};
58#endif
59
61 {PART_DRAW_NOT, "NONE", 0, "None", ""},
62 {PART_DRAW_REND, "RENDER", 0, "Rendered", ""},
63 {PART_DRAW_DOT, "DOT", 0, "Point", ""},
64 {PART_DRAW_CIRC, "CIRC", 0, "Circle", ""},
65 {PART_DRAW_CROSS, "CROSS", 0, "Cross", ""},
66 {PART_DRAW_AXIS, "AXIS", 0, "Axis", ""},
67 {0, nullptr, 0, nullptr, nullptr},
68};
69
70#ifdef RNA_RUNTIME
71static const EnumPropertyItem part_hair_draw_as_items[] = {
72 {PART_DRAW_NOT, "NONE", 0, "None", ""},
73 {PART_DRAW_REND, "RENDER", 0, "Rendered", ""},
74 {PART_DRAW_PATH, "PATH", 0, "Path", ""},
75 {0, nullptr, 0, nullptr, nullptr},
76};
77#endif
78
80 {PART_DRAW_NOT, "NONE", 0, "None", ""},
81 {PART_DRAW_HALO, "HALO", 0, "Halo", ""},
82 {PART_DRAW_LINE, "LINE", 0, "Line", ""},
83 {PART_DRAW_PATH, "PATH", 0, "Path", ""},
84 {PART_DRAW_OB, "OBJECT", 0, "Object", ""},
85 {PART_DRAW_GR, "COLLECTION", 0, "Collection", ""},
86 {0, nullptr, 0, nullptr, nullptr},
87};
88
89#ifdef RNA_RUNTIME
90static const EnumPropertyItem part_hair_ren_as_items[] = {
91 {PART_DRAW_NOT, "NONE", 0, "None", ""},
92 {PART_DRAW_PATH, "PATH", 0, "Path", ""},
93 {PART_DRAW_OB, "OBJECT", 0, "Object", ""},
94 {PART_DRAW_GR, "COLLECTION", 0, "Collection", ""},
95 {0, nullptr, 0, nullptr, nullptr},
96};
97#endif
98
100 {PART_EMITTER, "EMITTER", 0, "Emitter", ""},
101 /*{PART_REACTOR, "REACTOR", 0, "Reactor", ""}, */
102 {PART_HAIR, "HAIR", 0, "Hair", ""},
103 {0, nullptr, 0, nullptr, nullptr},
104};
105
106#ifdef RNA_RUNTIME
107static const EnumPropertyItem part_fluid_type_items[] = {
108 {PART_FLUID, "FLUID", 0, "Fluid", ""},
109 {PART_FLUID_FLIP, "FLIP", 0, "Liquid", ""},
110 {PART_FLUID_SPRAY, "SPRAY", 0, "Spray", ""},
111 {PART_FLUID_BUBBLE, "BUBBLE", 0, "Bubble", ""},
112 {PART_FLUID_FOAM, "FOAM", 0, "Foam", ""},
113 {PART_FLUID_TRACER, "TRACER", 0, "Tracer", ""},
114 {PART_FLUID_SPRAYFOAM, "SPRAYFOAM", 0, "Spray-Foam", ""},
115 {PART_FLUID_SPRAYBUBBLE, "SPRAYBUBBLE", 0, "Spray-Bubble", ""},
116 {PART_FLUID_FOAMBUBBLE, "FOAMBUBBLE", 0, "Foam-Bubble", ""},
117 {PART_FLUID_SPRAYFOAMBUBBLE, "SPRAYFOAMBUBBLE", 0, "Spray-Foam-Bubble", ""},
118 {0, nullptr, 0, nullptr, nullptr},
119};
120#endif
121
122#ifdef RNA_RUNTIME
123
124# include <fmt/format.h>
125
126# include "BLI_string_utils.hh"
127
128# include "DNA_cloth_types.h"
129# include "DNA_mesh_types.h"
130# include "DNA_meshdata_types.h"
131
132# include "BLI_math_matrix.h"
133# include "BLI_math_vector.h"
134
135# include "BKE_boids.h"
136# include "BKE_cloth.hh"
137# include "BKE_context.hh"
138# include "BKE_customdata.hh"
139# include "BKE_deform.hh"
140# include "BKE_effect.h"
141# include "BKE_material.hh"
142# include "BKE_mesh.hh"
144# include "BKE_modifier.hh"
145# include "BKE_particle.h"
146# include "BKE_pointcache.h"
147# include "BKE_texture.h"
148
149# include "DEG_depsgraph.hh"
150# include "DEG_depsgraph_build.hh"
151
152/* use for object space hair get/set */
153static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr,
155 ParticleData **pa_pt)
156{
157 HairKey *hkey = (HairKey *)ptr->data;
158 Object *ob = (Object *)ptr->owner_id;
159 ModifierData *md;
160 ParticleSystemModifierData *psmd = nullptr;
161 ParticleSystem *psys;
162 ParticleData *pa;
163 int i;
164
165 *psmd_pt = nullptr;
166 *pa_pt = nullptr;
167
168 /* given the pointer HairKey *hkey, we iterate over all particles in all
169 * particle systems in the object "ob" in order to find
170 * - the ParticleSystemData to which the HairKey (and hence the particle)
171 * belongs (will be stored in psmd_pt)
172 * - the ParticleData to which the HairKey belongs (will be stored in pa_pt)
173 *
174 * not a very efficient way of getting hair key location data,
175 * but it's the best we've got at the present
176 *
177 * IDEAS: include additional information in PointerRNA beforehand,
178 * for example a pointer to the ParticleSystemModifierData to which the
179 * hair-key belongs.
180 */
181
182 for (md = static_cast<ModifierData *>(ob->modifiers.first); md; md = md->next) {
184 psmd = (ParticleSystemModifierData *)md;
185 if (psmd && psmd->mesh_final && psmd->psys) {
186 psys = psmd->psys;
187 for (i = 0, pa = psys->particles; i < psys->totpart; i++, pa++) {
188 /* Hair-keys are stored sequentially in memory, so we can
189 * find if it's the same particle by comparing pointers,
190 * without having to iterate over them all. */
191 if ((hkey >= pa->hair) && (hkey < pa->hair + pa->totkey)) {
192 *psmd_pt = psmd;
193 *pa_pt = pa;
194 return;
195 }
196 }
197 }
198 }
199 }
200}
201
202static void rna_ParticleHairKey_location_object_get(PointerRNA *ptr, float *values)
203{
204 HairKey *hkey = (HairKey *)ptr->data;
205 Object *ob = (Object *)ptr->owner_id;
207 ParticleData *pa;
208
209 rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
210
211 if (pa) {
212 Mesh *hair_mesh = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_mesh :
213 nullptr;
214 if (hair_mesh) {
215 const blender::Span<blender::float3> positions = hair_mesh->vert_positions();
216 copy_v3_v3(values, positions[pa->hair_index + (hkey - pa->hair)]);
217 }
218 else {
219 float hairmat[4][4];
220 psys_mat_hair_to_object(ob, psmd->mesh_final, psmd->psys->part->from, pa, hairmat);
221 copy_v3_v3(values, hkey->co);
222 mul_m4_v3(hairmat, values);
223 }
224 }
225 else {
226 zero_v3(values);
227 }
228}
229
230/* Helper function which returns index of the given hair_key in particle which owns it.
231 * Works with cases when hair_key is coming from the particle which was passed here, and from the
232 * original particle of the given one.
233 *
234 * Such trickery is needed to allow modification of hair keys in the original object using
235 * evaluated particle and object to access proper hair matrix. */
236static int hair_key_index_get(const Object *object,
237 /*const*/ HairKey *hair_key,
238 /*const*/ ParticleSystemModifierData *modifier,
239 /*const*/ ParticleData *particle)
240{
241 if (ARRAY_HAS_ITEM(hair_key, particle->hair, particle->totkey)) {
242 return hair_key - particle->hair;
243 }
244
245 const ParticleSystem *particle_system = modifier->psys;
246 const int particle_index = particle - particle_system->particles;
247
248 const ParticleSystemModifierData *original_modifier = (ParticleSystemModifierData *)
249 BKE_modifier_get_original(object, &modifier->modifier);
250 const ParticleSystem *original_particle_system = original_modifier->psys;
251 const ParticleData *original_particle = &original_particle_system->particles[particle_index];
252
253 if (ARRAY_HAS_ITEM(hair_key, original_particle->hair, original_particle->totkey)) {
254 return hair_key - original_particle->hair;
255 }
256
257 return -1;
258}
259
260/* Set hair_key->co to the given coordinate in object space (the given coordinate will be
261 * converted to the proper space).
262 *
263 * The hair_key can be coming from both original and evaluated object. Object, modifier and
264 * particle are to be from evaluated object, so that all the data needed for hair matrix is
265 * present. */
266static void hair_key_location_object_set(HairKey *hair_key,
267 Object *object,
269 ParticleData *particle,
270 const float src_co[3])
271{
272 Mesh *hair_mesh = (modifier->psys->flag & PSYS_HAIR_DYNAMICS) ? modifier->psys->hair_out_mesh :
273 nullptr;
274
275 if (hair_mesh != nullptr) {
276 const int hair_key_index = hair_key_index_get(object, hair_key, modifier, particle);
277 if (hair_key_index == -1) {
278 return;
279 }
280 blender::MutableSpan<blender::float3> positions = hair_mesh->vert_positions_for_write();
281 copy_v3_v3(positions[particle->hair_index + (hair_key_index)], src_co);
282 return;
283 }
284
285 float hairmat[4][4];
287 object, modifier->mesh_final, modifier->psys->part->from, particle, hairmat);
288
289 float imat[4][4];
290 invert_m4_m4(imat, hairmat);
291
292 copy_v3_v3(hair_key->co, src_co);
293 mul_m4_v3(imat, hair_key->co);
294}
295
296static void rna_ParticleHairKey_location_object_set(PointerRNA *ptr, const float *values)
297{
298 HairKey *hkey = (HairKey *)ptr->data;
299 Object *ob = (Object *)ptr->owner_id;
300
302 ParticleData *pa;
303 rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
304
305 if (pa == nullptr) {
306 zero_v3(hkey->co);
307 return;
308 }
309
310 hair_key_location_object_set(hkey, ob, psmd, pa, values);
311}
312
313static void rna_ParticleHairKey_co_object(HairKey *hairkey,
314 Object *object,
316 ParticleData *particle,
317 float n_co[3])
318{
319
320 Mesh *hair_mesh = (modifier->psys->flag & PSYS_HAIR_DYNAMICS) ? modifier->psys->hair_out_mesh :
321 nullptr;
322 if (particle) {
323 if (hair_mesh) {
324 const blender::Span<blender::float3> positions = hair_mesh->vert_positions();
325 copy_v3_v3(n_co, positions[particle->hair_index + (hairkey - particle->hair)]);
326 }
327 else {
328 float hairmat[4][4];
330 object, modifier->mesh_final, modifier->psys->part->from, particle, hairmat);
331 copy_v3_v3(n_co, hairkey->co);
332 mul_m4_v3(hairmat, n_co);
333 }
334 }
335 else {
336 zero_v3(n_co);
337 }
338}
339
340static void rna_ParticleHairKey_co_object_set(ID *id,
341 HairKey *hair_key,
342 Object *object,
344 ParticleData *particle,
345 const float co[3])
346{
347
348 if (particle == nullptr) {
349 return;
350 }
351
352 /* Mark particle system as edited, so then particle_system_update() does not reset the hair
353 * keys from path. This behavior is similar to how particle edit mode sets flags. */
355 BKE_modifier_get_original(object, &modifier->modifier);
356 orig_modifier->psys->flag |= PSYS_EDITED;
357
358 hair_key_location_object_set(hair_key, object, modifier, particle, co);
359
360 /* Tag similar to brushes in particle edit mode, so the modifier stack is properly evaluated
361 * with the same particle system recalc flags as during combing. */
363}
364
365static void rna_Particle_uv_on_emitter(ParticleData *particle,
368 float r_uv[2])
369{
370# if 0
372 psmd, part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co, nor, 0, 0, sd.orco, 0);
373# endif
374
375 if (modifier->mesh_final == nullptr) {
376 BKE_report(reports, RPT_ERROR, "uv_on_emitter() requires a modifier from an evaluated object");
377 return;
378 }
379
380 /* Get UV-coordinate & color. */
381 int num = particle->num_dmcache;
382 int from = modifier->psys->part->from;
383
385 BKE_report(reports, RPT_ERROR, "Mesh has no UV data");
386 return;
387 }
388 BKE_mesh_tessface_ensure(modifier->mesh_final); /* BMESH - UNTIL MODIFIER IS UPDATED FOR POLYS */
390
392 if (particle->num < modifier->mesh_final->totface_legacy) {
393 num = particle->num;
394 }
395 }
396
397 /* Get UV-coordinate. */
398 if (r_uv && ELEM(from, PART_FROM_FACE, PART_FROM_VOLUME) &&
400 {
401
402 const MFace *mface = static_cast<const MFace *>(
404 const MTFace *mtface = static_cast<const MTFace *>(
406
407 if (mface && mtface) {
408 mtface += num;
409 psys_interpolate_uvs(mtface, mface->v4, particle->fuv, r_uv);
410 return;
411 }
412 }
413
414 r_uv[0] = 0.0f;
415 r_uv[1] = 0.0f;
416}
417
418static void rna_ParticleSystem_co_hair(
419 ParticleSystem *particlesystem, Object *object, int particle_no, int step, float n_co[3])
420{
421 ParticleSettings *part = nullptr;
422 ParticleData *pars = nullptr;
423 ParticleCacheKey *cache = nullptr;
424 int totchild = 0;
425 int totpart;
426 int max_k = 0;
427
428 if (particlesystem == nullptr) {
429 return;
430 }
431
432 part = particlesystem->part;
433 pars = particlesystem->particles;
434 totpart = particlesystem->totcached;
435 totchild = particlesystem->totchildcache;
436
437 if (part == nullptr || pars == nullptr) {
438 return;
439 }
440
442 return;
443 }
444
445 /* can happen for disconnected/global hair */
446 if (part->type == PART_HAIR && !particlesystem->childcache) {
447 totchild = 0;
448 }
449
450 if (particle_no < totpart && particlesystem->pathcache) {
451 cache = particlesystem->pathcache[particle_no];
452 max_k = int(cache->segments);
453 }
454 else if (particle_no < totpart + totchild && particlesystem->childcache) {
455 cache = particlesystem->childcache[particle_no - totpart];
456
457 if (cache->segments < 0) {
458 max_k = 0;
459 }
460 else {
461 max_k = int(cache->segments);
462 }
463 }
464 else {
465 return;
466 }
467
468 /* Strands key loop data stored in cache + step->co. */
469 if (step >= 0 && step <= max_k) {
470 copy_v3_v3(n_co, (cache + step)->co);
471 mul_m4_v3(particlesystem->imat, n_co);
472 mul_m4_v3(object->object_to_world().ptr(), n_co);
473 }
474}
475
476static const EnumPropertyItem *rna_Particle_Material_itemf(bContext *C,
478 PropertyRNA * /*prop*/,
479 bool *r_free)
480{
481
482 ParticleSettings *part = reinterpret_cast<ParticleSettings *>(ptr->owner_id);
483
484 /* The context object might not be what we want when doing this from python. */
485 Object *ob_found = nullptr;
486
487 if (Object *ob_context = static_cast<Object *>(CTX_data_pointer_get(C, "object").data)) {
488 LISTBASE_FOREACH (ParticleSystem *, psys, &ob_context->particlesystem) {
489 if (psys->part == part) {
490 ob_found = ob_context;
491 break;
492 }
493 }
494 }
495
496 if (ob_found == nullptr) {
497 /* Iterating over all object is slow, but no better solution exists at the moment. */
498 for (Object *ob = static_cast<Object *>(CTX_data_main(C)->objects.first);
499 ob && (ob_found == nullptr);
500 ob = static_cast<Object *>(ob->id.next))
501 {
503 if (psys->part == part) {
504 ob_found = ob;
505 break;
506 }
507 }
508 }
509 }
510
511 Material *ma;
512 EnumPropertyItem *item = nullptr;
513 EnumPropertyItem tmp = {0, "", 0, "", ""};
514 int totitem = 0;
515 int i;
516
517 if (ob_found && ob_found->totcol > 0) {
518 for (i = 1; i <= ob_found->totcol; i++) {
519 ma = BKE_object_material_get(ob_found, i);
520 tmp.value = i;
521 tmp.icon = ICON_MATERIAL_DATA;
522 if (ma) {
523 tmp.name = ma->id.name + 2;
524 tmp.identifier = tmp.name;
525 }
526 else {
527 tmp.name = "Default Material";
528 tmp.identifier = tmp.name;
529 }
530 RNA_enum_item_add(&item, &totitem, &tmp);
531 }
532 }
533 else {
534 tmp.value = 1;
535 tmp.icon = ICON_MATERIAL_DATA;
536 tmp.name = "Default Material";
537 tmp.identifier = tmp.name;
538 RNA_enum_item_add(&item, &totitem, &tmp);
539 }
540
541 RNA_enum_item_end(&item, &totitem);
542 *r_free = true;
543
544 return item;
545}
546
547/* return < 0 means invalid (no matching tessellated face could be found). */
548static int rna_ParticleSystem_tessfaceidx_on_emitter(ParticleSystem *particlesystem,
550 ParticleData *particle,
551 int particle_no,
552 float (**r_fuv)[4])
553{
554 ParticleSettings *part = nullptr;
555 int totpart;
556 int totchild = 0;
557 int totface;
558 int totvert;
559 int num = -1;
560
561 BKE_mesh_tessface_ensure(modifier->mesh_final); /* BMESH - UNTIL MODIFIER IS UPDATED FOR POLYS */
562 totface = modifier->mesh_final->totface_legacy;
563 totvert = modifier->mesh_final->verts_num;
564
565 /* 1. check that everything is ok & updated */
566 if (!particlesystem || !totface) {
567 return num;
568 }
569
570 part = particlesystem->part;
571 /* NOTE: only hair, keyed and baked particles may have cached items... */
572 totpart = particlesystem->totcached != 0 ? particlesystem->totcached : particlesystem->totpart;
573 totchild = particlesystem->totchildcache != 0 ? particlesystem->totchildcache :
574 particlesystem->totchild;
575
576 /* can happen for disconnected/global hair */
577 if (part->type == PART_HAIR && !particlesystem->childcache) {
578 totchild = 0;
579 }
580
581 if (particle_no >= totpart + totchild) {
582 return num;
583 }
584
585 /* 2. get matching face index. */
586 if (particle_no < totpart) {
587 num = (ELEM(particle->num_dmcache, DMCACHE_ISCHILD, DMCACHE_NOTFOUND)) ? particle->num :
588 particle->num_dmcache;
589
591 if (num != DMCACHE_NOTFOUND && num < totface) {
592 *r_fuv = &particle->fuv;
593 return num;
594 }
595 }
596 else if (part->from == PART_FROM_VERT) {
597 if (num != DMCACHE_NOTFOUND && num < totvert) {
598 const MFace *mface = static_cast<const MFace *>(
600
601 *r_fuv = &particle->fuv;
602
603 /* This finds the first face to contain the emitting vertex,
604 * this is not ideal, but is mostly fine as UV seams generally
605 * map to equal-colored parts of a texture */
606 for (int i = 0; i < totface; i++, mface++) {
607 if (ELEM(num, mface->v1, mface->v2, mface->v3, mface->v4)) {
608 return i;
609 }
610 }
611 }
612 }
613 }
614 else {
615 ChildParticle *cpa = particlesystem->child + particle_no - totpart;
616 num = cpa->num;
617
618 if (part->childtype == PART_CHILD_FACES) {
620 if (num != DMCACHE_NOTFOUND && num < totface) {
621 *r_fuv = &cpa->fuv;
622 return num;
623 }
624 }
625 }
626 else {
627 ParticleData *parent = particlesystem->particles + cpa->parent;
628 num = parent->num_dmcache;
629
630 if (num == DMCACHE_NOTFOUND) {
631 num = parent->num;
632 }
633
635 if (num != DMCACHE_NOTFOUND && num < totface) {
636 *r_fuv = &parent->fuv;
637 return num;
638 }
639 }
640 else if (part->from == PART_FROM_VERT) {
641 if (num != DMCACHE_NOTFOUND && num < totvert) {
642 const MFace *mface = static_cast<const MFace *>(
644
645 *r_fuv = &parent->fuv;
646
647 /* This finds the first face to contain the emitting vertex,
648 * this is not ideal, but is mostly fine as UV seams generally
649 * map to equal-colored parts of a texture */
650 for (int i = 0; i < totface; i++, mface++) {
651 if (ELEM(num, mface->v1, mface->v2, mface->v3, mface->v4)) {
652 return i;
653 }
654 }
655 }
656 }
657 }
658 }
659
660 return -1;
661}
662
663static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem,
666 ParticleData *particle,
667 int particle_no,
668 int uv_no,
669 float r_uv[2])
670{
671 if (modifier->mesh_final == nullptr) {
672 BKE_report(reports, RPT_ERROR, "Object was not yet evaluated");
673 zero_v2(r_uv);
674 return;
675 }
677 BKE_report(reports, RPT_ERROR, "Mesh has no UV data");
678 zero_v2(r_uv);
679 return;
680 }
681
682 {
683 float(*fuv)[4];
684 /* Note all sanity checks are done in this helper func. */
685 const int num = rna_ParticleSystem_tessfaceidx_on_emitter(
686 particlesystem, modifier, particle, particle_no, &fuv);
687
688 if (num < 0) {
689 /* No matching face found. */
690 zero_v2(r_uv);
691 }
692 else {
693 const MFace *mfaces = static_cast<const MFace *>(
695 const MFace *mface = &mfaces[num];
696 const MTFace *mtface = (const MTFace *)CustomData_get_layer_n(
697 &modifier->mesh_final->fdata_legacy, CD_MTFACE, uv_no);
698
699 psys_interpolate_uvs(&mtface[num], mface->v4, *fuv, r_uv);
700 }
701 }
702}
703
704static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem,
707 ParticleData *particle,
708 int particle_no,
709 int vcol_no,
710 float r_mcol[3])
711{
713 BKE_report(reports, RPT_ERROR, "Mesh has no VCol data");
714 zero_v3(r_mcol);
715 return;
716 }
717
718 {
719 float(*fuv)[4];
720 /* Note all sanity checks are done in this helper func. */
721 const int num = rna_ParticleSystem_tessfaceidx_on_emitter(
722 particlesystem, modifier, particle, particle_no, &fuv);
723
724 if (num < 0) {
725 /* No matching face found. */
726 zero_v3(r_mcol);
727 }
728 else {
729 const MFace *mfaces = static_cast<const MFace *>(
731 const MFace *mface = &mfaces[num];
732 const MCol *mc = (const MCol *)CustomData_get_layer_n(
733 &modifier->mesh_final->fdata_legacy, CD_MCOL, vcol_no);
734 MCol mcol;
735
736 psys_interpolate_mcol(&mc[num * 4], mface->v4, *fuv, &mcol);
737 r_mcol[0] = float(mcol.b) / 255.0f;
738 r_mcol[1] = float(mcol.g) / 255.0f;
739 r_mcol[2] = float(mcol.r) / 255.0f;
740 }
741 }
742}
743
744static void particle_recalc(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr, short flag)
745{
746 if (ptr->type == &RNA_ParticleSystem) {
747 Object *ob = (Object *)ptr->owner_id;
748 ParticleSystem *psys = (ParticleSystem *)ptr->data;
749
750 psys->recalc = flag;
751
753 }
754 else {
756 }
757
759}
760static void rna_Particle_redo(Main *bmain, Scene *scene, PointerRNA *ptr)
761{
762 particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_REDO);
763}
764
765static void rna_Particle_redo_dependency(Main *bmain, Scene *scene, PointerRNA *ptr)
766{
768 rna_Particle_redo(bmain, scene, ptr);
769}
770
771static void rna_Particle_redo_count(Main *bmain, Scene *scene, PointerRNA *ptr)
772{
773 ParticleSettings *part = (ParticleSettings *)ptr->data;
776 particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_REDO);
777}
778
779static void rna_Particle_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
780{
781 particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_RESET);
782}
783
784static void rna_Particle_reset_dependency(Main *bmain, Scene *scene, PointerRNA *ptr)
785{
787 rna_Particle_reset(bmain, scene, ptr);
788}
789
790static void rna_Particle_change_type(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
791{
792 ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
793
794 /* Iterating over all object is slow, but no better solution exists at the moment. */
795 for (Object *ob = static_cast<Object *>(bmain->objects.first); ob;
796 ob = static_cast<Object *>(ob->id.next))
797 {
799 if (psys->part == part) {
800 psys_changed_type(ob, psys);
803 }
804 }
805 }
806
809}
810
811static void rna_Particle_change_physics_type(Main *bmain, Scene *scene, PointerRNA *ptr)
812{
813 particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_RESET | ID_RECALC_PSYS_PHYS);
814
815 ParticleSettings *part = (ParticleSettings *)ptr->data;
816
817 if (part->phystype == PART_PHYS_BOIDS && part->boids == nullptr) {
819
820 part->boids = MEM_callocN<BoidSettings>("Boid Settings");
822
823 state = boid_new_state(part->boids);
826
827 ((BoidRule *)state->rules.first)->flag |= BOIDRULE_CURRENT;
828
829 state->flag |= BOIDSTATE_CURRENT;
830 BLI_addtail(&part->boids->states, state);
831 }
832 else if (part->phystype == PART_PHYS_FLUID && part->fluid == nullptr) {
833 part->fluid = MEM_callocN<SPHFluidSettings>("SPH Fluid Settings");
835 }
836
838}
839
840static void rna_Particle_redo_child(Main *bmain, Scene *scene, PointerRNA *ptr)
841{
842 particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_CHILD);
843}
844
845static void rna_Particle_cloth_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
846{
847 Object *ob = (Object *)ptr->owner_id;
848
851}
852
853static ParticleSystem *rna_particle_system_for_target(Object *ob, ParticleTarget *target)
854{
855 ParticleSystem *psys;
856 ParticleTarget *pt;
857
858 for (psys = static_cast<ParticleSystem *>(ob->particlesystem.first); psys; psys = psys->next) {
859 for (pt = static_cast<ParticleTarget *>(psys->targets.first); pt; pt = pt->next) {
860 if (pt == target) {
861 return psys;
862 }
863 }
864 }
865
866 return nullptr;
867}
868
869static void rna_Particle_target_reset(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
870{
871 if (ptr->type == &RNA_ParticleTarget) {
872 Object *ob = (Object *)ptr->owner_id;
873 ParticleTarget *pt = (ParticleTarget *)ptr->data;
874 ParticleSystem *kpsys = nullptr, *psys = rna_particle_system_for_target(ob, pt);
875
876 if (ELEM(pt->ob, ob, nullptr)) {
877 kpsys = static_cast<ParticleSystem *>(BLI_findlink(&ob->particlesystem, pt->psys - 1));
878
879 if (kpsys) {
880 pt->flag |= PTARGET_VALID;
881 }
882 else {
883 pt->flag &= ~PTARGET_VALID;
884 }
885 }
886 else {
887 if (pt->ob) {
888 kpsys = static_cast<ParticleSystem *>(BLI_findlink(&pt->ob->particlesystem, pt->psys - 1));
889 }
890
891 if (kpsys) {
892 pt->flag |= PTARGET_VALID;
893 }
894 else {
895 pt->flag &= ~PTARGET_VALID;
896 }
897 }
898
900
903 }
904
906}
907
908static void rna_Particle_target_redo(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
909{
910 if (ptr->type == &RNA_ParticleTarget) {
911 Object *ob = (Object *)ptr->owner_id;
912 ParticleTarget *pt = (ParticleTarget *)ptr->data;
913 ParticleSystem *psys = rna_particle_system_for_target(ob, pt);
914
916
919 }
920}
921
922static void rna_Particle_hair_dynamics_update(Main *bmain, Scene *scene, PointerRNA *ptr)
923{
924 Object *ob = (Object *)ptr->owner_id;
925 ParticleSystem *psys = (ParticleSystem *)ptr->data;
926
927 if (psys && !psys->clmd) {
929 psys->clmd->sim_parms->goalspring = 0.0f;
932 rna_Particle_redo(bmain, scene, ptr);
933 }
934 else {
936 }
937
940}
941
942static PointerRNA rna_particle_settings_get(PointerRNA *ptr)
943{
944 ParticleSystem *psys = (ParticleSystem *)ptr->data;
945 ParticleSettings *part = psys->part;
946
947 return RNA_id_pointer_create(reinterpret_cast<ID *>(part));
948}
949
950static void rna_particle_settings_set(PointerRNA *ptr, PointerRNA value, ReportList * /*reports*/)
951{
952 Object *ob = (Object *)ptr->owner_id;
953 ParticleSystem *psys = (ParticleSystem *)ptr->data;
954 int old_type = 0;
955
956 if (psys->part) {
957 old_type = psys->part->type;
958 id_us_min(&psys->part->id);
959 }
960
961 psys->part = (ParticleSettings *)value.data;
962
963 if (psys->part) {
964 id_us_plus(&psys->part->id);
966 if (old_type != psys->part->type) {
967 psys_changed_type(ob, psys);
968 }
969 }
970}
971static void rna_Particle_abspathtime_update(Main *bmain, Scene *scene, PointerRNA *ptr)
972{
973 ParticleSettings *settings = (ParticleSettings *)ptr->data;
974 float delta = settings->end + settings->lifetime - settings->sta;
975 if (settings->draw & PART_ABS_PATH_TIME) {
976 settings->path_start = settings->sta + settings->path_start * delta;
977 settings->path_end = settings->sta + settings->path_end * delta;
978 }
979 else {
980 settings->path_start = (settings->path_start - settings->sta) / delta;
981 settings->path_end = (settings->path_end - settings->sta) / delta;
982 }
983 rna_Particle_redo(bmain, scene, ptr);
984}
985static void rna_PartSettings_start_set(PointerRNA *ptr, float value)
986{
987 ParticleSettings *settings = (ParticleSettings *)ptr->data;
988
989 /* check for clipping */
990 if (value > settings->end) {
991 settings->end = value;
992 }
993
994# if 0
995 if (settings->type == PART_REACTOR && value < 1.0)
996 value = 1.0;
997 else
998# endif
999 if (value < MINAFRAMEF) {
1000 value = MINAFRAMEF;
1001 }
1002
1003 settings->sta = value;
1004}
1005
1006static void rna_PartSettings_end_set(PointerRNA *ptr, float value)
1007{
1008 ParticleSettings *settings = (ParticleSettings *)ptr->data;
1009
1010 /* check for clipping */
1011 if (value < settings->sta) {
1012 settings->sta = value;
1013 }
1014
1015 settings->end = value;
1016}
1017
1018static void rna_PartSetings_timestep_set(PointerRNA *ptr, float value)
1019{
1020 ParticleSettings *settings = (ParticleSettings *)ptr->data;
1021
1022 settings->timetweak = value / 0.04f;
1023}
1024
1025static float rna_PartSettings_timestep_get(PointerRNA *ptr)
1026{
1027 ParticleSettings *settings = (ParticleSettings *)ptr->data;
1028
1029 return settings->timetweak * 0.04f;
1030}
1031
1032static void rna_PartSetting_hairlength_set(PointerRNA *ptr, float value)
1033{
1034 ParticleSettings *settings = (ParticleSettings *)ptr->data;
1035 settings->normfac = value / 4.0f;
1036}
1037
1038static float rna_PartSetting_hairlength_get(PointerRNA *ptr)
1039{
1040 ParticleSettings *settings = (ParticleSettings *)ptr->data;
1041 return settings->normfac * 4.0f;
1042}
1043
1044static void rna_PartSetting_linelentail_set(PointerRNA *ptr, float value)
1045{
1046 ParticleSettings *settings = (ParticleSettings *)ptr->data;
1047 settings->draw_line[0] = value;
1048}
1049
1050static float rna_PartSetting_linelentail_get(PointerRNA *ptr)
1051{
1052 ParticleSettings *settings = (ParticleSettings *)ptr->data;
1053 return settings->draw_line[0];
1054}
1055static void rna_PartSetting_pathstartend_range(
1056 PointerRNA *ptr, float *min, float *max, float * /*softmin*/, float * /*softmax*/)
1057{
1058 ParticleSettings *settings = (ParticleSettings *)ptr->data;
1059
1060 if (settings->type == PART_HAIR) {
1061 *min = 0.0f;
1062 *max = (settings->draw & PART_ABS_PATH_TIME) ? 100.0f : 1.0f;
1063 }
1064 else {
1065 *min = (settings->draw & PART_ABS_PATH_TIME) ? settings->sta : 0.0f;
1066 *max = (settings->draw & PART_ABS_PATH_TIME) ? MAXFRAMEF : 1.0f;
1067 }
1068}
1069static void rna_PartSetting_linelenhead_set(PointerRNA *ptr, float value)
1070{
1071 ParticleSettings *settings = (ParticleSettings *)ptr->data;
1072 settings->draw_line[1] = value;
1073}
1074
1075static float rna_PartSetting_linelenhead_get(PointerRNA *ptr)
1076{
1077 ParticleSettings *settings = (ParticleSettings *)ptr->data;
1078 return settings->draw_line[1];
1079}
1080
1081static bool rna_PartSettings_is_fluid_get(PointerRNA *ptr)
1082{
1083 ParticleSettings *part = static_cast<ParticleSettings *>(ptr->data);
1084 return ELEM(part->type,
1085 PART_FLUID,
1095}
1096
1097static void rna_ParticleSettings_use_clump_curve_update(Main *bmain, Scene *scene, PointerRNA *ptr)
1098{
1099 ParticleSettings *part = static_cast<ParticleSettings *>(ptr->data);
1100
1102 if (!part->clumpcurve) {
1104 }
1105 }
1106
1107 rna_Particle_redo_child(bmain, scene, ptr);
1108}
1109
1110static void rna_ParticleSettings_use_roughness_curve_update(Main *bmain,
1111 Scene *scene,
1112 PointerRNA *ptr)
1113{
1114 ParticleSettings *part = static_cast<ParticleSettings *>(ptr->data);
1115
1117 if (!part->roughcurve) {
1119 }
1120 }
1121
1122 rna_Particle_redo_child(bmain, scene, ptr);
1123}
1124
1125static void rna_ParticleSettings_use_twist_curve_update(Main *bmain, Scene *scene, PointerRNA *ptr)
1126{
1127 ParticleSettings *part = static_cast<ParticleSettings *>(ptr->data);
1128
1130 if (!part->twistcurve) {
1132 }
1133 }
1134
1135 rna_Particle_redo_child(bmain, scene, ptr);
1136}
1137
1138static void rna_ParticleSystem_name_set(PointerRNA *ptr, const char *value)
1139{
1140 Object *ob = (Object *)ptr->owner_id;
1141 ParticleSystem *part = (ParticleSystem *)ptr->data;
1142
1143 /* copy the new name into the name slot */
1144 STRNCPY_UTF8(part->name, value);
1145
1147 part,
1148 DATA_("ParticleSystem"),
1149 '.',
1150 offsetof(ParticleSystem, name),
1151 sizeof(part->name));
1152}
1153
1154static PointerRNA rna_ParticleSystem_active_particle_target_get(PointerRNA *ptr)
1155{
1156 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1157 ParticleTarget *pt = static_cast<ParticleTarget *>(psys->targets.first);
1158
1159 for (; pt; pt = pt->next) {
1160 if (pt->flag & PTARGET_CURRENT) {
1161 return RNA_pointer_create_with_parent(*ptr, &RNA_ParticleTarget, pt);
1162 }
1163 }
1164 return PointerRNA_NULL;
1165}
1166static void rna_ParticleSystem_active_particle_target_index_range(
1167 PointerRNA *ptr, int *min, int *max, int * /*softmin*/, int * /*softmax*/)
1168{
1169 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1170 *min = 0;
1171 *max = max_ii(0, BLI_listbase_count(&psys->targets) - 1);
1172}
1173
1174static int rna_ParticleSystem_active_particle_target_index_get(PointerRNA *ptr)
1175{
1176 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1177 ParticleTarget *pt = static_cast<ParticleTarget *>(psys->targets.first);
1178 int i = 0;
1179
1180 for (; pt; pt = pt->next, i++) {
1181 if (pt->flag & PTARGET_CURRENT) {
1182 return i;
1183 }
1184 }
1185
1186 return 0;
1187}
1188
1189static void rna_ParticleSystem_active_particle_target_index_set(PointerRNA *ptr, int value)
1190{
1191 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1192 ParticleTarget *pt = static_cast<ParticleTarget *>(psys->targets.first);
1193 int i = 0;
1194
1195 for (; pt; pt = pt->next, i++) {
1196 if (i == value) {
1197 pt->flag |= PTARGET_CURRENT;
1198 }
1199 else {
1200 pt->flag &= ~PTARGET_CURRENT;
1201 }
1202 }
1203}
1204
1205static size_t rna_ParticleTarget_name_get_impl(PointerRNA *ptr,
1206 char *value,
1207 const size_t value_maxncpy)
1208{
1209 ParticleTarget *pt = static_cast<ParticleTarget *>(ptr->data);
1210
1211 if (pt->flag & PTARGET_VALID) {
1212 ParticleSystem *psys = nullptr;
1213
1214 if (pt->ob) {
1215 psys = static_cast<ParticleSystem *>(BLI_findlink(&pt->ob->particlesystem, pt->psys - 1));
1216 }
1217 else {
1218 Object *ob = (Object *)ptr->owner_id;
1219 psys = static_cast<ParticleSystem *>(BLI_findlink(&ob->particlesystem, pt->psys - 1));
1220 }
1221
1222 if (psys) {
1223 int value_len;
1224 if (pt->ob) {
1225 value_len = BLI_snprintf_rlen(
1226 value, value_maxncpy, "%s: %s", pt->ob->id.name + 2, psys->name);
1227 }
1228 else {
1229 value_len = BLI_strncpy_rlen(value, psys->name, value_maxncpy);
1230 }
1231 return value_len;
1232 }
1233 }
1234
1235 return BLI_strncpy_rlen(value, RPT_("Invalid target!"), value_maxncpy);
1236}
1237
1238static void rna_ParticleTarget_name_get(PointerRNA *ptr, char *value)
1239{
1240 char value_buf[MAX_ID_NAME + MAX_ID_NAME + 64];
1241 const size_t value_buf_len = rna_ParticleTarget_name_get_impl(ptr, value_buf, sizeof(value_buf));
1242 memcpy(value, value_buf, value_buf_len + 1);
1243}
1244
1245static int rna_ParticleTarget_name_length(PointerRNA *ptr)
1246{
1247 char value_buf[MAX_ID_NAME + MAX_ID_NAME + 64];
1248 return rna_ParticleTarget_name_get_impl(ptr, value_buf, sizeof(value_buf));
1249}
1250
1251static int particle_id_check(const PointerRNA *ptr)
1252{
1253 const ID *id = ptr->owner_id;
1254
1255 return (GS(id->name) == ID_PA);
1256}
1257
1258static std::optional<std::string> rna_SPHFluidSettings_path(const PointerRNA *ptr)
1259{
1260 const SPHFluidSettings *fluid = (SPHFluidSettings *)ptr->data;
1261
1262 if (particle_id_check(ptr)) {
1263 const ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
1264
1265 if (part->fluid == fluid) {
1266 return "fluid";
1267 }
1268 }
1269 return std::nullopt;
1270}
1271
1272static bool rna_ParticleSystem_multiple_caches_get(PointerRNA *ptr)
1273{
1274 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1275
1276 return (psys->ptcaches.first != psys->ptcaches.last);
1277}
1278static bool rna_ParticleSystem_editable_get(PointerRNA *ptr)
1279{
1280 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1281
1282 return psys_check_edited(psys);
1283}
1284static bool rna_ParticleSystem_edited_get(PointerRNA *ptr)
1285{
1286 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1287
1288 if (psys->part && psys->part->type == PART_HAIR) {
1289 return (psys->flag & PSYS_EDITED || (psys->edit && psys->edit->edited));
1290 }
1291 else {
1292 return (psys->pointcache->edit && psys->pointcache->edit->edited);
1293 }
1294}
1295static PointerRNA rna_ParticleDupliWeight_active_get(PointerRNA *ptr)
1296{
1297 ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
1299
1300 for (; dw; dw = dw->next) {
1301 if (dw->flag & PART_DUPLIW_CURRENT) {
1302 return RNA_pointer_create_with_parent(*ptr, &RNA_ParticleDupliWeight, dw);
1303 }
1304 }
1305 return PointerRNA_NULL;
1306}
1307static void rna_ParticleDupliWeight_active_index_range(
1308 PointerRNA *ptr, int *min, int *max, int * /*softmin*/, int * /*softmax*/)
1309{
1310 ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
1311 *min = 0;
1312 *max = max_ii(0, BLI_listbase_count(&part->instance_weights) - 1);
1313}
1314
1315static int rna_ParticleDupliWeight_active_index_get(PointerRNA *ptr)
1316{
1317 ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
1319 int i = 0;
1320
1321 for (; dw; dw = dw->next, i++) {
1322 if (dw->flag & PART_DUPLIW_CURRENT) {
1323 return i;
1324 }
1325 }
1326
1327 return 0;
1328}
1329
1330static void rna_ParticleDupliWeight_active_index_set(PointerRNA *ptr, int value)
1331{
1332 ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
1334 int i = 0;
1335
1336 for (; dw; dw = dw->next, i++) {
1337 if (i == value) {
1339 }
1340 else {
1342 }
1343 }
1344}
1345
1346static size_t rna_ParticleDupliWeight_name_get_impl(PointerRNA *ptr,
1347 char *value,
1348 const size_t value_maxncpy)
1349{
1350 ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
1352
1353 ParticleDupliWeight *dw = static_cast<ParticleDupliWeight *>(ptr->data);
1354
1355 if (dw->ob) {
1356 return BLI_snprintf_rlen(value, value_maxncpy, "%s: %i", dw->ob->id.name + 2, dw->count);
1357 }
1358
1359 return BLI_strncpy_rlen(value, "No object", value_maxncpy);
1360}
1361
1362static void rna_ParticleDupliWeight_name_get(PointerRNA *ptr, char *value)
1363{
1364 char value_buf[MAX_ID_NAME + 64];
1365 const size_t value_buf_len = rna_ParticleDupliWeight_name_get_impl(
1366 ptr, value_buf, sizeof(value_buf));
1367 memcpy(value, value_buf, value_buf_len + 1);
1368}
1369
1370static int rna_ParticleDupliWeight_name_length(PointerRNA *ptr)
1371{
1372 char value_buf[MAX_ID_NAME + 64];
1373 return rna_ParticleDupliWeight_name_get_impl(ptr, value_buf, sizeof(value_buf));
1374}
1375
1376static const EnumPropertyItem *rna_Particle_type_itemf(bContext * /*C*/,
1377 PointerRNA *ptr,
1378 PropertyRNA * /*prop*/,
1379 bool * /*r_free*/)
1380{
1381 ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
1382
1383 if (ELEM(part->type, PART_HAIR, PART_EMITTER)) {
1384 return part_type_items;
1385 }
1386 else {
1387 return part_fluid_type_items;
1388 }
1389}
1390
1391static const EnumPropertyItem *rna_Particle_from_itemf(bContext * /*C*/,
1392 PointerRNA * /*ptr*/,
1393 PropertyRNA * /*prop*/,
1394 bool * /*r_free*/)
1395{
1396# if 0
1397 if (part->type == PART_REACTOR) {
1399 }
1400# endif
1401 return part_from_items;
1402}
1403
1404static const EnumPropertyItem *rna_Particle_dist_itemf(bContext * /*C*/,
1405 PointerRNA *ptr,
1406 PropertyRNA * /*prop*/,
1407 bool * /*r_free*/)
1408{
1409 ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
1410
1411 if (part->type == PART_HAIR) {
1412 return part_hair_dist_items;
1413 }
1414 else {
1415 return part_dist_items;
1416 }
1417}
1418
1419static const EnumPropertyItem *rna_Particle_draw_as_itemf(bContext * /*C*/,
1420 PointerRNA *ptr,
1421 PropertyRNA * /*prop*/,
1422 bool * /*r_free*/)
1423{
1424 ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
1425
1426 if (part->type == PART_HAIR) {
1427 return part_hair_draw_as_items;
1428 }
1429 else {
1430 return part_draw_as_items;
1431 }
1432}
1433
1434static const EnumPropertyItem *rna_Particle_ren_as_itemf(bContext * /*C*/,
1435 PointerRNA *ptr,
1436 PropertyRNA * /*prop*/,
1437 bool * /*r_free*/)
1438{
1439 ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
1440
1441 if (part->type == PART_HAIR) {
1442 return part_hair_ren_as_items;
1443 }
1444 else {
1445 return part_ren_as_items;
1446 }
1447}
1448
1449static PointerRNA rna_Particle_field1_get(PointerRNA *ptr)
1450{
1451 ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
1452 return RNA_pointer_create_with_parent(*ptr, &RNA_FieldSettings, part->pd);
1453}
1454
1455static PointerRNA rna_Particle_field2_get(PointerRNA *ptr)
1456{
1457 ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
1458 return RNA_pointer_create_with_parent(*ptr, &RNA_FieldSettings, part->pd2);
1459}
1460
1461static void psys_vg_name_get__internal(PointerRNA *ptr, char *value, int index)
1462{
1463 Object *ob = (Object *)ptr->owner_id;
1464 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1465 const ListBase *defbase = BKE_object_defgroup_list(ob);
1466
1467 if (psys->vgroup[index] > 0) {
1468 bDeformGroup *defGroup = static_cast<bDeformGroup *>(
1469 BLI_findlink(defbase, psys->vgroup[index] - 1));
1470
1471 if (defGroup) {
1472 strcpy(value, defGroup->name);
1473 return;
1474 }
1475 }
1476
1477 value[0] = '\0';
1478}
1479static int psys_vg_name_len__internal(PointerRNA *ptr, int index)
1480{
1481 Object *ob = (Object *)ptr->owner_id;
1482 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1483
1484 if (psys->vgroup[index] > 0) {
1485 const ListBase *defbase = BKE_object_defgroup_list(ob);
1486 bDeformGroup *defGroup = static_cast<bDeformGroup *>(
1487 BLI_findlink(defbase, psys->vgroup[index] - 1));
1488
1489 if (defGroup) {
1490 return strlen(defGroup->name);
1491 }
1492 }
1493 return 0;
1494}
1495static void psys_vg_name_set__internal(PointerRNA *ptr, const char *value, int index)
1496{
1497 Object *ob = (Object *)ptr->owner_id;
1498 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1499
1500 if (value[0] == '\0') {
1501 psys->vgroup[index] = 0;
1502 }
1503 else {
1504 int defgrp_index = BKE_object_defgroup_name_index(ob, value);
1505
1506 if (defgrp_index == -1) {
1507 return;
1508 }
1509
1510 psys->vgroup[index] = defgrp_index + 1;
1511 }
1512}
1513
1514static std::optional<std::string> rna_ParticleSystem_path(const PointerRNA *ptr)
1515{
1516 const ParticleSystem *psys = (ParticleSystem *)ptr->data;
1517 char name_esc[sizeof(psys->name) * 2];
1518
1519 BLI_str_escape(name_esc, psys->name, sizeof(name_esc));
1520 return fmt::format("particle_systems[\"{}\"]", name_esc);
1521}
1522
1523static void rna_ParticleSettings_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
1524{
1525 ParticleSettings *part = (ParticleSettings *)ptr->data;
1526 rna_iterator_array_begin(iter, ptr, (void *)part->mtex, sizeof(MTex *), MAX_MTEX, 0, nullptr);
1527}
1528
1529static PointerRNA rna_ParticleSettings_active_texture_get(PointerRNA *ptr)
1530{
1531 ParticleSettings *part = (ParticleSettings *)ptr->data;
1532 Tex *tex;
1533
1535 return RNA_id_pointer_create(reinterpret_cast<ID *>(tex));
1536}
1537
1538static void rna_ParticleSettings_active_texture_set(PointerRNA *ptr,
1539 PointerRNA value,
1540 ReportList * /*reports*/)
1541{
1542 ParticleSettings *part = (ParticleSettings *)ptr->data;
1543
1544 set_current_particle_texture(part, static_cast<Tex *>(value.data));
1545}
1546
1547/* irritating string functions for each index :/ */
1548static void rna_ParticleVGroup_name_get_0(PointerRNA *ptr, char *value)
1549{
1550 psys_vg_name_get__internal(ptr, value, 0);
1551}
1552static void rna_ParticleVGroup_name_get_1(PointerRNA *ptr, char *value)
1553{
1554 psys_vg_name_get__internal(ptr, value, 1);
1555}
1556static void rna_ParticleVGroup_name_get_2(PointerRNA *ptr, char *value)
1557{
1558 psys_vg_name_get__internal(ptr, value, 2);
1559}
1560static void rna_ParticleVGroup_name_get_3(PointerRNA *ptr, char *value)
1561{
1562 psys_vg_name_get__internal(ptr, value, 3);
1563}
1564static void rna_ParticleVGroup_name_get_4(PointerRNA *ptr, char *value)
1565{
1566 psys_vg_name_get__internal(ptr, value, 4);
1567}
1568static void rna_ParticleVGroup_name_get_5(PointerRNA *ptr, char *value)
1569{
1570 psys_vg_name_get__internal(ptr, value, 5);
1571}
1572static void rna_ParticleVGroup_name_get_6(PointerRNA *ptr, char *value)
1573{
1574 psys_vg_name_get__internal(ptr, value, 6);
1575}
1576static void rna_ParticleVGroup_name_get_7(PointerRNA *ptr, char *value)
1577{
1578 psys_vg_name_get__internal(ptr, value, 7);
1579}
1580static void rna_ParticleVGroup_name_get_8(PointerRNA *ptr, char *value)
1581{
1582 psys_vg_name_get__internal(ptr, value, 8);
1583}
1584static void rna_ParticleVGroup_name_get_9(PointerRNA *ptr, char *value)
1585{
1586 psys_vg_name_get__internal(ptr, value, 9);
1587}
1588static void rna_ParticleVGroup_name_get_10(PointerRNA *ptr, char *value)
1589{
1590 psys_vg_name_get__internal(ptr, value, 10);
1591}
1592static void rna_ParticleVGroup_name_get_11(PointerRNA *ptr, char *value)
1593{
1594 psys_vg_name_get__internal(ptr, value, 11);
1595}
1596static void rna_ParticleVGroup_name_get_12(PointerRNA *ptr, char *value)
1597{
1598 psys_vg_name_get__internal(ptr, value, 12);
1599}
1600
1601static int rna_ParticleVGroup_name_len_0(PointerRNA *ptr)
1602{
1603 return psys_vg_name_len__internal(ptr, 0);
1604}
1605static int rna_ParticleVGroup_name_len_1(PointerRNA *ptr)
1606{
1607 return psys_vg_name_len__internal(ptr, 1);
1608}
1609static int rna_ParticleVGroup_name_len_2(PointerRNA *ptr)
1610{
1611 return psys_vg_name_len__internal(ptr, 2);
1612}
1613static int rna_ParticleVGroup_name_len_3(PointerRNA *ptr)
1614{
1615 return psys_vg_name_len__internal(ptr, 3);
1616}
1617static int rna_ParticleVGroup_name_len_4(PointerRNA *ptr)
1618{
1619 return psys_vg_name_len__internal(ptr, 4);
1620}
1621static int rna_ParticleVGroup_name_len_5(PointerRNA *ptr)
1622{
1623 return psys_vg_name_len__internal(ptr, 5);
1624}
1625static int rna_ParticleVGroup_name_len_6(PointerRNA *ptr)
1626{
1627 return psys_vg_name_len__internal(ptr, 6);
1628}
1629static int rna_ParticleVGroup_name_len_7(PointerRNA *ptr)
1630{
1631 return psys_vg_name_len__internal(ptr, 7);
1632}
1633static int rna_ParticleVGroup_name_len_8(PointerRNA *ptr)
1634{
1635 return psys_vg_name_len__internal(ptr, 8);
1636}
1637static int rna_ParticleVGroup_name_len_9(PointerRNA *ptr)
1638{
1639 return psys_vg_name_len__internal(ptr, 9);
1640}
1641static int rna_ParticleVGroup_name_len_10(PointerRNA *ptr)
1642{
1643 return psys_vg_name_len__internal(ptr, 10);
1644}
1645static int rna_ParticleVGroup_name_len_11(PointerRNA *ptr)
1646{
1647 return psys_vg_name_len__internal(ptr, 11);
1648}
1649static int rna_ParticleVGroup_name_len_12(PointerRNA *ptr)
1650{
1651 return psys_vg_name_len__internal(ptr, 12);
1652}
1653
1654static void rna_ParticleVGroup_name_set_0(PointerRNA *ptr, const char *value)
1655{
1656 psys_vg_name_set__internal(ptr, value, 0);
1657}
1658static void rna_ParticleVGroup_name_set_1(PointerRNA *ptr, const char *value)
1659{
1660 psys_vg_name_set__internal(ptr, value, 1);
1661}
1662static void rna_ParticleVGroup_name_set_2(PointerRNA *ptr, const char *value)
1663{
1664 psys_vg_name_set__internal(ptr, value, 2);
1665}
1666static void rna_ParticleVGroup_name_set_3(PointerRNA *ptr, const char *value)
1667{
1668 psys_vg_name_set__internal(ptr, value, 3);
1669}
1670static void rna_ParticleVGroup_name_set_4(PointerRNA *ptr, const char *value)
1671{
1672 psys_vg_name_set__internal(ptr, value, 4);
1673}
1674static void rna_ParticleVGroup_name_set_5(PointerRNA *ptr, const char *value)
1675{
1676 psys_vg_name_set__internal(ptr, value, 5);
1677}
1678static void rna_ParticleVGroup_name_set_6(PointerRNA *ptr, const char *value)
1679{
1680 psys_vg_name_set__internal(ptr, value, 6);
1681}
1682static void rna_ParticleVGroup_name_set_7(PointerRNA *ptr, const char *value)
1683{
1684 psys_vg_name_set__internal(ptr, value, 7);
1685}
1686static void rna_ParticleVGroup_name_set_8(PointerRNA *ptr, const char *value)
1687{
1688 psys_vg_name_set__internal(ptr, value, 8);
1689}
1690static void rna_ParticleVGroup_name_set_9(PointerRNA *ptr, const char *value)
1691{
1692 psys_vg_name_set__internal(ptr, value, 9);
1693}
1694static void rna_ParticleVGroup_name_set_10(PointerRNA *ptr, const char *value)
1695{
1696 psys_vg_name_set__internal(ptr, value, 10);
1697}
1698static void rna_ParticleVGroup_name_set_11(PointerRNA *ptr, const char *value)
1699{
1700 psys_vg_name_set__internal(ptr, value, 11);
1701}
1702static void rna_ParticleVGroup_name_set_12(PointerRNA *ptr, const char *value)
1703{
1704 psys_vg_name_set__internal(ptr, value, 12);
1705}
1706
1707#else
1708
1710{
1711 StructRNA *srna;
1712 PropertyRNA *prop;
1713
1714 FunctionRNA *func;
1715 PropertyRNA *parm;
1716
1717 srna = RNA_def_struct(brna, "ParticleHairKey", nullptr);
1718 RNA_def_struct_sdna(srna, "HairKey");
1719 RNA_def_struct_ui_text(srna, "Particle Hair Key", "Particle key for hair particle system");
1720
1721 prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
1722 RNA_def_property_ui_text(prop, "Time", "Relative time of key over hair length");
1723
1724 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_UNSIGNED);
1725 RNA_def_property_range(prop, 0.0, 1.0);
1726 RNA_def_property_ui_text(prop, "Weight", "Weight for cloth simulation");
1727
1728 prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
1729 RNA_def_property_array(prop, 3);
1731 prop, "Location (Object Space)", "Location of the hair key in object space");
1733 "rna_ParticleHairKey_location_object_get",
1734 "rna_ParticleHairKey_location_object_set",
1735 nullptr);
1736
1737 prop = RNA_def_property(srna, "co_local", PROP_FLOAT, PROP_TRANSLATION);
1738 RNA_def_property_float_sdna(prop, nullptr, "co");
1740 "Location",
1741 "Location of the hair key in its local coordinate system, "
1742 "relative to the emitting face");
1743
1744 /* Aided co func */
1745 func = RNA_def_function(srna, "co_object", "rna_ParticleHairKey_co_object");
1746 RNA_def_function_ui_description(func, "Obtain hairkey location with particle and modifier data");
1747 parm = RNA_def_pointer(func, "object", "Object", "", "Object");
1749 parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
1751 parm = RNA_def_pointer(func, "particle", "Particle", "", "hair particle");
1753 parm = RNA_def_float_vector(
1754 func, "co", 3, nullptr, -FLT_MAX, FLT_MAX, "Co", "Exported hairkey location", -1e4, 1e4);
1756 RNA_def_function_output(func, parm);
1757
1758 func = RNA_def_function(srna, "co_object_set", "rna_ParticleHairKey_co_object_set");
1760 RNA_def_function_ui_description(func, "Set hairkey location with particle and modifier data");
1761 parm = RNA_def_pointer(func, "object", "Object", "", "Object");
1763 parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
1765 parm = RNA_def_pointer(func, "particle", "Particle", "", "hair particle");
1767 parm = RNA_def_float_vector(
1768 func, "co", 3, nullptr, -FLT_MAX, FLT_MAX, "Co", "Specified hairkey location", -1e4, 1e4);
1770}
1771
1773{
1774 StructRNA *srna;
1775 PropertyRNA *prop;
1776
1777 srna = RNA_def_struct(brna, "ParticleKey", nullptr);
1778 RNA_def_struct_ui_text(srna, "Particle Key", "Key location for a particle over time");
1779
1780 prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
1781 RNA_def_property_float_sdna(prop, nullptr, "co");
1782 RNA_def_property_ui_text(prop, "Location", "Key location");
1783
1784 prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
1785 RNA_def_property_float_sdna(prop, nullptr, "vel");
1786 RNA_def_property_ui_text(prop, "Velocity", "Key velocity");
1787
1788 prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
1789 RNA_def_property_float_sdna(prop, nullptr, "rot");
1790 RNA_def_property_ui_text(prop, "Rotation", "Key rotation quaternion");
1791
1792 prop = RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
1793 RNA_def_property_float_sdna(prop, nullptr, "ave");
1794 RNA_def_property_ui_text(prop, "Angular Velocity", "Key angular velocity");
1795
1796 prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
1797 RNA_def_property_ui_text(prop, "Time", "Time of key over the simulation");
1798}
1799
1801{
1802 StructRNA *srna;
1803 // PropertyRNA *prop;
1804
1805 srna = RNA_def_struct(brna, "ChildParticle", nullptr);
1807 srna, "Child Particle", "Child particle interpolated from simulated or edited particles");
1808
1809 // int num, parent; /* num is face index on the final derived mesh */
1810 //
1811 // int pa[4]; /* nearest particles to the child, used for the interpolation */
1812 // float w[4]; /* interpolation weights for the above particles */
1813 // float fuv[4], foffset; /* face vertex weights and offset */
1814 // float rand[3];
1815}
1816
1818{
1819 StructRNA *srna;
1820 PropertyRNA *prop;
1821
1822 FunctionRNA *func;
1823 PropertyRNA *parm;
1824
1825 static const EnumPropertyItem alive_items[] = {
1826 /*{PARS_KILLED, "KILLED", 0, "Killed", ""}, */
1827 {PARS_DEAD, "DEAD", 0, "Dead", ""},
1828 {PARS_UNBORN, "UNBORN", 0, "Unborn", ""},
1829 {PARS_ALIVE, "ALIVE", 0, "Alive", ""},
1830 {PARS_DYING, "DYING", 0, "Dying", ""},
1831 {0, nullptr, 0, nullptr, nullptr},
1832 };
1833
1834 srna = RNA_def_struct(brna, "Particle", nullptr);
1835 RNA_def_struct_sdna(srna, "ParticleData");
1836 RNA_def_struct_ui_text(srna, "Particle", "Particle in a particle system");
1837
1838 /* Particle State & Previous State */
1839 prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
1840 RNA_def_property_float_sdna(prop, nullptr, "state.co");
1841 RNA_def_property_ui_text(prop, "Particle Location", "");
1842
1843 prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
1844 RNA_def_property_float_sdna(prop, nullptr, "state.vel");
1845 RNA_def_property_ui_text(prop, "Particle Velocity", "");
1846
1847 prop = RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
1848 RNA_def_property_float_sdna(prop, nullptr, "state.ave");
1849 RNA_def_property_ui_text(prop, "Angular Velocity", "");
1850
1851 prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
1852 RNA_def_property_float_sdna(prop, nullptr, "state.rot");
1853 RNA_def_property_ui_text(prop, "Rotation", "");
1854
1855 prop = RNA_def_property(srna, "prev_location", PROP_FLOAT, PROP_TRANSLATION);
1856 RNA_def_property_float_sdna(prop, nullptr, "prev_state.co");
1857 RNA_def_property_ui_text(prop, "Previous Particle Location", "");
1858
1859 prop = RNA_def_property(srna, "prev_velocity", PROP_FLOAT, PROP_VELOCITY);
1860 RNA_def_property_float_sdna(prop, nullptr, "prev_state.vel");
1861 RNA_def_property_ui_text(prop, "Previous Particle Velocity", "");
1862
1863 prop = RNA_def_property(srna, "prev_angular_velocity", PROP_FLOAT, PROP_VELOCITY);
1864 RNA_def_property_float_sdna(prop, nullptr, "prev_state.ave");
1865 RNA_def_property_ui_text(prop, "Previous Angular Velocity", "");
1866
1867 prop = RNA_def_property(srna, "prev_rotation", PROP_FLOAT, PROP_QUATERNION);
1868 RNA_def_property_float_sdna(prop, nullptr, "prev_state.rot");
1869 RNA_def_property_ui_text(prop, "Previous Rotation", "");
1870
1871 /* Hair & Keyed Keys */
1872
1873 prop = RNA_def_property(srna, "hair_keys", PROP_COLLECTION, PROP_NONE);
1874 RNA_def_property_collection_sdna(prop, nullptr, "hair", "totkey");
1875 RNA_def_property_struct_type(prop, "ParticleHairKey");
1876 RNA_def_property_ui_text(prop, "Hair", "");
1877
1878 prop = RNA_def_property(srna, "particle_keys", PROP_COLLECTION, PROP_NONE);
1879 RNA_def_property_collection_sdna(prop, nullptr, "keys", "totkey");
1880 RNA_def_property_struct_type(prop, "ParticleKey");
1881 RNA_def_property_ui_text(prop, "Keyed States", "");
1882
1883 // float fuv[4], foffset; /* Coordinates on face/edge number "num" and depth along. */
1884 // /* Face normal for volume emission. */
1885
1886 prop = RNA_def_property(srna, "birth_time", PROP_FLOAT, PROP_TIME);
1887 RNA_def_property_float_sdna(prop, nullptr, "time");
1888 // RNA_def_property_range(prop, lowerLimitf, upperLimitf);
1889 RNA_def_property_ui_text(prop, "Birth Time", "");
1890
1891 prop = RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
1892 // RNA_def_property_range(prop, lowerLimitf, upperLimitf);
1893 RNA_def_property_ui_text(prop, "Lifetime", "");
1894
1895 prop = RNA_def_property(srna, "die_time", PROP_FLOAT, PROP_TIME);
1896 RNA_def_property_float_sdna(prop, nullptr, "dietime");
1897 // RNA_def_property_range(prop, lowerLimitf, upperLimitf);
1898 RNA_def_property_ui_text(prop, "Die Time", "");
1899
1900 prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
1901 // RNA_def_property_range(prop, lowerLimitf, upperLimitf);
1902 RNA_def_property_ui_text(prop, "Size", "");
1903
1904 // int num; /* index to vert/edge/face */
1905 // int num_dmcache; /* index to derived mesh data (face) to avoid slow lookups */
1906 // int pad;
1907 // int totkey;
1908
1909 /* flag */
1910 prop = RNA_def_property(srna, "is_exist", PROP_BOOLEAN, PROP_NONE);
1913 RNA_def_property_ui_text(prop, "Exists", "");
1914
1915 prop = RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE);
1918 RNA_def_property_ui_text(prop, "Visible", "");
1919
1920 prop = RNA_def_property(srna, "alive_state", PROP_ENUM, PROP_NONE);
1921 RNA_def_property_enum_sdna(prop, nullptr, "alive");
1922 RNA_def_property_enum_items(prop, alive_items);
1923 RNA_def_property_ui_text(prop, "Alive State", "");
1924
1925 // short rt2;
1926
1927 /* UVs */
1928 func = RNA_def_function(srna, "uv_on_emitter", "rna_Particle_uv_on_emitter");
1930 "Obtain UV coordinates for a particle on an evaluated mesh.");
1932 parm = RNA_def_pointer(func,
1933 "modifier",
1934 "ParticleSystemModifier",
1935 "",
1936 "Particle modifier from an evaluated object");
1938 parm = RNA_def_property(func, "uv", PROP_FLOAT, PROP_COORDS);
1939 RNA_def_property_array(parm, 2);
1941 RNA_def_function_output(func, parm);
1942}
1943
1945{
1946 StructRNA *srna;
1947 PropertyRNA *prop;
1948
1949 srna = RNA_def_struct(brna, "ParticleDupliWeight", nullptr);
1951 "Particle Instance Object Weight",
1952 "Weight of a particle instance object in a collection");
1953 RNA_def_struct_sdna(srna, "ParticleDupliWeight");
1954
1955 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1957 prop, "rna_ParticleDupliWeight_name_get", "rna_ParticleDupliWeight_name_length", nullptr);
1958 RNA_def_property_ui_text(prop, "Name", "Particle instance object name");
1960 RNA_def_struct_name_property(srna, prop);
1961
1962 prop = RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
1963 RNA_def_property_range(prop, 0, SHRT_MAX);
1965 prop, "Count", "The number of times this object is repeated with respect to other objects");
1966 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1967}
1968
1970{
1971 StructRNA *srna;
1972 PropertyRNA *prop;
1973
1974 static const EnumPropertyItem sph_solver_items[] = {
1976 "DDR",
1977 0,
1978 "Double-Density",
1979 "An artistic solver with strong surface tension effects (original)"},
1980 {SPH_SOLVER_CLASSICAL, "CLASSICAL", 0, "Classical", "A more physically-accurate solver"},
1981 {0, nullptr, 0, nullptr, nullptr},
1982 };
1983
1984 srna = RNA_def_struct(brna, "SPHFluidSettings", nullptr);
1985 RNA_def_struct_path_func(srna, "rna_SPHFluidSettings_path");
1986 RNA_def_struct_ui_text(srna, "SPH Fluid Settings", "Settings for particle fluids physics");
1987
1988 /* Fluid settings */
1989 prop = RNA_def_property(srna, "solver", PROP_ENUM, PROP_NONE);
1990 RNA_def_property_enum_sdna(prop, nullptr, "solver");
1992 RNA_def_property_enum_items(prop, sph_solver_items);
1994 prop, "SPH Solver", "The code used to calculate internal forces on particles");
1995 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1996
1997 prop = RNA_def_property(srna, "spring_force", PROP_FLOAT, PROP_NONE);
1998 RNA_def_property_float_sdna(prop, nullptr, "spring_k");
1999 RNA_def_property_range(prop, 0.0f, 100.0f);
2000 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
2001 RNA_def_property_ui_text(prop, "Spring Force", "Spring force");
2002 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2003
2004 prop = RNA_def_property(srna, "fluid_radius", PROP_FLOAT, PROP_NONE);
2005 RNA_def_property_float_sdna(prop, nullptr, "radius");
2006 RNA_def_property_range(prop, 0.0f, 20.0f);
2007 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
2008 RNA_def_property_ui_text(prop, "Interaction Radius", "Fluid interaction radius");
2009 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2010
2011 prop = RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_NONE);
2012 RNA_def_property_range(prop, 0.0f, 2.0f);
2013 RNA_def_property_ui_text(prop, "Rest Length", "Spring rest length (factor of particle radius)");
2014 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2015
2016 prop = RNA_def_property(srna, "use_viscoelastic_springs", PROP_BOOLEAN, PROP_NONE);
2019 prop, "Viscoelastic Springs", "Use viscoelastic springs instead of Hooke's springs");
2020 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2021
2022 prop = RNA_def_property(srna, "use_initial_rest_length", PROP_BOOLEAN, PROP_NONE);
2025 prop,
2026 "Initial Rest Length",
2027 "Use the initial length as spring rest length instead of 2 * particle size");
2028 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2029
2030 prop = RNA_def_property(srna, "plasticity", PROP_FLOAT, PROP_NONE);
2031 RNA_def_property_float_sdna(prop, nullptr, "plasticity_constant");
2032 RNA_def_property_range(prop, 0.0f, 100.0f);
2034 prop,
2035 "Plasticity",
2036 "How much the spring rest length can change after the elastic limit is crossed");
2037 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2038
2039 prop = RNA_def_property(srna, "yield_ratio", PROP_FLOAT, PROP_FACTOR);
2040 RNA_def_property_float_sdna(prop, nullptr, "yield_ratio");
2041 RNA_def_property_range(prop, 0.0f, 1.0f);
2043 prop,
2044 "Elastic Limit",
2045 "How much the spring has to be stretched/compressed in order to change its rest length");
2046 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2047
2048 prop = RNA_def_property(srna, "spring_frames", PROP_INT, PROP_NONE);
2049 RNA_def_property_range(prop, 0.0f, 100.0f);
2051 prop,
2052 "Spring Frames",
2053 "Create springs for this number of frames since particles birth (0 is always)");
2054 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2055
2056 /* Viscosity */
2057 prop = RNA_def_property(srna, "linear_viscosity", PROP_FLOAT, PROP_NONE);
2058 RNA_def_property_float_sdna(prop, nullptr, "viscosity_omega");
2059 RNA_def_property_range(prop, 0.0f, 100.0f);
2060 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
2061 RNA_def_property_ui_text(prop, "Viscosity", "Linear viscosity");
2062 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2063
2064 prop = RNA_def_property(srna, "stiff_viscosity", PROP_FLOAT, PROP_NONE);
2065 RNA_def_property_float_sdna(prop, nullptr, "viscosity_beta");
2066 RNA_def_property_range(prop, 0.0f, 100.0f);
2067 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
2068 RNA_def_property_ui_text(prop, "Stiff Viscosity", "Creates viscosity for expanding fluid");
2069 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2070
2071 /* Double density relaxation */
2072 prop = RNA_def_property(srna, "stiffness", PROP_FLOAT, PROP_NONE);
2073 RNA_def_property_float_sdna(prop, nullptr, "stiffness_k");
2074 RNA_def_property_range(prop, 0.0f, 1000.0f);
2075 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
2076 RNA_def_property_ui_text(prop, "Stiffness", "How incompressible the fluid is (speed of sound)");
2077 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2078
2079 prop = RNA_def_property(srna, "repulsion", PROP_FLOAT, PROP_NONE);
2080 RNA_def_property_float_sdna(prop, nullptr, "stiffness_knear");
2081 RNA_def_property_range(prop, 0.0f, 100.0f);
2082 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
2084 prop,
2085 "Repulsion Factor",
2086 "How strongly the fluid tries to keep from clustering (factor of stiffness)");
2087 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2088
2089 prop = RNA_def_property(srna, "rest_density", PROP_FLOAT, PROP_NONE);
2090 RNA_def_property_float_sdna(prop, nullptr, "rest_density");
2091 RNA_def_property_range(prop, 0.0f, 10000.0f);
2092 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
2093 RNA_def_property_ui_text(prop, "Rest Density", "Fluid rest density");
2094 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2095
2096 /* Buoyancy */
2097 prop = RNA_def_property(srna, "buoyancy", PROP_FLOAT, PROP_NONE);
2098 RNA_def_property_float_sdna(prop, nullptr, "buoyancy");
2099 RNA_def_property_range(prop, 0.0f, 10.0f);
2100 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3);
2102 prop,
2103 "Buoyancy",
2104 "Artificial buoyancy force in negative gravity direction based on pressure "
2105 "differences inside the fluid");
2106 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2107
2108 /* Factor flags */
2109
2110 prop = RNA_def_property(srna, "use_factor_repulsion", PROP_BOOLEAN, PROP_NONE);
2111 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SPH_FAC_REPULSION);
2112 RNA_def_property_ui_text(prop, "Factor Repulsion", "Repulsion is a factor of stiffness");
2113 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2114
2115 prop = RNA_def_property(srna, "use_factor_density", PROP_BOOLEAN, PROP_NONE);
2116 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SPH_FAC_DENSITY);
2118 prop,
2119 "Factor Density",
2120 "Density is calculated as a factor of default density (depends on particle size)");
2121 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2122
2123 prop = RNA_def_property(srna, "use_factor_radius", PROP_BOOLEAN, PROP_NONE);
2124 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SPH_FAC_RADIUS);
2126 prop, "Factor Radius", "Interaction radius is a factor of 4 * particle size");
2127 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2128
2129 prop = RNA_def_property(srna, "use_factor_stiff_viscosity", PROP_BOOLEAN, PROP_NONE);
2130 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SPH_FAC_VISCOSITY);
2132 prop, "Factor Stiff Viscosity", "Stiff viscosity is a factor of normal viscosity");
2133 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2134
2135 prop = RNA_def_property(srna, "use_factor_rest_length", PROP_BOOLEAN, PROP_NONE);
2136 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SPH_FAC_REST_LENGTH);
2138 prop, "Factor Rest Length", "Spring rest length is a factor of 2 * particle size");
2139 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2140}
2141
2143{
2144 StructRNA *srna;
2145 PropertyRNA *prop;
2146
2147 static const EnumPropertyItem texco_items[] = {
2148 {TEXCO_GLOB, "GLOBAL", 0, "Global", "Use global coordinates for the texture coordinates"},
2149 {TEXCO_OBJECT,
2150 "OBJECT",
2151 0,
2152 "Object",
2153 "Use linked object's coordinates for texture coordinates"},
2154 {TEXCO_UV, "UV", 0, "UV", "Use UV coordinates for texture coordinates"},
2155 {TEXCO_ORCO,
2156 "ORCO",
2157 0,
2158 "Generated",
2159 "Use the original undeformed coordinates of the object"},
2160 {TEXCO_STRAND,
2161 "STRAND",
2162 0,
2163 "Strand / Particle",
2164 "Use normalized strand texture coordinate (1D) or particle age (X) and trail position (Y)"},
2165 {0, nullptr, 0, nullptr, nullptr},
2166 };
2167
2168 static const EnumPropertyItem prop_mapping_items[] = {
2169 {MTEX_FLAT, "FLAT", 0, "Flat", "Map X and Y coordinates directly"},
2170 {MTEX_CUBE, "CUBE", 0, "Cube", "Map using the normal vector"},
2171 {MTEX_TUBE, "TUBE", 0, "Tube", "Map with Z as central axis"},
2172 {MTEX_SPHERE, "SPHERE", 0, "Sphere", "Map with Z as central axis"},
2173 {0, nullptr, 0, nullptr, nullptr},
2174 };
2175
2176 static const EnumPropertyItem prop_x_mapping_items[] = {
2177 {0, "NONE", 0, "None", ""},
2178 {1, "X", 0, "X", ""},
2179 {2, "Y", 0, "Y", ""},
2180 {3, "Z", 0, "Z", ""},
2181 {0, nullptr, 0, nullptr, nullptr},
2182 };
2183
2184 static const EnumPropertyItem prop_y_mapping_items[] = {
2185 {0, "NONE", 0, "None", ""},
2186 {1, "X", 0, "X", ""},
2187 {2, "Y", 0, "Y", ""},
2188 {3, "Z", 0, "Z", ""},
2189 {0, nullptr, 0, nullptr, nullptr},
2190 };
2191
2192 static const EnumPropertyItem prop_z_mapping_items[] = {
2193 {0, "NONE", 0, "None", ""},
2194 {1, "X", 0, "X", ""},
2195 {2, "Y", 0, "Y", ""},
2196 {3, "Z", 0, "Z", ""},
2197 {0, nullptr, 0, nullptr, nullptr},
2198 };
2199
2200 srna = RNA_def_struct(brna, "ParticleSettingsTextureSlot", "TextureSlot");
2201 RNA_def_struct_sdna(srna, "MTex");
2203 "Particle Settings Texture Slot",
2204 "Texture slot for textures in a Particle Settings data-block");
2205
2206 prop = RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
2207 RNA_def_property_enum_sdna(prop, nullptr, "texco");
2208 RNA_def_property_enum_items(prop, texco_items);
2211 "Texture Coordinates",
2212 "Texture coordinates used to map the texture onto the background");
2213 RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
2214
2215 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
2216 RNA_def_property_pointer_sdna(prop, nullptr, "object");
2217 RNA_def_property_struct_type(prop, "Object");
2221 prop, "Object", "Object to use for mapping with Object texture coordinates");
2222 RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
2223
2224 prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
2225 RNA_def_property_string_sdna(prop, nullptr, "uvname");
2227 prop, "UV Map", "UV map to use for mapping with UV texture coordinates");
2228 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2229
2230 prop = RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE);
2231 RNA_def_property_enum_sdna(prop, nullptr, "projx");
2232 RNA_def_property_enum_items(prop, prop_x_mapping_items);
2233 RNA_def_property_ui_text(prop, "X Mapping", "");
2234 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2235
2236 prop = RNA_def_property(srna, "mapping_y", PROP_ENUM, PROP_NONE);
2237 RNA_def_property_enum_sdna(prop, nullptr, "projy");
2238 RNA_def_property_enum_items(prop, prop_y_mapping_items);
2239 RNA_def_property_ui_text(prop, "Y Mapping", "");
2240 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2241
2242 prop = RNA_def_property(srna, "mapping_z", PROP_ENUM, PROP_NONE);
2243 RNA_def_property_enum_sdna(prop, nullptr, "projz");
2244 RNA_def_property_enum_items(prop, prop_z_mapping_items);
2245 RNA_def_property_ui_text(prop, "Z Mapping", "");
2246 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2247
2248 prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
2249 RNA_def_property_enum_items(prop, prop_mapping_items);
2250 RNA_def_property_ui_text(prop, "Mapping", "");
2252 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2253
2254 /* map to */
2255 prop = RNA_def_property(srna, "use_map_time", PROP_BOOLEAN, PROP_NONE);
2256 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_TIME);
2257 RNA_def_property_ui_text(prop, "Emission Time", "Affect the emission time of the particles");
2258 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2259
2260 prop = RNA_def_property(srna, "use_map_life", PROP_BOOLEAN, PROP_NONE);
2261 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_LIFE);
2262 RNA_def_property_ui_text(prop, "Life Time", "Affect the life time of the particles");
2263 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2264
2265 prop = RNA_def_property(srna, "use_map_density", PROP_BOOLEAN, PROP_NONE);
2266 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_DENS);
2267 RNA_def_property_ui_text(prop, "Density", "Affect the density of the particles");
2268 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2269
2270 prop = RNA_def_property(srna, "use_map_size", PROP_BOOLEAN, PROP_NONE);
2271 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_SIZE);
2272 RNA_def_property_ui_text(prop, "Size", "Affect the particle size");
2273 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2274
2275 prop = RNA_def_property(srna, "use_map_velocity", PROP_BOOLEAN, PROP_NONE);
2276 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_IVEL);
2277 RNA_def_property_ui_text(prop, "Initial Velocity", "Affect the particle initial velocity");
2278 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2279
2280 prop = RNA_def_property(srna, "use_map_field", PROP_BOOLEAN, PROP_NONE);
2281 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_FIELD);
2282 RNA_def_property_ui_text(prop, "Force Field", "Affect the particle force fields");
2283 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2284
2285 prop = RNA_def_property(srna, "use_map_gravity", PROP_BOOLEAN, PROP_NONE);
2286 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_GRAVITY);
2287 RNA_def_property_ui_text(prop, "Gravity", "Affect the particle gravity");
2288 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2289
2290 prop = RNA_def_property(srna, "use_map_damp", PROP_BOOLEAN, PROP_NONE);
2291 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_DAMP);
2292 RNA_def_property_ui_text(prop, "Damp", "Affect the particle velocity damping");
2293 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2294
2295 prop = RNA_def_property(srna, "use_map_clump", PROP_BOOLEAN, PROP_NONE);
2296 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_CLUMP);
2297 RNA_def_property_ui_text(prop, "Clump", "Affect the child clumping");
2298 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2299
2300 prop = RNA_def_property(srna, "use_map_kink_amp", PROP_BOOLEAN, PROP_NONE);
2301 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_KINK_AMP);
2302 RNA_def_property_ui_text(prop, "Kink Amplitude", "Affect the child kink amplitude");
2303 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2304
2305 prop = RNA_def_property(srna, "use_map_kink_freq", PROP_BOOLEAN, PROP_NONE);
2306 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_KINK_FREQ);
2307 RNA_def_property_ui_text(prop, "Kink Frequency", "Affect the child kink frequency");
2308 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2309
2310 prop = RNA_def_property(srna, "use_map_rough", PROP_BOOLEAN, PROP_NONE);
2311 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_ROUGH);
2312 RNA_def_property_ui_text(prop, "Rough", "Affect the child rough");
2313 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2314
2315 prop = RNA_def_property(srna, "use_map_length", PROP_BOOLEAN, PROP_NONE);
2316 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_LENGTH);
2317 RNA_def_property_ui_text(prop, "Length", "Affect the child hair length");
2318 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2319
2320 prop = RNA_def_property(srna, "use_map_twist", PROP_BOOLEAN, PROP_NONE);
2321 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_TWIST);
2322 RNA_def_property_ui_text(prop, "Twist", "Affect the child twist");
2323 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2324
2325 /* influence factors */
2326 prop = RNA_def_property(srna, "time_factor", PROP_FLOAT, PROP_NONE);
2327 RNA_def_property_float_sdna(prop, nullptr, "timefac");
2328 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2330 prop, "Emission Time Factor", "Amount texture affects particle emission time");
2331 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2332
2333 prop = RNA_def_property(srna, "life_factor", PROP_FLOAT, PROP_NONE);
2334 RNA_def_property_float_sdna(prop, nullptr, "lifefac");
2335 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2336 RNA_def_property_ui_text(prop, "Life Time Factor", "Amount texture affects particle life time");
2337 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2338
2339 prop = RNA_def_property(srna, "density_factor", PROP_FLOAT, PROP_NONE);
2340 RNA_def_property_float_sdna(prop, nullptr, "padensfac");
2341 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2342 RNA_def_property_ui_text(prop, "Density Factor", "Amount texture affects particle density");
2343 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2344
2345 prop = RNA_def_property(srna, "size_factor", PROP_FLOAT, PROP_NONE);
2346 RNA_def_property_float_sdna(prop, nullptr, "sizefac");
2347 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2348 RNA_def_property_ui_text(prop, "Size Factor", "Amount texture affects physical particle size");
2349 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2350
2351 prop = RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE);
2352 RNA_def_property_float_sdna(prop, nullptr, "ivelfac");
2353 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2355 prop, "Velocity Factor", "Amount texture affects particle initial velocity");
2356 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2357
2358 prop = RNA_def_property(srna, "field_factor", PROP_FLOAT, PROP_NONE);
2359 RNA_def_property_float_sdna(prop, nullptr, "fieldfac");
2360 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2361 RNA_def_property_ui_text(prop, "Field Factor", "Amount texture affects particle force fields");
2362 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2363
2364 prop = RNA_def_property(srna, "gravity_factor", PROP_FLOAT, PROP_NONE);
2365 RNA_def_property_float_sdna(prop, nullptr, "gravityfac");
2366 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2367 RNA_def_property_ui_text(prop, "Gravity Factor", "Amount texture affects particle gravity");
2368 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2369
2370 prop = RNA_def_property(srna, "damp_factor", PROP_FLOAT, PROP_NONE);
2371 RNA_def_property_float_sdna(prop, nullptr, "dampfac");
2372 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2373 RNA_def_property_ui_text(prop, "Damp Factor", "Amount texture affects particle damping");
2374 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2375
2376 prop = RNA_def_property(srna, "length_factor", PROP_FLOAT, PROP_NONE);
2377 RNA_def_property_float_sdna(prop, nullptr, "lengthfac");
2378 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2379 RNA_def_property_ui_text(prop, "Length Factor", "Amount texture affects child hair length");
2380 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2381
2382 prop = RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
2383 RNA_def_property_float_sdna(prop, nullptr, "clumpfac");
2384 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2385 RNA_def_property_ui_text(prop, "Clump Factor", "Amount texture affects child clump");
2386 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2387
2388 prop = RNA_def_property(srna, "kink_amp_factor", PROP_FLOAT, PROP_NONE);
2389 RNA_def_property_float_sdna(prop, nullptr, "kinkampfac");
2390 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2392 prop, "Kink Amplitude Factor", "Amount texture affects child kink amplitude");
2393 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2394
2395 prop = RNA_def_property(srna, "kink_freq_factor", PROP_FLOAT, PROP_NONE);
2396 RNA_def_property_float_sdna(prop, nullptr, "kinkfac");
2397 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2399 prop, "Kink Frequency Factor", "Amount texture affects child kink frequency");
2400 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2401
2402 prop = RNA_def_property(srna, "rough_factor", PROP_FLOAT, PROP_NONE);
2403 RNA_def_property_float_sdna(prop, nullptr, "roughfac");
2404 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2405 RNA_def_property_ui_text(prop, "Rough Factor", "Amount texture affects child roughness");
2406 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2407
2408 prop = RNA_def_property(srna, "twist_factor", PROP_FLOAT, PROP_NONE);
2409 RNA_def_property_float_sdna(prop, nullptr, "twistfac");
2410 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2411 RNA_def_property_ui_text(prop, "Twist Factor", "Amount texture affects child twist");
2412 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2413}
2414
2416{
2417 StructRNA *srna;
2418 PropertyRNA *prop;
2419
2420 static const EnumPropertyItem phys_type_items[] = {
2421 {PART_PHYS_NO, "NO", 0, "None", ""},
2422 {PART_PHYS_NEWTON, "NEWTON", 0, "Newtonian", ""},
2423 {PART_PHYS_KEYED, "KEYED", 0, "Keyed", ""},
2424 {PART_PHYS_BOIDS, "BOIDS", 0, "Boids", ""},
2425 {PART_PHYS_FLUID, "FLUID", 0, "Fluid", ""},
2426 {0, nullptr, 0, nullptr, nullptr},
2427 };
2428
2429 static const EnumPropertyItem rot_mode_items[] = {
2430 {0, "NONE", 0, "None", ""},
2431 {PART_ROT_NOR, "NOR", 0, "Normal", ""},
2432 {PART_ROT_NOR_TAN, "NOR_TAN", 0, "Normal-Tangent", ""},
2433 {PART_ROT_VEL, "VEL", 0, "Velocity / Hair", ""},
2434 {PART_ROT_GLOB_X, "GLOB_X", 0, "Global X", ""},
2435 {PART_ROT_GLOB_Y, "GLOB_Y", 0, "Global Y", ""},
2436 {PART_ROT_GLOB_Z, "GLOB_Z", 0, "Global Z", ""},
2437 {PART_ROT_OB_X, "OB_X", 0, "Object X", ""},
2438 {PART_ROT_OB_Y, "OB_Y", 0, "Object Y", ""},
2439 {PART_ROT_OB_Z, "OB_Z", 0, "Object Z", ""},
2440 {0, nullptr, 0, nullptr, nullptr},
2441 };
2442
2443 static const EnumPropertyItem ave_mode_items[] = {
2444 {0, "NONE", 0, "None", ""},
2445 {PART_AVE_VELOCITY, "VELOCITY", 0, "Velocity", ""},
2446 {PART_AVE_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""},
2447 {PART_AVE_VERTICAL, "VERTICAL", 0, "Vertical", ""},
2448 {PART_AVE_GLOBAL_X, "GLOBAL_X", 0, "Global X", ""},
2449 {PART_AVE_GLOBAL_Y, "GLOBAL_Y", 0, "Global Y", ""},
2450 {PART_AVE_GLOBAL_Z, "GLOBAL_Z", 0, "Global Z", ""},
2451 {PART_AVE_RAND, "RAND", 0, "Random", ""},
2452 {0, nullptr, 0, nullptr, nullptr},
2453 };
2454
2455 static const EnumPropertyItem react_event_items[] = {
2456 {PART_EVENT_DEATH, "DEATH", 0, "Death", ""},
2457 {PART_EVENT_COLLIDE, "COLLIDE", 0, "Collision", ""},
2458 {PART_EVENT_NEAR, "NEAR", 0, "Proximity", ""},
2459 {0, nullptr, 0, nullptr, nullptr},
2460 };
2461
2462 static const EnumPropertyItem child_type_items[] = {
2463 {0, "NONE", 0, "None", ""},
2464 {PART_CHILD_PARTICLES, "SIMPLE", 0, "Simple", ""},
2465 {PART_CHILD_FACES, "INTERPOLATED", 0, "Interpolated", ""},
2466 {0, nullptr, 0, nullptr, nullptr},
2467 };
2468
2469 /* TODO: names, tool-tips. */
2470 static const EnumPropertyItem integrator_type_items[] = {
2471 {PART_INT_EULER, "EULER", 0, "Euler", ""},
2472 {PART_INT_VERLET, "VERLET", 0, "Verlet", ""},
2473 {PART_INT_MIDPOINT, "MIDPOINT", 0, "Midpoint", ""},
2474 {PART_INT_RK4, "RK4", 0, "RK4", ""},
2475 {0, nullptr, 0, nullptr, nullptr},
2476 };
2477
2478 static const EnumPropertyItem kink_type_items[] = {
2479 {PART_KINK_NO, "NO", 0, "Nothing", ""},
2480 {PART_KINK_CURL, "CURL", 0, "Curl", ""},
2481 {PART_KINK_RADIAL, "RADIAL", 0, "Radial", ""},
2482 {PART_KINK_WAVE, "WAVE", 0, "Wave", ""},
2483 {PART_KINK_BRAID, "BRAID", 0, "Braid", ""},
2484 {PART_KINK_SPIRAL, "SPIRAL", 0, "Spiral", ""},
2485 {0, nullptr, 0, nullptr, nullptr},
2486 };
2487
2488 static const EnumPropertyItem draw_col_items[] = {
2489 {PART_DRAW_COL_NONE, "NONE", 0, "None", ""},
2490 {PART_DRAW_COL_MAT, "MATERIAL", 0, "Material", ""},
2491 {PART_DRAW_COL_VEL, "VELOCITY", 0, "Velocity", ""},
2492 {PART_DRAW_COL_ACC, "ACCELERATION", 0, "Acceleration", ""},
2493 {0, nullptr, 0, nullptr, nullptr},
2494 };
2495
2496 srna = RNA_def_struct(brna, "ParticleSettings", "ID");
2498 srna, "Particle Settings", "Particle settings, reusable by multiple particle systems");
2499 RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
2500
2502 srna,
2503 "rna_ParticleSettings_mtex_begin",
2504 "rna_ParticleSettings_active_texture_get",
2505 "rna_ParticleSettings_active_texture_set",
2506 nullptr,
2507 "ParticleSettingsTextureSlot",
2508 "ParticleSettingsTextureSlots",
2509 "rna_Particle_reset_dependency",
2510 nullptr);
2511
2512 /* Fluid particle type can't be checked from the type value in RNA
2513 * as it's not shown in the menu. */
2514 prop = RNA_def_property(srna, "is_fluid", PROP_BOOLEAN, PROP_NONE);
2516 RNA_def_property_boolean_funcs(prop, "rna_PartSettings_is_fluid_get", nullptr);
2517 RNA_def_property_ui_text(prop, "Fluid", "Particles were created by a fluid simulation");
2518
2519 /* flag */
2520 prop = RNA_def_property(srna, "use_react_start_end", PROP_BOOLEAN, PROP_NONE);
2521 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_REACT_STA_END);
2523 RNA_def_property_ui_text(prop, "Start/End", "Give birth to unreacted particles eventually");
2524 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2525
2526 prop = RNA_def_property(srna, "use_react_multiple", PROP_BOOLEAN, PROP_NONE);
2527 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_REACT_MULTIPLE);
2529 RNA_def_property_ui_text(prop, "Multi React", "React multiple times");
2530 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2531
2532 prop = RNA_def_property(srna, "use_regrow_hair", PROP_BOOLEAN, PROP_NONE);
2533 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_HAIR_REGROW);
2534 RNA_def_property_ui_text(prop, "Regrow", "Regrow hair for each frame");
2535 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2536
2537 prop = RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
2538 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_UNBORN);
2539 RNA_def_property_ui_text(prop, "Unborn", "Show particles before they are emitted");
2540 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2541
2542 prop = RNA_def_property(srna, "use_dead", PROP_BOOLEAN, PROP_NONE);
2543 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_DIED);
2544 RNA_def_property_ui_text(prop, "Died", "Show particles after they have died");
2545 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2546
2547 prop = RNA_def_property(srna, "use_emit_random", PROP_BOOLEAN, PROP_NONE);
2548 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_TRAND);
2550 RNA_def_property_ui_text(prop, "Random", "Emit in random order of elements");
2551 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2552
2553 prop = RNA_def_property(srna, "use_even_distribution", PROP_BOOLEAN, PROP_NONE);
2554 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_EDISTR);
2557 "Even Distribution",
2558 "Use even distribution from faces based on face areas or edge lengths");
2559 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2560
2561 prop = RNA_def_property(srna, "use_die_on_collision", PROP_BOOLEAN, PROP_NONE);
2562 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_DIE_ON_COL);
2565 prop, "Die on Hit", "Particles die when they collide with a deflector object");
2566 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2567
2568 prop = RNA_def_property(srna, "use_size_deflect", PROP_BOOLEAN, PROP_NONE);
2569 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_SIZE_DEFL);
2571 RNA_def_property_ui_text(prop, "Size Deflect", "Use particle's size in deflection");
2572 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2573
2574 prop = RNA_def_property(srna, "use_rotations", PROP_BOOLEAN, PROP_NONE);
2575 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_ROTATIONS);
2577 RNA_def_property_ui_text(prop, "Rotations", "Calculate particle rotations");
2578 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2579
2580 prop = RNA_def_property(srna, "use_dynamic_rotation", PROP_BOOLEAN, PROP_NONE);
2581 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_ROT_DYN);
2584 prop, "Dynamic", "Particle rotations are affected by collisions and effectors");
2585 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2586
2587 prop = RNA_def_property(srna, "use_multiply_size_mass", PROP_BOOLEAN, PROP_NONE);
2588 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_SIZEMASS);
2590 RNA_def_property_ui_text(prop, "Mass from Size", "Multiply mass by particle size");
2591 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2592
2593 prop = RNA_def_property(srna, "use_advanced_hair", PROP_BOOLEAN, PROP_NONE);
2596 RNA_def_property_ui_text(prop, "Advanced", "Use full physics calculations for growing hair");
2597 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2598
2599 prop = RNA_def_property(srna, "lock_boids_to_surface", PROP_BOOLEAN, PROP_NONE);
2600 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_BOIDS_2D);
2601 RNA_def_property_ui_text(prop, "Boids 2D", "Constrain boids to a surface");
2602 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2603
2604 prop = RNA_def_property(srna, "use_hair_bspline", PROP_BOOLEAN, PROP_NONE);
2605 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_HAIR_BSPLINE);
2606 RNA_def_property_ui_text(prop, "B-Spline", "Interpolate hair using B-Splines");
2607 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2608
2609 prop = RNA_def_property(srna, "invert_grid", PROP_BOOLEAN, PROP_NONE);
2610 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_GRID_INVERT);
2612 prop, "Invert Grid", "Invert what is considered object and what is not");
2613 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2614
2615 prop = RNA_def_property(srna, "hexagonal_grid", PROP_BOOLEAN, PROP_NONE);
2616 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_GRID_HEXAGONAL);
2617 RNA_def_property_ui_text(prop, "Hexagonal Grid", "Create the grid in a hexagonal pattern");
2618 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2619
2620 prop = RNA_def_property(srna, "apply_effector_to_children", PROP_BOOLEAN, PROP_NONE);
2621 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_CHILD_EFFECT);
2622 RNA_def_property_ui_text(prop, "Affect Children", "Apply effectors to children");
2623 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2624
2625 prop = RNA_def_property(srna, "create_long_hair_children", PROP_BOOLEAN, PROP_NONE);
2627 RNA_def_property_ui_text(prop, "Long Hair", "Calculate children that suit long hair well");
2628 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2629
2630 prop = RNA_def_property(srna, "apply_guide_to_children", PROP_BOOLEAN, PROP_NONE);
2631 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_CHILD_GUIDE);
2632 RNA_def_property_ui_text(prop, "apply_guide_to_children", "");
2633 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2634
2635 prop = RNA_def_property(srna, "use_self_effect", PROP_BOOLEAN, PROP_NONE);
2636 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_SELF_EFFECT);
2637 RNA_def_property_ui_text(prop, "Self Effect", "Particle effectors affect themselves");
2638 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2639
2640 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2643 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Particle_type_itemf");
2644 RNA_def_property_ui_text(prop, "Type", "Particle type");
2645 RNA_def_property_update(prop, 0, "rna_Particle_change_type");
2646
2647 prop = RNA_def_property(srna, "emit_from", PROP_ENUM, PROP_NONE);
2648 RNA_def_property_enum_sdna(prop, nullptr, "from");
2651 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Particle_from_itemf");
2652 RNA_def_property_ui_text(prop, "Emit From", "Where to emit particles from");
2653 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2654
2655 prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
2656 RNA_def_property_enum_sdna(prop, nullptr, "distr");
2659 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Particle_dist_itemf");
2661 prop, "Distribution", "How to distribute particles on selected element");
2662 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2663
2664 /* physics modes */
2665 prop = RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
2666 RNA_def_property_enum_sdna(prop, nullptr, "phystype");
2668 RNA_def_property_enum_items(prop, phys_type_items);
2669 RNA_def_property_ui_text(prop, "Physics Type", "Particle physics type");
2670 RNA_def_property_update(prop, 0, "rna_Particle_change_physics_type");
2671
2672 prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
2673 RNA_def_property_enum_sdna(prop, nullptr, "rotmode");
2675 RNA_def_property_enum_items(prop, rot_mode_items);
2677 prop,
2678 "Orientation Axis",
2679 "Particle orientation axis (does not affect Explode modifier's results)");
2680 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2681
2682 prop = RNA_def_property(srna, "angular_velocity_mode", PROP_ENUM, PROP_NONE);
2683 RNA_def_property_enum_sdna(prop, nullptr, "avemode");
2685 RNA_def_property_enum_items(prop, ave_mode_items);
2687 prop, "Angular Velocity Axis", "What axis is used to change particle rotation with time");
2688 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2689
2690 prop = RNA_def_property(srna, "react_event", PROP_ENUM, PROP_NONE);
2691 RNA_def_property_enum_sdna(prop, nullptr, "reactevent");
2693 RNA_def_property_enum_items(prop, react_event_items);
2694 RNA_def_property_ui_text(prop, "React On", "The event of target particles to react on");
2695 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2696
2697 /* Draw flag. */
2698 prop = RNA_def_property(srna, "show_guide_hairs", PROP_BOOLEAN, PROP_NONE);
2700 RNA_def_property_ui_text(prop, "Guide Hairs", "Show guide hairs");
2701 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2702
2703 prop = RNA_def_property(srna, "show_hair_grid", PROP_BOOLEAN, PROP_NONE);
2704 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_DRAW_HAIR_GRID);
2705 RNA_def_property_ui_text(prop, "Guide Hairs", "Show hair simulation grid");
2706 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2707
2708 prop = RNA_def_property(srna, "show_velocity", PROP_BOOLEAN, PROP_NONE);
2709 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_DRAW_VEL);
2710 RNA_def_property_ui_text(prop, "Velocity", "Show particle velocity");
2711 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2712
2713 prop = RNA_def_property(srna, "show_size", PROP_BOOLEAN, PROP_NONE);
2714 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_DRAW_SIZE);
2715 RNA_def_property_ui_text(prop, "Size", "Show particle size");
2716 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2717
2718 prop = RNA_def_property(srna, "show_health", PROP_BOOLEAN, PROP_NONE);
2719 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_DRAW_HEALTH);
2720 RNA_def_property_ui_text(prop, "Health", "Display boid health");
2721 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2722
2723 prop = RNA_def_property(srna, "use_absolute_path_time", PROP_BOOLEAN, PROP_NONE);
2724 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_ABS_PATH_TIME);
2725 RNA_def_property_ui_text(prop, "Absolute Path Time", "Path timing is in absolute frames");
2726 RNA_def_property_update(prop, 0, "rna_Particle_abspathtime_update");
2727
2728 prop = RNA_def_property(srna, "use_parent_particles", PROP_BOOLEAN, PROP_NONE);
2729 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_DRAW_PARENT);
2730 RNA_def_property_ui_text(prop, "Parents", "Render parent particles");
2732 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2733
2734 prop = RNA_def_property(srna, "show_number", PROP_BOOLEAN, PROP_NONE);
2735 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_DRAW_NUM);
2736 RNA_def_property_ui_text(prop, "Number", "Show particle number");
2737 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2738
2739 prop = RNA_def_property(srna, "use_collection_pick_random", PROP_BOOLEAN, PROP_NONE);
2740 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_DRAW_RAND_GR);
2741 RNA_def_property_ui_text(prop, "Pick Random", "Pick objects from collection randomly");
2742 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2743
2744 prop = RNA_def_property(srna, "use_collection_count", PROP_BOOLEAN, PROP_NONE);
2745 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_DRAW_COUNT_GR);
2746 RNA_def_property_ui_text(prop, "Use Count", "Use object multiple times in the same collection");
2747 RNA_def_property_update(prop, 0, "rna_Particle_redo_count");
2748
2749 prop = RNA_def_property(srna, "use_global_instance", PROP_BOOLEAN, PROP_NONE);
2750 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_DRAW_GLOBAL_OB);
2751 RNA_def_property_ui_text(prop, "Global", "Use object's global coordinates for duplication");
2752 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2753
2754 prop = RNA_def_property(srna, "use_rotation_instance", PROP_BOOLEAN, PROP_NONE);
2755 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_DRAW_ROTATE_OB);
2757 "Rotation",
2758 "Use object's rotation for duplication (global x-axis is aligned "
2759 "particle rotation axis)");
2760 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2761
2762 prop = RNA_def_property(srna, "use_scale_instance", PROP_BOOLEAN, PROP_NONE);
2764 RNA_def_property_ui_text(prop, "Scale", "Use object's scale for duplication");
2765 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2766
2767 prop = RNA_def_property(srna, "use_render_adaptive", PROP_BOOLEAN, PROP_NONE);
2768 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_DRAW_REN_ADAPT);
2769 RNA_def_property_ui_text(prop, "Adaptive Render", "Display steps of the particle path");
2770 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2771
2772 prop = RNA_def_property(srna, "use_velocity_length", PROP_BOOLEAN, PROP_NONE);
2774 RNA_def_property_ui_text(prop, "Speed", "Multiply line length by particle speed");
2775 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2776
2777 prop = RNA_def_property(srna, "use_whole_collection", PROP_BOOLEAN, PROP_NONE);
2778 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_DRAW_WHOLE_GR);
2779 RNA_def_property_ui_text(prop, "Whole Collection", "Use whole collection at once");
2780 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2781
2782 prop = RNA_def_property(srna, "use_strand_primitive", PROP_BOOLEAN, PROP_NONE);
2784 RNA_def_property_ui_text(prop, "Strand Render", "Use the strand primitive for rendering");
2785 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2786
2787 prop = RNA_def_property(srna, "display_method", PROP_ENUM, PROP_NONE);
2788 RNA_def_property_enum_sdna(prop, nullptr, "draw_as");
2790 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Particle_draw_as_itemf");
2791 RNA_def_property_ui_text(prop, "Particle Display", "How particles are displayed in viewport");
2793 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2794
2795 prop = RNA_def_property(srna, "render_type", PROP_ENUM, PROP_NONE);
2796 RNA_def_property_enum_sdna(prop, nullptr, "ren_as");
2798 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Particle_ren_as_itemf");
2799 RNA_def_property_ui_text(prop, "Particle Rendering", "How particles are rendered");
2800 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2801
2802 prop = RNA_def_property(srna, "display_color", PROP_ENUM, PROP_NONE);
2803 RNA_def_property_enum_sdna(prop, nullptr, "draw_col");
2804 RNA_def_property_enum_items(prop, draw_col_items);
2805 RNA_def_property_ui_text(prop, "Display Color", "Display additional particle data as a color");
2806 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2807
2808 prop = RNA_def_property(srna, "display_size", PROP_FLOAT, PROP_DISTANCE);
2809 RNA_def_property_float_sdna(prop, nullptr, "draw_size");
2810 RNA_def_property_range(prop, 0, 1000);
2811 RNA_def_property_ui_range(prop, 0, 100, 1, -1);
2812 RNA_def_property_ui_text(prop, "Display Size", "Size of particles on viewport");
2813 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2814
2815 prop = RNA_def_property(srna, "child_type", PROP_ENUM, PROP_NONE);
2816 RNA_def_property_enum_sdna(prop, nullptr, "childtype");
2817 RNA_def_property_enum_items(prop, child_type_items);
2818 RNA_def_property_ui_text(prop, "Children From", "Create child particles");
2819 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2820
2821 prop = RNA_def_property(srna, "display_step", PROP_INT, PROP_NONE);
2822 RNA_def_property_int_sdna(prop, nullptr, "draw_step");
2823 RNA_def_property_range(prop, 0, 10);
2824 RNA_def_property_ui_range(prop, 0, 7, 1, -1);
2825 RNA_def_property_ui_text(prop, "Steps", "How many steps paths are displayed with (power of 2)");
2826 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2827
2828 prop = RNA_def_property(srna, "render_step", PROP_INT, PROP_NONE);
2829 RNA_def_property_int_sdna(prop, nullptr, "ren_step");
2830 RNA_def_property_range(prop, 0, 20);
2831 RNA_def_property_ui_range(prop, 0, 9, 1, -1);
2832 RNA_def_property_ui_text(prop, "Render", "How many steps paths are rendered with (power of 2)");
2833
2834 prop = RNA_def_property(srna, "hair_step", PROP_INT, PROP_NONE);
2835 RNA_def_property_range(prop, 2, SHRT_MAX);
2836 RNA_def_property_ui_range(prop, 2, 50, 1, 1);
2838 RNA_def_property_ui_text(prop, "Segments", "Number of hair segments");
2839 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2840
2841 prop = RNA_def_property(srna, "bending_random", PROP_FLOAT, PROP_FACTOR);
2842 RNA_def_property_float_sdna(prop, nullptr, "bending_random");
2843 RNA_def_property_range(prop, 0.0f, 1.0f);
2844 RNA_def_property_ui_text(prop, "Random Bending Stiffness", "Random stiffness of hairs");
2845 RNA_def_property_update(prop, 0, "rna_Particle_cloth_update");
2846
2847 /* TODO: not found in UI, read-only? */
2848 prop = RNA_def_property(srna, "keys_step", PROP_INT, PROP_NONE);
2849 RNA_def_property_range(prop, 0, SHRT_MAX); /* TODO: min,max. */
2850 RNA_def_property_ui_text(prop, "Keys Step", "");
2851
2852 /* adaptive path rendering */
2853 prop = RNA_def_property(srna, "adaptive_angle", PROP_INT, PROP_NONE);
2854 RNA_def_property_int_sdna(prop, nullptr, "adapt_angle");
2855 RNA_def_property_range(prop, 0, 45);
2857 prop, "Degrees", "How many degrees path has to curve to make another render segment");
2858
2859 prop = RNA_def_property(srna, "adaptive_pixel", PROP_INT, PROP_NONE);
2860 RNA_def_property_int_sdna(prop, nullptr, "adapt_pix");
2861 RNA_def_property_range(prop, 0, 50);
2863 prop, "Pixel", "How many pixels path has to cover to make another render segment");
2864
2865 prop = RNA_def_property(srna, "display_percentage", PROP_INT, PROP_PERCENTAGE);
2866 RNA_def_property_int_sdna(prop, nullptr, "disp");
2867 RNA_def_property_range(prop, 0, 100);
2868 RNA_def_property_ui_text(prop, "Display", "Percentage of particles to display in 3D view");
2869 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2870
2871 prop = RNA_def_property(srna, "material", PROP_INT, PROP_NONE);
2872 RNA_def_property_int_sdna(prop, nullptr, "omat");
2873 RNA_def_property_range(prop, 1, 32767);
2875 prop, "Material Index", "Index of material slot used for rendering particles");
2876 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2877
2878 prop = RNA_def_property(srna, "material_slot", PROP_ENUM, PROP_NONE);
2879 RNA_def_property_enum_sdna(prop, nullptr, "omat");
2881 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Particle_Material_itemf");
2882 RNA_def_property_ui_text(prop, "Material Slot", "Material slot used for rendering particles");
2883 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2884
2885 prop = RNA_def_property(srna, "integrator", PROP_ENUM, PROP_NONE);
2886 RNA_def_property_enum_items(prop, integrator_type_items);
2888 "Integration",
2889 "Algorithm used to calculate physics, from the fastest to the "
2890 "most stable and accurate: Midpoint, Euler, Verlet, RK4");
2891 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2892
2893 prop = RNA_def_property(srna, "kink", PROP_ENUM, PROP_NONE);
2894 RNA_def_property_enum_items(prop, kink_type_items);
2895 RNA_def_property_ui_text(prop, "Kink", "Type of periodic offset on the path");
2897 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2898
2899 prop = RNA_def_property(srna, "kink_axis", PROP_ENUM, PROP_NONE);
2901 RNA_def_property_ui_text(prop, "Axis", "Which axis to use for offset");
2902 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2903
2904 prop = RNA_def_property(srna, "color_maximum", PROP_FLOAT, PROP_NONE);
2905 RNA_def_property_float_sdna(prop, nullptr, "color_vec_max");
2906 RNA_def_property_range(prop, 0.01f, 100.0f);
2907 RNA_def_property_ui_text(prop, "Color Maximum", "Maximum length of the particle color vector");
2908 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2909
2910 /* general values */
2911 prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_TIME);
2912 RNA_def_property_float_sdna(prop, nullptr, "sta"); /* Optional if prop names are the same. */
2915 RNA_def_property_float_funcs(prop, nullptr, "rna_PartSettings_start_set", nullptr);
2916 RNA_def_property_ui_text(prop, "Start", "Frame number to start emitting particles");
2917 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2918
2919 prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_TIME);
2920 RNA_def_property_float_sdna(prop, nullptr, "end");
2922
2924 RNA_def_property_float_funcs(prop, nullptr, "rna_PartSettings_end_set", nullptr);
2925 RNA_def_property_ui_text(prop, "End", "Frame number to stop emitting particles");
2926 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2927
2928 prop = RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
2929 RNA_def_property_range(prop, 1.0f, MAXFRAMEF);
2930 RNA_def_property_ui_text(prop, "Lifetime", "Life span of the particles");
2931 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2932
2933 prop = RNA_def_property(srna, "lifetime_random", PROP_FLOAT, PROP_FACTOR);
2934 RNA_def_property_float_sdna(prop, nullptr, "randlife");
2935 RNA_def_property_range(prop, 0.0f, 1.0f);
2936 RNA_def_property_ui_text(prop, "Random", "Give the particle life a random variation");
2937 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2938
2939 prop = RNA_def_property(srna, "time_tweak", PROP_FLOAT, PROP_NONE);
2940 RNA_def_property_float_sdna(prop, nullptr, "timetweak");
2941 RNA_def_property_range(prop, 0.0f, 100.0f);
2942 RNA_def_property_ui_range(prop, 0, 10, 1, 3);
2944 prop, "Tweak", "A multiplier for physics timestep (1.0 means one frame = 1/25 seconds)");
2945 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2946
2947 prop = RNA_def_property(srna, "timestep", PROP_FLOAT, PROP_NONE);
2949 prop, "rna_PartSettings_timestep_get", "rna_PartSetings_timestep_set", nullptr);
2950 RNA_def_property_range(prop, 0.0001, 100.0);
2951 RNA_def_property_ui_range(prop, 0.01, 10, 1, 3);
2953 prop, "Timestep", "The simulation timestep per frame (seconds per frame)");
2954 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2955
2956 prop = RNA_def_property(srna, "use_adaptive_subframes", PROP_BOOLEAN, PROP_NONE);
2957 RNA_def_property_boolean_sdna(prop, nullptr, "time_flag", PART_TIME_AUTOSF);
2959 prop, "Automatic Subframes", "Automatically set the number of subframes");
2960 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2961
2962 prop = RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE);
2963 RNA_def_property_range(prop, 0, 1000);
2965 prop,
2966 "Subframes",
2967 "Subframes to simulate for improved stability and finer granularity simulations "
2968 "(dt = timestep / (subframes + 1))");
2969 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2970
2971 prop = RNA_def_property(srna, "courant_target", PROP_FLOAT, PROP_NONE);
2972 RNA_def_property_range(prop, 0.0001, 10);
2974 prop,
2975 "Adaptive Subframe Threshold",
2976 "The relative distance a particle can move before requiring more subframes "
2977 "(target Courant number); 0.01 to 0.3 is the recommended range");
2978 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2979
2980 prop = RNA_def_property(srna, "jitter_factor", PROP_FLOAT, PROP_NONE);
2982 RNA_def_property_float_sdna(prop, nullptr, "jitfac");
2983 RNA_def_property_range(prop, 0.0f, 2.0f);
2984 RNA_def_property_ui_text(prop, "Amount", "Amount of jitter applied to the sampling");
2985 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2986
2987 prop = RNA_def_property(srna, "effect_hair", PROP_FLOAT, PROP_FACTOR);
2988 RNA_def_property_float_sdna(prop, nullptr, "eff_hair");
2989 RNA_def_property_range(prop, 0.0f, 1.0f);
2990 RNA_def_property_ui_text(prop, "Stiffness", "Hair stiffness for effectors");
2991 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2992
2993 prop = RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
2994 RNA_def_property_int_sdna(prop, nullptr, "totpart");
2996 RNA_def_property_ui_range(prop, 0, 1000000, 1, -1);
2997 RNA_def_property_ui_text(prop, "Number", "Total number of particles");
2999 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3000
3001 prop = RNA_def_property(
3002 srna, "userjit", PROP_INT, PROP_UNSIGNED); /* TODO: can we get a better name for userjit? */
3003 RNA_def_property_int_sdna(prop, nullptr, "userjit");
3005 RNA_def_property_range(prop, 0, 1000);
3006 RNA_def_property_ui_text(prop, "Particles/Face", "Emission locations per face (0 = automatic)");
3007 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3008
3009 prop = RNA_def_property(srna, "grid_resolution", PROP_INT, PROP_UNSIGNED);
3010 RNA_def_property_int_sdna(prop, nullptr, "grid_res");
3013 prop, 1, 250); /* ~15M particles in a cube (ouch!), but could be very usable in a plane */
3014 RNA_def_property_ui_range(prop, 1, 50, 1, -1); /* ~100k particles in a cube */
3015 RNA_def_property_ui_text(prop, "Resolution", "The resolution of the particle grid");
3016 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3017
3018 prop = RNA_def_property(srna, "grid_random", PROP_FLOAT, PROP_FACTOR);
3019 RNA_def_property_float_sdna(prop, nullptr, "grid_rand");
3020 RNA_def_property_range(prop, 0.0f, 1.0f);
3021 RNA_def_property_ui_text(prop, "Grid Randomness", "Add random offset to the grid locations");
3022 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3023
3024 prop = RNA_def_property(srna, "effector_amount", PROP_INT, PROP_UNSIGNED);
3025 /* In theory PROP_ANIMATABLE perhaps should be cleared,
3026 * but animating this can give some interesting results! */
3027 RNA_def_property_range(prop, 0, 10000); /* 10000 effectors will be SLOW, but who knows */
3028 RNA_def_property_ui_range(prop, 0, 100, 1, -1);
3030 prop, "Effector Number", "How many particles are effectors (0 is all particles)");
3031 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3032
3033 /* initial velocity factors */
3034 prop = RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_VELOCITY);
3035 RNA_def_property_float_sdna(prop, nullptr, "normfac"); /* Optional if prop names are the same. */
3036 RNA_def_property_range(prop, -1000.0f, 1000.0f);
3037 RNA_def_property_ui_range(prop, 0, 100, 1, 3);
3039 prop, "Normal", "Let the surface normal give the particle a starting velocity");
3040 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3041
3042 prop = RNA_def_property(srna, "object_factor", PROP_FLOAT, PROP_NONE);
3043 RNA_def_property_float_sdna(prop, nullptr, "obfac");
3044 RNA_def_property_range(prop, -200.0f, 200.0f);
3045 RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
3047 prop, "Object Velocity", "Let the object give the particle a starting velocity");
3048 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3049
3050 prop = RNA_def_property(srna, "factor_random", PROP_FLOAT, PROP_NONE);
3051 RNA_def_property_float_sdna(prop, nullptr, "randfac"); /* Optional if prop names are the same. */
3052 RNA_def_property_range(prop, 0.0f, 200.0f);
3053 RNA_def_property_ui_range(prop, 0, 100, 1, 3);
3054 RNA_def_property_ui_text(prop, "Random", "Give the starting velocity a random variation");
3055 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3056
3057 prop = RNA_def_property(srna, "particle_factor", PROP_FLOAT, PROP_NONE);
3058 RNA_def_property_float_sdna(prop, nullptr, "partfac");
3059 RNA_def_property_range(prop, -200.0f, 200.0f);
3060 RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
3062 prop, "Particle", "Let the target particle give the particle a starting velocity");
3063 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3064
3065 prop = RNA_def_property(srna, "tangent_factor", PROP_FLOAT, PROP_VELOCITY);
3066 RNA_def_property_float_sdna(prop, nullptr, "tanfac");
3067 RNA_def_property_range(prop, -1000.0f, 1000.0f);
3068 RNA_def_property_ui_range(prop, -100, 100, 1, 2);
3070 prop, "Tangent", "Let the surface tangent give the particle a starting velocity");
3071 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3072
3073 prop = RNA_def_property(srna, "tangent_phase", PROP_FLOAT, PROP_NONE);
3074 RNA_def_property_float_sdna(prop, nullptr, "tanphase");
3075 RNA_def_property_range(prop, -1.0f, 1.0f);
3076 RNA_def_property_ui_text(prop, "Rotation", "Rotate the surface tangent");
3077 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3078
3079 prop = RNA_def_property(srna, "reactor_factor", PROP_FLOAT, PROP_NONE);
3080 RNA_def_property_float_sdna(prop, nullptr, "reactfac");
3081 RNA_def_property_range(prop, -10.0f, 10.0f);
3083 prop,
3084 "Reactor",
3085 "Let the vector away from the target particle's location give the particle "
3086 "a starting velocity");
3087 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3088
3089 prop = RNA_def_property(srna, "object_align_factor", PROP_FLOAT, PROP_VELOCITY);
3090 RNA_def_property_float_sdna(prop, nullptr, "ob_vel");
3091 RNA_def_property_array(prop, 3);
3092 RNA_def_property_range(prop, -200.0f, 200.0f);
3093 RNA_def_property_ui_range(prop, -100, 100, 1, 3);
3095 prop,
3096 "Object Aligned",
3097 "Let the emitter object orientation give the particle a starting velocity");
3098 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3099
3100 prop = RNA_def_property(srna, "angular_velocity_factor", PROP_FLOAT, PROP_NONE);
3101 RNA_def_property_float_sdna(prop, nullptr, "avefac");
3102 RNA_def_property_range(prop, -200.0f, 200.0f);
3103 RNA_def_property_ui_range(prop, -100, 100, 10, 3);
3105 prop, "Angular Velocity", "Angular velocity amount (in radians per second)");
3106 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3107
3108 prop = RNA_def_property(srna, "phase_factor", PROP_FLOAT, PROP_NONE);
3109 RNA_def_property_float_sdna(prop, nullptr, "phasefac");
3110 RNA_def_property_range(prop, -1.0f, 1.0f);
3111 RNA_def_property_ui_text(prop, "Phase", "Rotation around the chosen orientation axis");
3112 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3113
3114 prop = RNA_def_property(srna, "rotation_factor_random", PROP_FLOAT, PROP_FACTOR);
3115 RNA_def_property_float_sdna(prop, nullptr, "randrotfac");
3116 RNA_def_property_range(prop, 0.0f, 1.0f);
3117 RNA_def_property_ui_text(prop, "Random Orientation", "Randomize particle orientation");
3118 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3119
3120 prop = RNA_def_property(srna, "phase_factor_random", PROP_FLOAT, PROP_FACTOR);
3121 RNA_def_property_float_sdna(prop, nullptr, "randphasefac");
3122 RNA_def_property_range(prop, 0.0f, 2.0f);
3124 prop, "Random Phase", "Randomize rotation around the chosen orientation axis");
3125 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3126
3127 prop = RNA_def_property(srna, "hair_length", PROP_FLOAT, PROP_DISTANCE);
3129 prop, "rna_PartSetting_hairlength_get", "rna_PartSetting_hairlength_set", nullptr);
3130 RNA_def_property_range(prop, 0.0f, 1000.0f);
3131 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
3132 RNA_def_property_ui_text(prop, "Hair Length", "Length of the hair");
3133 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3134
3135 /* physical properties */
3136 prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_UNIT_MASS);
3137 RNA_def_property_range(prop, 0.00000001f, 100000.0f);
3138 RNA_def_property_ui_range(prop, 0.01, 100, 1, 4);
3139 RNA_def_property_ui_text(prop, "Mass", "Mass of the particles");
3140 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3141
3142 prop = RNA_def_property(srna, "particle_size", PROP_FLOAT, PROP_NONE);
3143 RNA_def_property_float_sdna(prop, nullptr, "size");
3144 RNA_def_property_range(prop, 0.001f, 100000.0f);
3145 RNA_def_property_ui_range(prop, 0.01, 100, 1, 3);
3146 RNA_def_property_ui_text(prop, "Size", "The size of the particles");
3147 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3148
3149 prop = RNA_def_property(srna, "size_random", PROP_FLOAT, PROP_FACTOR);
3150 RNA_def_property_float_sdna(prop, nullptr, "randsize");
3151 RNA_def_property_range(prop, 0.0f, 1.0f);
3152 RNA_def_property_ui_text(prop, "Random Size", "Give the particle size a random variation");
3153 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3154
3155 prop = RNA_def_property(srna, "collision_collection", PROP_POINTER, PROP_NONE);
3156 RNA_def_property_struct_type(prop, "Collection");
3157 RNA_def_property_pointer_sdna(prop, nullptr, "collision_group");
3160 RNA_def_property_ui_text(prop, "Collision Collection", "Limit colliders to this collection");
3161 RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
3162
3163 /* global physical properties */
3164 prop = RNA_def_property(srna, "drag_factor", PROP_FLOAT, PROP_FACTOR);
3165 RNA_def_property_float_sdna(prop, nullptr, "dragfac");
3166 RNA_def_property_range(prop, 0.0f, 1.0f);
3167 RNA_def_property_ui_text(prop, "Drag", "Amount of air drag");
3168 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3169
3170 prop = RNA_def_property(srna, "brownian_factor", PROP_FLOAT, PROP_NONE);
3171 RNA_def_property_float_sdna(prop, nullptr, "brownfac");
3172 RNA_def_property_range(prop, 0.0f, 200.0f);
3173 RNA_def_property_ui_range(prop, 0, 20, 1, 3);
3174 RNA_def_property_ui_text(prop, "Brownian", "Amount of random, erratic particle movement");
3175 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3176
3177 prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_FACTOR);
3178 RNA_def_property_float_sdna(prop, nullptr, "dampfac");
3179 RNA_def_property_range(prop, 0.0f, 1.0f);
3180 RNA_def_property_ui_text(prop, "Damp", "Amount of damping");
3181 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3182
3183 /* random length */
3184 prop = RNA_def_property(srna, "length_random", PROP_FLOAT, PROP_FACTOR);
3185 RNA_def_property_float_sdna(prop, nullptr, "randlength");
3186 RNA_def_property_range(prop, 0.0f, 1.0f);
3187 RNA_def_property_ui_text(prop, "Random Length", "Give path length a random variation");
3188 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3189
3190 /* children */
3191
3192 prop = RNA_def_property(srna, "child_percent", PROP_INT, PROP_NONE);
3194 prop, nullptr, "child_percent"); /* Optional if prop names are the same. */
3195 RNA_def_property_range(prop, 0, 100000);
3196 RNA_def_property_ui_range(prop, 0, 1000, 1, -1);
3197 RNA_def_property_ui_text(prop, "Children Per Parent", "Number of children per parent");
3198 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3199
3200 prop = RNA_def_property(srna, "rendered_child_count", PROP_INT, PROP_NONE);
3201 RNA_def_property_int_sdna(prop, nullptr, "child_render_percent");
3202 RNA_def_property_range(prop, 0, 100000);
3203 RNA_def_property_ui_range(prop, 0, 10000, 1, -1);
3205 prop, "Rendered Children", "Number of children per parent for rendering");
3206
3207 prop = RNA_def_property(srna, "virtual_parents", PROP_FLOAT, PROP_FACTOR);
3208 RNA_def_property_float_sdna(prop, nullptr, "parents");
3209 RNA_def_property_range(prop, 0.0f, 1.0f);
3210 RNA_def_property_ui_text(prop, "Virtual Parents", "Relative amount of virtual parents");
3211 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3212
3213 prop = RNA_def_property(srna, "child_size", PROP_FLOAT, PROP_NONE);
3214 RNA_def_property_float_sdna(prop, nullptr, "childsize");
3215 RNA_def_property_range(prop, 0.001f, 100000.0f);
3216 RNA_def_property_ui_range(prop, 0.01f, 100.0f, 0.1, 3);
3217 RNA_def_property_ui_text(prop, "Child Size", "A multiplier for the child particle size");
3218 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3219
3220 prop = RNA_def_property(srna, "child_size_random", PROP_FLOAT, PROP_FACTOR);
3221 RNA_def_property_float_sdna(prop, nullptr, "childrandsize");
3222 RNA_def_property_range(prop, 0.0f, 1.0f);
3224 prop, "Random Child Size", "Random variation to the size of the child particles");
3225 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3226
3227 prop = RNA_def_property(srna, "child_radius", PROP_FLOAT, PROP_DISTANCE);
3228 RNA_def_property_float_sdna(prop, nullptr, "childrad");
3229 RNA_def_property_range(prop, 0.0f, 100000.0f);
3230 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
3231 RNA_def_property_ui_text(prop, "Child Radius", "Radius of children around parent");
3232 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3233
3234 prop = RNA_def_property(srna, "child_roundness", PROP_FLOAT, PROP_FACTOR);
3235 RNA_def_property_float_sdna(prop, nullptr, "childflat");
3236 RNA_def_property_range(prop, 0.0f, 1.0f);
3237 RNA_def_property_ui_text(prop, "Child Roundness", "Roundness of children around parent");
3238 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3239
3240 /* clumping */
3241 prop = RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
3242 RNA_def_property_float_sdna(prop, nullptr, "clumpfac");
3243 RNA_def_property_range(prop, -1.0f, 1.0f);
3244 RNA_def_property_ui_text(prop, "Clump", "Amount of clumping");
3245 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3246
3247 prop = RNA_def_property(srna, "clump_shape", PROP_FLOAT, PROP_NONE);
3248 RNA_def_property_float_sdna(prop, nullptr, "clumppow");
3249 RNA_def_property_range(prop, -0.999f, 0.999f);
3250 RNA_def_property_ui_text(prop, "Shape", "Shape of clumping");
3251 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3252
3253 prop = RNA_def_property(srna, "use_clump_curve", PROP_BOOLEAN, PROP_NONE);
3254 RNA_def_property_boolean_sdna(prop, nullptr, "child_flag", PART_CHILD_USE_CLUMP_CURVE);
3255 RNA_def_property_ui_text(prop, "Use Clump Curve", "Use a curve to define clump tapering");
3256 RNA_def_property_update(prop, 0, "rna_ParticleSettings_use_clump_curve_update");
3257
3258 prop = RNA_def_property(srna, "clump_curve", PROP_POINTER, PROP_NONE);
3259 RNA_def_property_pointer_sdna(prop, nullptr, "clumpcurve");
3260 RNA_def_property_struct_type(prop, "CurveMapping");
3262 RNA_def_property_ui_text(prop, "Clump Curve", "Curve defining clump tapering");
3263 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3264
3265 prop = RNA_def_property(srna, "use_clump_noise", PROP_BOOLEAN, PROP_NONE);
3266 RNA_def_property_boolean_sdna(prop, nullptr, "child_flag", PART_CHILD_USE_CLUMP_NOISE);
3267 RNA_def_property_ui_text(prop, "Use Clump Noise", "Create random clumps around the parent");
3268 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3269
3270 prop = RNA_def_property(srna, "clump_noise_size", PROP_FLOAT, PROP_NONE);
3271 RNA_def_property_float_sdna(prop, nullptr, "clump_noise_size");
3272 RNA_def_property_range(prop, 0.00001f, 100000.0f);
3273 RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1f, 3);
3274 RNA_def_property_ui_text(prop, "Clump Noise Size", "Size of clump noise");
3275 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3276
3277 /* kink */
3278 prop = RNA_def_property(srna, "kink_amplitude", PROP_FLOAT, PROP_DISTANCE);
3279 RNA_def_property_float_sdna(prop, nullptr, "kink_amp");
3280 RNA_def_property_range(prop, -100000.0f, 100000.0f);
3281 RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
3282 RNA_def_property_ui_text(prop, "Amplitude", "The amplitude of the offset");
3283 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3284
3285 prop = RNA_def_property(srna, "kink_amplitude_clump", PROP_FLOAT, PROP_FACTOR);
3286 RNA_def_property_float_sdna(prop, nullptr, "kink_amp_clump");
3287 RNA_def_property_range(prop, 0.0f, 1.0f);
3288 RNA_def_property_ui_text(prop, "Amplitude Clump", "How much clump affects kink amplitude");
3289 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3290
3291 prop = RNA_def_property(srna, "kink_amplitude_random", PROP_FLOAT, PROP_FACTOR);
3292 RNA_def_property_float_sdna(prop, nullptr, "kink_amp_random");
3293 RNA_def_property_range(prop, 0.0f, 1.0f);
3294 RNA_def_property_ui_text(prop, "Amplitude Random", "Random variation of the amplitude");
3295 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3296
3297 prop = RNA_def_property(srna, "kink_frequency", PROP_FLOAT, PROP_NONE);
3298 RNA_def_property_float_sdna(prop, nullptr, "kink_freq");
3299 RNA_def_property_range(prop, -100000.0f, 100000.0f);
3300 RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
3301 RNA_def_property_ui_text(prop, "Frequency", "The frequency of the offset (1/total length)");
3302 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3303
3304 prop = RNA_def_property(srna, "kink_shape", PROP_FLOAT, PROP_NONE);
3305 RNA_def_property_range(prop, -0.999f, 0.999f);
3306 RNA_def_property_ui_text(prop, "Shape", "Adjust the offset to the beginning/end");
3307 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3308
3309 prop = RNA_def_property(srna, "kink_flat", PROP_FLOAT, PROP_FACTOR);
3310 RNA_def_property_range(prop, 0.0f, 1.0f);
3311 RNA_def_property_ui_text(prop, "Flatness", "How flat the hairs are");
3312 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3313
3314 prop = RNA_def_property(srna, "kink_extra_steps", PROP_INT, PROP_NONE);
3315 RNA_def_property_range(prop, 1, INT_MAX);
3316 RNA_def_property_ui_range(prop, 1, 100, 1, -1);
3318 prop, "Extra Steps", "Extra steps for resolution of special kink features");
3319 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3320
3321 prop = RNA_def_property(srna, "kink_axis_random", PROP_FLOAT, PROP_FACTOR);
3322 RNA_def_property_range(prop, 0.0f, 1.0f);
3323 RNA_def_property_ui_text(prop, "Axis Random", "Random variation of the orientation");
3324 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3325
3326 /* rough */
3327 prop = RNA_def_property(srna, "roughness_1", PROP_FLOAT, PROP_NONE);
3328 RNA_def_property_float_sdna(prop, nullptr, "rough1");
3329 RNA_def_property_range(prop, 0.0f, 100000.0f);
3330 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
3331 RNA_def_property_ui_text(prop, "Roughness 1", "Amount of location dependent roughness");
3332 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3333
3334 prop = RNA_def_property(srna, "roughness_1_size", PROP_FLOAT, PROP_NONE);
3335 RNA_def_property_float_sdna(prop, nullptr, "rough1_size");
3336 RNA_def_property_range(prop, 0.01f, 100000.0f);
3337 RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3);
3338 RNA_def_property_ui_text(prop, "Size 1", "Size of location dependent roughness");
3339 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3340
3341 prop = RNA_def_property(srna, "roughness_2", PROP_FLOAT, PROP_NONE);
3342 RNA_def_property_float_sdna(prop, nullptr, "rough2");
3343 RNA_def_property_range(prop, 0.0f, 100000.0f);
3344 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
3345 RNA_def_property_ui_text(prop, "Roughness 2", "Amount of random roughness");
3346 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3347
3348 prop = RNA_def_property(srna, "roughness_2_size", PROP_FLOAT, PROP_NONE);
3349 RNA_def_property_float_sdna(prop, nullptr, "rough2_size");
3350 RNA_def_property_range(prop, 0.01f, 100000.0f);
3351 RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3);
3352 RNA_def_property_ui_text(prop, "Size 2", "Size of random roughness");
3353 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3354
3355 prop = RNA_def_property(srna, "roughness_2_threshold", PROP_FLOAT, PROP_FACTOR);
3356 RNA_def_property_float_sdna(prop, nullptr, "rough2_thres");
3357 RNA_def_property_range(prop, 0.0f, 1.0f);
3359 prop, "Threshold", "Amount of particles left untouched by random roughness");
3360 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3361
3362 prop = RNA_def_property(srna, "roughness_endpoint", PROP_FLOAT, PROP_NONE);
3363 RNA_def_property_float_sdna(prop, nullptr, "rough_end");
3364 RNA_def_property_range(prop, 0.0f, 100000.0f);
3365 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
3366 RNA_def_property_ui_text(prop, "Roughness Endpoint", "Amount of endpoint roughness");
3367 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3368
3369 prop = RNA_def_property(srna, "roughness_end_shape", PROP_FLOAT, PROP_NONE);
3370 RNA_def_property_float_sdna(prop, nullptr, "rough_end_shape");
3371 RNA_def_property_range(prop, 0.0f, 10.0f);
3372 RNA_def_property_ui_text(prop, "Shape", "Shape of endpoint roughness");
3373 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3374
3375 prop = RNA_def_property(srna, "use_roughness_curve", PROP_BOOLEAN, PROP_NONE);
3376 RNA_def_property_boolean_sdna(prop, nullptr, "child_flag", PART_CHILD_USE_ROUGH_CURVE);
3377 RNA_def_property_ui_text(prop, "Use Roughness Curve", "Use a curve to define roughness");
3378 RNA_def_property_update(prop, 0, "rna_ParticleSettings_use_roughness_curve_update");
3379
3380 prop = RNA_def_property(srna, "roughness_curve", PROP_POINTER, PROP_NONE);
3381 RNA_def_property_pointer_sdna(prop, nullptr, "roughcurve");
3382 RNA_def_property_struct_type(prop, "CurveMapping");
3384 RNA_def_property_ui_text(prop, "Roughness Curve", "Curve defining roughness");
3385 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3386
3387 prop = RNA_def_property(srna, "child_length", PROP_FLOAT, PROP_FACTOR);
3388 RNA_def_property_float_sdna(prop, nullptr, "clength");
3389 RNA_def_property_range(prop, 0.0f, 1.0f);
3390 RNA_def_property_ui_text(prop, "Length", "Length of child paths");
3391 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3392
3393 prop = RNA_def_property(srna, "child_length_threshold", PROP_FLOAT, PROP_FACTOR);
3394 RNA_def_property_float_sdna(prop, nullptr, "clength_thres");
3395 RNA_def_property_range(prop, 0.0f, 1.0f);
3397 prop, "Threshold", "Amount of particles left untouched by child path length");
3398 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3399
3400 /* parting */
3401 prop = RNA_def_property(srna, "child_parting_factor", PROP_FLOAT, PROP_FACTOR);
3402 RNA_def_property_float_sdna(prop, nullptr, "parting_fac");
3403 RNA_def_property_range(prop, 0.0f, 1.0f);
3405 prop, "Parting Factor", "Create parting in the children based on parent strands");
3406 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3407
3408 prop = RNA_def_property(srna, "child_parting_min", PROP_FLOAT, PROP_NONE);
3409 RNA_def_property_float_sdna(prop, nullptr, "parting_min");
3410 RNA_def_property_range(prop, 0.0f, 180.0f);
3412 "Parting Minimum",
3413 "Minimum root to tip angle (tip distance/root distance for long hair)");
3414 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3415
3416 prop = RNA_def_property(srna, "child_parting_max", PROP_FLOAT, PROP_NONE);
3417 RNA_def_property_float_sdna(prop, nullptr, "parting_max");
3418 RNA_def_property_range(prop, 0.0f, 180.0f);
3420 "Parting Maximum",
3421 "Maximum root to tip angle (tip distance/root distance for long hair)");
3422 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3423
3424 /* branching */
3425 prop = RNA_def_property(srna, "branch_threshold", PROP_FLOAT, PROP_FACTOR);
3426 RNA_def_property_float_sdna(prop, nullptr, "branch_thres");
3427 RNA_def_property_range(prop, 0.0f, 1.0f);
3428 RNA_def_property_ui_text(prop, "Threshold", "Threshold of branching");
3429 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3430
3431 /* drawing stuff */
3432 prop = RNA_def_property(srna, "line_length_tail", PROP_FLOAT, PROP_NONE);
3434 prop, "rna_PartSetting_linelentail_get", "rna_PartSetting_linelentail_set", nullptr);
3435 RNA_def_property_range(prop, 0.0f, 100000.0f);
3436 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
3437 RNA_def_property_ui_text(prop, "Tail", "Length of the line's tail");
3438 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3439
3440 prop = RNA_def_property(srna, "line_length_head", PROP_FLOAT, PROP_NONE);
3442 prop, "rna_PartSetting_linelenhead_get", "rna_PartSetting_linelenhead_set", nullptr);
3443 RNA_def_property_range(prop, 0.0f, 100000.0f);
3444 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
3445 RNA_def_property_ui_text(prop, "Head", "Length of the line's head");
3446 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3447
3448 prop = RNA_def_property(srna, "path_start", PROP_FLOAT, PROP_NONE);
3449 RNA_def_property_float_sdna(prop, nullptr, "path_start");
3450 RNA_def_property_float_funcs(prop, nullptr, nullptr, "rna_PartSetting_pathstartend_range");
3451 RNA_def_property_ui_text(prop, "Path Start", "Starting time of path");
3452 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3453
3454 prop = RNA_def_property(srna, "path_end", PROP_FLOAT, PROP_NONE);
3455 RNA_def_property_float_sdna(prop, nullptr, "path_end");
3456 RNA_def_property_float_funcs(prop, nullptr, nullptr, "rna_PartSetting_pathstartend_range");
3457 RNA_def_property_ui_text(prop, "Path End", "End time of path");
3458 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3459
3460 prop = RNA_def_property(srna, "trail_count", PROP_INT, PROP_NONE);
3461 RNA_def_property_int_sdna(prop, nullptr, "trail_count");
3462 RNA_def_property_range(prop, 1, 100000);
3463 RNA_def_property_ui_range(prop, 1, 100, 1, -1);
3464 RNA_def_property_ui_text(prop, "Trail Count", "Number of trail particles");
3465 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3466
3467 /* keyed particles */
3468 prop = RNA_def_property(srna, "keyed_loops", PROP_INT, PROP_NONE);
3469 RNA_def_property_int_sdna(prop, nullptr, "keyed_loops");
3470 RNA_def_property_range(prop, 1.0f, 10000.0f);
3471 RNA_def_property_ui_range(prop, 1.0f, 100.0f, 1, 3);
3472 RNA_def_property_ui_text(prop, "Loop Count", "Number of times the keys are looped");
3473 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3474
3475 /* Evaluated mesh support. */
3476 prop = RNA_def_property(srna, "use_modifier_stack", PROP_BOOLEAN, PROP_NONE);
3477 RNA_def_property_boolean_sdna(prop, nullptr, "use_modifier_stack", 0);
3479 prop,
3480 "Use Modifier Stack",
3481 "Emit particles from mesh with modifiers applied "
3482 "(must use same subdivision surface level for viewport and render for correct results)");
3483 RNA_def_property_update(prop, 0, "rna_Particle_change_type");
3484
3485 /* draw objects & collections */
3486 prop = RNA_def_property(srna, "instance_collection", PROP_POINTER, PROP_NONE);
3487 RNA_def_property_pointer_sdna(prop, nullptr, "instance_collection");
3488 RNA_def_property_struct_type(prop, "Collection");
3492 prop, "Instance Collection", "Show objects in this collection in place of particles");
3493 RNA_def_property_update(prop, 0, "rna_Particle_redo_count");
3494
3495 prop = RNA_def_property(srna, "instance_weights", PROP_COLLECTION, PROP_NONE);
3496 RNA_def_property_collection_sdna(prop, nullptr, "instance_weights", nullptr);
3497 RNA_def_property_struct_type(prop, "ParticleDupliWeight");
3499 "Instance Collection Weights",
3500 "Weights for all of the objects in the instance collection");
3501
3502 prop = RNA_def_property(srna, "active_instanceweight", PROP_POINTER, PROP_NONE);
3503 RNA_def_property_struct_type(prop, "ParticleDupliWeight");
3505 prop, "rna_ParticleDupliWeight_active_get", nullptr, nullptr, nullptr);
3506 RNA_def_property_ui_text(prop, "Active Instance Object", "");
3507
3508 prop = RNA_def_property(srna, "active_instanceweight_index", PROP_INT, PROP_UNSIGNED);
3510 "rna_ParticleDupliWeight_active_index_get",
3511 "rna_ParticleDupliWeight_active_index_set",
3512 "rna_ParticleDupliWeight_active_index_range");
3513 RNA_def_property_ui_text(prop, "Active Instance Object Index", "");
3514
3515 prop = RNA_def_property(srna, "instance_object", PROP_POINTER, PROP_NONE);
3516 RNA_def_property_struct_type(prop, "Object");
3519 RNA_def_property_ui_text(prop, "Instance Object", "Show this object in place of particles");
3520 RNA_def_property_update(prop, 0, "rna_Particle_redo_dependency");
3521
3522 /* boids */
3523 prop = RNA_def_property(srna, "boids", PROP_POINTER, PROP_NONE);
3524 RNA_def_property_struct_type(prop, "BoidSettings");
3526 RNA_def_property_ui_text(prop, "Boid Settings", "");
3527
3528 /* Fluid particles */
3529 prop = RNA_def_property(srna, "fluid", PROP_POINTER, PROP_NONE);
3530 RNA_def_property_struct_type(prop, "SPHFluidSettings");
3532 RNA_def_property_ui_text(prop, "SPH Fluid Settings", "");
3533
3534 /* Effector weights */
3535 prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
3536 RNA_def_property_struct_type(prop, "EffectorWeights");
3539 RNA_def_property_ui_text(prop, "Effector Weights", "");
3540
3541 /* animation here? */
3543
3544 prop = RNA_def_property(srna, "force_field_1", PROP_POINTER, PROP_NONE);
3545 RNA_def_property_pointer_sdna(prop, nullptr, "pd");
3546 RNA_def_property_struct_type(prop, "FieldSettings");
3547 RNA_def_property_pointer_funcs(prop, "rna_Particle_field1_get", nullptr, nullptr, nullptr);
3549 RNA_def_property_ui_text(prop, "Force Field 1", "");
3550
3551 prop = RNA_def_property(srna, "force_field_2", PROP_POINTER, PROP_NONE);
3552 RNA_def_property_pointer_sdna(prop, nullptr, "pd2");
3553 RNA_def_property_struct_type(prop, "FieldSettings");
3554 RNA_def_property_pointer_funcs(prop, "rna_Particle_field2_get", nullptr, nullptr, nullptr);
3556 RNA_def_property_ui_text(prop, "Force Field 2", "");
3557
3558 /* twist */
3559 prop = RNA_def_property(srna, "twist", PROP_FLOAT, PROP_NONE);
3560 RNA_def_property_range(prop, -100000.0f, 100000.0f);
3561 RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
3562 RNA_def_property_ui_text(prop, "Twist", "Number of turns around parent along the strand");
3563 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3564
3565 prop = RNA_def_property(srna, "use_twist_curve", PROP_BOOLEAN, PROP_NONE);
3566 RNA_def_property_boolean_sdna(prop, nullptr, "child_flag", PART_CHILD_USE_TWIST_CURVE);
3567 RNA_def_property_ui_text(prop, "Use Twist Curve", "Use a curve to define twist");
3568 RNA_def_property_update(prop, 0, "rna_ParticleSettings_use_twist_curve_update");
3569
3570 prop = RNA_def_property(srna, "twist_curve", PROP_POINTER, PROP_NONE);
3571 RNA_def_property_pointer_sdna(prop, nullptr, "twistcurve");
3572 RNA_def_property_struct_type(prop, "CurveMapping");
3574 RNA_def_property_ui_text(prop, "Twist Curve", "Curve defining twist");
3575 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3576
3577 /* hair shape */
3578 prop = RNA_def_property(srna, "use_close_tip", PROP_BOOLEAN, PROP_NONE);
3579 RNA_def_property_boolean_sdna(prop, nullptr, "shape_flag", PART_SHAPE_CLOSE_TIP);
3580 RNA_def_property_ui_text(prop, "Close Tip", "Set tip radius to zero");
3582 prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */
3583
3584 prop = RNA_def_property(srna, "shape", PROP_FLOAT, PROP_FACTOR);
3585 RNA_def_property_range(prop, -1.0f, 1.0f);
3586 RNA_def_property_ui_text(prop, "Shape", "Strand shape parameter");
3588 prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */
3589
3590 prop = RNA_def_property(srna, "root_radius", PROP_FLOAT, PROP_DISTANCE);
3591 RNA_def_property_float_sdna(prop, nullptr, "rad_root");
3592 RNA_def_property_range(prop, 0.0f, FLT_MAX);
3593 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 2);
3594 RNA_def_property_ui_text(prop, "Root Diameter", "Strand diameter width at the root");
3596 prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */
3597
3598 prop = RNA_def_property(srna, "tip_radius", PROP_FLOAT, PROP_DISTANCE);
3599 RNA_def_property_float_sdna(prop, nullptr, "rad_tip");
3600 RNA_def_property_range(prop, 0.0f, FLT_MAX);
3601 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 2);
3602 RNA_def_property_ui_text(prop, "Tip Diameter", "Strand diameter width at the tip");
3604 prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */
3605
3606 prop = RNA_def_property(srna, "radius_scale", PROP_FLOAT, PROP_NONE);
3607 RNA_def_property_float_sdna(prop, nullptr, "rad_scale");
3608 RNA_def_property_range(prop, 0.0f, FLT_MAX);
3609 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 2);
3610 RNA_def_property_ui_text(prop, "Diameter Scale", "Multiplier of diameter properties");
3612 prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */
3613}
3614
3616{
3617 StructRNA *srna;
3618 PropertyRNA *prop;
3619
3620 static const EnumPropertyItem mode_items[] = {
3621 {PTARGET_MODE_FRIEND, "FRIEND", 0, "Friend", ""},
3622 {PTARGET_MODE_NEUTRAL, "NEUTRAL", 0, "Neutral", ""},
3623 {PTARGET_MODE_ENEMY, "ENEMY", 0, "Enemy", ""},
3624 {0, nullptr, 0, nullptr, nullptr},
3625 };
3626
3627 srna = RNA_def_struct(brna, "ParticleTarget", nullptr);
3628 RNA_def_struct_ui_text(srna, "Particle Target", "Target particle system");
3629
3630 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
3632 prop, "rna_ParticleTarget_name_get", "rna_ParticleTarget_name_length", nullptr);
3633 RNA_def_property_ui_text(prop, "Name", "Particle target name");
3635 RNA_def_struct_name_property(srna, prop);
3636
3637 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
3638 RNA_def_property_pointer_sdna(prop, nullptr, "ob");
3642 prop,
3643 "Target Object",
3644 "The object that has the target particle system (empty if same object)");
3645 RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
3646
3647 prop = RNA_def_property(srna, "system", PROP_INT, PROP_UNSIGNED);
3648 RNA_def_property_int_sdna(prop, nullptr, "psys");
3649 RNA_def_property_range(prop, 1, INT_MAX);
3651 prop, "Target Particle System", "The index of particle system on the target object");
3652 RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
3653
3654 prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_TIME);
3655 RNA_def_property_float_sdna(prop, nullptr, "time");
3657 RNA_def_property_ui_text(prop, "Time", "");
3658 RNA_def_property_update(prop, 0, "rna_Particle_target_redo");
3659
3660 prop = RNA_def_property(srna, "duration", PROP_FLOAT, PROP_NONE);
3661 RNA_def_property_float_sdna(prop, nullptr, "duration");
3663 RNA_def_property_ui_text(prop, "Duration", "");
3664 RNA_def_property_update(prop, 0, "rna_Particle_target_redo");
3665
3666 prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
3667 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PTARGET_VALID);
3669 RNA_def_property_ui_text(prop, "Valid", "Keyed particles target is valid");
3670
3671 prop = RNA_def_property(srna, "alliance", PROP_ENUM, PROP_NONE);
3672 RNA_def_property_enum_sdna(prop, nullptr, "mode");
3673 RNA_def_property_enum_items(prop, mode_items);
3675 RNA_def_property_ui_text(prop, "Mode", "");
3676 RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
3677}
3679{
3680 StructRNA *srna;
3681 PropertyRNA *prop;
3682
3683 FunctionRNA *func;
3684 PropertyRNA *parm;
3685
3686 srna = RNA_def_struct(brna, "ParticleSystem", nullptr);
3687 RNA_def_struct_ui_text(srna, "Particle System", "Particle system in an object");
3688 RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
3689
3690 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
3691 RNA_def_property_ui_text(prop, "Name", "Particle system name");
3693 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_ParticleSystem_name_set");
3694 RNA_def_struct_name_property(srna, prop);
3695
3697
3698 /* access to particle settings is redirected through functions */
3699 /* to allow proper id-buttons functionality */
3700 prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
3701 // RNA_def_property_pointer_sdna(prop, nullptr, "part");
3702 RNA_def_property_struct_type(prop, "ParticleSettings");
3705 prop, "rna_particle_settings_get", "rna_particle_settings_set", nullptr, nullptr);
3706 RNA_def_property_ui_text(prop, "Settings", "Particle system settings");
3707 RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
3708
3709 prop = RNA_def_property(srna, "particles", PROP_COLLECTION, PROP_NONE);
3710 RNA_def_property_collection_sdna(prop, nullptr, "particles", "totpart");
3711 RNA_def_property_struct_type(prop, "Particle");
3713 RNA_def_property_ui_text(prop, "Particles", "Particles generated by the particle system");
3714
3715 prop = RNA_def_property(srna, "child_particles", PROP_COLLECTION, PROP_NONE);
3716 RNA_def_property_collection_sdna(prop, nullptr, "child", "totchild");
3717 RNA_def_property_struct_type(prop, "ChildParticle");
3720 prop, "Child Particles", "Child particles generated by the particle system");
3721
3722 prop = RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED);
3724 prop, "Seed", "Offset in the random number table, to get a different randomized result");
3725 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3726
3727 prop = RNA_def_property(srna, "child_seed", PROP_INT, PROP_UNSIGNED);
3729 prop,
3730 "Child Seed",
3731 "Offset in the random number table for child particles, to get a different "
3732 "randomized result");
3733 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3734
3735 /* hair */
3736 prop = RNA_def_property(srna, "is_global_hair", PROP_BOOLEAN, PROP_NONE);
3737 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PSYS_GLOBAL_HAIR);
3739 RNA_def_property_ui_text(prop, "Global Hair", "Hair keys are in global coordinate space");
3740
3741 prop = RNA_def_property(srna, "use_hair_dynamics", PROP_BOOLEAN, PROP_NONE);
3742 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PSYS_HAIR_DYNAMICS);
3743 RNA_def_property_ui_text(prop, "Hair Dynamics", "Enable hair dynamics using cloth simulation");
3744 RNA_def_property_update(prop, 0, "rna_Particle_hair_dynamics_update");
3745
3746 prop = RNA_def_property(srna, "cloth", PROP_POINTER, PROP_NONE);
3747 RNA_def_property_pointer_sdna(prop, nullptr, "clmd");
3748 RNA_def_property_struct_type(prop, "ClothModifier");
3751 RNA_def_property_ui_text(prop, "Cloth", "Cloth dynamics for hair");
3752
3753 /* reactor */
3754 prop = RNA_def_property(srna, "reactor_target_object", PROP_POINTER, PROP_NONE);
3755 RNA_def_property_pointer_sdna(prop, nullptr, "target_ob");
3758 "Reactor Target Object",
3759 "For reactor systems, the object that has the target particle system "
3760 "(empty if same object)");
3761 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3762
3763 prop = RNA_def_property(srna, "reactor_target_particle_system", PROP_INT, PROP_UNSIGNED);
3764 RNA_def_property_int_sdna(prop, nullptr, "target_psys");
3765 RNA_def_property_range(prop, 1, SHRT_MAX);
3767 "Reactor Target Particle System",
3768 "For reactor systems, index of particle system on the target object");
3769 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3770
3771 /* keyed */
3772 prop = RNA_def_property(srna, "use_keyed_timing", PROP_BOOLEAN, PROP_NONE);
3773 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PSYS_KEYED_TIMING);
3775 RNA_def_property_ui_text(prop, "Keyed Timing", "Use key times");
3776 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3777
3778 prop = RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
3779 RNA_def_property_struct_type(prop, "ParticleTarget");
3780 RNA_def_property_ui_text(prop, "Targets", "Target particle systems");
3781
3782 prop = RNA_def_property(srna, "active_particle_target", PROP_POINTER, PROP_NONE);
3783 RNA_def_property_struct_type(prop, "ParticleTarget");
3785 prop, "rna_ParticleSystem_active_particle_target_get", nullptr, nullptr, nullptr);
3786 RNA_def_property_ui_text(prop, "Active Particle Target", "");
3787
3788 prop = RNA_def_property(srna, "active_particle_target_index", PROP_INT, PROP_UNSIGNED);
3790 "rna_ParticleSystem_active_particle_target_index_get",
3791 "rna_ParticleSystem_active_particle_target_index_set",
3792 "rna_ParticleSystem_active_particle_target_index_range");
3793 RNA_def_property_ui_text(prop, "Active Particle Target Index", "");
3794
3795 /* vertex groups */
3796
3797 /* NOTE: internally store as ints, access as strings. */
3798# if 0 /* int access. works ok but isn't useful for the UI */
3799 prop = RNA_def_property(srna, "vertex_group_density", PROP_INT, PROP_NONE);
3800 RNA_def_property_int_sdna(prop, nullptr, "vgroup[0]");
3801 RNA_def_property_ui_text(prop, "Vertex Group Density", "Vertex group to control density");
3802 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3803# endif
3804
3805 prop = RNA_def_property(srna, "vertex_group_density", PROP_STRING, PROP_NONE);
3807 "rna_ParticleVGroup_name_get_0",
3808 "rna_ParticleVGroup_name_len_0",
3809 "rna_ParticleVGroup_name_set_0");
3810 RNA_def_property_ui_text(prop, "Vertex Group Density", "Vertex group to control density");
3811 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3812
3813 prop = RNA_def_property(srna, "invert_vertex_group_density", PROP_BOOLEAN, PROP_NONE);
3814 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_DENSITY));
3816 prop, "Vertex Group Density Negate", "Negate the effect of the density vertex group");
3817 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3818
3819 prop = RNA_def_property(srna, "vertex_group_velocity", PROP_STRING, PROP_NONE);
3821 "rna_ParticleVGroup_name_get_1",
3822 "rna_ParticleVGroup_name_len_1",
3823 "rna_ParticleVGroup_name_set_1");
3824 RNA_def_property_ui_text(prop, "Vertex Group Velocity", "Vertex group to control velocity");
3825 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3826
3827 prop = RNA_def_property(srna, "invert_vertex_group_velocity", PROP_BOOLEAN, PROP_NONE);
3828 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_VEL));
3830 prop, "Vertex Group Velocity Negate", "Negate the effect of the velocity vertex group");
3831 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3832
3833 prop = RNA_def_property(srna, "vertex_group_length", PROP_STRING, PROP_NONE);
3835 "rna_ParticleVGroup_name_get_2",
3836 "rna_ParticleVGroup_name_len_2",
3837 "rna_ParticleVGroup_name_set_2");
3838 RNA_def_property_ui_text(prop, "Vertex Group Length", "Vertex group to control length");
3839 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3840
3841 prop = RNA_def_property(srna, "invert_vertex_group_length", PROP_BOOLEAN, PROP_NONE);
3842 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_LENGTH));
3844 prop, "Vertex Group Length Negate", "Negate the effect of the length vertex group");
3845 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3846
3847 prop = RNA_def_property(srna, "vertex_group_clump", PROP_STRING, PROP_NONE);
3849 "rna_ParticleVGroup_name_get_3",
3850 "rna_ParticleVGroup_name_len_3",
3851 "rna_ParticleVGroup_name_set_3");
3852 RNA_def_property_ui_text(prop, "Vertex Group Clump", "Vertex group to control clump");
3853 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3854
3855 prop = RNA_def_property(srna, "invert_vertex_group_clump", PROP_BOOLEAN, PROP_NONE);
3856 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_CLUMP));
3858 prop, "Vertex Group Clump Negate", "Negate the effect of the clump vertex group");
3859 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3860
3861 prop = RNA_def_property(srna, "vertex_group_kink", PROP_STRING, PROP_NONE);
3863 "rna_ParticleVGroup_name_get_4",
3864 "rna_ParticleVGroup_name_len_4",
3865 "rna_ParticleVGroup_name_set_4");
3866 RNA_def_property_ui_text(prop, "Vertex Group Kink", "Vertex group to control kink");
3867 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3868
3869 prop = RNA_def_property(srna, "invert_vertex_group_kink", PROP_BOOLEAN, PROP_NONE);
3870 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_KINK));
3872 prop, "Vertex Group Kink Negate", "Negate the effect of the kink vertex group");
3873 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3874
3875 prop = RNA_def_property(srna, "vertex_group_roughness_1", PROP_STRING, PROP_NONE);
3877 "rna_ParticleVGroup_name_get_5",
3878 "rna_ParticleVGroup_name_len_5",
3879 "rna_ParticleVGroup_name_set_5");
3881 prop, "Vertex Group Roughness 1", "Vertex group to control roughness 1");
3882 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3883
3884 prop = RNA_def_property(srna, "invert_vertex_group_roughness_1", PROP_BOOLEAN, PROP_NONE);
3885 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_ROUGH1));
3887 "Vertex Group Roughness 1 Negate",
3888 "Negate the effect of the roughness 1 vertex group");
3889 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3890
3891 prop = RNA_def_property(srna, "vertex_group_roughness_2", PROP_STRING, PROP_NONE);
3893 "rna_ParticleVGroup_name_get_6",
3894 "rna_ParticleVGroup_name_len_6",
3895 "rna_ParticleVGroup_name_set_6");
3897 prop, "Vertex Group Roughness 2", "Vertex group to control roughness 2");
3898 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3899
3900 prop = RNA_def_property(srna, "invert_vertex_group_roughness_2", PROP_BOOLEAN, PROP_NONE);
3901 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_ROUGH2));
3903 "Vertex Group Roughness 2 Negate",
3904 "Negate the effect of the roughness 2 vertex group");
3905 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3906
3907 prop = RNA_def_property(srna, "vertex_group_roughness_end", PROP_STRING, PROP_NONE);
3909 "rna_ParticleVGroup_name_get_7",
3910 "rna_ParticleVGroup_name_len_7",
3911 "rna_ParticleVGroup_name_set_7");
3913 prop, "Vertex Group Roughness End", "Vertex group to control roughness end");
3914 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3915
3916 prop = RNA_def_property(srna, "invert_vertex_group_roughness_end", PROP_BOOLEAN, PROP_NONE);
3917 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_ROUGHE));
3919 "Vertex Group Roughness End Negate",
3920 "Negate the effect of the roughness end vertex group");
3921 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3922
3923 prop = RNA_def_property(srna, "vertex_group_size", PROP_STRING, PROP_NONE);
3925 "rna_ParticleVGroup_name_get_8",
3926 "rna_ParticleVGroup_name_len_8",
3927 "rna_ParticleVGroup_name_set_8");
3928 RNA_def_property_ui_text(prop, "Vertex Group Size", "Vertex group to control size");
3929 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3930
3931 prop = RNA_def_property(srna, "invert_vertex_group_size", PROP_BOOLEAN, PROP_NONE);
3932 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_SIZE));
3934 prop, "Vertex Group Size Negate", "Negate the effect of the size vertex group");
3935 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3936
3937 prop = RNA_def_property(srna, "vertex_group_tangent", PROP_STRING, PROP_NONE);
3939 "rna_ParticleVGroup_name_get_9",
3940 "rna_ParticleVGroup_name_len_9",
3941 "rna_ParticleVGroup_name_set_9");
3942 RNA_def_property_ui_text(prop, "Vertex Group Tangent", "Vertex group to control tangent");
3943 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3944
3945 prop = RNA_def_property(srna, "invert_vertex_group_tangent", PROP_BOOLEAN, PROP_NONE);
3946 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_TAN));
3948 prop, "Vertex Group Tangent Negate", "Negate the effect of the tangent vertex group");
3949 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3950
3951 prop = RNA_def_property(srna, "vertex_group_rotation", PROP_STRING, PROP_NONE);
3953 "rna_ParticleVGroup_name_get_10",
3954 "rna_ParticleVGroup_name_len_10",
3955 "rna_ParticleVGroup_name_set_10");
3956 RNA_def_property_ui_text(prop, "Vertex Group Rotation", "Vertex group to control rotation");
3957 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3958
3959 prop = RNA_def_property(srna, "invert_vertex_group_rotation", PROP_BOOLEAN, PROP_NONE);
3960 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_ROT));
3962 prop, "Vertex Group Rotation Negate", "Negate the effect of the rotation vertex group");
3963 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3964
3965 prop = RNA_def_property(srna, "vertex_group_field", PROP_STRING, PROP_NONE);
3967 "rna_ParticleVGroup_name_get_11",
3968 "rna_ParticleVGroup_name_len_11",
3969 "rna_ParticleVGroup_name_set_11");
3970 RNA_def_property_ui_text(prop, "Vertex Group Field", "Vertex group to control field");
3971 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3972
3973 prop = RNA_def_property(srna, "invert_vertex_group_field", PROP_BOOLEAN, PROP_NONE);
3974 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_EFFECTOR));
3976 prop, "Vertex Group Field Negate", "Negate the effect of the field vertex group");
3977 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3978
3979 prop = RNA_def_property(srna, "vertex_group_twist", PROP_STRING, PROP_NONE);
3981 "rna_ParticleVGroup_name_get_12",
3982 "rna_ParticleVGroup_name_len_12",
3983 "rna_ParticleVGroup_name_set_12");
3984 RNA_def_property_ui_text(prop, "Vertex Group Twist", "Vertex group to control twist");
3985 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3986
3987 prop = RNA_def_property(srna, "invert_vertex_group_twist", PROP_BOOLEAN, PROP_NONE);
3988 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_TWIST));
3990 prop, "Vertex Group Twist Negate", "Negate the effect of the twist vertex group");
3991 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3992
3993 /* pointcache */
3994 prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
3996 RNA_def_property_pointer_sdna(prop, nullptr, "pointcache");
3997 RNA_def_property_struct_type(prop, "PointCache");
3998 RNA_def_property_ui_text(prop, "Point Cache", "");
3999
4000 prop = RNA_def_property(srna, "has_multiple_caches", PROP_BOOLEAN, PROP_NONE);
4001 RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_multiple_caches_get", nullptr);
4003 RNA_def_property_ui_text(prop, "Multiple Caches", "Particle system has multiple point caches");
4004
4005 /* offset ob */
4006 prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
4007 RNA_def_property_pointer_sdna(prop, nullptr, "parent");
4011 prop, "Parent", "Use this object's coordinate system instead of global coordinate system");
4012 RNA_def_property_update(prop, 0, "rna_Particle_redo");
4013
4014 /* hair or cache editing */
4015 prop = RNA_def_property(srna, "is_editable", PROP_BOOLEAN, PROP_NONE);
4016 RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_editable_get", nullptr);
4018 RNA_def_property_ui_text(prop, "Editable", "Particle system can be edited in particle mode");
4019
4020 prop = RNA_def_property(srna, "is_edited", PROP_BOOLEAN, PROP_NONE);
4021 RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_edited_get", nullptr);
4023 RNA_def_property_ui_text(prop, "Edited", "Particle system has been edited in particle mode");
4024
4025 /* Read-only: this is calculated internally. Changing it would only affect
4026 * the next time-step. The user should change ParticlSettings.subframes or
4027 * ParticleSettings.courant_target instead. */
4028 prop = RNA_def_property(srna, "dt_frac", PROP_FLOAT, PROP_NONE);
4029 RNA_def_property_range(prop, 1.0f / 101.0f, 1.0f);
4031 prop, "Timestep", "The current simulation time step size, as a fraction of a frame");
4033
4035
4036 RNA_def_struct_path_func(srna, "rna_ParticleSystem_path");
4037
4038 /* extract cached hair location data */
4039 func = RNA_def_function(srna, "co_hair", "rna_ParticleSystem_co_hair");
4040 RNA_def_function_ui_description(func, "Obtain cache hair data");
4041 parm = RNA_def_pointer(func, "object", "Object", "", "Object");
4043 RNA_def_int(func, "particle_no", 0, INT_MIN, INT_MAX, "Particle no", "", INT_MIN, INT_MAX);
4044 RNA_def_int(func, "step", 0, INT_MIN, INT_MAX, "step no", "", INT_MIN, INT_MAX);
4045 parm = RNA_def_float_vector(
4046 func, "co", 3, nullptr, -FLT_MAX, FLT_MAX, "Co", "Exported hairkey location", -1e4, 1e4);
4048 RNA_def_function_output(func, parm);
4049
4050 /* extract hair UVs */
4051 func = RNA_def_function(srna, "uv_on_emitter", "rna_ParticleSystem_uv_on_emitter");
4052 RNA_def_function_ui_description(func, "Obtain uv for all particles");
4054 parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
4056 parm = RNA_def_pointer(func, "particle", "Particle", "", "Particle");
4058 RNA_def_int(func, "particle_no", 0, INT_MIN, INT_MAX, "Particle no", "", INT_MIN, INT_MAX);
4059 RNA_def_int(func, "uv_no", 0, INT_MIN, INT_MAX, "UV no", "", INT_MIN, INT_MAX);
4060 parm = RNA_def_property(func, "uv", PROP_FLOAT, PROP_COORDS);
4061 RNA_def_property_array(parm, 2);
4063 RNA_def_function_output(func, parm);
4064
4065 /* Extract hair vertex-colors. */
4066 func = RNA_def_function(srna, "mcol_on_emitter", "rna_ParticleSystem_mcol_on_emitter");
4068 RNA_def_function_ui_description(func, "Obtain mcol for all particles");
4069 parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
4071 parm = RNA_def_pointer(func, "particle", "Particle", "", "Particle");
4073 RNA_def_int(func, "particle_no", 0, INT_MIN, INT_MAX, "Particle no", "", INT_MIN, INT_MAX);
4074 RNA_def_int(func, "vcol_no", 0, INT_MIN, INT_MAX, "vcol no", "", INT_MIN, INT_MAX);
4075 parm = RNA_def_property(func, "mcol", PROP_FLOAT, PROP_COLOR);
4076 RNA_def_property_array(parm, 3);
4078 RNA_def_function_output(func, parm);
4079}
4080
4095
4096#endif
void boid_default_settings(struct BoidSettings *boids)
Definition boids.cc:1638
struct BoidRule * boid_new_rule(int type)
Definition boids.cc:1585
struct BoidState * boid_new_state(struct BoidSettings *boids)
Definition boids.cc:1664
PointerRNA CTX_data_pointer_get(const bContext *C, const char *member)
Main * CTX_data_main(const bContext *C)
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)
bool CustomData_has_layer(const CustomData *data, eCustomDataType type)
support for deformation groups and hooks.
const ListBase * BKE_object_defgroup_list(const Object *ob)
Definition deform.cc:574
int BKE_object_defgroup_name_index(const Object *ob, blender::StringRef name)
Definition deform.cc:580
void id_us_plus(ID *id)
Definition lib_id.cc:353
void id_us_min(ID *id)
Definition lib_id.cc:361
General operations, lookup, etc. for materials.
Material * BKE_object_material_get(Object *ob, short act)
void BKE_mesh_tessface_ensure(Mesh *mesh)
ModifierData * BKE_modifier_get_original(const Object *object, ModifierData *md)
ModifierData * BKE_modifier_new(int type)
void BKE_particlesettings_fluid_default_settings(struct ParticleSettings *part)
#define DMCACHE_NOTFOUND
void BKE_particlesettings_rough_curve_init(struct ParticleSettings *part)
Definition particle.cc:4109
bool psys_check_edited(struct ParticleSystem *psys)
Definition particle.cc:735
void BKE_particlesettings_twist_curve_init(struct ParticleSettings *part)
Definition particle.cc:4123
void psys_interpolate_uvs(const struct MTFace *tface, int quad, const float w[4], float uvco[2])
void psys_check_group_weights(struct ParticleSettings *part)
Definition particle.cc:765
void BKE_particlesettings_clump_curve_init(struct ParticleSettings *part)
Definition particle.cc:4095
void psys_mat_hair_to_object(struct Object *ob, struct Mesh *mesh, short from, struct ParticleData *pa, float hairmat[4][4])
Definition particle.cc:3842
void psys_particle_on_emitter(struct 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])
Definition particle.cc:2244
void psys_check_boid_data(struct ParticleSystem *psys)
void psys_changed_type(struct Object *ob, struct ParticleSystem *psys)
void psys_find_group_weights(struct ParticleSettings *part)
Definition particle.cc:744
#define DMCACHE_ISCHILD
void psys_interpolate_mcol(const struct MCol *mcol, int quad, const float w[4], struct MCol *mc)
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:126
struct Tex * give_current_particle_texture(struct ParticleSettings *part)
Definition texture.cc:549
void set_current_particle_texture(struct ParticleSettings *part, struct Tex *tex)
Definition texture.cc:566
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:534
#define LISTBASE_FOREACH(type, var, list)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:111
int BLI_listbase_count(const ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:524
MINLINE int max_ii(int a, int b)
void mul_m4_v3(const float M[4][4], float r[3])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void zero_v2(float r[2])
MINLINE void zero_v3(float r[3])
ATTR_WARN_UNUSED_RESULT const size_t num
size_t BLI_snprintf_rlen(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
char char size_t BLI_strncpy_rlen(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define STRNCPY_UTF8(dst, src)
void BLI_uniquename(const struct ListBase *list, void *vlink, const char *defname, char delim, int name_offset, size_t name_maxncpy) ATTR_NONNULL(1
#define ARRAY_HAS_ITEM(arr_item, arr_start, arr_len)
#define ELEM(...)
#define BLT_I18NCONTEXT_AMOUNT
#define RPT_(msgid)
#define BLT_I18NCONTEXT_ID_IMAGE
#define BLT_I18NCONTEXT_ID_PARTICLESETTINGS
#define DATA_(msgid)
#define BLT_I18NCONTEXT_ID_TEXTURE
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
@ ID_RECALC_PSYS_PHYS
Definition DNA_ID.h:995
@ ID_RECALC_PSYS_REDO
Definition DNA_ID.h:989
@ ID_RECALC_PSYS_CHILD
Definition DNA_ID.h:993
@ ID_RECALC_PSYS_RESET
Definition DNA_ID.h:991
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:982
@ ID_PA
#define BOIDSTATE_CURRENT
@ BOIDRULE_CURRENT
@ eBoidRuleType_Flock
@ eBoidRuleType_Separate
@ CLOTH_COLLSETTINGS_FLAG_SELF
@ CLOTH_SIMSETTINGS_FLAG_RESIST_SPRING_COMPRESS
@ CD_PROP_BYTE_COLOR
@ CD_PROP_FLOAT2
@ TEXCO_ORCO
@ TEXCO_GLOB
@ TEXCO_OBJECT
@ TEXCO_STRAND
@ eModifierType_ParticleSystem
@ eModifierType_Cloth
@ SPH_FAC_DENSITY
@ SPH_CURRENT_REST_LENGTH
@ SPH_FAC_REST_LENGTH
@ SPH_FAC_REPULSION
@ SPH_FAC_VISCOSITY
@ SPH_VISCOELASTIC_SPRINGS
@ SPH_FAC_RADIUS
@ PART_SHAPE_CLOSE_TIP
@ PART_DUPLIW_CURRENT
@ PART_TIME_AUTOSF
@ PART_CHILD_PARTICLES
@ PART_CHILD_FACES
@ PART_FROM_VOLUME
@ PART_FROM_VERT
@ PART_FROM_FACE
@ PART_EVENT_NEAR
@ PART_EVENT_DEATH
@ PART_EVENT_COLLIDE
@ PART_DRAW_COL_NONE
@ PART_DRAW_COL_ACC
@ PART_DRAW_COL_MAT
@ PART_DRAW_COL_VEL
@ PART_UNBORN
@ PART_CHILD_LONG_HAIR
@ PART_REACT_STA_END
@ PART_BOIDS_2D
@ PART_EDISTR
@ PART_SIZEMASS
@ PART_HAIR_REGROW
@ PART_ROT_DYN
@ PART_CHILD_GUIDE
@ PART_DIE_ON_COL
@ PART_CHILD_EFFECT
@ PART_HIDE_ADVANCED_HAIR
@ PART_SIZE_DEFL
@ PART_HAIR_BSPLINE
@ PART_DIED
@ PART_GRID_HEXAGONAL
@ PART_GRID_INVERT
@ PART_SELF_EFFECT
@ PART_ROTATIONS
@ PART_REACT_MULTIPLE
@ PART_TRAND
@ PART_INT_VERLET
@ PART_INT_MIDPOINT
@ PART_INT_RK4
@ PART_INT_EULER
@ PSYS_HAIR_DYNAMICS
@ PSYS_EDITED
@ PSYS_GLOBAL_HAIR
@ PSYS_KEYED_TIMING
@ PART_DRAW_WHOLE_GR
@ PART_DRAW_REN_STRAND
@ PART_DRAW_SIZE
@ PART_DRAW_VEL
@ PART_DRAW_GLOBAL_OB
@ PART_DRAW_PARENT
@ PART_DRAW_NUM
@ PART_DRAW_NO_SCALE_OB
@ PART_DRAW_COUNT_GR
@ PART_DRAW_HAIR_GRID
@ PART_ABS_PATH_TIME
@ PART_DRAW_REN_ADAPT
@ PART_DRAW_HEALTH
@ PART_DRAW_RAND_GR
@ PART_DRAW_VEL_LENGTH
@ PART_DRAW_GUIDE_HAIRS
@ PART_DRAW_ROTATE_OB
@ PART_AVE_GLOBAL_X
@ PART_AVE_GLOBAL_Z
@ PART_AVE_VERTICAL
@ PART_AVE_VELOCITY
@ PART_AVE_GLOBAL_Y
@ PART_AVE_HORIZONTAL
@ PART_AVE_RAND
@ PART_DISTR_GRID
@ PART_DISTR_RAND
@ PART_DISTR_JIT
@ PAMAP_DENS
@ PAMAP_FIELD
@ PAMAP_KINK_FREQ
@ PAMAP_TWIST
@ PAMAP_DAMP
@ PAMAP_SIZE
@ PAMAP_IVEL
@ PAMAP_GRAVITY
@ PAMAP_LIFE
@ PAMAP_KINK_AMP
@ PAMAP_TIME
@ PAMAP_CLUMP
@ PAMAP_LENGTH
@ PAMAP_ROUGH
@ PART_KINK_BRAID
@ PART_KINK_WAVE
@ PART_KINK_SPIRAL
@ PART_KINK_RADIAL
@ PART_KINK_CURL
@ PART_KINK_NO
@ SPH_SOLVER_DDR
@ SPH_SOLVER_CLASSICAL
@ PART_FLUID_FLIP
@ PART_EMITTER
@ PART_FLUID_BUBBLE
@ PART_FLUID_SPRAYBUBBLE
@ PART_FLUID_TRACER
@ PART_FLUID
@ PART_FLUID_FOAM
@ PART_FLUID_SPRAYFOAMBUBBLE
@ PART_FLUID_SPRAYFOAM
@ PART_HAIR
@ PART_FLUID_SPRAY
@ PART_FLUID_FOAMBUBBLE
@ PART_DRAW_CIRC
@ PART_DRAW_CROSS
@ PART_DRAW_AXIS
@ PART_DRAW_PATH
@ PART_DRAW_LINE
@ PART_DRAW_NOT
@ PART_DRAW_GR
@ PART_DRAW_OB
@ PART_DRAW_REND
@ PART_DRAW_HALO
@ PART_DRAW_DOT
@ PSYS_VG_ROUGHE
@ PSYS_VG_SIZE
@ PSYS_VG_ROT
@ PSYS_VG_LENGTH
@ PSYS_VG_ROUGH1
@ PSYS_VG_DENSITY
@ PSYS_VG_CLUMP
@ PSYS_VG_VEL
@ PSYS_VG_TAN
@ PSYS_VG_KINK
@ PSYS_VG_EFFECTOR
@ PSYS_VG_ROUGH2
@ PSYS_VG_TWIST
@ PART_PHYS_FLUID
@ PART_PHYS_NEWTON
@ PART_PHYS_KEYED
@ PART_PHYS_BOIDS
@ PART_PHYS_NO
@ PTARGET_MODE_ENEMY
@ PTARGET_MODE_FRIEND
@ PTARGET_MODE_NEUTRAL
@ PARS_ALIVE
@ PARS_DYING
@ PARS_DEAD
@ PARS_UNBORN
@ PARS_NO_DISP
@ PARS_UNEXIST
@ PTARGET_CURRENT
@ PTARGET_VALID
@ PART_CHILD_USE_TWIST_CURVE
@ PART_CHILD_USE_CLUMP_CURVE
@ PART_CHILD_USE_CLUMP_NOISE
@ PART_CHILD_USE_ROUGH_CURVE
@ PART_ROT_VEL
@ PART_ROT_OB_Y
@ PART_ROT_NOR_TAN
@ PART_ROT_OB_Z
@ PART_ROT_GLOB_Y
@ PART_ROT_GLOB_X
@ PART_ROT_NOR
@ PART_ROT_OB_X
@ PART_ROT_GLOB_Z
#define MAXFRAMEF
#define MINAFRAMEF
@ MTEX_FLAT
@ MTEX_SPHERE
@ MTEX_CUBE
@ MTEX_TUBE
ParameterFlag
Definition RNA_types.hh:510
@ PARM_REQUIRED
Definition RNA_types.hh:511
@ FUNC_USE_REPORTS
Definition RNA_types.hh:805
@ FUNC_USE_SELF_ID
Definition RNA_types.hh:792
@ PROP_FLOAT
Definition RNA_types.hh:152
@ PROP_BOOLEAN
Definition RNA_types.hh:150
@ PROP_ENUM
Definition RNA_types.hh:154
@ PROP_INT
Definition RNA_types.hh:151
@ PROP_STRING
Definition RNA_types.hh:153
@ PROP_POINTER
Definition RNA_types.hh:155
@ PROP_COLLECTION
Definition RNA_types.hh:156
@ PROP_UNIT_MASS
Definition RNA_types.hh:165
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:469
@ PROPOVERRIDE_NO_COMPARISON
Definition RNA_types.hh:477
@ PROP_THICK_WRAP
Definition RNA_types.hh:397
@ PROP_ANIMATABLE
Definition RNA_types.hh:305
@ PROP_EDITABLE
Definition RNA_types.hh:292
@ PROP_NEVER_NULL
Definition RNA_types.hh:351
@ PROP_ID_REFCOUNT
Definition RNA_types.hh:338
@ PROP_TIME
Definition RNA_types.hh:241
@ PROP_DISTANCE
Definition RNA_types.hh:244
@ PROP_COLOR
Definition RNA_types.hh:248
@ PROP_COORDS
Definition RNA_types.hh:262
@ PROP_NONE
Definition RNA_types.hh:221
@ PROP_PERCENTAGE
Definition RNA_types.hh:238
@ PROP_FACTOR
Definition RNA_types.hh:239
@ PROP_TRANSLATION
Definition RNA_types.hh:249
@ PROP_UNSIGNED
Definition RNA_types.hh:237
@ PROP_QUATERNION
Definition RNA_types.hh:255
@ PROP_VELOCITY
Definition RNA_types.hh:251
#define C
Definition RandGen.cpp:29
#define MAX_MTEX
Definition Stroke.h:31
#define ND_MODIFIER
Definition WM_types.hh:459
#define NA_EDITED
Definition WM_types.hh:581
#define ND_PARTICLE
Definition WM_types.hh:462
ReportList * reports
Definition WM_types.hh:1025
#define NA_RENAME
Definition WM_types.hh:585
#define NC_OBJECT
Definition WM_types.hh:376
BMesh const char void * data
#define offsetof(t, d)
uint nor
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
#define MAX_ID_NAME
#define GS(a)
ccl_device_inline uint particle_index(KernelGlobals kg, const int particle)
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
static ulong state[N]
void rna_iterator_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, void *data, int itemsize, int length, bool free_ptr, IteratorSkipFunc skip)
const PointerRNA PointerRNA_NULL
PointerRNA RNA_pointer_create_with_parent(const PointerRNA &parent, StructRNA *type, void *data)
PointerRNA RNA_id_pointer_create(ID *id)
void rna_def_animdata_common(StructRNA *srna)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_define_lib_overridable(const bool make_overridable)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
PropertyRNA * RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
void RNA_def_property_array(PropertyRNA *prop, int length)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
void RNA_def_function_flag(FunctionRNA *func, int flag)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_function_output(FunctionRNA *, PropertyRNA *ret)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
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)
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void rna_def_mtex_common(BlenderRNA *brna, StructRNA *srna, const char *begin, const char *activeget, const char *activeset, const char *activeeditable, const char *name, const char *name_slots, const char *update, const char *update_index)
const EnumPropertyItem rna_enum_axis_xyz_items[]
static void rna_def_particle_settings(BlenderRNA *brna)
static void rna_def_fluid_settings(BlenderRNA *brna)
static void rna_def_particle_settings_mtex(BlenderRNA *brna)
static const EnumPropertyItem part_type_items[]
static void rna_def_particle_dupliweight(BlenderRNA *brna)
static const EnumPropertyItem part_draw_as_items[]
void RNA_def_particle(BlenderRNA *brna)
static void rna_def_particle_target(BlenderRNA *brna)
static void rna_def_particle_system(BlenderRNA *brna)
static void rna_def_particle(BlenderRNA *brna)
static void rna_def_particle_hair_key(BlenderRNA *brna)
static const EnumPropertyItem part_reactor_from_items[]
static const EnumPropertyItem part_dist_items[]
static void rna_def_particle_key(BlenderRNA *brna)
static const EnumPropertyItem part_ren_as_items[]
static void rna_def_child_particle(BlenderRNA *brna)
const EnumPropertyItem rna_enum_dummy_DEFAULT_items[]
Definition rna_rna.cc:32
#define min(a, b)
Definition sort.cc:36
#define FLT_MAX
Definition stdcycles.h:14
struct ListBase states
struct ClothSimSettings * sim_parms
struct ClothCollSettings * coll_parms
const char * identifier
Definition RNA_types.hh:623
const char * name
Definition RNA_types.hh:627
Definition DNA_ID.h:404
void * next
Definition DNA_ID.h:407
char name[66]
Definition DNA_ID.h:415
void * last
void * first
unsigned char r
unsigned char g
unsigned char b
unsigned int v2
unsigned int v1
unsigned int v4
unsigned int v3
CustomData corner_data
CustomData fdata_legacy
int totface_legacy
int verts_num
struct ModifierData * next
ListBase particlesystem
ListBase modifiers
struct ParticleDupliWeight * next
struct CurveMapping * clumpcurve
struct PartDeflect * pd2
struct CurveMapping * roughcurve
struct CurveMapping * twistcurve
struct BoidSettings * boids
struct MTex * mtex[18]
struct PartDeflect * pd
struct ListBase instance_weights
struct SPHFluidSettings * fluid
struct ParticleSystem * psys
ChildParticle * child
struct PTCacheEdit * edit
struct ListBase ptcaches
ParticleData * particles
struct ListBase targets
ParticleSettings * part
struct ParticleSystem * next
struct PointCache * pointcache
struct ClothModifierData * clmd
struct ParticleCacheKey ** childcache
struct Mesh * hair_out_mesh
struct ParticleCacheKey ** pathcache
struct Object * ob
struct ParticleTarget * next
struct PTCacheEdit * edit
i
Definition text_draw.cc:230
max
Definition text_draw.cc:251
void WM_main_add_notifier(uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4227
uint8_t flag
Definition wm_window.cc:139