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