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