Blender V5.0
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,
366 ReportList *reports,
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,
664 ReportList *reports,
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,
705 ReportList *reports,
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 }
998 else
999# endif
1000 if (value < MINAFRAMEF) {
1001 value = MINAFRAMEF;
1002 }
1003
1004 settings->sta = value;
1005}
1006
1007static void rna_PartSettings_end_set(PointerRNA *ptr, float value)
1008{
1009 ParticleSettings *settings = (ParticleSettings *)ptr->data;
1010
1011 /* check for clipping */
1012 if (value < settings->sta) {
1013 settings->sta = value;
1014 }
1015
1016 settings->end = value;
1017}
1018
1019static void rna_PartSetings_timestep_set(PointerRNA *ptr, float value)
1020{
1021 ParticleSettings *settings = (ParticleSettings *)ptr->data;
1022
1023 settings->timetweak = value / 0.04f;
1024}
1025
1026static float rna_PartSettings_timestep_get(PointerRNA *ptr)
1027{
1028 ParticleSettings *settings = (ParticleSettings *)ptr->data;
1029
1030 return settings->timetweak * 0.04f;
1031}
1032
1033static void rna_PartSetting_hairlength_set(PointerRNA *ptr, float value)
1034{
1035 ParticleSettings *settings = (ParticleSettings *)ptr->data;
1036 settings->normfac = value / 4.0f;
1037}
1038
1039static float rna_PartSetting_hairlength_get(PointerRNA *ptr)
1040{
1041 ParticleSettings *settings = (ParticleSettings *)ptr->data;
1042 return settings->normfac * 4.0f;
1043}
1044
1045static void rna_PartSetting_linelentail_set(PointerRNA *ptr, float value)
1046{
1047 ParticleSettings *settings = (ParticleSettings *)ptr->data;
1048 settings->draw_line[0] = value;
1049}
1050
1051static float rna_PartSetting_linelentail_get(PointerRNA *ptr)
1052{
1053 ParticleSettings *settings = (ParticleSettings *)ptr->data;
1054 return settings->draw_line[0];
1055}
1056static void rna_PartSetting_pathstartend_range(
1057 PointerRNA *ptr, float *min, float *max, float * /*softmin*/, float * /*softmax*/)
1058{
1059 ParticleSettings *settings = (ParticleSettings *)ptr->data;
1060
1061 if (settings->type == PART_HAIR) {
1062 *min = 0.0f;
1063 *max = (settings->draw & PART_ABS_PATH_TIME) ? 100.0f : 1.0f;
1064 }
1065 else {
1066 *min = (settings->draw & PART_ABS_PATH_TIME) ? settings->sta : 0.0f;
1067 *max = (settings->draw & PART_ABS_PATH_TIME) ? MAXFRAMEF : 1.0f;
1068 }
1069}
1070static void rna_PartSetting_linelenhead_set(PointerRNA *ptr, float value)
1071{
1072 ParticleSettings *settings = (ParticleSettings *)ptr->data;
1073 settings->draw_line[1] = value;
1074}
1075
1076static float rna_PartSetting_linelenhead_get(PointerRNA *ptr)
1077{
1078 ParticleSettings *settings = (ParticleSettings *)ptr->data;
1079 return settings->draw_line[1];
1080}
1081
1082static bool rna_PartSettings_is_fluid_get(PointerRNA *ptr)
1083{
1084 ParticleSettings *part = static_cast<ParticleSettings *>(ptr->data);
1085 return ELEM(part->type,
1086 PART_FLUID,
1096}
1097
1098static void rna_ParticleSettings_use_clump_curve_update(Main *bmain, Scene *scene, PointerRNA *ptr)
1099{
1100 ParticleSettings *part = static_cast<ParticleSettings *>(ptr->data);
1101
1103 if (!part->clumpcurve) {
1105 }
1106 }
1107
1108 rna_Particle_redo_child(bmain, scene, ptr);
1109}
1110
1111static void rna_ParticleSettings_use_roughness_curve_update(Main *bmain,
1112 Scene *scene,
1113 PointerRNA *ptr)
1114{
1115 ParticleSettings *part = static_cast<ParticleSettings *>(ptr->data);
1116
1118 if (!part->roughcurve) {
1120 }
1121 }
1122
1123 rna_Particle_redo_child(bmain, scene, ptr);
1124}
1125
1126static void rna_ParticleSettings_use_twist_curve_update(Main *bmain, Scene *scene, PointerRNA *ptr)
1127{
1128 ParticleSettings *part = static_cast<ParticleSettings *>(ptr->data);
1129
1131 if (!part->twistcurve) {
1133 }
1134 }
1135
1136 rna_Particle_redo_child(bmain, scene, ptr);
1137}
1138
1139static void rna_ParticleSystem_name_set(PointerRNA *ptr, const char *value)
1140{
1141 Object *ob = (Object *)ptr->owner_id;
1142 ParticleSystem *part = (ParticleSystem *)ptr->data;
1143
1144 /* copy the new name into the name slot */
1145 STRNCPY_UTF8(part->name, value);
1146
1148 part,
1149 DATA_("ParticleSystem"),
1150 '.',
1152 sizeof(part->name));
1153}
1154
1155static PointerRNA rna_ParticleSystem_active_particle_target_get(PointerRNA *ptr)
1156{
1157 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1158 ParticleTarget *pt = static_cast<ParticleTarget *>(psys->targets.first);
1159
1160 for (; pt; pt = pt->next) {
1161 if (pt->flag & PTARGET_CURRENT) {
1162 return RNA_pointer_create_with_parent(*ptr, &RNA_ParticleTarget, pt);
1163 }
1164 }
1165 return PointerRNA_NULL;
1166}
1167static void rna_ParticleSystem_active_particle_target_index_range(
1168 PointerRNA *ptr, int *min, int *max, int * /*softmin*/, int * /*softmax*/)
1169{
1170 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1171 *min = 0;
1172 *max = max_ii(0, BLI_listbase_count(&psys->targets) - 1);
1173}
1174
1175static int rna_ParticleSystem_active_particle_target_index_get(PointerRNA *ptr)
1176{
1177 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1178 ParticleTarget *pt = static_cast<ParticleTarget *>(psys->targets.first);
1179 int i = 0;
1180
1181 for (; pt; pt = pt->next, i++) {
1182 if (pt->flag & PTARGET_CURRENT) {
1183 return i;
1184 }
1185 }
1186
1187 return 0;
1188}
1189
1190static void rna_ParticleSystem_active_particle_target_index_set(PointerRNA *ptr, int value)
1191{
1192 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1193 ParticleTarget *pt = static_cast<ParticleTarget *>(psys->targets.first);
1194 int i = 0;
1195
1196 for (; pt; pt = pt->next, i++) {
1197 if (i == value) {
1198 pt->flag |= PTARGET_CURRENT;
1199 }
1200 else {
1201 pt->flag &= ~PTARGET_CURRENT;
1202 }
1203 }
1204}
1205
1206static size_t rna_ParticleTarget_name_get_impl(PointerRNA *ptr,
1207 char *value,
1208 const size_t value_maxncpy)
1209{
1210 ParticleTarget *pt = static_cast<ParticleTarget *>(ptr->data);
1211
1212 if (pt->flag & PTARGET_VALID) {
1213 ParticleSystem *psys = nullptr;
1214
1215 if (pt->ob) {
1216 psys = static_cast<ParticleSystem *>(BLI_findlink(&pt->ob->particlesystem, pt->psys - 1));
1217 }
1218 else {
1219 Object *ob = (Object *)ptr->owner_id;
1220 psys = static_cast<ParticleSystem *>(BLI_findlink(&ob->particlesystem, pt->psys - 1));
1221 }
1222
1223 if (psys) {
1224 int value_len;
1225 if (pt->ob) {
1226 value_len = BLI_snprintf_rlen(
1227 value, value_maxncpy, "%s: %s", pt->ob->id.name + 2, psys->name);
1228 }
1229 else {
1230 value_len = BLI_strncpy_rlen(value, psys->name, value_maxncpy);
1231 }
1232 return value_len;
1233 }
1234 }
1235
1236 return BLI_strncpy_rlen(value, RPT_("Invalid target!"), value_maxncpy);
1237}
1238
1239static void rna_ParticleTarget_name_get(PointerRNA *ptr, char *value)
1240{
1241 char value_buf[MAX_ID_NAME + MAX_ID_NAME + 64];
1242 const size_t value_buf_len = rna_ParticleTarget_name_get_impl(ptr, value_buf, sizeof(value_buf));
1243 memcpy(value, value_buf, value_buf_len + 1);
1244}
1245
1246static int rna_ParticleTarget_name_length(PointerRNA *ptr)
1247{
1248 char value_buf[MAX_ID_NAME + MAX_ID_NAME + 64];
1249 return rna_ParticleTarget_name_get_impl(ptr, value_buf, sizeof(value_buf));
1250}
1251
1252static int particle_id_check(const PointerRNA *ptr)
1253{
1254 const ID *id = ptr->owner_id;
1255
1256 return (GS(id->name) == ID_PA);
1257}
1258
1259static std::optional<std::string> rna_SPHFluidSettings_path(const PointerRNA *ptr)
1260{
1261 const SPHFluidSettings *fluid = (SPHFluidSettings *)ptr->data;
1262
1263 if (particle_id_check(ptr)) {
1264 const ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
1265
1266 if (part->fluid == fluid) {
1267 return "fluid";
1268 }
1269 }
1270 return std::nullopt;
1271}
1272
1273static bool rna_ParticleSystem_multiple_caches_get(PointerRNA *ptr)
1274{
1275 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1276
1277 return (psys->ptcaches.first != psys->ptcaches.last);
1278}
1279static bool rna_ParticleSystem_editable_get(PointerRNA *ptr)
1280{
1281 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1282
1283 return psys_check_edited(psys);
1284}
1285static bool rna_ParticleSystem_edited_get(PointerRNA *ptr)
1286{
1287 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1288
1289 if (psys->part && psys->part->type == PART_HAIR) {
1290 return (psys->flag & PSYS_EDITED || (psys->edit && psys->edit->edited));
1291 }
1292 else {
1293 return (psys->pointcache->edit && psys->pointcache->edit->edited);
1294 }
1295}
1296static PointerRNA rna_ParticleDupliWeight_active_get(PointerRNA *ptr)
1297{
1298 ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
1300
1301 for (; dw; dw = dw->next) {
1302 if (dw->flag & PART_DUPLIW_CURRENT) {
1303 return RNA_pointer_create_with_parent(*ptr, &RNA_ParticleDupliWeight, dw);
1304 }
1305 }
1306 return PointerRNA_NULL;
1307}
1308static void rna_ParticleDupliWeight_active_index_range(
1309 PointerRNA *ptr, int *min, int *max, int * /*softmin*/, int * /*softmax*/)
1310{
1311 ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
1312 *min = 0;
1313 *max = max_ii(0, BLI_listbase_count(&part->instance_weights) - 1);
1314}
1315
1316static int rna_ParticleDupliWeight_active_index_get(PointerRNA *ptr)
1317{
1318 ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
1320 int i = 0;
1321
1322 for (; dw; dw = dw->next, i++) {
1323 if (dw->flag & PART_DUPLIW_CURRENT) {
1324 return i;
1325 }
1326 }
1327
1328 return 0;
1329}
1330
1331static void rna_ParticleDupliWeight_active_index_set(PointerRNA *ptr, int value)
1332{
1333 ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
1335 int i = 0;
1336
1337 for (; dw; dw = dw->next, i++) {
1338 if (i == value) {
1340 }
1341 else {
1343 }
1344 }
1345}
1346
1347static size_t rna_ParticleDupliWeight_name_get_impl(PointerRNA *ptr,
1348 char *value,
1349 const size_t value_maxncpy)
1350{
1351 ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
1353
1354 ParticleDupliWeight *dw = static_cast<ParticleDupliWeight *>(ptr->data);
1355
1356 if (dw->ob) {
1357 return BLI_snprintf_utf8_rlen(value, value_maxncpy, "%s: %i", dw->ob->id.name + 2, dw->count);
1358 }
1359
1360 return BLI_strncpy_utf8_rlen(value, "No object", value_maxncpy);
1361}
1362
1363static void rna_ParticleDupliWeight_name_get(PointerRNA *ptr, char *value)
1364{
1365 char value_buf[MAX_ID_NAME + 64];
1366 const size_t value_buf_len = rna_ParticleDupliWeight_name_get_impl(
1367 ptr, value_buf, sizeof(value_buf));
1368 memcpy(value, value_buf, value_buf_len + 1);
1369}
1370
1371static int rna_ParticleDupliWeight_name_length(PointerRNA *ptr)
1372{
1373 char value_buf[MAX_ID_NAME + 64];
1374 return rna_ParticleDupliWeight_name_get_impl(ptr, value_buf, sizeof(value_buf));
1375}
1376
1377static const EnumPropertyItem *rna_Particle_type_itemf(bContext * /*C*/,
1378 PointerRNA *ptr,
1379 PropertyRNA * /*prop*/,
1380 bool * /*r_free*/)
1381{
1382 ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
1383
1384 if (ELEM(part->type, PART_HAIR, PART_EMITTER)) {
1385 return part_type_items;
1386 }
1387 else {
1388 return part_fluid_type_items;
1389 }
1390}
1391
1392static const EnumPropertyItem *rna_Particle_from_itemf(bContext * /*C*/,
1393 PointerRNA * /*ptr*/,
1394 PropertyRNA * /*prop*/,
1395 bool * /*r_free*/)
1396{
1397# if 0
1398 if (part->type == PART_REACTOR) {
1400 }
1401# endif
1402 return part_from_items;
1403}
1404
1405static const EnumPropertyItem *rna_Particle_dist_itemf(bContext * /*C*/,
1406 PointerRNA *ptr,
1407 PropertyRNA * /*prop*/,
1408 bool * /*r_free*/)
1409{
1410 ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
1411
1412 if (part->type == PART_HAIR) {
1413 return part_hair_dist_items;
1414 }
1415 else {
1416 return part_dist_items;
1417 }
1418}
1419
1420static const EnumPropertyItem *rna_Particle_draw_as_itemf(bContext * /*C*/,
1421 PointerRNA *ptr,
1422 PropertyRNA * /*prop*/,
1423 bool * /*r_free*/)
1424{
1425 ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
1426
1427 if (part->type == PART_HAIR) {
1428 return part_hair_draw_as_items;
1429 }
1430 else {
1431 return part_draw_as_items;
1432 }
1433}
1434
1435static const EnumPropertyItem *rna_Particle_ren_as_itemf(bContext * /*C*/,
1436 PointerRNA *ptr,
1437 PropertyRNA * /*prop*/,
1438 bool * /*r_free*/)
1439{
1440 ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
1441
1442 if (part->type == PART_HAIR) {
1443 return part_hair_ren_as_items;
1444 }
1445 else {
1446 return part_ren_as_items;
1447 }
1448}
1449
1450static PointerRNA rna_Particle_field1_get(PointerRNA *ptr)
1451{
1452 ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
1453 return RNA_pointer_create_with_parent(*ptr, &RNA_FieldSettings, part->pd);
1454}
1455
1456static PointerRNA rna_Particle_field2_get(PointerRNA *ptr)
1457{
1458 ParticleSettings *part = (ParticleSettings *)ptr->owner_id;
1459 return RNA_pointer_create_with_parent(*ptr, &RNA_FieldSettings, part->pd2);
1460}
1461
1462static void psys_vg_name_get__internal(PointerRNA *ptr, char *value, int index)
1463{
1464 Object *ob = (Object *)ptr->owner_id;
1465 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1466 const ListBase *defbase = BKE_object_defgroup_list(ob);
1467
1468 if (psys->vgroup[index] > 0) {
1469 bDeformGroup *defGroup = static_cast<bDeformGroup *>(
1470 BLI_findlink(defbase, psys->vgroup[index] - 1));
1471
1472 if (defGroup) {
1473 strcpy(value, defGroup->name);
1474 return;
1475 }
1476 }
1477
1478 value[0] = '\0';
1479}
1480static int psys_vg_name_len__internal(PointerRNA *ptr, int index)
1481{
1482 Object *ob = (Object *)ptr->owner_id;
1483 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1484
1485 if (psys->vgroup[index] > 0) {
1486 const ListBase *defbase = BKE_object_defgroup_list(ob);
1487 bDeformGroup *defGroup = static_cast<bDeformGroup *>(
1488 BLI_findlink(defbase, psys->vgroup[index] - 1));
1489
1490 if (defGroup) {
1491 return strlen(defGroup->name);
1492 }
1493 }
1494 return 0;
1495}
1496static void psys_vg_name_set__internal(PointerRNA *ptr, const char *value, int index)
1497{
1498 Object *ob = (Object *)ptr->owner_id;
1499 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1500
1501 if (value[0] == '\0') {
1502 psys->vgroup[index] = 0;
1503 }
1504 else {
1505 int defgrp_index = BKE_object_defgroup_name_index(ob, value);
1506
1507 if (defgrp_index == -1) {
1508 return;
1509 }
1510
1511 psys->vgroup[index] = defgrp_index + 1;
1512 }
1513}
1514
1515static std::optional<std::string> rna_ParticleSystem_path(const PointerRNA *ptr)
1516{
1517 const ParticleSystem *psys = (ParticleSystem *)ptr->data;
1518 char name_esc[sizeof(psys->name) * 2];
1519
1520 BLI_str_escape(name_esc, psys->name, sizeof(name_esc));
1521 return fmt::format("particle_systems[\"{}\"]", name_esc);
1522}
1523
1524static void rna_ParticleSettings_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
1525{
1526 ParticleSettings *part = (ParticleSettings *)ptr->data;
1527 rna_iterator_array_begin(iter, ptr, (void *)part->mtex, sizeof(MTex *), MAX_MTEX, 0, nullptr);
1528}
1529
1530static PointerRNA rna_ParticleSettings_active_texture_get(PointerRNA *ptr)
1531{
1532 ParticleSettings *part = (ParticleSettings *)ptr->data;
1533 Tex *tex;
1534
1536 return RNA_id_pointer_create(reinterpret_cast<ID *>(tex));
1537}
1538
1539static void rna_ParticleSettings_active_texture_set(PointerRNA *ptr,
1540 PointerRNA value,
1541 ReportList * /*reports*/)
1542{
1543 ParticleSettings *part = (ParticleSettings *)ptr->data;
1544
1545 set_current_particle_texture(part, static_cast<Tex *>(value.data));
1546}
1547
1548/* irritating string functions for each index :/ */
1549static void rna_ParticleVGroup_name_get_0(PointerRNA *ptr, char *value)
1550{
1551 psys_vg_name_get__internal(ptr, value, 0);
1552}
1553static void rna_ParticleVGroup_name_get_1(PointerRNA *ptr, char *value)
1554{
1555 psys_vg_name_get__internal(ptr, value, 1);
1556}
1557static void rna_ParticleVGroup_name_get_2(PointerRNA *ptr, char *value)
1558{
1559 psys_vg_name_get__internal(ptr, value, 2);
1560}
1561static void rna_ParticleVGroup_name_get_3(PointerRNA *ptr, char *value)
1562{
1563 psys_vg_name_get__internal(ptr, value, 3);
1564}
1565static void rna_ParticleVGroup_name_get_4(PointerRNA *ptr, char *value)
1566{
1567 psys_vg_name_get__internal(ptr, value, 4);
1568}
1569static void rna_ParticleVGroup_name_get_5(PointerRNA *ptr, char *value)
1570{
1571 psys_vg_name_get__internal(ptr, value, 5);
1572}
1573static void rna_ParticleVGroup_name_get_6(PointerRNA *ptr, char *value)
1574{
1575 psys_vg_name_get__internal(ptr, value, 6);
1576}
1577static void rna_ParticleVGroup_name_get_7(PointerRNA *ptr, char *value)
1578{
1579 psys_vg_name_get__internal(ptr, value, 7);
1580}
1581static void rna_ParticleVGroup_name_get_8(PointerRNA *ptr, char *value)
1582{
1583 psys_vg_name_get__internal(ptr, value, 8);
1584}
1585static void rna_ParticleVGroup_name_get_9(PointerRNA *ptr, char *value)
1586{
1587 psys_vg_name_get__internal(ptr, value, 9);
1588}
1589static void rna_ParticleVGroup_name_get_10(PointerRNA *ptr, char *value)
1590{
1591 psys_vg_name_get__internal(ptr, value, 10);
1592}
1593static void rna_ParticleVGroup_name_get_11(PointerRNA *ptr, char *value)
1594{
1595 psys_vg_name_get__internal(ptr, value, 11);
1596}
1597static void rna_ParticleVGroup_name_get_12(PointerRNA *ptr, char *value)
1598{
1599 psys_vg_name_get__internal(ptr, value, 12);
1600}
1601
1602static int rna_ParticleVGroup_name_len_0(PointerRNA *ptr)
1603{
1604 return psys_vg_name_len__internal(ptr, 0);
1605}
1606static int rna_ParticleVGroup_name_len_1(PointerRNA *ptr)
1607{
1608 return psys_vg_name_len__internal(ptr, 1);
1609}
1610static int rna_ParticleVGroup_name_len_2(PointerRNA *ptr)
1611{
1612 return psys_vg_name_len__internal(ptr, 2);
1613}
1614static int rna_ParticleVGroup_name_len_3(PointerRNA *ptr)
1615{
1616 return psys_vg_name_len__internal(ptr, 3);
1617}
1618static int rna_ParticleVGroup_name_len_4(PointerRNA *ptr)
1619{
1620 return psys_vg_name_len__internal(ptr, 4);
1621}
1622static int rna_ParticleVGroup_name_len_5(PointerRNA *ptr)
1623{
1624 return psys_vg_name_len__internal(ptr, 5);
1625}
1626static int rna_ParticleVGroup_name_len_6(PointerRNA *ptr)
1627{
1628 return psys_vg_name_len__internal(ptr, 6);
1629}
1630static int rna_ParticleVGroup_name_len_7(PointerRNA *ptr)
1631{
1632 return psys_vg_name_len__internal(ptr, 7);
1633}
1634static int rna_ParticleVGroup_name_len_8(PointerRNA *ptr)
1635{
1636 return psys_vg_name_len__internal(ptr, 8);
1637}
1638static int rna_ParticleVGroup_name_len_9(PointerRNA *ptr)
1639{
1640 return psys_vg_name_len__internal(ptr, 9);
1641}
1642static int rna_ParticleVGroup_name_len_10(PointerRNA *ptr)
1643{
1644 return psys_vg_name_len__internal(ptr, 10);
1645}
1646static int rna_ParticleVGroup_name_len_11(PointerRNA *ptr)
1647{
1648 return psys_vg_name_len__internal(ptr, 11);
1649}
1650static int rna_ParticleVGroup_name_len_12(PointerRNA *ptr)
1651{
1652 return psys_vg_name_len__internal(ptr, 12);
1653}
1654
1655static void rna_ParticleVGroup_name_set_0(PointerRNA *ptr, const char *value)
1656{
1657 psys_vg_name_set__internal(ptr, value, 0);
1658}
1659static void rna_ParticleVGroup_name_set_1(PointerRNA *ptr, const char *value)
1660{
1661 psys_vg_name_set__internal(ptr, value, 1);
1662}
1663static void rna_ParticleVGroup_name_set_2(PointerRNA *ptr, const char *value)
1664{
1665 psys_vg_name_set__internal(ptr, value, 2);
1666}
1667static void rna_ParticleVGroup_name_set_3(PointerRNA *ptr, const char *value)
1668{
1669 psys_vg_name_set__internal(ptr, value, 3);
1670}
1671static void rna_ParticleVGroup_name_set_4(PointerRNA *ptr, const char *value)
1672{
1673 psys_vg_name_set__internal(ptr, value, 4);
1674}
1675static void rna_ParticleVGroup_name_set_5(PointerRNA *ptr, const char *value)
1676{
1677 psys_vg_name_set__internal(ptr, value, 5);
1678}
1679static void rna_ParticleVGroup_name_set_6(PointerRNA *ptr, const char *value)
1680{
1681 psys_vg_name_set__internal(ptr, value, 6);
1682}
1683static void rna_ParticleVGroup_name_set_7(PointerRNA *ptr, const char *value)
1684{
1685 psys_vg_name_set__internal(ptr, value, 7);
1686}
1687static void rna_ParticleVGroup_name_set_8(PointerRNA *ptr, const char *value)
1688{
1689 psys_vg_name_set__internal(ptr, value, 8);
1690}
1691static void rna_ParticleVGroup_name_set_9(PointerRNA *ptr, const char *value)
1692{
1693 psys_vg_name_set__internal(ptr, value, 9);
1694}
1695static void rna_ParticleVGroup_name_set_10(PointerRNA *ptr, const char *value)
1696{
1697 psys_vg_name_set__internal(ptr, value, 10);
1698}
1699static void rna_ParticleVGroup_name_set_11(PointerRNA *ptr, const char *value)
1700{
1701 psys_vg_name_set__internal(ptr, value, 11);
1702}
1703static void rna_ParticleVGroup_name_set_12(PointerRNA *ptr, const char *value)
1704{
1705 psys_vg_name_set__internal(ptr, value, 12);
1706}
1707
1708#else
1709
1711{
1712 StructRNA *srna;
1713 PropertyRNA *prop;
1714
1715 FunctionRNA *func;
1716 PropertyRNA *parm;
1717
1718 srna = RNA_def_struct(brna, "ParticleHairKey", nullptr);
1719 RNA_def_struct_sdna(srna, "HairKey");
1720 RNA_def_struct_ui_text(srna, "Particle Hair Key", "Particle key for hair particle system");
1721
1722 prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
1723 RNA_def_property_ui_text(prop, "Time", "Relative time of key over hair length");
1724
1725 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_UNSIGNED);
1726 RNA_def_property_range(prop, 0.0, 1.0);
1727 RNA_def_property_ui_text(prop, "Weight", "Weight for cloth simulation");
1728
1729 prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
1730 RNA_def_property_array(prop, 3);
1732 prop, "Location (Object Space)", "Location of the hair key in object space");
1734 "rna_ParticleHairKey_location_object_get",
1735 "rna_ParticleHairKey_location_object_set",
1736 nullptr);
1737
1738 prop = RNA_def_property(srna, "co_local", PROP_FLOAT, PROP_TRANSLATION);
1739 RNA_def_property_float_sdna(prop, nullptr, "co");
1741 "Location",
1742 "Location of the hair key in its local coordinate system, "
1743 "relative to the emitting face");
1744
1745 /* Aided co func */
1746 func = RNA_def_function(srna, "co_object", "rna_ParticleHairKey_co_object");
1747 RNA_def_function_ui_description(func, "Obtain hairkey location with particle and modifier data");
1748 parm = RNA_def_pointer(func, "object", "Object", "", "Object");
1750 parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
1752 parm = RNA_def_pointer(func, "particle", "Particle", "", "hair particle");
1754 parm = RNA_def_float_vector(
1755 func, "co", 3, nullptr, -FLT_MAX, FLT_MAX, "Co", "Exported hairkey location", -1e4, 1e4);
1757 RNA_def_function_output(func, parm);
1758
1759 func = RNA_def_function(srna, "co_object_set", "rna_ParticleHairKey_co_object_set");
1761 RNA_def_function_ui_description(func, "Set hairkey location with particle and modifier data");
1762 parm = RNA_def_pointer(func, "object", "Object", "", "Object");
1764 parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
1766 parm = RNA_def_pointer(func, "particle", "Particle", "", "hair particle");
1768 parm = RNA_def_float_vector(
1769 func, "co", 3, nullptr, -FLT_MAX, FLT_MAX, "Co", "Specified hairkey location", -1e4, 1e4);
1771}
1772
1774{
1775 StructRNA *srna;
1776 PropertyRNA *prop;
1777
1778 srna = RNA_def_struct(brna, "ParticleKey", nullptr);
1779 RNA_def_struct_ui_text(srna, "Particle Key", "Key location for a particle over time");
1780
1781 prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
1782 RNA_def_property_float_sdna(prop, nullptr, "co");
1783 RNA_def_property_ui_text(prop, "Location", "Key location");
1784
1785 prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
1786 RNA_def_property_float_sdna(prop, nullptr, "vel");
1787 RNA_def_property_ui_text(prop, "Velocity", "Key velocity");
1788
1789 prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
1790 RNA_def_property_float_sdna(prop, nullptr, "rot");
1791 RNA_def_property_ui_text(prop, "Rotation", "Key rotation quaternion");
1792
1793 prop = RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
1794 RNA_def_property_float_sdna(prop, nullptr, "ave");
1795 RNA_def_property_ui_text(prop, "Angular Velocity", "Key angular velocity");
1796
1797 prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
1798 RNA_def_property_ui_text(prop, "Time", "Time of key over the simulation");
1799}
1800
1802{
1803 StructRNA *srna;
1804 // PropertyRNA *prop;
1805
1806 srna = RNA_def_struct(brna, "ChildParticle", nullptr);
1808 srna, "Child Particle", "Child particle interpolated from simulated or edited particles");
1809
1810 // int num, parent; /* num is face index on the final derived mesh */
1811 //
1812 // int pa[4]; /* nearest particles to the child, used for the interpolation */
1813 // float w[4]; /* interpolation weights for the above particles */
1814 // float fuv[4], foffset; /* face vertex weights and offset */
1815 // float rand[3];
1816}
1817
1819{
1820 StructRNA *srna;
1821 PropertyRNA *prop;
1822
1823 FunctionRNA *func;
1824 PropertyRNA *parm;
1825
1826 static const EnumPropertyItem alive_items[] = {
1827 // {PARS_KILLED, "KILLED", 0, "Killed", ""},
1828 {PARS_DEAD, "DEAD", 0, "Dead", ""},
1829 {PARS_UNBORN, "UNBORN", 0, "Unborn", ""},
1830 {PARS_ALIVE, "ALIVE", 0, "Alive", ""},
1831 {PARS_DYING, "DYING", 0, "Dying", ""},
1832 {0, nullptr, 0, nullptr, nullptr},
1833 };
1834
1835 srna = RNA_def_struct(brna, "Particle", nullptr);
1836 RNA_def_struct_sdna(srna, "ParticleData");
1837 RNA_def_struct_ui_text(srna, "Particle", "Particle in a particle system");
1838
1839 /* Particle State & Previous State */
1840 prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
1841 RNA_def_property_float_sdna(prop, nullptr, "state.co");
1842 RNA_def_property_ui_text(prop, "Particle Location", "");
1843
1844 prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
1845 RNA_def_property_float_sdna(prop, nullptr, "state.vel");
1846 RNA_def_property_ui_text(prop, "Particle Velocity", "");
1847
1848 prop = RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
1849 RNA_def_property_float_sdna(prop, nullptr, "state.ave");
1850 RNA_def_property_ui_text(prop, "Angular Velocity", "");
1851
1852 prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
1853 RNA_def_property_float_sdna(prop, nullptr, "state.rot");
1854 RNA_def_property_ui_text(prop, "Rotation", "");
1855
1856 prop = RNA_def_property(srna, "prev_location", PROP_FLOAT, PROP_TRANSLATION);
1857 RNA_def_property_float_sdna(prop, nullptr, "prev_state.co");
1858 RNA_def_property_ui_text(prop, "Previous Particle Location", "");
1859
1860 prop = RNA_def_property(srna, "prev_velocity", PROP_FLOAT, PROP_VELOCITY);
1861 RNA_def_property_float_sdna(prop, nullptr, "prev_state.vel");
1862 RNA_def_property_ui_text(prop, "Previous Particle Velocity", "");
1863
1864 prop = RNA_def_property(srna, "prev_angular_velocity", PROP_FLOAT, PROP_VELOCITY);
1865 RNA_def_property_float_sdna(prop, nullptr, "prev_state.ave");
1866 RNA_def_property_ui_text(prop, "Previous Angular Velocity", "");
1867
1868 prop = RNA_def_property(srna, "prev_rotation", PROP_FLOAT, PROP_QUATERNION);
1869 RNA_def_property_float_sdna(prop, nullptr, "prev_state.rot");
1870 RNA_def_property_ui_text(prop, "Previous Rotation", "");
1871
1872 /* Hair & Keyed Keys */
1873
1874 prop = RNA_def_property(srna, "hair_keys", PROP_COLLECTION, PROP_NONE);
1875 RNA_def_property_collection_sdna(prop, nullptr, "hair", "totkey");
1876 RNA_def_property_struct_type(prop, "ParticleHairKey");
1877 RNA_def_property_ui_text(prop, "Hair", "");
1878
1879 prop = RNA_def_property(srna, "particle_keys", PROP_COLLECTION, PROP_NONE);
1880 RNA_def_property_collection_sdna(prop, nullptr, "keys", "totkey");
1881 RNA_def_property_struct_type(prop, "ParticleKey");
1882 RNA_def_property_ui_text(prop, "Keyed States", "");
1883
1884 // float fuv[4], foffset; /* Coordinates on face/edge number "num" and depth along. */
1885 // /* Face normal for volume emission. */
1886
1887 prop = RNA_def_property(srna, "birth_time", PROP_FLOAT, PROP_TIME);
1888 RNA_def_property_float_sdna(prop, nullptr, "time");
1889 // RNA_def_property_range(prop, lowerLimitf, upperLimitf);
1890 RNA_def_property_ui_text(prop, "Birth Time", "");
1891
1892 prop = RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
1893 // RNA_def_property_range(prop, lowerLimitf, upperLimitf);
1894 RNA_def_property_ui_text(prop, "Lifetime", "");
1895
1896 prop = RNA_def_property(srna, "die_time", PROP_FLOAT, PROP_TIME);
1897 RNA_def_property_float_sdna(prop, nullptr, "dietime");
1898 // RNA_def_property_range(prop, lowerLimitf, upperLimitf);
1899 RNA_def_property_ui_text(prop, "Die Time", "");
1900
1901 prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
1902 // RNA_def_property_range(prop, lowerLimitf, upperLimitf);
1903 RNA_def_property_ui_text(prop, "Size", "");
1904
1905 // int num; /* index to vert/edge/face */
1906 // int num_dmcache; /* index to derived mesh data (face) to avoid slow lookups */
1907 // int pad;
1908 // int totkey;
1909
1910 /* flag */
1911 prop = RNA_def_property(srna, "is_exist", PROP_BOOLEAN, PROP_NONE);
1914 RNA_def_property_ui_text(prop, "Exists", "");
1915
1916 prop = RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE);
1919 RNA_def_property_ui_text(prop, "Visible", "");
1920
1921 prop = RNA_def_property(srna, "alive_state", PROP_ENUM, PROP_NONE);
1922 RNA_def_property_enum_sdna(prop, nullptr, "alive");
1923 RNA_def_property_enum_items(prop, alive_items);
1924 RNA_def_property_ui_text(prop, "Alive State", "");
1925
1926 // short rt2;
1927
1928 /* UVs */
1929 func = RNA_def_function(srna, "uv_on_emitter", "rna_Particle_uv_on_emitter");
1931 "Obtain UV coordinates for a particle on an evaluated mesh.");
1933 parm = RNA_def_pointer(func,
1934 "modifier",
1935 "ParticleSystemModifier",
1936 "",
1937 "Particle modifier from an evaluated object");
1939 parm = RNA_def_property(func, "uv", PROP_FLOAT, PROP_COORDS);
1940 RNA_def_property_array(parm, 2);
1942 RNA_def_function_output(func, parm);
1943}
1944
1946{
1947 StructRNA *srna;
1948 PropertyRNA *prop;
1949
1950 srna = RNA_def_struct(brna, "ParticleDupliWeight", nullptr);
1952 "Particle Instance Object Weight",
1953 "Weight of a particle instance object in a collection");
1954 RNA_def_struct_sdna(srna, "ParticleDupliWeight");
1955
1956 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1958 prop, "rna_ParticleDupliWeight_name_get", "rna_ParticleDupliWeight_name_length", nullptr);
1959 RNA_def_property_ui_text(prop, "Name", "Particle instance object name");
1961 RNA_def_struct_name_property(srna, prop);
1962
1963 prop = RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
1964 RNA_def_property_range(prop, 0, SHRT_MAX);
1966 prop, "Count", "The number of times this object is repeated with respect to other objects");
1967 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1968}
1969
1971{
1972 StructRNA *srna;
1973 PropertyRNA *prop;
1974
1975 static const EnumPropertyItem sph_solver_items[] = {
1977 "DDR",
1978 0,
1979 "Double-Density",
1980 "An artistic solver with strong surface tension effects (original)"},
1981 {SPH_SOLVER_CLASSICAL, "CLASSICAL", 0, "Classical", "A more physically-accurate solver"},
1982 {0, nullptr, 0, nullptr, nullptr},
1983 };
1984
1985 srna = RNA_def_struct(brna, "SPHFluidSettings", nullptr);
1986 RNA_def_struct_path_func(srna, "rna_SPHFluidSettings_path");
1987 RNA_def_struct_ui_text(srna, "SPH Fluid Settings", "Settings for particle fluids physics");
1988
1989 /* Fluid settings */
1990 prop = RNA_def_property(srna, "solver", PROP_ENUM, PROP_NONE);
1991 RNA_def_property_enum_sdna(prop, nullptr, "solver");
1993 RNA_def_property_enum_items(prop, sph_solver_items);
1995 prop, "SPH Solver", "The code used to calculate internal forces on particles");
1996 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1997
1998 prop = RNA_def_property(srna, "spring_force", PROP_FLOAT, PROP_NONE);
1999 RNA_def_property_float_sdna(prop, nullptr, "spring_k");
2000 RNA_def_property_range(prop, 0.0f, 100.0f);
2001 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
2002 RNA_def_property_ui_text(prop, "Spring Force", "Spring force");
2003 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2004
2005 prop = RNA_def_property(srna, "fluid_radius", PROP_FLOAT, PROP_NONE);
2006 RNA_def_property_float_sdna(prop, nullptr, "radius");
2007 RNA_def_property_range(prop, 0.0f, 20.0f);
2008 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
2009 RNA_def_property_ui_text(prop, "Interaction Radius", "Fluid interaction radius");
2010 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2011
2012 prop = RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_NONE);
2013 RNA_def_property_range(prop, 0.0f, 2.0f);
2014 RNA_def_property_ui_text(prop, "Rest Length", "Spring rest length (factor of particle radius)");
2015 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2016
2017 prop = RNA_def_property(srna, "use_viscoelastic_springs", PROP_BOOLEAN, PROP_NONE);
2020 prop, "Viscoelastic Springs", "Use viscoelastic springs instead of Hooke's springs");
2021 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2022
2023 prop = RNA_def_property(srna, "use_initial_rest_length", PROP_BOOLEAN, PROP_NONE);
2026 prop,
2027 "Initial Rest Length",
2028 "Use the initial length as spring rest length instead of 2 * particle size");
2029 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2030
2031 prop = RNA_def_property(srna, "plasticity", PROP_FLOAT, PROP_NONE);
2032 RNA_def_property_float_sdna(prop, nullptr, "plasticity_constant");
2033 RNA_def_property_range(prop, 0.0f, 100.0f);
2035 prop,
2036 "Plasticity",
2037 "How much the spring rest length can change after the elastic limit is crossed");
2038 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2039
2040 prop = RNA_def_property(srna, "yield_ratio", PROP_FLOAT, PROP_FACTOR);
2041 RNA_def_property_float_sdna(prop, nullptr, "yield_ratio");
2042 RNA_def_property_range(prop, 0.0f, 1.0f);
2044 prop,
2045 "Elastic Limit",
2046 "How much the spring has to be stretched/compressed in order to change its rest length");
2047 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2048
2049 prop = RNA_def_property(srna, "spring_frames", PROP_INT, PROP_NONE);
2050 RNA_def_property_range(prop, 0.0f, 100.0f);
2052 prop,
2053 "Spring Frames",
2054 "Create springs for this number of frames since particles birth (0 is always)");
2055 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2056
2057 /* Viscosity */
2058 prop = RNA_def_property(srna, "linear_viscosity", PROP_FLOAT, PROP_NONE);
2059 RNA_def_property_float_sdna(prop, nullptr, "viscosity_omega");
2060 RNA_def_property_range(prop, 0.0f, 100.0f);
2061 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
2062 RNA_def_property_ui_text(prop, "Viscosity", "Linear viscosity");
2063 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2064
2065 prop = RNA_def_property(srna, "stiff_viscosity", PROP_FLOAT, PROP_NONE);
2066 RNA_def_property_float_sdna(prop, nullptr, "viscosity_beta");
2067 RNA_def_property_range(prop, 0.0f, 100.0f);
2068 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
2069 RNA_def_property_ui_text(prop, "Stiff Viscosity", "Creates viscosity for expanding fluid");
2070 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2071
2072 /* Double density relaxation */
2073 prop = RNA_def_property(srna, "stiffness", PROP_FLOAT, PROP_NONE);
2074 RNA_def_property_float_sdna(prop, nullptr, "stiffness_k");
2075 RNA_def_property_range(prop, 0.0f, 1000.0f);
2076 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
2077 RNA_def_property_ui_text(prop, "Stiffness", "How incompressible the fluid is (speed of sound)");
2078 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2079
2080 prop = RNA_def_property(srna, "repulsion", PROP_FLOAT, PROP_NONE);
2081 RNA_def_property_float_sdna(prop, nullptr, "stiffness_knear");
2082 RNA_def_property_range(prop, 0.0f, 100.0f);
2083 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
2085 prop,
2086 "Repulsion Factor",
2087 "How strongly the fluid tries to keep from clustering (factor of stiffness)");
2088 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2089
2090 prop = RNA_def_property(srna, "rest_density", PROP_FLOAT, PROP_NONE);
2091 RNA_def_property_float_sdna(prop, nullptr, "rest_density");
2092 RNA_def_property_range(prop, 0.0f, 10000.0f);
2093 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
2094 RNA_def_property_ui_text(prop, "Rest Density", "Fluid rest density");
2095 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2096
2097 /* Buoyancy */
2098 prop = RNA_def_property(srna, "buoyancy", PROP_FLOAT, PROP_NONE);
2099 RNA_def_property_float_sdna(prop, nullptr, "buoyancy");
2100 RNA_def_property_range(prop, 0.0f, 10.0f);
2101 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3);
2103 prop,
2104 "Buoyancy",
2105 "Artificial buoyancy force in negative gravity direction based on pressure "
2106 "differences inside the fluid");
2107 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2108
2109 /* Factor flags */
2110
2111 prop = RNA_def_property(srna, "use_factor_repulsion", PROP_BOOLEAN, PROP_NONE);
2112 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SPH_FAC_REPULSION);
2113 RNA_def_property_ui_text(prop, "Factor Repulsion", "Repulsion is a factor of stiffness");
2114 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2115
2116 prop = RNA_def_property(srna, "use_factor_density", PROP_BOOLEAN, PROP_NONE);
2117 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SPH_FAC_DENSITY);
2119 prop,
2120 "Factor Density",
2121 "Density is calculated as a factor of default density (depends on particle size)");
2122 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2123
2124 prop = RNA_def_property(srna, "use_factor_radius", PROP_BOOLEAN, PROP_NONE);
2125 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SPH_FAC_RADIUS);
2127 prop, "Factor Radius", "Interaction radius is a factor of 4 * particle size");
2128 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2129
2130 prop = RNA_def_property(srna, "use_factor_stiff_viscosity", PROP_BOOLEAN, PROP_NONE);
2131 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SPH_FAC_VISCOSITY);
2133 prop, "Factor Stiff Viscosity", "Stiff viscosity is a factor of normal viscosity");
2134 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2135
2136 prop = RNA_def_property(srna, "use_factor_rest_length", PROP_BOOLEAN, PROP_NONE);
2137 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SPH_FAC_REST_LENGTH);
2139 prop, "Factor Rest Length", "Spring rest length is a factor of 2 * particle size");
2140 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2141}
2142
2144{
2145 StructRNA *srna;
2146 PropertyRNA *prop;
2147
2148 static const EnumPropertyItem texco_items[] = {
2149 {TEXCO_GLOB, "GLOBAL", 0, "Global", "Use global coordinates for the texture coordinates"},
2150 {TEXCO_OBJECT,
2151 "OBJECT",
2152 0,
2153 "Object",
2154 "Use linked object's coordinates for texture coordinates"},
2155 {TEXCO_UV, "UV", 0, "UV", "Use UV coordinates for texture coordinates"},
2156 {TEXCO_ORCO,
2157 "ORCO",
2158 0,
2159 "Generated",
2160 "Use the original undeformed coordinates of the object"},
2161 {TEXCO_STRAND,
2162 "STRAND",
2163 0,
2164 "Strand / Particle",
2165 "Use normalized strand texture coordinate (1D) or particle age (X) and trail position (Y)"},
2166 {0, nullptr, 0, nullptr, nullptr},
2167 };
2168
2169 static const EnumPropertyItem prop_mapping_items[] = {
2170 {MTEX_FLAT, "FLAT", 0, "Flat", "Map X and Y coordinates directly"},
2171 {MTEX_CUBE, "CUBE", 0, "Cube", "Map using the normal vector"},
2172 {MTEX_TUBE, "TUBE", 0, "Tube", "Map with Z as central axis"},
2173 {MTEX_SPHERE, "SPHERE", 0, "Sphere", "Map with Z as central axis"},
2174 {0, nullptr, 0, nullptr, nullptr},
2175 };
2176
2177 static const EnumPropertyItem prop_x_mapping_items[] = {
2178 {0, "NONE", 0, "None", ""},
2179 {1, "X", 0, "X", ""},
2180 {2, "Y", 0, "Y", ""},
2181 {3, "Z", 0, "Z", ""},
2182 {0, nullptr, 0, nullptr, nullptr},
2183 };
2184
2185 static const EnumPropertyItem prop_y_mapping_items[] = {
2186 {0, "NONE", 0, "None", ""},
2187 {1, "X", 0, "X", ""},
2188 {2, "Y", 0, "Y", ""},
2189 {3, "Z", 0, "Z", ""},
2190 {0, nullptr, 0, nullptr, nullptr},
2191 };
2192
2193 static const EnumPropertyItem prop_z_mapping_items[] = {
2194 {0, "NONE", 0, "None", ""},
2195 {1, "X", 0, "X", ""},
2196 {2, "Y", 0, "Y", ""},
2197 {3, "Z", 0, "Z", ""},
2198 {0, nullptr, 0, nullptr, nullptr},
2199 };
2200
2201 srna = RNA_def_struct(brna, "ParticleSettingsTextureSlot", "TextureSlot");
2202 RNA_def_struct_sdna(srna, "MTex");
2204 "Particle Settings Texture Slot",
2205 "Texture slot for textures in a Particle Settings data-block");
2206
2207 prop = RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
2208 RNA_def_property_enum_sdna(prop, nullptr, "texco");
2209 RNA_def_property_enum_items(prop, texco_items);
2212 "Texture Coordinates",
2213 "Texture coordinates used to map the texture onto the background");
2214 RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
2215
2216 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
2217 RNA_def_property_pointer_sdna(prop, nullptr, "object");
2218 RNA_def_property_struct_type(prop, "Object");
2222 prop, "Object", "Object to use for mapping with Object texture coordinates");
2223 RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
2224
2225 prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
2226 RNA_def_property_string_sdna(prop, nullptr, "uvname");
2228 prop, "UV Map", "UV map to use for mapping with UV texture coordinates");
2229 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2230
2231 prop = RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE);
2232 RNA_def_property_enum_sdna(prop, nullptr, "projx");
2233 RNA_def_property_enum_items(prop, prop_x_mapping_items);
2234 RNA_def_property_ui_text(prop, "X Mapping", "");
2235 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2236
2237 prop = RNA_def_property(srna, "mapping_y", PROP_ENUM, PROP_NONE);
2238 RNA_def_property_enum_sdna(prop, nullptr, "projy");
2239 RNA_def_property_enum_items(prop, prop_y_mapping_items);
2240 RNA_def_property_ui_text(prop, "Y Mapping", "");
2241 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2242
2243 prop = RNA_def_property(srna, "mapping_z", PROP_ENUM, PROP_NONE);
2244 RNA_def_property_enum_sdna(prop, nullptr, "projz");
2245 RNA_def_property_enum_items(prop, prop_z_mapping_items);
2246 RNA_def_property_ui_text(prop, "Z Mapping", "");
2247 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2248
2249 prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
2250 RNA_def_property_enum_items(prop, prop_mapping_items);
2251 RNA_def_property_ui_text(prop, "Mapping", "");
2253 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2254
2255 /* map to */
2256 prop = RNA_def_property(srna, "use_map_time", PROP_BOOLEAN, PROP_NONE);
2257 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_TIME);
2258 RNA_def_property_ui_text(prop, "Emission Time", "Affect the emission time of the particles");
2259 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2260
2261 prop = RNA_def_property(srna, "use_map_life", PROP_BOOLEAN, PROP_NONE);
2262 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_LIFE);
2263 RNA_def_property_ui_text(prop, "Life Time", "Affect the life time of the particles");
2264 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2265
2266 prop = RNA_def_property(srna, "use_map_density", PROP_BOOLEAN, PROP_NONE);
2267 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_DENS);
2268 RNA_def_property_ui_text(prop, "Density", "Affect the density of the particles");
2269 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2270
2271 prop = RNA_def_property(srna, "use_map_size", PROP_BOOLEAN, PROP_NONE);
2272 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_SIZE);
2273 RNA_def_property_ui_text(prop, "Size", "Affect the particle size");
2274 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2275
2276 prop = RNA_def_property(srna, "use_map_velocity", PROP_BOOLEAN, PROP_NONE);
2277 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_IVEL);
2278 RNA_def_property_ui_text(prop, "Initial Velocity", "Affect the particle initial velocity");
2279 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2280
2281 prop = RNA_def_property(srna, "use_map_field", PROP_BOOLEAN, PROP_NONE);
2282 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_FIELD);
2283 RNA_def_property_ui_text(prop, "Force Field", "Affect the particle force fields");
2284 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2285
2286 prop = RNA_def_property(srna, "use_map_gravity", PROP_BOOLEAN, PROP_NONE);
2287 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_GRAVITY);
2288 RNA_def_property_ui_text(prop, "Gravity", "Affect the particle gravity");
2289 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2290
2291 prop = RNA_def_property(srna, "use_map_damp", PROP_BOOLEAN, PROP_NONE);
2292 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_DAMP);
2293 RNA_def_property_ui_text(prop, "Damp", "Affect the particle velocity damping");
2294 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2295
2296 prop = RNA_def_property(srna, "use_map_clump", PROP_BOOLEAN, PROP_NONE);
2297 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_CLUMP);
2298 RNA_def_property_ui_text(prop, "Clump", "Affect the child clumping");
2299 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2300
2301 prop = RNA_def_property(srna, "use_map_kink_amp", PROP_BOOLEAN, PROP_NONE);
2302 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_KINK_AMP);
2303 RNA_def_property_ui_text(prop, "Kink Amplitude", "Affect the child kink amplitude");
2304 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2305
2306 prop = RNA_def_property(srna, "use_map_kink_freq", PROP_BOOLEAN, PROP_NONE);
2307 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_KINK_FREQ);
2308 RNA_def_property_ui_text(prop, "Kink Frequency", "Affect the child kink frequency");
2309 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2310
2311 prop = RNA_def_property(srna, "use_map_rough", PROP_BOOLEAN, PROP_NONE);
2312 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_ROUGH);
2313 RNA_def_property_ui_text(prop, "Rough", "Affect the child rough");
2314 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2315
2316 prop = RNA_def_property(srna, "use_map_length", PROP_BOOLEAN, PROP_NONE);
2317 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_LENGTH);
2318 RNA_def_property_ui_text(prop, "Length", "Affect the child hair length");
2319 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2320
2321 prop = RNA_def_property(srna, "use_map_twist", PROP_BOOLEAN, PROP_NONE);
2322 RNA_def_property_boolean_sdna(prop, nullptr, "mapto", PAMAP_TWIST);
2323 RNA_def_property_ui_text(prop, "Twist", "Affect the child twist");
2324 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2325
2326 /* influence factors */
2327 prop = RNA_def_property(srna, "time_factor", PROP_FLOAT, PROP_NONE);
2328 RNA_def_property_float_sdna(prop, nullptr, "timefac");
2329 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2331 prop, "Emission Time Factor", "Amount texture affects particle emission time");
2332 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2333
2334 prop = RNA_def_property(srna, "life_factor", PROP_FLOAT, PROP_NONE);
2335 RNA_def_property_float_sdna(prop, nullptr, "lifefac");
2336 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2337 RNA_def_property_ui_text(prop, "Life Time Factor", "Amount texture affects particle life time");
2338 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2339
2340 prop = RNA_def_property(srna, "density_factor", PROP_FLOAT, PROP_NONE);
2341 RNA_def_property_float_sdna(prop, nullptr, "padensfac");
2342 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2343 RNA_def_property_ui_text(prop, "Density Factor", "Amount texture affects particle density");
2344 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2345
2346 prop = RNA_def_property(srna, "size_factor", PROP_FLOAT, PROP_NONE);
2347 RNA_def_property_float_sdna(prop, nullptr, "sizefac");
2348 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2349 RNA_def_property_ui_text(prop, "Size Factor", "Amount texture affects physical particle size");
2350 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2351
2352 prop = RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE);
2353 RNA_def_property_float_sdna(prop, nullptr, "ivelfac");
2354 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2356 prop, "Velocity Factor", "Amount texture affects particle initial velocity");
2357 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2358
2359 prop = RNA_def_property(srna, "field_factor", PROP_FLOAT, PROP_NONE);
2360 RNA_def_property_float_sdna(prop, nullptr, "fieldfac");
2361 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2362 RNA_def_property_ui_text(prop, "Field Factor", "Amount texture affects particle force fields");
2363 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2364
2365 prop = RNA_def_property(srna, "gravity_factor", PROP_FLOAT, PROP_NONE);
2366 RNA_def_property_float_sdna(prop, nullptr, "gravityfac");
2367 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2368 RNA_def_property_ui_text(prop, "Gravity Factor", "Amount texture affects particle gravity");
2369 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2370
2371 prop = RNA_def_property(srna, "damp_factor", PROP_FLOAT, PROP_NONE);
2372 RNA_def_property_float_sdna(prop, nullptr, "dampfac");
2373 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2374 RNA_def_property_ui_text(prop, "Damp Factor", "Amount texture affects particle damping");
2375 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2376
2377 prop = RNA_def_property(srna, "length_factor", PROP_FLOAT, PROP_NONE);
2378 RNA_def_property_float_sdna(prop, nullptr, "lengthfac");
2379 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2380 RNA_def_property_ui_text(prop, "Length Factor", "Amount texture affects child hair length");
2381 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2382
2383 prop = RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
2384 RNA_def_property_float_sdna(prop, nullptr, "clumpfac");
2385 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2386 RNA_def_property_ui_text(prop, "Clump Factor", "Amount texture affects child clump");
2387 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2388
2389 prop = RNA_def_property(srna, "kink_amp_factor", PROP_FLOAT, PROP_NONE);
2390 RNA_def_property_float_sdna(prop, nullptr, "kinkampfac");
2391 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2393 prop, "Kink Amplitude Factor", "Amount texture affects child kink amplitude");
2394 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2395
2396 prop = RNA_def_property(srna, "kink_freq_factor", PROP_FLOAT, PROP_NONE);
2397 RNA_def_property_float_sdna(prop, nullptr, "kinkfac");
2398 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2400 prop, "Kink Frequency Factor", "Amount texture affects child kink frequency");
2401 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2402
2403 prop = RNA_def_property(srna, "rough_factor", PROP_FLOAT, PROP_NONE);
2404 RNA_def_property_float_sdna(prop, nullptr, "roughfac");
2405 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2406 RNA_def_property_ui_text(prop, "Rough Factor", "Amount texture affects child roughness");
2407 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2408
2409 prop = RNA_def_property(srna, "twist_factor", PROP_FLOAT, PROP_NONE);
2410 RNA_def_property_float_sdna(prop, nullptr, "twistfac");
2411 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2412 RNA_def_property_ui_text(prop, "Twist Factor", "Amount texture affects child twist");
2413 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2414}
2415
2417{
2418 StructRNA *srna;
2419 PropertyRNA *prop;
2420
2421 static const EnumPropertyItem phys_type_items[] = {
2422 {PART_PHYS_NO, "NO", 0, "None", ""},
2423 {PART_PHYS_NEWTON, "NEWTON", 0, "Newtonian", ""},
2424 {PART_PHYS_KEYED, "KEYED", 0, "Keyed", ""},
2425 {PART_PHYS_BOIDS, "BOIDS", 0, "Boids", ""},
2426 {PART_PHYS_FLUID, "FLUID", 0, "Fluid", ""},
2427 {0, nullptr, 0, nullptr, nullptr},
2428 };
2429
2430 static const EnumPropertyItem rot_mode_items[] = {
2431 {0, "NONE", 0, "None", ""},
2432 {PART_ROT_NOR, "NOR", 0, "Normal", ""},
2433 {PART_ROT_NOR_TAN, "NOR_TAN", 0, "Normal-Tangent", ""},
2434 {PART_ROT_VEL, "VEL", 0, "Velocity / Hair", ""},
2435 {PART_ROT_GLOB_X, "GLOB_X", 0, "Global X", ""},
2436 {PART_ROT_GLOB_Y, "GLOB_Y", 0, "Global Y", ""},
2437 {PART_ROT_GLOB_Z, "GLOB_Z", 0, "Global Z", ""},
2438 {PART_ROT_OB_X, "OB_X", 0, "Object X", ""},
2439 {PART_ROT_OB_Y, "OB_Y", 0, "Object Y", ""},
2440 {PART_ROT_OB_Z, "OB_Z", 0, "Object Z", ""},
2441 {0, nullptr, 0, nullptr, nullptr},
2442 };
2443
2444 static const EnumPropertyItem ave_mode_items[] = {
2445 {0, "NONE", 0, "None", ""},
2446 {PART_AVE_VELOCITY, "VELOCITY", 0, "Velocity", ""},
2447 {PART_AVE_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""},
2448 {PART_AVE_VERTICAL, "VERTICAL", 0, "Vertical", ""},
2449 {PART_AVE_GLOBAL_X, "GLOBAL_X", 0, "Global X", ""},
2450 {PART_AVE_GLOBAL_Y, "GLOBAL_Y", 0, "Global Y", ""},
2451 {PART_AVE_GLOBAL_Z, "GLOBAL_Z", 0, "Global Z", ""},
2452 {PART_AVE_RAND, "RAND", 0, "Random", ""},
2453 {0, nullptr, 0, nullptr, nullptr},
2454 };
2455
2456 static const EnumPropertyItem react_event_items[] = {
2457 {PART_EVENT_DEATH, "DEATH", 0, "Death", ""},
2458 {PART_EVENT_COLLIDE, "COLLIDE", 0, "Collision", ""},
2459 {PART_EVENT_NEAR, "NEAR", 0, "Proximity", ""},
2460 {0, nullptr, 0, nullptr, nullptr},
2461 };
2462
2463 static const EnumPropertyItem child_type_items[] = {
2464 {0, "NONE", 0, "None", ""},
2465 {PART_CHILD_PARTICLES, "SIMPLE", 0, "Simple", ""},
2466 {PART_CHILD_FACES, "INTERPOLATED", 0, "Interpolated", ""},
2467 {0, nullptr, 0, nullptr, nullptr},
2468 };
2469
2470 /* TODO: names, tool-tips. */
2471 static const EnumPropertyItem integrator_type_items[] = {
2472 {PART_INT_EULER, "EULER", 0, "Euler", ""},
2473 {PART_INT_VERLET, "VERLET", 0, "Verlet", ""},
2474 {PART_INT_MIDPOINT, "MIDPOINT", 0, "Midpoint", ""},
2475 {PART_INT_RK4, "RK4", 0, "RK4", ""},
2476 {0, nullptr, 0, nullptr, nullptr},
2477 };
2478
2479 static const EnumPropertyItem kink_type_items[] = {
2480 {PART_KINK_NO, "NO", 0, "Nothing", ""},
2481 {PART_KINK_CURL, "CURL", 0, "Curl", ""},
2482 {PART_KINK_RADIAL, "RADIAL", 0, "Radial", ""},
2483 {PART_KINK_WAVE, "WAVE", 0, "Wave", ""},
2484 {PART_KINK_BRAID, "BRAID", 0, "Braid", ""},
2485 {PART_KINK_SPIRAL, "SPIRAL", 0, "Spiral", ""},
2486 {0, nullptr, 0, nullptr, nullptr},
2487 };
2488
2489 static const EnumPropertyItem draw_col_items[] = {
2490 {PART_DRAW_COL_NONE, "NONE", 0, "None", ""},
2491 {PART_DRAW_COL_MAT, "MATERIAL", 0, "Material", ""},
2492 {PART_DRAW_COL_VEL, "VELOCITY", 0, "Velocity", ""},
2493 {PART_DRAW_COL_ACC, "ACCELERATION", 0, "Acceleration", ""},
2494 {0, nullptr, 0, nullptr, nullptr},
2495 };
2496
2497 srna = RNA_def_struct(brna, "ParticleSettings", "ID");
2499 srna, "Particle Settings", "Particle settings, reusable by multiple particle systems");
2500 RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
2501
2503 srna,
2504 "rna_ParticleSettings_mtex_begin",
2505 "rna_ParticleSettings_active_texture_get",
2506 "rna_ParticleSettings_active_texture_set",
2507 nullptr,
2508 "ParticleSettingsTextureSlot",
2509 "ParticleSettingsTextureSlots",
2510 "rna_Particle_reset_dependency",
2511 nullptr);
2512
2513 /* Fluid particle type can't be checked from the type value in RNA
2514 * as it's not shown in the menu. */
2515 prop = RNA_def_property(srna, "is_fluid", PROP_BOOLEAN, PROP_NONE);
2517 RNA_def_property_boolean_funcs(prop, "rna_PartSettings_is_fluid_get", nullptr);
2518 RNA_def_property_ui_text(prop, "Fluid", "Particles were created by a fluid simulation");
2519
2520 /* flag */
2521 prop = RNA_def_property(srna, "use_react_start_end", PROP_BOOLEAN, PROP_NONE);
2522 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_REACT_STA_END);
2524 RNA_def_property_ui_text(prop, "Start/End", "Give birth to unreacted particles eventually");
2525 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2526
2527 prop = RNA_def_property(srna, "use_react_multiple", PROP_BOOLEAN, PROP_NONE);
2528 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_REACT_MULTIPLE);
2530 RNA_def_property_ui_text(prop, "Multi React", "React multiple times");
2531 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2532
2533 prop = RNA_def_property(srna, "use_regrow_hair", PROP_BOOLEAN, PROP_NONE);
2534 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_HAIR_REGROW);
2535 RNA_def_property_ui_text(prop, "Regrow", "Regrow hair for each frame");
2536 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2537
2538 prop = RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
2539 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_UNBORN);
2540 RNA_def_property_ui_text(prop, "Unborn", "Show particles before they are emitted");
2541 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2542
2543 prop = RNA_def_property(srna, "use_dead", PROP_BOOLEAN, PROP_NONE);
2544 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_DIED);
2545 RNA_def_property_ui_text(prop, "Died", "Show particles after they have died");
2546 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2547
2548 prop = RNA_def_property(srna, "use_emit_random", PROP_BOOLEAN, PROP_NONE);
2549 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_TRAND);
2551 RNA_def_property_ui_text(prop, "Random", "Emit in random order of elements");
2552 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2553
2554 prop = RNA_def_property(srna, "use_even_distribution", PROP_BOOLEAN, PROP_NONE);
2555 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_EDISTR);
2558 "Even Distribution",
2559 "Use even distribution from faces based on face areas or edge lengths");
2560 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2561
2562 prop = RNA_def_property(srna, "use_die_on_collision", PROP_BOOLEAN, PROP_NONE);
2563 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_DIE_ON_COL);
2566 prop, "Die on Hit", "Particles die when they collide with a deflector object");
2567 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2568
2569 prop = RNA_def_property(srna, "use_size_deflect", PROP_BOOLEAN, PROP_NONE);
2570 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_SIZE_DEFL);
2572 RNA_def_property_ui_text(prop, "Size Deflect", "Use particle's size in deflection");
2573 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2574
2575 prop = RNA_def_property(srna, "use_rotations", PROP_BOOLEAN, PROP_NONE);
2576 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_ROTATIONS);
2578 RNA_def_property_ui_text(prop, "Rotations", "Calculate particle rotations");
2579 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2580
2581 prop = RNA_def_property(srna, "use_dynamic_rotation", PROP_BOOLEAN, PROP_NONE);
2582 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_ROT_DYN);
2585 prop, "Dynamic", "Particle rotations are affected by collisions and effectors");
2586 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2587
2588 prop = RNA_def_property(srna, "use_multiply_size_mass", PROP_BOOLEAN, PROP_NONE);
2589 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_SIZEMASS);
2591 RNA_def_property_ui_text(prop, "Mass from Size", "Multiply mass by particle size");
2592 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2593
2594 prop = RNA_def_property(srna, "use_advanced_hair", PROP_BOOLEAN, PROP_NONE);
2597 RNA_def_property_ui_text(prop, "Advanced", "Use full physics calculations for growing hair");
2598 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2599
2600 prop = RNA_def_property(srna, "lock_boids_to_surface", PROP_BOOLEAN, PROP_NONE);
2601 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_BOIDS_2D);
2602 RNA_def_property_ui_text(prop, "Boids 2D", "Constrain boids to a surface");
2603 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2604
2605 prop = RNA_def_property(srna, "use_hair_bspline", PROP_BOOLEAN, PROP_NONE);
2606 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_HAIR_BSPLINE);
2607 RNA_def_property_ui_text(prop, "B-Spline", "Interpolate hair using B-Splines");
2608 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2609
2610 prop = RNA_def_property(srna, "invert_grid", PROP_BOOLEAN, PROP_NONE);
2611 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_GRID_INVERT);
2613 prop, "Invert Grid", "Invert what is considered object and what is not");
2614 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2615
2616 prop = RNA_def_property(srna, "hexagonal_grid", PROP_BOOLEAN, PROP_NONE);
2617 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_GRID_HEXAGONAL);
2618 RNA_def_property_ui_text(prop, "Hexagonal Grid", "Create the grid in a hexagonal pattern");
2619 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2620
2621 prop = RNA_def_property(srna, "apply_effector_to_children", PROP_BOOLEAN, PROP_NONE);
2622 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_CHILD_EFFECT);
2623 RNA_def_property_ui_text(prop, "Affect Children", "Apply effectors to children");
2624 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2625
2626 prop = RNA_def_property(srna, "create_long_hair_children", PROP_BOOLEAN, PROP_NONE);
2628 RNA_def_property_ui_text(prop, "Long Hair", "Calculate children that suit long hair well");
2629 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2630
2631 prop = RNA_def_property(srna, "apply_guide_to_children", PROP_BOOLEAN, PROP_NONE);
2632 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_CHILD_GUIDE);
2633 RNA_def_property_ui_text(prop, "apply_guide_to_children", "");
2634 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2635
2636 prop = RNA_def_property(srna, "use_self_effect", PROP_BOOLEAN, PROP_NONE);
2637 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PART_SELF_EFFECT);
2638 RNA_def_property_ui_text(prop, "Self Effect", "Particle effectors affect themselves");
2639 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2640
2641 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2644 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Particle_type_itemf");
2645 RNA_def_property_ui_text(prop, "Type", "Particle type");
2646 RNA_def_property_update(prop, 0, "rna_Particle_change_type");
2647
2648 prop = RNA_def_property(srna, "emit_from", PROP_ENUM, PROP_NONE);
2649 RNA_def_property_enum_sdna(prop, nullptr, "from");
2652 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Particle_from_itemf");
2653 RNA_def_property_ui_text(prop, "Emit From", "Where to emit particles from");
2654 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2655
2656 prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
2657 RNA_def_property_enum_sdna(prop, nullptr, "distr");
2660 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Particle_dist_itemf");
2662 prop, "Distribution", "How to distribute particles on selected element");
2663 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2664
2665 /* physics modes */
2666 prop = RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
2667 RNA_def_property_enum_sdna(prop, nullptr, "phystype");
2669 RNA_def_property_enum_items(prop, phys_type_items);
2670 RNA_def_property_ui_text(prop, "Physics Type", "Particle physics type");
2671 RNA_def_property_update(prop, 0, "rna_Particle_change_physics_type");
2672
2673 prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
2674 RNA_def_property_enum_sdna(prop, nullptr, "rotmode");
2676 RNA_def_property_enum_items(prop, rot_mode_items);
2678 prop,
2679 "Orientation Axis",
2680 "Particle orientation axis (does not affect Explode modifier's results)");
2681 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2682
2683 prop = RNA_def_property(srna, "angular_velocity_mode", PROP_ENUM, PROP_NONE);
2684 RNA_def_property_enum_sdna(prop, nullptr, "avemode");
2686 RNA_def_property_enum_items(prop, ave_mode_items);
2688 prop, "Angular Velocity Axis", "What axis is used to change particle rotation with time");
2689 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2690
2691 prop = RNA_def_property(srna, "react_event", PROP_ENUM, PROP_NONE);
2692 RNA_def_property_enum_sdna(prop, nullptr, "reactevent");
2694 RNA_def_property_enum_items(prop, react_event_items);
2695 RNA_def_property_ui_text(prop, "React On", "The event of target particles to react on");
2696 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2697
2698 /* Draw flag. */
2699 prop = RNA_def_property(srna, "show_guide_hairs", PROP_BOOLEAN, PROP_NONE);
2701 RNA_def_property_ui_text(prop, "Guide Hairs", "Show guide hairs");
2702 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2703
2704 prop = RNA_def_property(srna, "show_hair_grid", PROP_BOOLEAN, PROP_NONE);
2705 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_DRAW_HAIR_GRID);
2706 RNA_def_property_ui_text(prop, "Guide Hairs", "Show hair simulation grid");
2707 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2708
2709 prop = RNA_def_property(srna, "show_velocity", PROP_BOOLEAN, PROP_NONE);
2710 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_DRAW_VEL);
2711 RNA_def_property_ui_text(prop, "Velocity", "Show particle velocity");
2712 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2713
2714 prop = RNA_def_property(srna, "show_size", PROP_BOOLEAN, PROP_NONE);
2715 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_DRAW_SIZE);
2716 RNA_def_property_ui_text(prop, "Size", "Show particle size");
2717 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2718
2719 prop = RNA_def_property(srna, "show_health", PROP_BOOLEAN, PROP_NONE);
2720 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_DRAW_HEALTH);
2721 RNA_def_property_ui_text(prop, "Health", "Display boid health");
2722 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2723
2724 prop = RNA_def_property(srna, "use_absolute_path_time", PROP_BOOLEAN, PROP_NONE);
2725 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_ABS_PATH_TIME);
2726 RNA_def_property_ui_text(prop, "Absolute Path Time", "Path timing is in absolute frames");
2727 RNA_def_property_update(prop, 0, "rna_Particle_abspathtime_update");
2728
2729 prop = RNA_def_property(srna, "use_parent_particles", PROP_BOOLEAN, PROP_NONE);
2730 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_DRAW_PARENT);
2731 RNA_def_property_ui_text(prop, "Parents", "Render parent particles");
2733 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2734
2735 prop = RNA_def_property(srna, "show_number", PROP_BOOLEAN, PROP_NONE);
2736 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_DRAW_NUM);
2737 RNA_def_property_ui_text(prop, "Number", "Show particle number");
2738 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2739
2740 prop = RNA_def_property(srna, "use_collection_pick_random", PROP_BOOLEAN, PROP_NONE);
2741 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_DRAW_RAND_GR);
2742 RNA_def_property_ui_text(prop, "Pick Random", "Pick objects from collection randomly");
2743 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2744
2745 prop = RNA_def_property(srna, "use_collection_count", PROP_BOOLEAN, PROP_NONE);
2746 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_DRAW_COUNT_GR);
2747 RNA_def_property_ui_text(prop, "Use Count", "Use object multiple times in the same collection");
2748 RNA_def_property_update(prop, 0, "rna_Particle_redo_count");
2749
2750 prop = RNA_def_property(srna, "use_global_instance", PROP_BOOLEAN, PROP_NONE);
2751 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_DRAW_GLOBAL_OB);
2752 RNA_def_property_ui_text(prop, "Global", "Use object's global coordinates for duplication");
2753 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2754
2755 prop = RNA_def_property(srna, "use_rotation_instance", PROP_BOOLEAN, PROP_NONE);
2756 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_DRAW_ROTATE_OB);
2758 "Rotation",
2759 "Use object's rotation for duplication (global x-axis is aligned "
2760 "particle rotation axis)");
2761 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2762
2763 prop = RNA_def_property(srna, "use_scale_instance", PROP_BOOLEAN, PROP_NONE);
2765 RNA_def_property_ui_text(prop, "Scale", "Use object's scale for duplication");
2766 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2767
2768 prop = RNA_def_property(srna, "use_render_adaptive", PROP_BOOLEAN, PROP_NONE);
2769 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_DRAW_REN_ADAPT);
2770 RNA_def_property_ui_text(prop, "Adaptive Render", "Display steps of the particle path");
2771 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2772
2773 prop = RNA_def_property(srna, "use_velocity_length", PROP_BOOLEAN, PROP_NONE);
2775 RNA_def_property_ui_text(prop, "Speed", "Multiply line length by particle speed");
2776 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2777
2778 prop = RNA_def_property(srna, "use_whole_collection", PROP_BOOLEAN, PROP_NONE);
2779 RNA_def_property_boolean_sdna(prop, nullptr, "draw", PART_DRAW_WHOLE_GR);
2780 RNA_def_property_ui_text(prop, "Whole Collection", "Use whole collection at once");
2781 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2782
2783 prop = RNA_def_property(srna, "use_strand_primitive", PROP_BOOLEAN, PROP_NONE);
2785 RNA_def_property_ui_text(prop, "Strand Render", "Use the strand primitive for rendering");
2786 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2787
2788 prop = RNA_def_property(srna, "display_method", PROP_ENUM, PROP_NONE);
2789 RNA_def_property_enum_sdna(prop, nullptr, "draw_as");
2791 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Particle_draw_as_itemf");
2792 RNA_def_property_ui_text(prop, "Particle Display", "How particles are displayed in viewport");
2794 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2795
2796 prop = RNA_def_property(srna, "render_type", PROP_ENUM, PROP_NONE);
2797 RNA_def_property_enum_sdna(prop, nullptr, "ren_as");
2799 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Particle_ren_as_itemf");
2800 RNA_def_property_ui_text(prop, "Particle Rendering", "How particles are rendered");
2801 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2802
2803 prop = RNA_def_property(srna, "display_color", PROP_ENUM, PROP_NONE);
2804 RNA_def_property_enum_sdna(prop, nullptr, "draw_col");
2805 RNA_def_property_enum_items(prop, draw_col_items);
2806 RNA_def_property_ui_text(prop, "Display Color", "Display additional particle data as a color");
2807 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2808
2809 prop = RNA_def_property(srna, "display_size", PROP_FLOAT, PROP_DISTANCE);
2810 RNA_def_property_float_sdna(prop, nullptr, "draw_size");
2811 RNA_def_property_range(prop, 0, 1000);
2812 RNA_def_property_ui_range(prop, 0, 100, 1, -1);
2813 RNA_def_property_ui_text(prop, "Display Size", "Size of particles on viewport");
2814 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2815
2816 prop = RNA_def_property(srna, "child_type", PROP_ENUM, PROP_NONE);
2817 RNA_def_property_enum_sdna(prop, nullptr, "childtype");
2818 RNA_def_property_enum_items(prop, child_type_items);
2819 RNA_def_property_ui_text(prop, "Children From", "Create child particles");
2820 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2821
2822 prop = RNA_def_property(srna, "display_step", PROP_INT, PROP_NONE);
2823 RNA_def_property_int_sdna(prop, nullptr, "draw_step");
2824 RNA_def_property_range(prop, 0, 10);
2825 RNA_def_property_ui_range(prop, 0, 7, 1, -1);
2826 RNA_def_property_ui_text(prop, "Steps", "How many steps paths are displayed with (power of 2)");
2827 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2828
2829 prop = RNA_def_property(srna, "render_step", PROP_INT, PROP_NONE);
2830 RNA_def_property_int_sdna(prop, nullptr, "ren_step");
2831 RNA_def_property_range(prop, 0, 20);
2832 RNA_def_property_ui_range(prop, 0, 9, 1, -1);
2833 RNA_def_property_ui_text(prop, "Render", "How many steps paths are rendered with (power of 2)");
2834
2835 prop = RNA_def_property(srna, "hair_step", PROP_INT, PROP_NONE);
2836 RNA_def_property_range(prop, 2, SHRT_MAX);
2837 RNA_def_property_ui_range(prop, 2, 50, 1, 1);
2839 RNA_def_property_ui_text(prop, "Segments", "Number of hair segments");
2840 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2841
2842 prop = RNA_def_property(srna, "bending_random", PROP_FLOAT, PROP_FACTOR);
2843 RNA_def_property_float_sdna(prop, nullptr, "bending_random");
2844 RNA_def_property_range(prop, 0.0f, 1.0f);
2845 RNA_def_property_ui_text(prop, "Random Bending Stiffness", "Random stiffness of hairs");
2846 RNA_def_property_update(prop, 0, "rna_Particle_cloth_update");
2847
2848 /* TODO: not found in UI, read-only? */
2849 prop = RNA_def_property(srna, "keys_step", PROP_INT, PROP_NONE);
2850 RNA_def_property_range(prop, 0, SHRT_MAX); /* TODO: min,max. */
2851 RNA_def_property_ui_text(prop, "Keys Step", "");
2852
2853 /* adaptive path rendering */
2854 prop = RNA_def_property(srna, "adaptive_angle", PROP_INT, PROP_NONE);
2855 RNA_def_property_int_sdna(prop, nullptr, "adapt_angle");
2856 RNA_def_property_range(prop, 0, 45);
2858 prop, "Degrees", "How many degrees path has to curve to make another render segment");
2859
2860 prop = RNA_def_property(srna, "adaptive_pixel", PROP_INT, PROP_NONE);
2861 RNA_def_property_int_sdna(prop, nullptr, "adapt_pix");
2862 RNA_def_property_range(prop, 0, 50);
2864 prop, "Pixel", "How many pixels path has to cover to make another render segment");
2865
2866 prop = RNA_def_property(srna, "display_percentage", PROP_INT, PROP_PERCENTAGE);
2867 RNA_def_property_int_sdna(prop, nullptr, "disp");
2868 RNA_def_property_range(prop, 0, 100);
2869 RNA_def_property_ui_text(prop, "Display", "Percentage of particles to display in 3D view");
2870 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2871
2872 prop = RNA_def_property(srna, "material", PROP_INT, PROP_NONE);
2873 RNA_def_property_int_sdna(prop, nullptr, "omat");
2874 RNA_def_property_range(prop, 1, 32767);
2876 prop, "Material Index", "Index of material slot used for rendering particles");
2877 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2878
2879 prop = RNA_def_property(srna, "material_slot", PROP_ENUM, PROP_NONE);
2880 RNA_def_property_enum_sdna(prop, nullptr, "omat");
2882 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Particle_Material_itemf");
2883 RNA_def_property_ui_text(prop, "Material Slot", "Material slot used for rendering particles");
2884 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2885
2886 prop = RNA_def_property(srna, "integrator", PROP_ENUM, PROP_NONE);
2887 RNA_def_property_enum_items(prop, integrator_type_items);
2889 "Integration",
2890 "Algorithm used to calculate physics, from the fastest to the "
2891 "most stable and accurate: Midpoint, Euler, Verlet, RK4");
2892 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2893
2894 prop = RNA_def_property(srna, "kink", PROP_ENUM, PROP_NONE);
2895 RNA_def_property_enum_items(prop, kink_type_items);
2896 RNA_def_property_ui_text(prop, "Kink", "Type of periodic offset on the path");
2898 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2899
2900 prop = RNA_def_property(srna, "kink_axis", PROP_ENUM, PROP_NONE);
2902 RNA_def_property_ui_text(prop, "Axis", "Which axis to use for offset");
2903 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2904
2905 prop = RNA_def_property(srna, "color_maximum", PROP_FLOAT, PROP_NONE);
2906 RNA_def_property_float_sdna(prop, nullptr, "color_vec_max");
2907 RNA_def_property_range(prop, 0.01f, 100.0f);
2908 RNA_def_property_ui_text(prop, "Color Maximum", "Maximum length of the particle color vector");
2909 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2910
2911 /* general values */
2912 prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_TIME);
2913 RNA_def_property_float_sdna(prop, nullptr, "sta"); /* Optional if prop names are the same. */
2916 RNA_def_property_float_funcs(prop, nullptr, "rna_PartSettings_start_set", nullptr);
2917 RNA_def_property_ui_text(prop, "Start", "Frame number to start emitting particles");
2918 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2919
2920 prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_TIME);
2921 RNA_def_property_float_sdna(prop, nullptr, "end");
2923
2925 RNA_def_property_float_funcs(prop, nullptr, "rna_PartSettings_end_set", nullptr);
2926 RNA_def_property_ui_text(prop, "End", "Frame number to stop emitting particles");
2927 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2928
2929 prop = RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
2930 RNA_def_property_range(prop, 1.0f, MAXFRAMEF);
2931 RNA_def_property_ui_text(prop, "Lifetime", "Life span of the particles");
2932 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2933
2934 prop = RNA_def_property(srna, "lifetime_random", PROP_FLOAT, PROP_FACTOR);
2935 RNA_def_property_float_sdna(prop, nullptr, "randlife");
2936 RNA_def_property_range(prop, 0.0f, 1.0f);
2937 RNA_def_property_ui_text(prop, "Random", "Give the particle life a random variation");
2938 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2939
2940 prop = RNA_def_property(srna, "time_tweak", PROP_FLOAT, PROP_NONE);
2941 RNA_def_property_float_sdna(prop, nullptr, "timetweak");
2942 RNA_def_property_range(prop, 0.0f, 100.0f);
2943 RNA_def_property_ui_range(prop, 0, 10, 1, 3);
2945 prop, "Tweak", "A multiplier for physics timestep (1.0 means one frame = 1/25 seconds)");
2946 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2947
2948 prop = RNA_def_property(srna, "timestep", PROP_FLOAT, PROP_NONE);
2950 prop, "rna_PartSettings_timestep_get", "rna_PartSetings_timestep_set", nullptr);
2951 RNA_def_property_range(prop, 0.0001, 100.0);
2952 RNA_def_property_ui_range(prop, 0.01, 10, 1, 3);
2954 prop, "Timestep", "The simulation timestep per frame (seconds per frame)");
2955 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2956
2957 prop = RNA_def_property(srna, "use_adaptive_subframes", PROP_BOOLEAN, PROP_NONE);
2958 RNA_def_property_boolean_sdna(prop, nullptr, "time_flag", PART_TIME_AUTOSF);
2960 prop, "Automatic Subframes", "Automatically set the number of subframes");
2961 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2962
2963 prop = RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE);
2964 RNA_def_property_range(prop, 0, 1000);
2966 prop,
2967 "Subframes",
2968 "Subframes to simulate for improved stability and finer granularity simulations "
2969 "(dt = timestep / (subframes + 1))");
2970 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2971
2972 prop = RNA_def_property(srna, "courant_target", PROP_FLOAT, PROP_NONE);
2973 RNA_def_property_range(prop, 0.0001, 10);
2975 prop,
2976 "Adaptive Subframe Threshold",
2977 "The relative distance a particle can move before requiring more subframes "
2978 "(target Courant number); 0.01 to 0.3 is the recommended range");
2979 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2980
2981 prop = RNA_def_property(srna, "jitter_factor", PROP_FLOAT, PROP_NONE);
2983 RNA_def_property_float_sdna(prop, nullptr, "jitfac");
2984 RNA_def_property_range(prop, 0.0f, 2.0f);
2985 RNA_def_property_ui_text(prop, "Amount", "Amount of jitter applied to the sampling");
2986 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2987
2988 prop = RNA_def_property(srna, "effect_hair", PROP_FLOAT, PROP_FACTOR);
2989 RNA_def_property_float_sdna(prop, nullptr, "eff_hair");
2990 RNA_def_property_range(prop, 0.0f, 1.0f);
2991 RNA_def_property_ui_text(prop, "Stiffness", "Hair stiffness for effectors");
2992 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2993
2994 prop = RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
2995 RNA_def_property_int_sdna(prop, nullptr, "totpart");
2997 RNA_def_property_ui_range(prop, 0, 1000000, 1, -1);
2998 RNA_def_property_ui_text(prop, "Number", "Total number of particles");
3000 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3001
3002 prop = RNA_def_property(
3003 srna, "userjit", PROP_INT, PROP_UNSIGNED); /* TODO: can we get a better name for userjit? */
3004 RNA_def_property_int_sdna(prop, nullptr, "userjit");
3006 RNA_def_property_range(prop, 0, 1000);
3007 RNA_def_property_ui_text(prop, "Particles/Face", "Emission locations per face (0 = automatic)");
3008 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3009
3010 prop = RNA_def_property(srna, "grid_resolution", PROP_INT, PROP_UNSIGNED);
3011 RNA_def_property_int_sdna(prop, nullptr, "grid_res");
3014 prop, 1, 250); /* ~15M particles in a cube (ouch!), but could be very usable in a plane */
3015 RNA_def_property_ui_range(prop, 1, 50, 1, -1); /* ~100k particles in a cube */
3016 RNA_def_property_ui_text(prop, "Resolution", "The resolution of the particle grid");
3017 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3018
3019 prop = RNA_def_property(srna, "grid_random", PROP_FLOAT, PROP_FACTOR);
3020 RNA_def_property_float_sdna(prop, nullptr, "grid_rand");
3021 RNA_def_property_range(prop, 0.0f, 1.0f);
3022 RNA_def_property_ui_text(prop, "Grid Randomness", "Add random offset to the grid locations");
3023 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3024
3025 prop = RNA_def_property(srna, "effector_amount", PROP_INT, PROP_UNSIGNED);
3026 /* In theory PROP_ANIMATABLE perhaps should be cleared,
3027 * but animating this can give some interesting results! */
3028 RNA_def_property_range(prop, 0, 10000); /* 10000 effectors will be SLOW, but who knows */
3029 RNA_def_property_ui_range(prop, 0, 100, 1, -1);
3031 prop, "Effector Number", "How many particles are effectors (0 is all particles)");
3032 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3033
3034 /* initial velocity factors */
3035 prop = RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_VELOCITY);
3036 RNA_def_property_float_sdna(prop, nullptr, "normfac"); /* Optional if prop names are the same. */
3037 RNA_def_property_range(prop, -1000.0f, 1000.0f);
3038 RNA_def_property_ui_range(prop, 0, 100, 1, 3);
3040 prop, "Normal", "Let the surface normal give the particle a starting velocity");
3041 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3042
3043 prop = RNA_def_property(srna, "object_factor", PROP_FLOAT, PROP_NONE);
3044 RNA_def_property_float_sdna(prop, nullptr, "obfac");
3045 RNA_def_property_range(prop, -200.0f, 200.0f);
3046 RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
3048 prop, "Object Velocity", "Let the object give the particle a starting velocity");
3049 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3050
3051 prop = RNA_def_property(srna, "factor_random", PROP_FLOAT, PROP_NONE);
3052 RNA_def_property_float_sdna(prop, nullptr, "randfac"); /* Optional if prop names are the same. */
3053 RNA_def_property_range(prop, 0.0f, 200.0f);
3054 RNA_def_property_ui_range(prop, 0, 100, 1, 3);
3055 RNA_def_property_ui_text(prop, "Random", "Give the starting velocity a random variation");
3056 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3057
3058 prop = RNA_def_property(srna, "particle_factor", PROP_FLOAT, PROP_NONE);
3059 RNA_def_property_float_sdna(prop, nullptr, "partfac");
3060 RNA_def_property_range(prop, -200.0f, 200.0f);
3061 RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
3063 prop, "Particle", "Let the target particle give the particle a starting velocity");
3064 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3065
3066 prop = RNA_def_property(srna, "tangent_factor", PROP_FLOAT, PROP_VELOCITY);
3067 RNA_def_property_float_sdna(prop, nullptr, "tanfac");
3068 RNA_def_property_range(prop, -1000.0f, 1000.0f);
3069 RNA_def_property_ui_range(prop, -100, 100, 1, 2);
3071 prop, "Tangent", "Let the surface tangent give the particle a starting velocity");
3072 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3073
3074 prop = RNA_def_property(srna, "tangent_phase", PROP_FLOAT, PROP_NONE);
3075 RNA_def_property_float_sdna(prop, nullptr, "tanphase");
3076 RNA_def_property_range(prop, -1.0f, 1.0f);
3077 RNA_def_property_ui_text(prop, "Rotation", "Rotate the surface tangent");
3078 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3079
3080 prop = RNA_def_property(srna, "reactor_factor", PROP_FLOAT, PROP_NONE);
3081 RNA_def_property_float_sdna(prop, nullptr, "reactfac");
3082 RNA_def_property_range(prop, -10.0f, 10.0f);
3084 prop,
3085 "Reactor",
3086 "Let the vector away from the target particle's location give the particle "
3087 "a starting velocity");
3088 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3089
3090 prop = RNA_def_property(srna, "object_align_factor", PROP_FLOAT, PROP_VELOCITY);
3091 RNA_def_property_float_sdna(prop, nullptr, "ob_vel");
3092 RNA_def_property_array(prop, 3);
3093 RNA_def_property_range(prop, -200.0f, 200.0f);
3094 RNA_def_property_ui_range(prop, -100, 100, 1, 3);
3096 prop,
3097 "Object Aligned",
3098 "Let the emitter object orientation give the particle a starting velocity");
3099 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3100
3101 prop = RNA_def_property(srna, "angular_velocity_factor", PROP_FLOAT, PROP_NONE);
3102 RNA_def_property_float_sdna(prop, nullptr, "avefac");
3103 RNA_def_property_range(prop, -200.0f, 200.0f);
3104 RNA_def_property_ui_range(prop, -100, 100, 10, 3);
3106 prop, "Angular Velocity", "Angular velocity amount (in radians per second)");
3107 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3108
3109 prop = RNA_def_property(srna, "phase_factor", PROP_FLOAT, PROP_NONE);
3110 RNA_def_property_float_sdna(prop, nullptr, "phasefac");
3111 RNA_def_property_range(prop, -1.0f, 1.0f);
3112 RNA_def_property_ui_text(prop, "Phase", "Rotation around the chosen orientation axis");
3113 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3114
3115 prop = RNA_def_property(srna, "rotation_factor_random", PROP_FLOAT, PROP_FACTOR);
3116 RNA_def_property_float_sdna(prop, nullptr, "randrotfac");
3117 RNA_def_property_range(prop, 0.0f, 1.0f);
3118 RNA_def_property_ui_text(prop, "Random Orientation", "Randomize particle orientation");
3119 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3120
3121 prop = RNA_def_property(srna, "phase_factor_random", PROP_FLOAT, PROP_FACTOR);
3122 RNA_def_property_float_sdna(prop, nullptr, "randphasefac");
3123 RNA_def_property_range(prop, 0.0f, 2.0f);
3125 prop, "Random Phase", "Randomize rotation around the chosen orientation axis");
3126 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3127
3128 prop = RNA_def_property(srna, "hair_length", PROP_FLOAT, PROP_DISTANCE);
3130 prop, "rna_PartSetting_hairlength_get", "rna_PartSetting_hairlength_set", nullptr);
3131 RNA_def_property_range(prop, 0.0f, 1000.0f);
3132 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
3133 RNA_def_property_ui_text(prop, "Hair Length", "Length of the hair");
3134 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3135
3136 /* physical properties */
3137 prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_UNIT_MASS);
3138 RNA_def_property_range(prop, 0.00000001f, 100000.0f);
3139 RNA_def_property_ui_range(prop, 0.01, 100, 1, 4);
3140 RNA_def_property_ui_text(prop, "Mass", "Mass of the particles");
3141 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3142
3143 prop = RNA_def_property(srna, "particle_size", PROP_FLOAT, PROP_NONE);
3144 RNA_def_property_float_sdna(prop, nullptr, "size");
3145 RNA_def_property_range(prop, 0.001f, 100000.0f);
3146 RNA_def_property_ui_range(prop, 0.01, 100, 1, 3);
3147 RNA_def_property_ui_text(prop, "Size", "The size of the particles");
3148 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3149
3150 prop = RNA_def_property(srna, "size_random", PROP_FLOAT, PROP_FACTOR);
3151 RNA_def_property_float_sdna(prop, nullptr, "randsize");
3152 RNA_def_property_range(prop, 0.0f, 1.0f);
3153 RNA_def_property_ui_text(prop, "Random Size", "Give the particle size a random variation");
3154 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3155
3156 prop = RNA_def_property(srna, "collision_collection", PROP_POINTER, PROP_NONE);
3157 RNA_def_property_struct_type(prop, "Collection");
3158 RNA_def_property_pointer_sdna(prop, nullptr, "collision_group");
3161 RNA_def_property_ui_text(prop, "Collision Collection", "Limit colliders to this collection");
3162 RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
3163
3164 /* global physical properties */
3165 prop = RNA_def_property(srna, "drag_factor", PROP_FLOAT, PROP_FACTOR);
3166 RNA_def_property_float_sdna(prop, nullptr, "dragfac");
3167 RNA_def_property_range(prop, 0.0f, 1.0f);
3168 RNA_def_property_ui_text(prop, "Drag", "Amount of air drag");
3169 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3170
3171 prop = RNA_def_property(srna, "brownian_factor", PROP_FLOAT, PROP_NONE);
3172 RNA_def_property_float_sdna(prop, nullptr, "brownfac");
3173 RNA_def_property_range(prop, 0.0f, 200.0f);
3174 RNA_def_property_ui_range(prop, 0, 20, 1, 3);
3175 RNA_def_property_ui_text(prop, "Brownian", "Amount of random, erratic particle movement");
3176 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3177
3178 prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_FACTOR);
3179 RNA_def_property_float_sdna(prop, nullptr, "dampfac");
3180 RNA_def_property_range(prop, 0.0f, 1.0f);
3181 RNA_def_property_ui_text(prop, "Damp", "Amount of damping");
3182 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3183
3184 /* random length */
3185 prop = RNA_def_property(srna, "length_random", PROP_FLOAT, PROP_FACTOR);
3186 RNA_def_property_float_sdna(prop, nullptr, "randlength");
3187 RNA_def_property_range(prop, 0.0f, 1.0f);
3188 RNA_def_property_ui_text(prop, "Random Length", "Give path length a random variation");
3189 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3190
3191 /* children */
3192
3193 prop = RNA_def_property(srna, "child_percent", PROP_INT, PROP_NONE);
3195 prop, nullptr, "child_percent"); /* Optional if prop names are the same. */
3196 RNA_def_property_range(prop, 0, 100000);
3197 RNA_def_property_ui_range(prop, 0, 1000, 1, -1);
3198 RNA_def_property_ui_text(prop, "Children Per Parent", "Number of children per parent");
3199 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3200
3201 prop = RNA_def_property(srna, "rendered_child_count", PROP_INT, PROP_NONE);
3202 RNA_def_property_int_sdna(prop, nullptr, "child_render_percent");
3203 RNA_def_property_range(prop, 0, 100000);
3204 RNA_def_property_ui_range(prop, 0, 10000, 1, -1);
3206 prop, "Rendered Children", "Number of children per parent for rendering");
3207
3208 prop = RNA_def_property(srna, "virtual_parents", PROP_FLOAT, PROP_FACTOR);
3209 RNA_def_property_float_sdna(prop, nullptr, "parents");
3210 RNA_def_property_range(prop, 0.0f, 1.0f);
3211 RNA_def_property_ui_text(prop, "Virtual Parents", "Relative amount of virtual parents");
3212 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3213
3214 prop = RNA_def_property(srna, "child_size", PROP_FLOAT, PROP_NONE);
3215 RNA_def_property_float_sdna(prop, nullptr, "childsize");
3216 RNA_def_property_range(prop, 0.001f, 100000.0f);
3217 RNA_def_property_ui_range(prop, 0.01f, 100.0f, 0.1, 3);
3218 RNA_def_property_ui_text(prop, "Child Size", "A multiplier for the child particle size");
3219 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3220
3221 prop = RNA_def_property(srna, "child_size_random", PROP_FLOAT, PROP_FACTOR);
3222 RNA_def_property_float_sdna(prop, nullptr, "childrandsize");
3223 RNA_def_property_range(prop, 0.0f, 1.0f);
3225 prop, "Random Child Size", "Random variation to the size of the child particles");
3226 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3227
3228 prop = RNA_def_property(srna, "child_radius", PROP_FLOAT, PROP_DISTANCE);
3229 RNA_def_property_float_sdna(prop, nullptr, "childrad");
3230 RNA_def_property_range(prop, 0.0f, 100000.0f);
3231 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
3232 RNA_def_property_ui_text(prop, "Child Radius", "Radius of children around parent");
3233 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3234
3235 prop = RNA_def_property(srna, "child_roundness", PROP_FLOAT, PROP_FACTOR);
3236 RNA_def_property_float_sdna(prop, nullptr, "childflat");
3237 RNA_def_property_range(prop, 0.0f, 1.0f);
3238 RNA_def_property_ui_text(prop, "Child Roundness", "Roundness of children around parent");
3239 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3240
3241 /* clumping */
3242 prop = RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
3243 RNA_def_property_float_sdna(prop, nullptr, "clumpfac");
3244 RNA_def_property_range(prop, -1.0f, 1.0f);
3245 RNA_def_property_ui_text(prop, "Clump", "Amount of clumping");
3246 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3247
3248 prop = RNA_def_property(srna, "clump_shape", PROP_FLOAT, PROP_NONE);
3249 RNA_def_property_float_sdna(prop, nullptr, "clumppow");
3250 RNA_def_property_range(prop, -0.999f, 0.999f);
3251 RNA_def_property_ui_text(prop, "Shape", "Shape of clumping");
3252 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3253
3254 prop = RNA_def_property(srna, "use_clump_curve", PROP_BOOLEAN, PROP_NONE);
3255 RNA_def_property_boolean_sdna(prop, nullptr, "child_flag", PART_CHILD_USE_CLUMP_CURVE);
3256 RNA_def_property_ui_text(prop, "Use Clump Curve", "Use a curve to define clump tapering");
3257 RNA_def_property_update(prop, 0, "rna_ParticleSettings_use_clump_curve_update");
3258
3259 prop = RNA_def_property(srna, "clump_curve", PROP_POINTER, PROP_NONE);
3260 RNA_def_property_pointer_sdna(prop, nullptr, "clumpcurve");
3261 RNA_def_property_struct_type(prop, "CurveMapping");
3263 RNA_def_property_ui_text(prop, "Clump Curve", "Curve defining clump tapering");
3264 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3265
3266 prop = RNA_def_property(srna, "use_clump_noise", PROP_BOOLEAN, PROP_NONE);
3267 RNA_def_property_boolean_sdna(prop, nullptr, "child_flag", PART_CHILD_USE_CLUMP_NOISE);
3268 RNA_def_property_ui_text(prop, "Use Clump Noise", "Create random clumps around the parent");
3269 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3270
3271 prop = RNA_def_property(srna, "clump_noise_size", PROP_FLOAT, PROP_NONE);
3272 RNA_def_property_float_sdna(prop, nullptr, "clump_noise_size");
3273 RNA_def_property_range(prop, 0.00001f, 100000.0f);
3274 RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1f, 3);
3275 RNA_def_property_ui_text(prop, "Clump Noise Size", "Size of clump noise");
3276 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3277
3278 /* kink */
3279 prop = RNA_def_property(srna, "kink_amplitude", PROP_FLOAT, PROP_DISTANCE);
3280 RNA_def_property_float_sdna(prop, nullptr, "kink_amp");
3281 RNA_def_property_range(prop, -100000.0f, 100000.0f);
3282 RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
3283 RNA_def_property_ui_text(prop, "Amplitude", "The amplitude of the offset");
3284 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3285
3286 prop = RNA_def_property(srna, "kink_amplitude_clump", PROP_FLOAT, PROP_FACTOR);
3287 RNA_def_property_float_sdna(prop, nullptr, "kink_amp_clump");
3288 RNA_def_property_range(prop, 0.0f, 1.0f);
3289 RNA_def_property_ui_text(prop, "Amplitude Clump", "How much clump affects kink amplitude");
3290 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3291
3292 prop = RNA_def_property(srna, "kink_amplitude_random", PROP_FLOAT, PROP_FACTOR);
3293 RNA_def_property_float_sdna(prop, nullptr, "kink_amp_random");
3294 RNA_def_property_range(prop, 0.0f, 1.0f);
3295 RNA_def_property_ui_text(prop, "Amplitude Random", "Random variation of the amplitude");
3296 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3297
3298 prop = RNA_def_property(srna, "kink_frequency", PROP_FLOAT, PROP_NONE);
3299 RNA_def_property_float_sdna(prop, nullptr, "kink_freq");
3300 RNA_def_property_range(prop, -100000.0f, 100000.0f);
3301 RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
3302 RNA_def_property_ui_text(prop, "Frequency", "The frequency of the offset (1/total length)");
3303 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3304
3305 prop = RNA_def_property(srna, "kink_shape", PROP_FLOAT, PROP_NONE);
3306 RNA_def_property_range(prop, -0.999f, 0.999f);
3307 RNA_def_property_ui_text(prop, "Shape", "Adjust the offset to the beginning/end");
3308 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3309
3310 prop = RNA_def_property(srna, "kink_flat", PROP_FLOAT, PROP_FACTOR);
3311 RNA_def_property_range(prop, 0.0f, 1.0f);
3312 RNA_def_property_ui_text(prop, "Flatness", "How flat the hairs are");
3313 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3314
3315 prop = RNA_def_property(srna, "kink_extra_steps", PROP_INT, PROP_NONE);
3316 RNA_def_property_range(prop, 1, INT_MAX);
3317 RNA_def_property_ui_range(prop, 1, 100, 1, -1);
3319 prop, "Extra Steps", "Extra steps for resolution of special kink features");
3320 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3321
3322 prop = RNA_def_property(srna, "kink_axis_random", PROP_FLOAT, PROP_FACTOR);
3323 RNA_def_property_range(prop, 0.0f, 1.0f);
3324 RNA_def_property_ui_text(prop, "Axis Random", "Random variation of the orientation");
3325 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3326
3327 /* rough */
3328 prop = RNA_def_property(srna, "roughness_1", PROP_FLOAT, PROP_NONE);
3329 RNA_def_property_float_sdna(prop, nullptr, "rough1");
3330 RNA_def_property_range(prop, 0.0f, 100000.0f);
3331 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
3332 RNA_def_property_ui_text(prop, "Roughness 1", "Amount of location dependent roughness");
3333 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3334
3335 prop = RNA_def_property(srna, "roughness_1_size", PROP_FLOAT, PROP_NONE);
3336 RNA_def_property_float_sdna(prop, nullptr, "rough1_size");
3337 RNA_def_property_range(prop, 0.01f, 100000.0f);
3338 RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3);
3339 RNA_def_property_ui_text(prop, "Size 1", "Size of location dependent roughness");
3340 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3341
3342 prop = RNA_def_property(srna, "roughness_2", PROP_FLOAT, PROP_NONE);
3343 RNA_def_property_float_sdna(prop, nullptr, "rough2");
3344 RNA_def_property_range(prop, 0.0f, 100000.0f);
3345 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
3346 RNA_def_property_ui_text(prop, "Roughness 2", "Amount of random roughness");
3347 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3348
3349 prop = RNA_def_property(srna, "roughness_2_size", PROP_FLOAT, PROP_NONE);
3350 RNA_def_property_float_sdna(prop, nullptr, "rough2_size");
3351 RNA_def_property_range(prop, 0.01f, 100000.0f);
3352 RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3);
3353 RNA_def_property_ui_text(prop, "Size 2", "Size of random roughness");
3354 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3355
3356 prop = RNA_def_property(srna, "roughness_2_threshold", PROP_FLOAT, PROP_FACTOR);
3357 RNA_def_property_float_sdna(prop, nullptr, "rough2_thres");
3358 RNA_def_property_range(prop, 0.0f, 1.0f);
3360 prop, "Threshold", "Amount of particles left untouched by random roughness");
3361 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3362
3363 prop = RNA_def_property(srna, "roughness_endpoint", PROP_FLOAT, PROP_NONE);
3364 RNA_def_property_float_sdna(prop, nullptr, "rough_end");
3365 RNA_def_property_range(prop, 0.0f, 100000.0f);
3366 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
3367 RNA_def_property_ui_text(prop, "Roughness Endpoint", "Amount of endpoint roughness");
3368 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3369
3370 prop = RNA_def_property(srna, "roughness_end_shape", PROP_FLOAT, PROP_NONE);
3371 RNA_def_property_float_sdna(prop, nullptr, "rough_end_shape");
3372 RNA_def_property_range(prop, 0.0f, 10.0f);
3373 RNA_def_property_ui_text(prop, "Shape", "Shape of endpoint roughness");
3374 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3375
3376 prop = RNA_def_property(srna, "use_roughness_curve", PROP_BOOLEAN, PROP_NONE);
3377 RNA_def_property_boolean_sdna(prop, nullptr, "child_flag", PART_CHILD_USE_ROUGH_CURVE);
3378 RNA_def_property_ui_text(prop, "Use Roughness Curve", "Use a curve to define roughness");
3379 RNA_def_property_update(prop, 0, "rna_ParticleSettings_use_roughness_curve_update");
3380
3381 prop = RNA_def_property(srna, "roughness_curve", PROP_POINTER, PROP_NONE);
3382 RNA_def_property_pointer_sdna(prop, nullptr, "roughcurve");
3383 RNA_def_property_struct_type(prop, "CurveMapping");
3385 RNA_def_property_ui_text(prop, "Roughness Curve", "Curve defining roughness");
3386 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3387
3388 prop = RNA_def_property(srna, "child_length", PROP_FLOAT, PROP_FACTOR);
3389 RNA_def_property_float_sdna(prop, nullptr, "clength");
3390 RNA_def_property_range(prop, 0.0f, 1.0f);
3391 RNA_def_property_ui_text(prop, "Length", "Length of child paths");
3392 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3393
3394 prop = RNA_def_property(srna, "child_length_threshold", PROP_FLOAT, PROP_FACTOR);
3395 RNA_def_property_float_sdna(prop, nullptr, "clength_thres");
3396 RNA_def_property_range(prop, 0.0f, 1.0f);
3398 prop, "Threshold", "Amount of particles left untouched by child path length");
3399 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3400
3401 /* parting */
3402 prop = RNA_def_property(srna, "child_parting_factor", PROP_FLOAT, PROP_FACTOR);
3403 RNA_def_property_float_sdna(prop, nullptr, "parting_fac");
3404 RNA_def_property_range(prop, 0.0f, 1.0f);
3406 prop, "Parting Factor", "Create parting in the children based on parent strands");
3407 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3408
3409 prop = RNA_def_property(srna, "child_parting_min", PROP_FLOAT, PROP_NONE);
3410 RNA_def_property_float_sdna(prop, nullptr, "parting_min");
3411 RNA_def_property_range(prop, 0.0f, 180.0f);
3413 "Parting Minimum",
3414 "Minimum root to tip angle (tip distance/root distance for long hair)");
3415 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3416
3417 prop = RNA_def_property(srna, "child_parting_max", PROP_FLOAT, PROP_NONE);
3418 RNA_def_property_float_sdna(prop, nullptr, "parting_max");
3419 RNA_def_property_range(prop, 0.0f, 180.0f);
3421 "Parting Maximum",
3422 "Maximum root to tip angle (tip distance/root distance for long hair)");
3423 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3424
3425 /* branching */
3426 prop = RNA_def_property(srna, "branch_threshold", PROP_FLOAT, PROP_FACTOR);
3427 RNA_def_property_float_sdna(prop, nullptr, "branch_thres");
3428 RNA_def_property_range(prop, 0.0f, 1.0f);
3429 RNA_def_property_ui_text(prop, "Threshold", "Threshold of branching");
3430 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3431
3432 /* drawing stuff */
3433 prop = RNA_def_property(srna, "line_length_tail", PROP_FLOAT, PROP_NONE);
3435 prop, "rna_PartSetting_linelentail_get", "rna_PartSetting_linelentail_set", nullptr);
3436 RNA_def_property_range(prop, 0.0f, 100000.0f);
3437 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
3438 RNA_def_property_ui_text(prop, "Tail", "Length of the line's tail");
3439 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3440
3441 prop = RNA_def_property(srna, "line_length_head", PROP_FLOAT, PROP_NONE);
3443 prop, "rna_PartSetting_linelenhead_get", "rna_PartSetting_linelenhead_set", nullptr);
3444 RNA_def_property_range(prop, 0.0f, 100000.0f);
3445 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
3446 RNA_def_property_ui_text(prop, "Head", "Length of the line's head");
3447 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3448
3449 prop = RNA_def_property(srna, "path_start", PROP_FLOAT, PROP_NONE);
3450 RNA_def_property_float_sdna(prop, nullptr, "path_start");
3451 RNA_def_property_float_funcs(prop, nullptr, nullptr, "rna_PartSetting_pathstartend_range");
3452 RNA_def_property_ui_text(prop, "Path Start", "Starting time of path");
3453 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3454
3455 prop = RNA_def_property(srna, "path_end", PROP_FLOAT, PROP_NONE);
3456 RNA_def_property_float_sdna(prop, nullptr, "path_end");
3457 RNA_def_property_float_funcs(prop, nullptr, nullptr, "rna_PartSetting_pathstartend_range");
3458 RNA_def_property_ui_text(prop, "Path End", "End time of path");
3459 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3460
3461 prop = RNA_def_property(srna, "trail_count", PROP_INT, PROP_NONE);
3462 RNA_def_property_int_sdna(prop, nullptr, "trail_count");
3463 RNA_def_property_range(prop, 1, 100000);
3464 RNA_def_property_ui_range(prop, 1, 100, 1, -1);
3465 RNA_def_property_ui_text(prop, "Trail Count", "Number of trail particles");
3466 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3467
3468 /* keyed particles */
3469 prop = RNA_def_property(srna, "keyed_loops", PROP_INT, PROP_NONE);
3470 RNA_def_property_int_sdna(prop, nullptr, "keyed_loops");
3471 RNA_def_property_range(prop, 1.0f, 10000.0f);
3472 RNA_def_property_ui_range(prop, 1.0f, 100.0f, 1, 3);
3473 RNA_def_property_ui_text(prop, "Loop Count", "Number of times the keys are looped");
3474 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3475
3476 /* Evaluated mesh support. */
3477 prop = RNA_def_property(srna, "use_modifier_stack", PROP_BOOLEAN, PROP_NONE);
3478 RNA_def_property_boolean_sdna(prop, nullptr, "use_modifier_stack", 0);
3480 prop,
3481 "Use Modifier Stack",
3482 "Emit particles from mesh with modifiers applied "
3483 "(must use same subdivision surface level for viewport and render for correct results)");
3484 RNA_def_property_update(prop, 0, "rna_Particle_change_type");
3485
3486 /* draw objects & collections */
3487 prop = RNA_def_property(srna, "instance_collection", PROP_POINTER, PROP_NONE);
3488 RNA_def_property_pointer_sdna(prop, nullptr, "instance_collection");
3489 RNA_def_property_struct_type(prop, "Collection");
3493 prop, "Instance Collection", "Show objects in this collection in place of particles");
3494 RNA_def_property_update(prop, 0, "rna_Particle_redo_count");
3495
3496 prop = RNA_def_property(srna, "instance_weights", PROP_COLLECTION, PROP_NONE);
3497 RNA_def_property_collection_sdna(prop, nullptr, "instance_weights", nullptr);
3498 RNA_def_property_struct_type(prop, "ParticleDupliWeight");
3500 "Instance Collection Weights",
3501 "Weights for all of the objects in the instance collection");
3502
3503 prop = RNA_def_property(srna, "active_instanceweight", PROP_POINTER, PROP_NONE);
3504 RNA_def_property_struct_type(prop, "ParticleDupliWeight");
3506 prop, "rna_ParticleDupliWeight_active_get", nullptr, nullptr, nullptr);
3507 RNA_def_property_ui_text(prop, "Active Instance Object", "");
3508
3509 prop = RNA_def_property(srna, "active_instanceweight_index", PROP_INT, PROP_UNSIGNED);
3511 "rna_ParticleDupliWeight_active_index_get",
3512 "rna_ParticleDupliWeight_active_index_set",
3513 "rna_ParticleDupliWeight_active_index_range");
3514 RNA_def_property_ui_text(prop, "Active Instance Object Index", "");
3515
3516 prop = RNA_def_property(srna, "instance_object", PROP_POINTER, PROP_NONE);
3517 RNA_def_property_struct_type(prop, "Object");
3520 RNA_def_property_ui_text(prop, "Instance Object", "Show this object in place of particles");
3521 RNA_def_property_update(prop, 0, "rna_Particle_redo_dependency");
3522
3523 /* boids */
3524 prop = RNA_def_property(srna, "boids", PROP_POINTER, PROP_NONE);
3525 RNA_def_property_struct_type(prop, "BoidSettings");
3527 RNA_def_property_ui_text(prop, "Boid Settings", "");
3528
3529 /* Fluid particles */
3530 prop = RNA_def_property(srna, "fluid", PROP_POINTER, PROP_NONE);
3531 RNA_def_property_struct_type(prop, "SPHFluidSettings");
3533 RNA_def_property_ui_text(prop, "SPH Fluid Settings", "");
3534
3535 /* Effector weights */
3536 prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
3537 RNA_def_property_struct_type(prop, "EffectorWeights");
3540 RNA_def_property_ui_text(prop, "Effector Weights", "");
3541
3542 /* animation here? */
3544
3545 prop = RNA_def_property(srna, "force_field_1", PROP_POINTER, PROP_NONE);
3546 RNA_def_property_pointer_sdna(prop, nullptr, "pd");
3547 RNA_def_property_struct_type(prop, "FieldSettings");
3548 RNA_def_property_pointer_funcs(prop, "rna_Particle_field1_get", nullptr, nullptr, nullptr);
3550 RNA_def_property_ui_text(prop, "Force Field 1", "");
3551
3552 prop = RNA_def_property(srna, "force_field_2", PROP_POINTER, PROP_NONE);
3553 RNA_def_property_pointer_sdna(prop, nullptr, "pd2");
3554 RNA_def_property_struct_type(prop, "FieldSettings");
3555 RNA_def_property_pointer_funcs(prop, "rna_Particle_field2_get", nullptr, nullptr, nullptr);
3557 RNA_def_property_ui_text(prop, "Force Field 2", "");
3558
3559 /* twist */
3560 prop = RNA_def_property(srna, "twist", PROP_FLOAT, PROP_NONE);
3561 RNA_def_property_range(prop, -100000.0f, 100000.0f);
3562 RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
3563 RNA_def_property_ui_text(prop, "Twist", "Number of turns around parent along the strand");
3564 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3565
3566 prop = RNA_def_property(srna, "use_twist_curve", PROP_BOOLEAN, PROP_NONE);
3567 RNA_def_property_boolean_sdna(prop, nullptr, "child_flag", PART_CHILD_USE_TWIST_CURVE);
3568 RNA_def_property_ui_text(prop, "Use Twist Curve", "Use a curve to define twist");
3569 RNA_def_property_update(prop, 0, "rna_ParticleSettings_use_twist_curve_update");
3570
3571 prop = RNA_def_property(srna, "twist_curve", PROP_POINTER, PROP_NONE);
3572 RNA_def_property_pointer_sdna(prop, nullptr, "twistcurve");
3573 RNA_def_property_struct_type(prop, "CurveMapping");
3575 RNA_def_property_ui_text(prop, "Twist Curve", "Curve defining twist");
3576 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3577
3578 /* hair shape */
3579 prop = RNA_def_property(srna, "use_close_tip", PROP_BOOLEAN, PROP_NONE);
3580 RNA_def_property_boolean_sdna(prop, nullptr, "shape_flag", PART_SHAPE_CLOSE_TIP);
3581 RNA_def_property_ui_text(prop, "Close Tip", "Set tip radius to zero");
3583 prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */
3584
3585 prop = RNA_def_property(srna, "shape", PROP_FLOAT, PROP_FACTOR);
3586 RNA_def_property_range(prop, -1.0f, 1.0f);
3587 RNA_def_property_ui_text(prop, "Shape", "Strand shape parameter");
3589 prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */
3590
3591 prop = RNA_def_property(srna, "root_radius", PROP_FLOAT, PROP_DISTANCE);
3592 RNA_def_property_float_sdna(prop, nullptr, "rad_root");
3593 RNA_def_property_range(prop, 0.0f, FLT_MAX);
3594 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 2);
3595 RNA_def_property_ui_text(prop, "Root Diameter", "Strand diameter width at the root");
3597 prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */
3598
3599 prop = RNA_def_property(srna, "tip_radius", PROP_FLOAT, PROP_DISTANCE);
3600 RNA_def_property_float_sdna(prop, nullptr, "rad_tip");
3601 RNA_def_property_range(prop, 0.0f, FLT_MAX);
3602 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 2);
3603 RNA_def_property_ui_text(prop, "Tip Diameter", "Strand diameter width at the tip");
3605 prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */
3606
3607 prop = RNA_def_property(srna, "radius_scale", PROP_FLOAT, PROP_NONE);
3608 RNA_def_property_float_sdna(prop, nullptr, "rad_scale");
3609 RNA_def_property_range(prop, 0.0f, FLT_MAX);
3610 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 2);
3611 RNA_def_property_ui_text(prop, "Diameter Scale", "Multiplier of diameter properties");
3613 prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */
3614}
3615
3617{
3618 StructRNA *srna;
3619 PropertyRNA *prop;
3620
3621 static const EnumPropertyItem mode_items[] = {
3622 {PTARGET_MODE_FRIEND, "FRIEND", 0, "Friend", ""},
3623 {PTARGET_MODE_NEUTRAL, "NEUTRAL", 0, "Neutral", ""},
3624 {PTARGET_MODE_ENEMY, "ENEMY", 0, "Enemy", ""},
3625 {0, nullptr, 0, nullptr, nullptr},
3626 };
3627
3628 srna = RNA_def_struct(brna, "ParticleTarget", nullptr);
3629 RNA_def_struct_ui_text(srna, "Particle Target", "Target particle system");
3630
3631 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
3633 prop, "rna_ParticleTarget_name_get", "rna_ParticleTarget_name_length", nullptr);
3634 RNA_def_property_ui_text(prop, "Name", "Particle target name");
3636 RNA_def_struct_name_property(srna, prop);
3637
3638 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
3639 RNA_def_property_pointer_sdna(prop, nullptr, "ob");
3643 prop,
3644 "Target Object",
3645 "The object that has the target particle system (empty if same object)");
3646 RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
3647
3648 prop = RNA_def_property(srna, "system", PROP_INT, PROP_UNSIGNED);
3649 RNA_def_property_int_sdna(prop, nullptr, "psys");
3650 RNA_def_property_range(prop, 1, INT_MAX);
3652 prop, "Target Particle System", "The index of particle system on the target object");
3653 RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
3654
3655 prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_TIME);
3656 RNA_def_property_float_sdna(prop, nullptr, "time");
3658 RNA_def_property_ui_text(prop, "Time", "");
3659 RNA_def_property_update(prop, 0, "rna_Particle_target_redo");
3660
3661 prop = RNA_def_property(srna, "duration", PROP_FLOAT, PROP_NONE);
3662 RNA_def_property_float_sdna(prop, nullptr, "duration");
3664 RNA_def_property_ui_text(prop, "Duration", "");
3665 RNA_def_property_update(prop, 0, "rna_Particle_target_redo");
3666
3667 prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
3668 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PTARGET_VALID);
3670 RNA_def_property_ui_text(prop, "Valid", "Keyed particles target is valid");
3671
3672 prop = RNA_def_property(srna, "alliance", PROP_ENUM, PROP_NONE);
3673 RNA_def_property_enum_sdna(prop, nullptr, "mode");
3674 RNA_def_property_enum_items(prop, mode_items);
3676 RNA_def_property_ui_text(prop, "Mode", "");
3677 RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
3678}
3680{
3681 StructRNA *srna;
3682 PropertyRNA *prop;
3683
3684 FunctionRNA *func;
3685 PropertyRNA *parm;
3686
3687 srna = RNA_def_struct(brna, "ParticleSystem", nullptr);
3688 RNA_def_struct_ui_text(srna, "Particle System", "Particle system in an object");
3689 RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
3690
3691 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
3692 RNA_def_property_ui_text(prop, "Name", "Particle system name");
3694 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_ParticleSystem_name_set");
3695 RNA_def_struct_name_property(srna, prop);
3696
3698
3699 /* access to particle settings is redirected through functions */
3700 /* to allow proper id-buttons functionality */
3701 prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
3702 // RNA_def_property_pointer_sdna(prop, nullptr, "part");
3703 RNA_def_property_struct_type(prop, "ParticleSettings");
3706 prop, "rna_particle_settings_get", "rna_particle_settings_set", nullptr, nullptr);
3707 RNA_def_property_ui_text(prop, "Settings", "Particle system settings");
3708 RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
3709
3710 prop = RNA_def_property(srna, "particles", PROP_COLLECTION, PROP_NONE);
3711 RNA_def_property_collection_sdna(prop, nullptr, "particles", "totpart");
3712 RNA_def_property_struct_type(prop, "Particle");
3714 RNA_def_property_ui_text(prop, "Particles", "Particles generated by the particle system");
3715
3716 prop = RNA_def_property(srna, "child_particles", PROP_COLLECTION, PROP_NONE);
3717 RNA_def_property_collection_sdna(prop, nullptr, "child", "totchild");
3718 RNA_def_property_struct_type(prop, "ChildParticle");
3721 prop, "Child Particles", "Child particles generated by the particle system");
3722
3723 prop = RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED);
3725 prop, "Seed", "Offset in the random number table, to get a different randomized result");
3726 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3727
3728 prop = RNA_def_property(srna, "child_seed", PROP_INT, PROP_UNSIGNED);
3730 prop,
3731 "Child Seed",
3732 "Offset in the random number table for child particles, to get a different "
3733 "randomized result");
3734 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3735
3736 /* hair */
3737 prop = RNA_def_property(srna, "is_global_hair", PROP_BOOLEAN, PROP_NONE);
3738 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PSYS_GLOBAL_HAIR);
3740 RNA_def_property_ui_text(prop, "Global Hair", "Hair keys are in global coordinate space");
3741
3742 prop = RNA_def_property(srna, "use_hair_dynamics", PROP_BOOLEAN, PROP_NONE);
3743 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PSYS_HAIR_DYNAMICS);
3744 RNA_def_property_ui_text(prop, "Hair Dynamics", "Enable hair dynamics using cloth simulation");
3745 RNA_def_property_update(prop, 0, "rna_Particle_hair_dynamics_update");
3746
3747 prop = RNA_def_property(srna, "cloth", PROP_POINTER, PROP_NONE);
3748 RNA_def_property_pointer_sdna(prop, nullptr, "clmd");
3749 RNA_def_property_struct_type(prop, "ClothModifier");
3752 RNA_def_property_ui_text(prop, "Cloth", "Cloth dynamics for hair");
3753
3754 /* reactor */
3755 prop = RNA_def_property(srna, "reactor_target_object", PROP_POINTER, PROP_NONE);
3756 RNA_def_property_pointer_sdna(prop, nullptr, "target_ob");
3759 "Reactor Target Object",
3760 "For reactor systems, the object that has the target particle system "
3761 "(empty if same object)");
3762 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3763
3764 prop = RNA_def_property(srna, "reactor_target_particle_system", PROP_INT, PROP_UNSIGNED);
3765 RNA_def_property_int_sdna(prop, nullptr, "target_psys");
3766 RNA_def_property_range(prop, 1, SHRT_MAX);
3768 "Reactor Target Particle System",
3769 "For reactor systems, index of particle system on the target object");
3770 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3771
3772 /* keyed */
3773 prop = RNA_def_property(srna, "use_keyed_timing", PROP_BOOLEAN, PROP_NONE);
3774 RNA_def_property_boolean_sdna(prop, nullptr, "flag", PSYS_KEYED_TIMING);
3776 RNA_def_property_ui_text(prop, "Keyed Timing", "Use key times");
3777 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3778
3779 prop = RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
3780 RNA_def_property_struct_type(prop, "ParticleTarget");
3781 RNA_def_property_ui_text(prop, "Targets", "Target particle systems");
3782
3783 prop = RNA_def_property(srna, "active_particle_target", PROP_POINTER, PROP_NONE);
3784 RNA_def_property_struct_type(prop, "ParticleTarget");
3786 prop, "rna_ParticleSystem_active_particle_target_get", nullptr, nullptr, nullptr);
3787 RNA_def_property_ui_text(prop, "Active Particle Target", "");
3788
3789 prop = RNA_def_property(srna, "active_particle_target_index", PROP_INT, PROP_UNSIGNED);
3791 "rna_ParticleSystem_active_particle_target_index_get",
3792 "rna_ParticleSystem_active_particle_target_index_set",
3793 "rna_ParticleSystem_active_particle_target_index_range");
3794 RNA_def_property_ui_text(prop, "Active Particle Target Index", "");
3795
3796 /* vertex groups */
3797
3798 /* NOTE: internally store as ints, access as strings. */
3799# if 0 /* int access. works ok but isn't useful for the UI */
3800 prop = RNA_def_property(srna, "vertex_group_density", PROP_INT, PROP_NONE);
3801 RNA_def_property_int_sdna(prop, nullptr, "vgroup[0]");
3802 RNA_def_property_ui_text(prop, "Vertex Group Density", "Vertex group to control density");
3803 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3804# endif
3805
3806 prop = RNA_def_property(srna, "vertex_group_density", PROP_STRING, PROP_NONE);
3808 "rna_ParticleVGroup_name_get_0",
3809 "rna_ParticleVGroup_name_len_0",
3810 "rna_ParticleVGroup_name_set_0");
3811 RNA_def_property_ui_text(prop, "Vertex Group Density", "Vertex group to control density");
3812 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3813
3814 prop = RNA_def_property(srna, "invert_vertex_group_density", PROP_BOOLEAN, PROP_NONE);
3815 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_DENSITY));
3817 prop, "Vertex Group Density Negate", "Negate the effect of the density vertex group");
3818 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3819
3820 prop = RNA_def_property(srna, "vertex_group_velocity", PROP_STRING, PROP_NONE);
3822 "rna_ParticleVGroup_name_get_1",
3823 "rna_ParticleVGroup_name_len_1",
3824 "rna_ParticleVGroup_name_set_1");
3825 RNA_def_property_ui_text(prop, "Vertex Group Velocity", "Vertex group to control velocity");
3826 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3827
3828 prop = RNA_def_property(srna, "invert_vertex_group_velocity", PROP_BOOLEAN, PROP_NONE);
3829 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_VEL));
3831 prop, "Vertex Group Velocity Negate", "Negate the effect of the velocity vertex group");
3832 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3833
3834 prop = RNA_def_property(srna, "vertex_group_length", PROP_STRING, PROP_NONE);
3836 "rna_ParticleVGroup_name_get_2",
3837 "rna_ParticleVGroup_name_len_2",
3838 "rna_ParticleVGroup_name_set_2");
3839 RNA_def_property_ui_text(prop, "Vertex Group Length", "Vertex group to control length");
3840 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3841
3842 prop = RNA_def_property(srna, "invert_vertex_group_length", PROP_BOOLEAN, PROP_NONE);
3843 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_LENGTH));
3845 prop, "Vertex Group Length Negate", "Negate the effect of the length vertex group");
3846 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3847
3848 prop = RNA_def_property(srna, "vertex_group_clump", PROP_STRING, PROP_NONE);
3850 "rna_ParticleVGroup_name_get_3",
3851 "rna_ParticleVGroup_name_len_3",
3852 "rna_ParticleVGroup_name_set_3");
3853 RNA_def_property_ui_text(prop, "Vertex Group Clump", "Vertex group to control clump");
3854 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3855
3856 prop = RNA_def_property(srna, "invert_vertex_group_clump", PROP_BOOLEAN, PROP_NONE);
3857 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_CLUMP));
3859 prop, "Vertex Group Clump Negate", "Negate the effect of the clump vertex group");
3860 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3861
3862 prop = RNA_def_property(srna, "vertex_group_kink", PROP_STRING, PROP_NONE);
3864 "rna_ParticleVGroup_name_get_4",
3865 "rna_ParticleVGroup_name_len_4",
3866 "rna_ParticleVGroup_name_set_4");
3867 RNA_def_property_ui_text(prop, "Vertex Group Kink", "Vertex group to control kink");
3868 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3869
3870 prop = RNA_def_property(srna, "invert_vertex_group_kink", PROP_BOOLEAN, PROP_NONE);
3871 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_KINK));
3873 prop, "Vertex Group Kink Negate", "Negate the effect of the kink vertex group");
3874 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3875
3876 prop = RNA_def_property(srna, "vertex_group_roughness_1", PROP_STRING, PROP_NONE);
3878 "rna_ParticleVGroup_name_get_5",
3879 "rna_ParticleVGroup_name_len_5",
3880 "rna_ParticleVGroup_name_set_5");
3882 prop, "Vertex Group Roughness 1", "Vertex group to control roughness 1");
3883 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3884
3885 prop = RNA_def_property(srna, "invert_vertex_group_roughness_1", PROP_BOOLEAN, PROP_NONE);
3886 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_ROUGH1));
3888 "Vertex Group Roughness 1 Negate",
3889 "Negate the effect of the roughness 1 vertex group");
3890 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3891
3892 prop = RNA_def_property(srna, "vertex_group_roughness_2", PROP_STRING, PROP_NONE);
3894 "rna_ParticleVGroup_name_get_6",
3895 "rna_ParticleVGroup_name_len_6",
3896 "rna_ParticleVGroup_name_set_6");
3898 prop, "Vertex Group Roughness 2", "Vertex group to control roughness 2");
3899 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3900
3901 prop = RNA_def_property(srna, "invert_vertex_group_roughness_2", PROP_BOOLEAN, PROP_NONE);
3902 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_ROUGH2));
3904 "Vertex Group Roughness 2 Negate",
3905 "Negate the effect of the roughness 2 vertex group");
3906 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3907
3908 prop = RNA_def_property(srna, "vertex_group_roughness_end", PROP_STRING, PROP_NONE);
3910 "rna_ParticleVGroup_name_get_7",
3911 "rna_ParticleVGroup_name_len_7",
3912 "rna_ParticleVGroup_name_set_7");
3914 prop, "Vertex Group Roughness End", "Vertex group to control roughness end");
3915 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3916
3917 prop = RNA_def_property(srna, "invert_vertex_group_roughness_end", PROP_BOOLEAN, PROP_NONE);
3918 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_ROUGHE));
3920 "Vertex Group Roughness End Negate",
3921 "Negate the effect of the roughness end vertex group");
3922 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3923
3924 prop = RNA_def_property(srna, "vertex_group_size", PROP_STRING, PROP_NONE);
3926 "rna_ParticleVGroup_name_get_8",
3927 "rna_ParticleVGroup_name_len_8",
3928 "rna_ParticleVGroup_name_set_8");
3929 RNA_def_property_ui_text(prop, "Vertex Group Size", "Vertex group to control size");
3930 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3931
3932 prop = RNA_def_property(srna, "invert_vertex_group_size", PROP_BOOLEAN, PROP_NONE);
3933 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_SIZE));
3935 prop, "Vertex Group Size Negate", "Negate the effect of the size vertex group");
3936 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3937
3938 prop = RNA_def_property(srna, "vertex_group_tangent", PROP_STRING, PROP_NONE);
3940 "rna_ParticleVGroup_name_get_9",
3941 "rna_ParticleVGroup_name_len_9",
3942 "rna_ParticleVGroup_name_set_9");
3943 RNA_def_property_ui_text(prop, "Vertex Group Tangent", "Vertex group to control tangent");
3944 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3945
3946 prop = RNA_def_property(srna, "invert_vertex_group_tangent", PROP_BOOLEAN, PROP_NONE);
3947 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_TAN));
3949 prop, "Vertex Group Tangent Negate", "Negate the effect of the tangent vertex group");
3950 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3951
3952 prop = RNA_def_property(srna, "vertex_group_rotation", PROP_STRING, PROP_NONE);
3954 "rna_ParticleVGroup_name_get_10",
3955 "rna_ParticleVGroup_name_len_10",
3956 "rna_ParticleVGroup_name_set_10");
3957 RNA_def_property_ui_text(prop, "Vertex Group Rotation", "Vertex group to control rotation");
3958 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3959
3960 prop = RNA_def_property(srna, "invert_vertex_group_rotation", PROP_BOOLEAN, PROP_NONE);
3961 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_ROT));
3963 prop, "Vertex Group Rotation Negate", "Negate the effect of the rotation vertex group");
3964 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3965
3966 prop = RNA_def_property(srna, "vertex_group_field", PROP_STRING, PROP_NONE);
3968 "rna_ParticleVGroup_name_get_11",
3969 "rna_ParticleVGroup_name_len_11",
3970 "rna_ParticleVGroup_name_set_11");
3971 RNA_def_property_ui_text(prop, "Vertex Group Field", "Vertex group to control field");
3972 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3973
3974 prop = RNA_def_property(srna, "invert_vertex_group_field", PROP_BOOLEAN, PROP_NONE);
3975 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_EFFECTOR));
3977 prop, "Vertex Group Field Negate", "Negate the effect of the field vertex group");
3978 RNA_def_property_update(prop, 0, "rna_Particle_reset");
3979
3980 prop = RNA_def_property(srna, "vertex_group_twist", PROP_STRING, PROP_NONE);
3982 "rna_ParticleVGroup_name_get_12",
3983 "rna_ParticleVGroup_name_len_12",
3984 "rna_ParticleVGroup_name_set_12");
3985 RNA_def_property_ui_text(prop, "Vertex Group Twist", "Vertex group to control twist");
3986 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3987
3988 prop = RNA_def_property(srna, "invert_vertex_group_twist", PROP_BOOLEAN, PROP_NONE);
3989 RNA_def_property_boolean_sdna(prop, nullptr, "vg_neg", (1 << PSYS_VG_TWIST));
3991 prop, "Vertex Group Twist Negate", "Negate the effect of the twist vertex group");
3992 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3993
3994 /* pointcache */
3995 prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
3997 RNA_def_property_pointer_sdna(prop, nullptr, "pointcache");
3998 RNA_def_property_struct_type(prop, "PointCache");
3999 RNA_def_property_ui_text(prop, "Point Cache", "");
4000
4001 prop = RNA_def_property(srna, "has_multiple_caches", PROP_BOOLEAN, PROP_NONE);
4002 RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_multiple_caches_get", nullptr);
4004 RNA_def_property_ui_text(prop, "Multiple Caches", "Particle system has multiple point caches");
4005
4006 /* offset ob */
4007 prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
4008 RNA_def_property_pointer_sdna(prop, nullptr, "parent");
4012 prop, "Parent", "Use this object's coordinate system instead of global coordinate system");
4013 RNA_def_property_update(prop, 0, "rna_Particle_redo");
4014
4015 /* hair or cache editing */
4016 prop = RNA_def_property(srna, "is_editable", PROP_BOOLEAN, PROP_NONE);
4017 RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_editable_get", nullptr);
4019 RNA_def_property_ui_text(prop, "Editable", "Particle system can be edited in particle mode");
4020
4021 prop = RNA_def_property(srna, "is_edited", PROP_BOOLEAN, PROP_NONE);
4022 RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_edited_get", nullptr);
4024 RNA_def_property_ui_text(prop, "Edited", "Particle system has been edited in particle mode");
4025
4026 /* Read-only: this is calculated internally. Changing it would only affect
4027 * the next time-step. The user should change ParticlSettings.subframes or
4028 * ParticleSettings.courant_target instead. */
4029 prop = RNA_def_property(srna, "dt_frac", PROP_FLOAT, PROP_NONE);
4030 RNA_def_property_range(prop, 1.0f / 101.0f, 1.0f);
4032 prop, "Timestep", "The current simulation time step size, as a fraction of a frame");
4034
4036
4037 RNA_def_struct_path_func(srna, "rna_ParticleSystem_path");
4038
4039 /* extract cached hair location data */
4040 func = RNA_def_function(srna, "co_hair", "rna_ParticleSystem_co_hair");
4041 RNA_def_function_ui_description(func, "Obtain cache hair data");
4042 parm = RNA_def_pointer(func, "object", "Object", "", "Object");
4044 RNA_def_int(func, "particle_no", 0, INT_MIN, INT_MAX, "Particle no", "", INT_MIN, INT_MAX);
4045 RNA_def_int(func, "step", 0, INT_MIN, INT_MAX, "step no", "", INT_MIN, INT_MAX);
4046 parm = RNA_def_float_vector(
4047 func, "co", 3, nullptr, -FLT_MAX, FLT_MAX, "Co", "Exported hairkey location", -1e4, 1e4);
4049 RNA_def_function_output(func, parm);
4050
4051 /* extract hair UVs */
4052 func = RNA_def_function(srna, "uv_on_emitter", "rna_ParticleSystem_uv_on_emitter");
4053 RNA_def_function_ui_description(func, "Obtain uv for all particles");
4055 parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
4057 parm = RNA_def_pointer(func, "particle", "Particle", "", "Particle");
4059 RNA_def_int(func, "particle_no", 0, INT_MIN, INT_MAX, "Particle no", "", INT_MIN, INT_MAX);
4060 RNA_def_int(func, "uv_no", 0, INT_MIN, INT_MAX, "UV no", "", INT_MIN, INT_MAX);
4061 parm = RNA_def_property(func, "uv", PROP_FLOAT, PROP_COORDS);
4062 RNA_def_property_array(parm, 2);
4064 RNA_def_function_output(func, parm);
4065
4066 /* Extract hair vertex-colors. */
4067 func = RNA_def_function(srna, "mcol_on_emitter", "rna_ParticleSystem_mcol_on_emitter");
4069 RNA_def_function_ui_description(func, "Obtain mcol for all particles");
4070 parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
4072 parm = RNA_def_pointer(func, "particle", "Particle", "", "Particle");
4074 RNA_def_int(func, "particle_no", 0, INT_MIN, INT_MAX, "Particle no", "", INT_MIN, INT_MAX);
4075 RNA_def_int(func, "vcol_no", 0, INT_MIN, INT_MAX, "vcol no", "", INT_MIN, INT_MAX);
4076 parm = RNA_def_property(func, "mcol", PROP_FLOAT, PROP_COLOR);
4077 RNA_def_property_array(parm, 3);
4079 RNA_def_function_output(func, parm);
4080}
4081
4096
4097#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:585
int BKE_object_defgroup_name_index(const Object *ob, blender::StringRef name)
Definition deform.cc:591
void id_us_plus(ID *id)
Definition lib_id.cc:358
void id_us_min(ID *id)
Definition lib_id.cc:366
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:4111
bool psys_check_edited(struct ParticleSystem *psys)
Definition particle.cc:736
void BKE_particlesettings_twist_curve_init(struct ParticleSettings *part)
Definition particle.cc:4125
void psys_check_group_weights(struct ParticleSettings *part)
Definition particle.cc:766
void BKE_particlesettings_clump_curve_init(struct ParticleSettings *part)
Definition particle.cc:4097
void psys_mat_hair_to_object(struct Object *ob, struct Mesh *mesh, short from, struct ParticleData *pa, float hairmat[4][4])
Definition particle.cc:3844
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:2246
void psys_interpolate_uvs(const struct MTFace *tface, int quad, const float w[4], float r_uv[2])
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:745
#define DMCACHE_ISCHILD
void psys_interpolate_mcol(const struct MCol *mcol, int quad, const float w[4], struct MCol *mc)
@ RPT_ERROR
Definition BKE_report.hh:39
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:153
struct Tex * give_current_particle_texture(struct ParticleSettings *part)
Definition texture.cc:545
void set_current_particle_texture(struct ParticleSettings *part, struct Tex *tex)
Definition texture.cc:562
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
char size_t BLI_strncpy_utf8_rlen(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
size_t BLI_snprintf_utf8_rlen(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) 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:1087
@ ID_RECALC_PSYS_REDO
Definition DNA_ID.h:1081
@ ID_RECALC_PSYS_CHILD
Definition DNA_ID.h:1085
@ ID_RECALC_PSYS_RESET
Definition DNA_ID.h:1083
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
#define MAX_ID_NAME
Definition DNA_ID.h:373
@ 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
@ PART_SHAPE_CLOSE_TIP
@ SPH_FAC_DENSITY
@ SPH_CURRENT_REST_LENGTH
@ SPH_FAC_REST_LENGTH
@ SPH_FAC_REPULSION
@ SPH_FAC_VISCOSITY
@ SPH_VISCOELASTIC_SPRINGS
@ SPH_FAC_RADIUS
@ PTARGET_CURRENT
@ PTARGET_VALID
@ PART_EVENT_NEAR
@ PART_EVENT_DEATH
@ PART_EVENT_COLLIDE
@ SPH_SOLVER_DDR
@ SPH_SOLVER_CLASSICAL
@ PSYS_HAIR_DYNAMICS
@ PSYS_EDITED
@ PSYS_GLOBAL_HAIR
@ PSYS_KEYED_TIMING
@ PART_DISTR_GRID
@ PART_DISTR_RAND
@ PART_DISTR_JIT
@ 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_TIME_AUTOSF
@ PARS_ALIVE
@ PARS_DYING
@ PARS_DEAD
@ PARS_UNBORN
@ PART_DUPLIW_CURRENT
@ 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_INT_VERLET
@ PART_INT_MIDPOINT
@ PART_INT_RK4
@ PART_INT_EULER
@ 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_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
@ 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_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
@ PART_KINK_BRAID
@ PART_KINK_WAVE
@ PART_KINK_SPIRAL
@ PART_KINK_RADIAL
@ PART_KINK_CURL
@ PART_KINK_NO
@ PART_DRAW_COL_NONE
@ PART_DRAW_COL_ACC
@ PART_DRAW_COL_MAT
@ PART_DRAW_COL_VEL
@ 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
@ PARS_NO_DISP
@ PARS_UNEXIST
@ PTARGET_MODE_ENEMY
@ PTARGET_MODE_FRIEND
@ PTARGET_MODE_NEUTRAL
@ PART_PHYS_FLUID
@ PART_PHYS_NEWTON
@ PART_PHYS_KEYED
@ PART_PHYS_BOIDS
@ PART_PHYS_NO
@ PART_CHILD_PARTICLES
@ PART_CHILD_FACES
@ PART_CHILD_USE_TWIST_CURVE
@ PART_CHILD_USE_CLUMP_CURVE
@ PART_CHILD_USE_CLUMP_NOISE
@ PART_CHILD_USE_ROUGH_CURVE
@ 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_FROM_VOLUME
@ PART_FROM_VERT
@ PART_FROM_FACE
#define MAXFRAMEF
#define MINAFRAMEF
@ MTEX_FLAT
@ MTEX_SPHERE
@ MTEX_CUBE
@ MTEX_TUBE
ParameterFlag
Definition RNA_types.hh:544
@ PARM_REQUIRED
Definition RNA_types.hh:545
@ FUNC_USE_REPORTS
Definition RNA_types.hh:914
@ FUNC_USE_SELF_ID
Definition RNA_types.hh:889
@ PROP_FLOAT
Definition RNA_types.hh:164
@ PROP_BOOLEAN
Definition RNA_types.hh:162
@ PROP_ENUM
Definition RNA_types.hh:166
@ PROP_INT
Definition RNA_types.hh:163
@ PROP_STRING
Definition RNA_types.hh:165
@ PROP_POINTER
Definition RNA_types.hh:167
@ PROP_COLLECTION
Definition RNA_types.hh:168
@ PROP_UNIT_MASS
Definition RNA_types.hh:177
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:503
@ PROPOVERRIDE_NO_COMPARISON
Definition RNA_types.hh:511
@ PROP_THICK_WRAP
Definition RNA_types.hh:423
@ PROP_ANIMATABLE
Definition RNA_types.hh:319
@ PROP_EDITABLE
Definition RNA_types.hh:306
@ PROP_NEVER_NULL
Definition RNA_types.hh:377
@ PROP_ID_REFCOUNT
Definition RNA_types.hh:364
@ PROP_TIME
Definition RNA_types.hh:253
@ PROP_DISTANCE
Definition RNA_types.hh:256
@ PROP_COLOR
Definition RNA_types.hh:260
@ PROP_COORDS
Definition RNA_types.hh:274
@ PROP_NONE
Definition RNA_types.hh:233
@ PROP_PERCENTAGE
Definition RNA_types.hh:250
@ PROP_FACTOR
Definition RNA_types.hh:251
@ PROP_TRANSLATION
Definition RNA_types.hh:261
@ PROP_UNSIGNED
Definition RNA_types.hh:249
@ PROP_QUATERNION
Definition RNA_types.hh:267
@ PROP_VELOCITY
Definition RNA_types.hh:263
#define C
Definition RandGen.cpp:29
#define MAX_MTEX
Definition Stroke.h:31
#define ND_MODIFIER
Definition WM_types.hh:462
#define NA_EDITED
Definition WM_types.hh:584
#define ND_PARTICLE
Definition WM_types.hh:465
#define NA_RENAME
Definition WM_types.hh:588
#define NC_OBJECT
Definition WM_types.hh:379
BMesh const char void * data
nullptr float
#define offsetof(t, d)
#define GS(x)
uint nor
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
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]
const char * name
const PointerRNA PointerRNA_NULL
void rna_iterator_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, void *data, size_t itemsize, int64_t length, bool free_ptr, IteratorSkipFunc skip)
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:657
const char * name
Definition RNA_types.hh:661
Definition DNA_ID.h:414
char name[258]
Definition DNA_ID.h:432
void * next
Definition DNA_ID.h:417
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:4238
uint8_t flag
Definition wm_window.cc:145