2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * Contributor(s): Blender Foundation (2008).
21 * Copyright 2011 AutoCRC
23 * ***** END GPL LICENSE BLOCK *****
26 /** \file blender/makesrna/intern/rna_particle.c
34 #include "DNA_material_types.h"
35 #include "DNA_mesh_types.h"
36 #include "DNA_meshdata_types.h"
37 #include "DNA_modifier_types.h"
38 #include "DNA_cloth_types.h"
39 #include "DNA_particle_types.h"
40 #include "DNA_object_force_types.h"
41 #include "DNA_object_types.h"
42 #include "DNA_scene_types.h"
43 #include "DNA_boid_types.h"
44 #include "DNA_texture_types.h"
46 #include "RNA_define.h"
47 #include "RNA_enum_types.h"
51 #include "BLI_string_utils.h"
53 #include "BLT_translation.h"
55 #include "rna_internal.h"
61 static const EnumPropertyItem part_from_items[] = {
62 {PART_FROM_VERT, "VERT", 0, "Verts", ""},
63 {PART_FROM_FACE, "FACE", 0, "Faces", ""},
64 {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
65 {0, NULL, 0, NULL, NULL}
70 static const EnumPropertyItem part_reactor_from_items[] = {
71 {PART_FROM_VERT, "VERT", 0, "Verts", ""},
72 {PART_FROM_FACE, "FACE", 0, "Faces", ""},
73 {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
74 {0, NULL, 0, NULL, NULL}
78 static const EnumPropertyItem part_dist_items[] = {
79 {PART_DISTR_JIT, "JIT", 0, "Jittered", ""},
80 {PART_DISTR_RAND, "RAND", 0, "Random", ""},
81 {PART_DISTR_GRID, "GRID", 0, "Grid", ""},
82 {0, NULL, 0, NULL, NULL}
86 static const EnumPropertyItem part_hair_dist_items[] = {
87 {PART_DISTR_JIT, "JIT", 0, "Jittered", ""},
88 {PART_DISTR_RAND, "RAND", 0, "Random", ""},
89 {0, NULL, 0, NULL, NULL}
93 static const EnumPropertyItem part_draw_as_items[] = {
94 {PART_DRAW_NOT, "NONE", 0, "None", ""},
95 {PART_DRAW_REND, "RENDER", 0, "Rendered", ""},
96 {PART_DRAW_DOT, "DOT", 0, "Point", ""},
97 {PART_DRAW_CIRC, "CIRC", 0, "Circle", ""},
98 {PART_DRAW_CROSS, "CROSS", 0, "Cross", ""},
99 {PART_DRAW_AXIS, "AXIS", 0, "Axis", ""},
100 {0, NULL, 0, NULL, NULL}
104 static const EnumPropertyItem part_hair_draw_as_items[] = {
105 {PART_DRAW_NOT, "NONE", 0, "None", ""},
106 {PART_DRAW_REND, "RENDER", 0, "Rendered", ""},
107 {PART_DRAW_PATH, "PATH", 0, "Path", ""},
108 {0, NULL, 0, NULL, NULL}
112 static const EnumPropertyItem part_ren_as_items[] = {
113 {PART_DRAW_NOT, "NONE", 0, "None", ""},
114 {PART_DRAW_HALO, "HALO", 0, "Halo", ""},
115 {PART_DRAW_LINE, "LINE", 0, "Line", ""},
116 {PART_DRAW_PATH, "PATH", 0, "Path", ""},
117 {PART_DRAW_OB, "OBJECT", 0, "Object", ""},
118 {PART_DRAW_GR, "COLLECTION", 0, "Collection", ""},
119 {PART_DRAW_BB, "BILLBOARD", 0, "Billboard", ""},
120 {0, NULL, 0, NULL, NULL}
124 static const EnumPropertyItem part_hair_ren_as_items[] = {
125 {PART_DRAW_NOT, "NONE", 0, "None", ""},
126 {PART_DRAW_PATH, "PATH", 0, "Path", ""},
127 {PART_DRAW_OB, "OBJECT", 0, "Object", ""},
128 {PART_DRAW_GR, "COLLECTION", 0, "Collection", ""},
129 {0, NULL, 0, NULL, NULL}
135 #include "BLI_math.h"
137 #include "BKE_boids.h"
138 #include "BKE_context.h"
139 #include "BKE_cloth.h"
140 #include "BKE_colortools.h"
141 #include "BKE_deform.h"
142 #include "BKE_effect.h"
143 #include "BKE_material.h"
144 #include "BKE_modifier.h"
145 #include "BKE_particle.h"
146 #include "BKE_pointcache.h"
147 #include "BKE_texture.h"
149 #include "DEG_depsgraph.h"
150 #include "DEG_depsgraph_build.h"
152 /* use for object space hair get/set */
153 static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, ParticleSystemModifierData **psmd_pt,
154 ParticleData **pa_pt)
156 HairKey *hkey = (HairKey *)ptr->data;
157 Object *ob = (Object *)ptr->id.data;
159 ParticleSystemModifierData *psmd = NULL;
160 ParticleSystem *psys;
167 /* given the pointer HairKey *hkey, we iterate over all particles in all
168 * particle systems in the object "ob" in order to find
169 * - the ParticleSystemData to which the HairKey (and hence the particle)
170 * belongs (will be stored in psmd_pt)
171 * - the ParticleData to which the HairKey belongs (will be stored in pa_pt)
173 * not a very efficient way of getting hair key location data,
174 * but it's the best we've got at the present
176 * IDEAS: include additional information in pointerRNA beforehand,
177 * for example a pointer to the ParticleStstemModifierData to which the
181 for (md = ob->modifiers.first; md; md = md->next) {
182 if (md->type == eModifierType_ParticleSystem) {
183 psmd = (ParticleSystemModifierData *) md;
184 if (psmd && psmd->mesh_final && psmd->psys) {
186 for (i = 0, pa = psys->particles; i < psys->totpart; i++, pa++) {
187 /* hairkeys are stored sequentially in memory, so we can
188 * find if it's the same particle by comparing pointers,
189 * without having to iterate over them all */
190 if ((hkey >= pa->hair) && (hkey < pa->hair + pa->totkey)) {
201 static void rna_ParticleHairKey_location_object_get(PointerRNA *ptr, float *values)
203 HairKey *hkey = (HairKey *)ptr->data;
204 Object *ob = (Object *)ptr->id.data;
205 ParticleSystemModifierData *psmd;
208 rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
211 Mesh *hair_mesh = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_mesh : NULL;
214 MVert *mvert = &hair_mesh->mvert[pa->hair_index + (hkey - pa->hair)];
215 copy_v3_v3(values, mvert->co);
219 psys_mat_hair_to_object(ob, psmd->mesh_final, psmd->psys->part->from, pa, hairmat);
220 copy_v3_v3(values, hkey->co);
221 mul_m4_v3(hairmat, values);
229 static void rna_ParticleHairKey_location_object_set(PointerRNA *ptr, const float *values)
231 HairKey *hkey = (HairKey *)ptr->data;
232 Object *ob = (Object *)ptr->id.data;
233 ParticleSystemModifierData *psmd;
236 rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
239 Mesh *hair_mesh = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_mesh : NULL;
242 MVert *mvert = &hair_mesh->mvert[pa->hair_index + (hkey - pa->hair)];
243 copy_v3_v3(mvert->co, values);
249 psys_mat_hair_to_object(ob, psmd->mesh_final, psmd->psys->part->from, pa, hairmat);
250 invert_m4_m4(imat, hairmat);
251 copy_v3_v3(hkey->co, values);
252 mul_m4_v3(imat, hkey->co);
260 static void rna_ParticleHairKey_co_object(HairKey *hairkey, Object *object, ParticleSystemModifierData *modifier, ParticleData *particle,
264 Mesh *hair_mesh = (modifier->psys->flag & PSYS_HAIR_DYNAMICS) ? modifier->psys->hair_out_mesh : NULL;
267 MVert *mvert = &hair_mesh->mvert[particle->hair_index + (hairkey - particle->hair)];
268 copy_v3_v3(n_co, mvert->co);
272 psys_mat_hair_to_object(object, modifier->mesh_final, modifier->psys->part->from, particle, hairmat);
273 copy_v3_v3(n_co, hairkey->co);
274 mul_m4_v3(hairmat, n_co);
282 static void rna_Particle_uv_on_emitter(ParticleData *particle, ReportList *reports,
283 ParticleSystemModifierData *modifier, float r_uv[2])
285 /*psys_particle_on_emitter(psmd, part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co, nor, 0, 0, sd.orco, 0);*/
287 /* get uvco & mcol */
288 int num = particle->num_dmcache;
289 int from = modifier->psys->part->from;
291 if (!CustomData_has_layer(&modifier->mesh_final->ldata, CD_MLOOPUV)) {
292 BKE_report(reports, RPT_ERROR, "Mesh has no UV data");
295 BKE_mesh_tessface_ensure(modifier->mesh_final); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
297 if (num == DMCACHE_NOTFOUND)
298 if (particle->num < modifier->mesh_final->totface)
302 if (r_uv && ELEM(from, PART_FROM_FACE, PART_FROM_VOLUME)) {
304 if (num != DMCACHE_NOTFOUND) {
308 mface = modifier->mesh_final->mface;
309 mtface = modifier->mesh_final->mtface;
311 if (mface && mtface) {
313 psys_interpolate_uvs(mtface, mface->v4, particle->fuv, r_uv);
323 static void rna_ParticleSystem_co_hair(ParticleSystem *particlesystem, Object *object,
324 int particle_no, int step, float n_co[3])
326 ParticleSettings *part = NULL;
327 ParticleData *pars = NULL;
328 ParticleCacheKey *cache = NULL;
333 if (particlesystem == NULL)
336 part = particlesystem->part;
337 pars = particlesystem->particles;
338 totpart = particlesystem->totcached;
339 totchild = particlesystem->totchildcache;
341 if (part == NULL || pars == NULL)
344 if (part->ren_as == PART_DRAW_OB || part->ren_as == PART_DRAW_GR || part->ren_as == PART_DRAW_NOT)
347 /* can happen for disconnected/global hair */
348 if (part->type == PART_HAIR && !particlesystem->childcache)
351 if (particle_no < totpart) {
352 cache = particlesystem->pathcache[particle_no];
353 max_k = (int)cache->segments;
355 else if (particle_no < totpart + totchild) {
356 cache = particlesystem->childcache[particle_no - totpart];
358 if (cache->segments < 0)
361 max_k = (int)cache->segments;
367 /* Strands key loop data stored in cache + step->co. */
368 if (step >= 0 && step <= max_k) {
369 copy_v3_v3(n_co, (cache + step)->co);
370 mul_m4_v3(particlesystem->imat, n_co);
371 mul_m4_v3(object->obmat, n_co);
376 static const EnumPropertyItem *rna_Particle_Material_itemf(bContext *C, PointerRNA *UNUSED(ptr),
377 PropertyRNA *UNUSED(prop), bool *r_free)
379 Object *ob = CTX_data_pointer_get(C, "object").data;
381 EnumPropertyItem *item = NULL;
382 EnumPropertyItem tmp = {0, "", 0, "", ""};
386 if (ob && ob->totcol > 0) {
387 for (i = 1; i <= ob->totcol; i++) {
388 ma = give_current_material(ob, i);
390 tmp.icon = ICON_MATERIAL_DATA;
392 tmp.name = ma->id.name + 2;
393 tmp.identifier = tmp.name;
396 tmp.name = "Default Material";
397 tmp.identifier = tmp.name;
399 RNA_enum_item_add(&item, &totitem, &tmp);
404 tmp.icon = ICON_MATERIAL_DATA;
405 tmp.name = "Default Material";
406 tmp.identifier = tmp.name;
407 RNA_enum_item_add(&item, &totitem, &tmp);
410 RNA_enum_item_end(&item, &totitem);
416 /* return < 0 means invalid (no matching tessellated face could be found). */
417 static int rna_ParticleSystem_tessfaceidx_on_emitter(ParticleSystem *particlesystem,
418 ParticleSystemModifierData *modifier, ParticleData *particle,
419 int particle_no, float (**r_fuv)[4])
421 ParticleSettings *part = NULL;
428 BKE_mesh_tessface_ensure(modifier->mesh_final); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
429 totface = modifier->mesh_final->totface;
430 totvert = modifier->mesh_final->totvert;
432 /* 1. check that everything is ok & updated */
433 if (!particlesystem || !totface) {
437 part = particlesystem->part;
438 totpart = particlesystem->totcached;
439 totchild = particlesystem->totchildcache;
441 /* can happen for disconnected/global hair */
442 if (part->type == PART_HAIR && !particlesystem->childcache)
445 if (particle_no >= totpart + totchild)
448 /* 2. get matching face index. */
449 if (particle_no < totpart) {
450 num = (ELEM(particle->num_dmcache, DMCACHE_ISCHILD, DMCACHE_NOTFOUND)) ? particle->num : particle->num_dmcache;
452 if (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME)) {
453 if (num != DMCACHE_NOTFOUND && num < totface) {
454 *r_fuv = &particle->fuv;
458 else if (part->from == PART_FROM_VERT) {
459 if (num != DMCACHE_NOTFOUND && num < totvert) {
460 MFace *mface = modifier->mesh_final->mface;
462 *r_fuv = &particle->fuv;
464 /* This finds the first face to contain the emitting vertex,
465 * this is not ideal, but is mostly fine as UV seams generally
466 * map to equal-colored parts of a texture */
467 for (int i = 0; i < totface; i++, mface++) {
468 if (ELEM(num, mface->v1, mface->v2, mface->v3, mface->v4)) {
476 ChildParticle *cpa = particlesystem->child + particle_no - totpart;
479 if (part->childtype == PART_CHILD_FACES) {
480 if (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME, PART_FROM_VERT)) {
481 if (num != DMCACHE_NOTFOUND && num < totface) {
488 ParticleData *parent = particlesystem->particles + cpa->parent;
489 num = parent->num_dmcache;
491 if (num == DMCACHE_NOTFOUND)
494 if (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME)) {
495 if (num != DMCACHE_NOTFOUND && num < totface) {
496 *r_fuv = &parent->fuv;
500 else if (part->from == PART_FROM_VERT) {
501 if (num != DMCACHE_NOTFOUND && num < totvert) {
502 MFace *mface = modifier->mesh_final->mface;
504 *r_fuv = &parent->fuv;
506 /* This finds the first face to contain the emitting vertex,
507 * this is not ideal, but is mostly fine as UV seams generally
508 * map to equal-colored parts of a texture */
509 for (int i = 0; i < totface; i++, mface++) {
510 if (ELEM(num, mface->v1, mface->v2, mface->v3, mface->v4)) {
522 static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem, ReportList *reports,
523 ParticleSystemModifierData *modifier, ParticleData *particle,
524 int particle_no, int uv_no, float r_uv[2])
526 if (!CustomData_has_layer(&modifier->mesh_final->ldata, CD_MLOOPUV)) {
527 BKE_report(reports, RPT_ERROR, "Mesh has no UV data");
534 /* Note all sanity checks are done in this helper func. */
535 const int num = rna_ParticleSystem_tessfaceidx_on_emitter(particlesystem, modifier, particle,
539 /* No matching face found. */
543 MFace *mface = &modifier->mesh_final->mface[num];
544 MTFace *mtface = (MTFace *)CustomData_get_layer_n(&modifier->mesh_final->fdata, CD_MTFACE, uv_no);
546 psys_interpolate_uvs(&mtface[num], mface->v4, *fuv, r_uv);
551 static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem, ReportList *reports,
552 ParticleSystemModifierData *modifier, ParticleData *particle,
553 int particle_no, int vcol_no, float r_mcol[3])
555 if (!CustomData_has_layer(&modifier->mesh_final->ldata, CD_MLOOPCOL)) {
556 BKE_report(reports, RPT_ERROR, "Mesh has no VCol data");
563 /* Note all sanity checks are done in this helper func. */
564 const int num = rna_ParticleSystem_tessfaceidx_on_emitter(particlesystem, modifier, particle,
568 /* No matching face found. */
572 MFace *mface = &modifier->mesh_final->mface[num];
573 MCol *mc = (MCol *)CustomData_get_layer_n(&modifier->mesh_final->fdata, CD_MCOL, vcol_no);
576 psys_interpolate_mcol(&mc[num * 4], mface->v4, *fuv, &mcol);
577 r_mcol[0] = (float)mcol.b / 255.0f;
578 r_mcol[1] = (float)mcol.g / 255.0f;
579 r_mcol[2] = (float)mcol.r / 255.0f;
584 static void particle_recalc(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr, short flag)
586 if (ptr->type == &RNA_ParticleSystem) {
587 Object *ob = ptr->id.data;
588 ParticleSystem *psys = (ParticleSystem *)ptr->data;
592 DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
595 DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY | flag);
597 WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
599 static void rna_Particle_redo(Main *bmain, Scene *scene, PointerRNA *ptr)
601 particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_REDO);
604 static void rna_Particle_redo_dependency(Main *bmain, Scene *scene, PointerRNA *ptr)
606 DEG_relations_tag_update(bmain);
607 rna_Particle_redo(bmain, scene, ptr);
610 static void rna_Particle_redo_count(Main *bmain, Scene *scene, PointerRNA *ptr)
612 ParticleSettings *part = (ParticleSettings *)ptr->data;
613 DEG_relations_tag_update(bmain);
614 psys_check_group_weights(part);
615 particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_REDO);
618 static void rna_Particle_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
620 particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_RESET);
623 static void rna_Particle_reset_dependency(Main *bmain, Scene *scene, PointerRNA *ptr)
625 DEG_relations_tag_update(bmain);
626 rna_Particle_reset(bmain, scene, ptr);
629 static void rna_Particle_change_type(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
631 ParticleSettings *part = ptr->id.data;
633 /* Iterating over all object is slow, but no better solution exists at the moment. */
634 for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
635 for (ParticleSystem *psys = ob->particlesystem.first; psys; psys = psys->next) {
636 if (psys->part == part) {
637 psys_changed_type(ob, psys);
638 psys->recalc |= ID_RECALC_PSYS_RESET;
639 DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
644 WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
645 DEG_relations_tag_update(bmain);
648 static void rna_Particle_change_physics_type(Main *bmain, Scene *scene, PointerRNA *ptr)
650 particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_RESET | ID_RECALC_PSYS_PHYS);
652 ParticleSettings *part = (ParticleSettings *)ptr->data;
654 if (part->phystype == PART_PHYS_BOIDS && part->boids == NULL) {
657 part->boids = MEM_callocN(sizeof(BoidSettings), "Boid Settings");
658 boid_default_settings(part->boids);
660 state = boid_new_state(part->boids);
661 BLI_addtail(&state->rules, boid_new_rule(eBoidRuleType_Separate));
662 BLI_addtail(&state->rules, boid_new_rule(eBoidRuleType_Flock));
664 ((BoidRule *)state->rules.first)->flag |= BOIDRULE_CURRENT;
666 state->flag |= BOIDSTATE_CURRENT;
667 BLI_addtail(&part->boids->states, state);
669 else if (part->phystype == PART_PHYS_FLUID && part->fluid == NULL) {
670 part->fluid = MEM_callocN(sizeof(SPHFluidSettings), "SPH Fluid Settings");
671 BKE_particlesettings_fluid_default_settings(part);
675 static void rna_Particle_redo_child(Main *bmain, Scene *scene, PointerRNA *ptr)
677 particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_CHILD);
680 static void rna_Particle_cloth_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
682 Object *ob = (Object *)ptr->id.data;
684 DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
685 WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
689 static ParticleSystem *rna_particle_system_for_target(Object *ob, ParticleTarget *target)
691 ParticleSystem *psys;
694 for (psys = ob->particlesystem.first; psys; psys = psys->next)
695 for (pt = psys->targets.first; pt; pt = pt->next)
702 static void rna_Particle_target_reset(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
704 if (ptr->type == &RNA_ParticleTarget) {
705 Object *ob = (Object *)ptr->id.data;
706 ParticleTarget *pt = (ParticleTarget *)ptr->data;
707 ParticleSystem *kpsys = NULL, *psys = rna_particle_system_for_target(ob, pt);
709 if (pt->ob == ob || pt->ob == NULL) {
710 kpsys = BLI_findlink(&ob->particlesystem, pt->psys - 1);
713 pt->flag |= PTARGET_VALID;
715 pt->flag &= ~PTARGET_VALID;
719 kpsys = BLI_findlink(&pt->ob->particlesystem, pt->psys - 1);
722 pt->flag |= PTARGET_VALID;
724 pt->flag &= ~PTARGET_VALID;
727 psys->recalc = ID_RECALC_PSYS_RESET;
729 DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
730 DEG_relations_tag_update(bmain);
733 WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
736 static void rna_Particle_target_redo(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
738 if (ptr->type == &RNA_ParticleTarget) {
739 Object *ob = (Object *)ptr->id.data;
740 ParticleTarget *pt = (ParticleTarget *)ptr->data;
741 ParticleSystem *psys = rna_particle_system_for_target(ob, pt);
743 psys->recalc = ID_RECALC_PSYS_REDO;
745 DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
746 WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
750 static void rna_Particle_hair_dynamics_update(Main *bmain, Scene *scene, PointerRNA *ptr)
752 Object *ob = (Object *)ptr->id.data;
753 ParticleSystem *psys = (ParticleSystem *)ptr->data;
755 if (psys && !psys->clmd) {
756 psys->clmd = (ClothModifierData *)modifier_new(eModifierType_Cloth);
757 psys->clmd->sim_parms->goalspring = 0.0f;
758 psys->clmd->sim_parms->flags |= CLOTH_SIMSETTINGS_FLAG_RESIST_SPRING_COMPRESS;
759 psys->clmd->coll_parms->flags &= ~CLOTH_COLLSETTINGS_FLAG_SELF;
760 rna_Particle_redo(bmain, scene, ptr);
763 WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
766 DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
767 DEG_relations_tag_update(bmain);
770 static PointerRNA rna_particle_settings_get(PointerRNA *ptr)
772 ParticleSystem *psys = (ParticleSystem *)ptr->data;
773 ParticleSettings *part = psys->part;
775 return rna_pointer_inherit_refine(ptr, &RNA_ParticleSettings, part);
778 static void rna_particle_settings_set(PointerRNA *ptr, PointerRNA value)
780 Object *ob = ptr->id.data;
781 ParticleSystem *psys = (ParticleSystem *)ptr->data;
786 old_type = psys->part->type;
787 id_us_min(&psys->part->id);
790 psys->part = (ParticleSettings *)value.data;
793 id_us_plus(&psys->part->id);
794 psys_check_boid_data(psys);
795 if (old_type != psys->part->type) {
796 psys_changed_type(ob, psys);
800 static void rna_Particle_abspathtime_update(Main *bmain, Scene *scene, PointerRNA *ptr)
802 ParticleSettings *settings = (ParticleSettings *)ptr->data;
803 float delta = settings->end + settings->lifetime - settings->sta;
804 if (settings->draw & PART_ABS_PATH_TIME) {
805 settings->path_start = settings->sta + settings->path_start * delta;
806 settings->path_end = settings->sta + settings->path_end * delta;
809 settings->path_start = (settings->path_start - settings->sta) / delta;
810 settings->path_end = (settings->path_end - settings->sta) / delta;
812 rna_Particle_redo(bmain, scene, ptr);
814 static void rna_PartSettings_start_set(struct PointerRNA *ptr, float value)
816 ParticleSettings *settings = (ParticleSettings *)ptr->data;
818 /* check for clipping */
819 if (value > settings->end)
820 value = settings->end;
822 /*if (settings->type==PART_REACTOR && value < 1.0) */
825 if (value < MINAFRAMEF)
828 settings->sta = value;
831 static void rna_PartSettings_end_set(struct PointerRNA *ptr, float value)
833 ParticleSettings *settings = (ParticleSettings *)ptr->data;
835 /* check for clipping */
836 if (value < settings->sta)
837 value = settings->sta;
839 settings->end = value;
842 static void rna_PartSetings_timestep_set(struct PointerRNA *ptr, float value)
844 ParticleSettings *settings = (ParticleSettings *)ptr->data;
846 settings->timetweak = value / 0.04f;
849 static float rna_PartSettings_timestep_get(struct PointerRNA *ptr)
851 ParticleSettings *settings = (ParticleSettings *)ptr->data;
853 return settings->timetweak * 0.04f;
856 static void rna_PartSetting_hairlength_set(struct PointerRNA *ptr, float value)
858 ParticleSettings *settings = (ParticleSettings *)ptr->data;
859 settings->normfac = value / 4.f;
862 static float rna_PartSetting_hairlength_get(struct PointerRNA *ptr)
864 ParticleSettings *settings = (ParticleSettings *)ptr->data;
865 return settings->normfac * 4.f;
868 static void rna_PartSetting_linelentail_set(struct PointerRNA *ptr, float value)
870 ParticleSettings *settings = (ParticleSettings *)ptr->data;
871 settings->draw_line[0] = value;
874 static float rna_PartSetting_linelentail_get(struct PointerRNA *ptr)
876 ParticleSettings *settings = (ParticleSettings *)ptr->data;
877 return settings->draw_line[0];
879 static void rna_PartSetting_pathstartend_range(PointerRNA *ptr, float *min, float *max,
880 float *UNUSED(softmin), float *UNUSED(softmax))
882 ParticleSettings *settings = (ParticleSettings *)ptr->data;
884 if (settings->type == PART_HAIR) {
886 *max = (settings->draw & PART_ABS_PATH_TIME) ? 100.0f : 1.0f;
889 *min = (settings->draw & PART_ABS_PATH_TIME) ? settings->sta : 0.0f;
890 *max = (settings->draw & PART_ABS_PATH_TIME) ? MAXFRAMEF : 1.0f;
893 static void rna_PartSetting_linelenhead_set(struct PointerRNA *ptr, float value)
895 ParticleSettings *settings = (ParticleSettings *)ptr->data;
896 settings->draw_line[1] = value;
899 static float rna_PartSetting_linelenhead_get(struct PointerRNA *ptr)
901 ParticleSettings *settings = (ParticleSettings *)ptr->data;
902 return settings->draw_line[1];
906 static bool rna_PartSettings_is_fluid_get(PointerRNA *ptr)
908 ParticleSettings *part = (ParticleSettings *)ptr->data;
910 return part->type == PART_FLUID;
913 static void rna_ParticleSettings_use_clump_curve_update(Main *bmain, Scene *scene, PointerRNA *ptr)
915 ParticleSettings *part = ptr->data;
917 if (part->child_flag & PART_CHILD_USE_CLUMP_CURVE) {
918 if (!part->clumpcurve) {
919 BKE_particlesettings_clump_curve_init(part);
923 rna_Particle_redo_child(bmain, scene, ptr);
926 static void rna_ParticleSettings_use_roughness_curve_update(Main *bmain, Scene *scene, PointerRNA *ptr)
928 ParticleSettings *part = ptr->data;
930 if (part->child_flag & PART_CHILD_USE_ROUGH_CURVE) {
931 if (!part->roughcurve) {
932 BKE_particlesettings_rough_curve_init(part);
936 rna_Particle_redo_child(bmain, scene, ptr);
939 static void rna_ParticleSettings_use_twist_curve_update(Main *bmain, Scene *scene, PointerRNA *ptr)
941 ParticleSettings *part = ptr->data;
943 if (part->child_flag & PART_CHILD_USE_TWIST_CURVE) {
944 if (!part->twistcurve) {
945 BKE_particlesettings_twist_curve_init(part);
949 rna_Particle_redo_child(bmain, scene, ptr);
952 static void rna_ParticleSystem_name_set(PointerRNA *ptr, const char *value)
954 Object *ob = ptr->id.data;
955 ParticleSystem *part = (ParticleSystem *)ptr->data;
957 /* copy the new name into the name slot */
958 BLI_strncpy_utf8(part->name, value, sizeof(part->name));
960 BLI_uniquename(&ob->particlesystem, part, DATA_("ParticleSystem"), '.', offsetof(ParticleSystem, name),
964 static PointerRNA rna_ParticleSystem_active_particle_target_get(PointerRNA *ptr)
966 ParticleSystem *psys = (ParticleSystem *)ptr->data;
967 ParticleTarget *pt = psys->targets.first;
969 for (; pt; pt = pt->next) {
970 if (pt->flag & PTARGET_CURRENT)
971 return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, pt);
973 return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, NULL);
975 static void rna_ParticleSystem_active_particle_target_index_range(PointerRNA *ptr, int *min, int *max,
976 int *UNUSED(softmin), int *UNUSED(softmax))
978 ParticleSystem *psys = (ParticleSystem *)ptr->data;
980 *max = max_ii(0, BLI_listbase_count(&psys->targets) - 1);
983 static int rna_ParticleSystem_active_particle_target_index_get(PointerRNA *ptr)
985 ParticleSystem *psys = (ParticleSystem *)ptr->data;
986 ParticleTarget *pt = psys->targets.first;
989 for (; pt; pt = pt->next, i++)
990 if (pt->flag & PTARGET_CURRENT)
996 static void rna_ParticleSystem_active_particle_target_index_set(struct PointerRNA *ptr, int value)
998 ParticleSystem *psys = (ParticleSystem *)ptr->data;
999 ParticleTarget *pt = psys->targets.first;
1002 for (; pt; pt = pt->next, i++) {
1004 pt->flag |= PTARGET_CURRENT;
1006 pt->flag &= ~PTARGET_CURRENT;
1010 static void rna_ParticleTarget_name_get(PointerRNA *ptr, char *str)
1012 ParticleTarget *pt = ptr->data;
1014 if (pt->flag & PTARGET_VALID) {
1015 ParticleSystem *psys = NULL;
1018 psys = BLI_findlink(&pt->ob->particlesystem, pt->psys - 1);
1020 Object *ob = (Object *) ptr->id.data;
1021 psys = BLI_findlink(&ob->particlesystem, pt->psys - 1);
1026 sprintf(str, "%s: %s", pt->ob->id.name + 2, psys->name);
1028 strcpy(str, psys->name);
1031 strcpy(str, "Invalid target!");
1034 strcpy(str, "Invalid target!");
1037 static int rna_ParticleTarget_name_length(PointerRNA *ptr)
1039 char tstr[MAX_ID_NAME + MAX_ID_NAME + 64];
1041 rna_ParticleTarget_name_get(ptr, tstr);
1043 return strlen(tstr);
1046 static int particle_id_check(PointerRNA *ptr)
1048 ID *id = ptr->id.data;
1050 return (GS(id->name) == ID_PA);
1053 static char *rna_SPHFluidSettings_path(PointerRNA *ptr)
1055 SPHFluidSettings *fluid = (SPHFluidSettings *)ptr->data;
1057 if (particle_id_check(ptr)) {
1058 ParticleSettings *part = (ParticleSettings *)ptr->id.data;
1060 if (part->fluid == fluid)
1061 return BLI_sprintfN("fluid");
1066 static bool rna_ParticleSystem_multiple_caches_get(PointerRNA *ptr)
1068 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1070 return (psys->ptcaches.first != psys->ptcaches.last);
1072 static bool rna_ParticleSystem_editable_get(PointerRNA *ptr)
1074 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1076 return psys_check_edited(psys);
1078 static bool rna_ParticleSystem_edited_get(PointerRNA *ptr)
1080 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1082 if (psys->part && psys->part->type == PART_HAIR)
1083 return (psys->flag & PSYS_EDITED || (psys->edit && psys->edit->edited));
1085 return (psys->pointcache->edit && psys->pointcache->edit->edited);
1087 static PointerRNA rna_ParticleDupliWeight_active_get(PointerRNA *ptr)
1089 ParticleSettings *part = (ParticleSettings *)ptr->id.data;
1090 ParticleDupliWeight *dw = part->dupliweights.first;
1092 for (; dw; dw = dw->next) {
1093 if (dw->flag & PART_DUPLIW_CURRENT)
1094 return rna_pointer_inherit_refine(ptr, &RNA_ParticleDupliWeight, dw);
1096 return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, NULL);
1098 static void rna_ParticleDupliWeight_active_index_range(PointerRNA *ptr, int *min, int *max,
1099 int *UNUSED(softmin), int *UNUSED(softmax))
1101 ParticleSettings *part = (ParticleSettings *)ptr->id.data;
1103 *max = max_ii(0, BLI_listbase_count(&part->dupliweights) - 1);
1106 static int rna_ParticleDupliWeight_active_index_get(PointerRNA *ptr)
1108 ParticleSettings *part = (ParticleSettings *)ptr->id.data;
1109 ParticleDupliWeight *dw = part->dupliweights.first;
1112 for (; dw; dw = dw->next, i++)
1113 if (dw->flag & PART_DUPLIW_CURRENT)
1119 static void rna_ParticleDupliWeight_active_index_set(struct PointerRNA *ptr, int value)
1121 ParticleSettings *part = (ParticleSettings *)ptr->id.data;
1122 ParticleDupliWeight *dw = part->dupliweights.first;
1125 for (; dw; dw = dw->next, i++) {
1127 dw->flag |= PART_DUPLIW_CURRENT;
1129 dw->flag &= ~PART_DUPLIW_CURRENT;
1133 static void rna_ParticleDupliWeight_name_get(PointerRNA *ptr, char *str)
1135 ParticleSettings *part = (ParticleSettings *)ptr->id.data;
1136 psys_find_group_weights(part);
1138 ParticleDupliWeight *dw = ptr->data;
1141 sprintf(str, "%s: %i", dw->ob->id.name + 2, dw->count);
1143 strcpy(str, "No object");
1146 static int rna_ParticleDupliWeight_name_length(PointerRNA *ptr)
1148 char tstr[MAX_ID_NAME + 64];
1150 rna_ParticleDupliWeight_name_get(ptr, tstr);
1152 return strlen(tstr);
1155 static const EnumPropertyItem *rna_Particle_from_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr),
1156 PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
1158 /*if (part->type==PART_REACTOR) */
1159 /* return part_reactor_from_items; */
1161 return part_from_items;
1164 static const EnumPropertyItem *rna_Particle_dist_itemf(bContext *UNUSED(C), PointerRNA *ptr,
1165 PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
1167 ParticleSettings *part = ptr->id.data;
1169 if (part->type == PART_HAIR)
1170 return part_hair_dist_items;
1172 return part_dist_items;
1175 static const EnumPropertyItem *rna_Particle_draw_as_itemf(bContext *UNUSED(C), PointerRNA *ptr,
1176 PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
1178 ParticleSettings *part = ptr->id.data;
1180 if (part->type == PART_HAIR)
1181 return part_hair_draw_as_items;
1183 return part_draw_as_items;
1186 static const EnumPropertyItem *rna_Particle_ren_as_itemf(bContext *UNUSED(C), PointerRNA *ptr,
1187 PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
1189 ParticleSettings *part = ptr->id.data;
1191 if (part->type == PART_HAIR)
1192 return part_hair_ren_as_items;
1194 return part_ren_as_items;
1197 static PointerRNA rna_Particle_field1_get(PointerRNA *ptr)
1199 ParticleSettings *part = (ParticleSettings *)ptr->id.data;
1203 part->pd = BKE_partdeflect_new(0);
1205 return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd);
1208 static PointerRNA rna_Particle_field2_get(PointerRNA *ptr)
1210 ParticleSettings *part = (ParticleSettings *)ptr->id.data;
1214 part->pd2 = BKE_partdeflect_new(0);
1216 return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd2);
1219 static void psys_vg_name_get__internal(PointerRNA *ptr, char *value, int index)
1221 Object *ob = ptr->id.data;
1222 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1224 if (psys->vgroup[index] > 0) {
1225 bDeformGroup *defGroup = BLI_findlink(&ob->defbase, psys->vgroup[index] - 1);
1228 strcpy(value, defGroup->name);
1235 static int psys_vg_name_len__internal(PointerRNA *ptr, int index)
1237 Object *ob = ptr->id.data;
1238 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1240 if (psys->vgroup[index] > 0) {
1241 bDeformGroup *defGroup = BLI_findlink(&ob->defbase, psys->vgroup[index] - 1);
1244 return strlen(defGroup->name);
1249 static void psys_vg_name_set__internal(PointerRNA *ptr, const char *value, int index)
1251 Object *ob = ptr->id.data;
1252 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1254 if (value[0] == '\0') {
1255 psys->vgroup[index] = 0;
1258 int defgrp_index = defgroup_name_index(ob, value);
1260 if (defgrp_index == -1)
1263 psys->vgroup[index] = defgrp_index + 1;
1267 static char *rna_ParticleSystem_path(PointerRNA *ptr)
1269 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1270 char name_esc[sizeof(psys->name) * 2];
1272 BLI_strescape(name_esc, psys->name, sizeof(name_esc));
1273 return BLI_sprintfN("particle_systems[\"%s\"]", name_esc);
1276 static void rna_ParticleSettings_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
1278 ParticleSettings *part = (ParticleSettings *)ptr->data;
1279 rna_iterator_array_begin(iter, (void *)part->mtex, sizeof(MTex *), MAX_MTEX, 0, NULL);
1282 static PointerRNA rna_ParticleSettings_active_texture_get(PointerRNA *ptr)
1284 ParticleSettings *part = (ParticleSettings *)ptr->data;
1287 tex = give_current_particle_texture(part);
1288 return rna_pointer_inherit_refine(ptr, &RNA_Texture, tex);
1291 static void rna_ParticleSettings_active_texture_set(PointerRNA *ptr, PointerRNA value)
1293 ParticleSettings *part = (ParticleSettings *)ptr->data;
1295 set_current_particle_texture(part, value.data);
1298 /* irritating string functions for each index :/ */
1299 static void rna_ParticleVGroup_name_get_0(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 0); }
1300 static void rna_ParticleVGroup_name_get_1(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 1); }
1301 static void rna_ParticleVGroup_name_get_2(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 2); }
1302 static void rna_ParticleVGroup_name_get_3(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 3); }
1303 static void rna_ParticleVGroup_name_get_4(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 4); }
1304 static void rna_ParticleVGroup_name_get_5(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 5); }
1305 static void rna_ParticleVGroup_name_get_6(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 6); }
1306 static void rna_ParticleVGroup_name_get_7(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 7); }
1307 static void rna_ParticleVGroup_name_get_8(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 8); }
1308 static void rna_ParticleVGroup_name_get_9(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 9); }
1309 static void rna_ParticleVGroup_name_get_10(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 10); }
1310 static void rna_ParticleVGroup_name_get_11(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 11); }
1311 static void rna_ParticleVGroup_name_get_12(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 12); }
1313 static int rna_ParticleVGroup_name_len_0(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 0); }
1314 static int rna_ParticleVGroup_name_len_1(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 1); }
1315 static int rna_ParticleVGroup_name_len_2(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 2); }
1316 static int rna_ParticleVGroup_name_len_3(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 3); }
1317 static int rna_ParticleVGroup_name_len_4(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 4); }
1318 static int rna_ParticleVGroup_name_len_5(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 5); }
1319 static int rna_ParticleVGroup_name_len_6(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 6); }
1320 static int rna_ParticleVGroup_name_len_7(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 7); }
1321 static int rna_ParticleVGroup_name_len_8(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 8); }
1322 static int rna_ParticleVGroup_name_len_9(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 9); }
1323 static int rna_ParticleVGroup_name_len_10(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 10); }
1324 static int rna_ParticleVGroup_name_len_11(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 11); }
1325 static int rna_ParticleVGroup_name_len_12(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 12); }
1327 static void rna_ParticleVGroup_name_set_0(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 0); }
1328 static void rna_ParticleVGroup_name_set_1(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 1); }
1329 static void rna_ParticleVGroup_name_set_2(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 2); }
1330 static void rna_ParticleVGroup_name_set_3(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 3); }
1331 static void rna_ParticleVGroup_name_set_4(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 4); }
1332 static void rna_ParticleVGroup_name_set_5(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 5); }
1333 static void rna_ParticleVGroup_name_set_6(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 6); }
1334 static void rna_ParticleVGroup_name_set_7(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 7); }
1335 static void rna_ParticleVGroup_name_set_8(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 8); }
1336 static void rna_ParticleVGroup_name_set_9(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 9); }
1337 static void rna_ParticleVGroup_name_set_10(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 10); }
1338 static void rna_ParticleVGroup_name_set_11(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 11); }
1339 static void rna_ParticleVGroup_name_set_12(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 12); }
1344 static void rna_def_particle_hair_key(BlenderRNA *brna)
1352 srna = RNA_def_struct(brna, "ParticleHairKey", NULL);
1353 RNA_def_struct_sdna(srna, "HairKey");
1354 RNA_def_struct_ui_text(srna, "Particle Hair Key", "Particle key for hair particle system");
1356 prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
1357 RNA_def_property_ui_text(prop, "Time", "Relative time of key over hair length");
1359 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_UNSIGNED);
1360 RNA_def_property_range(prop, 0.0, 1.0);
1361 RNA_def_property_ui_text(prop, "Weight", "Weight for cloth simulation");
1363 prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
1364 RNA_def_property_array(prop, 3);
1365 RNA_def_property_ui_text(prop, "Location (Object Space)", "Location of the hair key in object space");
1366 RNA_def_property_float_funcs(prop, "rna_ParticleHairKey_location_object_get",
1367 "rna_ParticleHairKey_location_object_set", NULL);
1369 prop = RNA_def_property(srna, "co_local", PROP_FLOAT, PROP_TRANSLATION);
1370 RNA_def_property_float_sdna(prop, NULL, "co");
1371 RNA_def_property_ui_text(prop, "Location",
1372 "Location of the hair key in its local coordinate system, "
1373 "relative to the emitting face");
1376 func = RNA_def_function(srna, "co_object", "rna_ParticleHairKey_co_object");
1377 RNA_def_function_ui_description(func, "Obtain hairkey location with particle and modifier data");
1378 parm = RNA_def_pointer(func, "object", "Object", "", "Object");
1379 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
1380 parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
1381 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
1382 parm = RNA_def_pointer(func, "particle", "Particle", "", "hair particle");
1383 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
1384 parm = RNA_def_float_vector(func, "co", 3, NULL, -FLT_MAX, FLT_MAX, "Co",
1385 "Exported hairkey location", -1e4, 1e4);
1386 RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
1387 RNA_def_function_output(func, parm);
1390 static void rna_def_particle_key(BlenderRNA *brna)
1395 srna = RNA_def_struct(brna, "ParticleKey", NULL);
1396 RNA_def_struct_ui_text(srna, "Particle Key", "Key location for a particle over time");
1398 prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
1399 RNA_def_property_float_sdna(prop, NULL, "co");
1400 RNA_def_property_ui_text(prop, "Location", "Key location");
1402 prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
1403 RNA_def_property_float_sdna(prop, NULL, "vel");
1404 RNA_def_property_ui_text(prop, "Velocity", "Key velocity");
1406 prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
1407 RNA_def_property_float_sdna(prop, NULL, "rot");
1408 RNA_def_property_ui_text(prop, "Rotation", "Key rotation quaternion");
1410 prop = RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
1411 RNA_def_property_float_sdna(prop, NULL, "ave");
1412 RNA_def_property_ui_text(prop, "Angular Velocity", "Key angular velocity");
1414 prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
1415 RNA_def_property_ui_text(prop, "Time", "Time of key over the simulation");
1418 static void rna_def_child_particle(BlenderRNA *brna)
1421 /*PropertyRNA *prop; */
1423 srna = RNA_def_struct(brna, "ChildParticle", NULL);
1424 RNA_def_struct_ui_text(srna, "Child Particle",
1425 "Child particle interpolated from simulated or edited particles");
1427 /* int num, parent; *//* num is face index on the final derived mesh */
1429 /* int pa[4]; *//* nearest particles to the child, used for the interpolation */
1430 /* float w[4]; *//* interpolation weights for the above particles */
1431 /* float fuv[4], foffset; *//* face vertex weights and offset */
1432 /* float rand[3]; */
1435 static void rna_def_particle(BlenderRNA *brna)
1443 static const EnumPropertyItem alive_items[] = {
1444 /*{PARS_KILLED, "KILLED", 0, "Killed", ""}, */
1445 {PARS_DEAD, "DEAD", 0, "Dead", ""},
1446 {PARS_UNBORN, "UNBORN", 0, "Unborn", ""},
1447 {PARS_ALIVE, "ALIVE", 0, "Alive", ""},
1448 {PARS_DYING, "DYING", 0, "Dying", ""},
1449 {0, NULL, 0, NULL, NULL}
1452 srna = RNA_def_struct(brna, "Particle", NULL);
1453 RNA_def_struct_sdna(srna, "ParticleData");
1454 RNA_def_struct_ui_text(srna, "Particle", "Particle in a particle system");
1456 /* Particle State & Previous State */
1457 prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
1458 RNA_def_property_float_sdna(prop, NULL, "state.co");
1459 RNA_def_property_ui_text(prop, "Particle Location", "");
1461 prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
1462 RNA_def_property_float_sdna(prop, NULL, "state.vel");
1463 RNA_def_property_ui_text(prop, "Particle Velocity", "");
1465 prop = RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
1466 RNA_def_property_float_sdna(prop, NULL, "state.ave");
1467 RNA_def_property_ui_text(prop, "Angular Velocity", "");
1469 prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
1470 RNA_def_property_float_sdna(prop, NULL, "state.rot");
1471 RNA_def_property_ui_text(prop, "Rotation", "");
1473 prop = RNA_def_property(srna, "prev_location", PROP_FLOAT, PROP_TRANSLATION);
1474 RNA_def_property_float_sdna(prop, NULL, "prev_state.co");
1475 RNA_def_property_ui_text(prop, "Previous Particle Location", "");
1477 prop = RNA_def_property(srna, "prev_velocity", PROP_FLOAT, PROP_VELOCITY);
1478 RNA_def_property_float_sdna(prop, NULL, "prev_state.vel");
1479 RNA_def_property_ui_text(prop, "Previous Particle Velocity", "");
1481 prop = RNA_def_property(srna, "prev_angular_velocity", PROP_FLOAT, PROP_VELOCITY);
1482 RNA_def_property_float_sdna(prop, NULL, "prev_state.ave");
1483 RNA_def_property_ui_text(prop, "Previous Angular Velocity", "");
1485 prop = RNA_def_property(srna, "prev_rotation", PROP_FLOAT, PROP_QUATERNION);
1486 RNA_def_property_float_sdna(prop, NULL, "prev_state.rot");
1487 RNA_def_property_ui_text(prop, "Previous Rotation", "");
1489 /* Hair & Keyed Keys */
1491 prop = RNA_def_property(srna, "hair_keys", PROP_COLLECTION, PROP_NONE);
1492 RNA_def_property_collection_sdna(prop, NULL, "hair", "totkey");
1493 RNA_def_property_struct_type(prop, "ParticleHairKey");
1494 RNA_def_property_ui_text(prop, "Hair", "");
1496 prop = RNA_def_property(srna, "particle_keys", PROP_COLLECTION, PROP_NONE);
1497 RNA_def_property_collection_sdna(prop, NULL, "keys", "totkey");
1498 RNA_def_property_struct_type(prop, "ParticleKey");
1499 RNA_def_property_ui_text(prop, "Keyed States", "");
1501 /* float fuv[4], foffset; *//* coordinates on face/edge number "num" and depth along*/
1502 /* *//* face normal for volume emission */
1504 prop = RNA_def_property(srna, "birth_time", PROP_FLOAT, PROP_TIME);
1505 RNA_def_property_float_sdna(prop, NULL, "time");
1506 /* RNA_def_property_range(prop, lowerLimitf, upperLimitf); */
1507 RNA_def_property_ui_text(prop, "Birth Time", "");
1509 prop = RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
1510 /* RNA_def_property_range(prop, lowerLimitf, upperLimitf); */
1511 RNA_def_property_ui_text(prop, "Lifetime", "");
1513 prop = RNA_def_property(srna, "die_time", PROP_FLOAT, PROP_TIME);
1514 RNA_def_property_float_sdna(prop, NULL, "dietime");
1515 /* RNA_def_property_range(prop, lowerLimitf, upperLimitf); */
1516 RNA_def_property_ui_text(prop, "Die Time", "");
1518 prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
1519 /* RNA_def_property_range(prop, lowerLimitf, upperLimitf); */
1520 RNA_def_property_ui_text(prop, "Size", "");
1523 /* int num; *//* index to vert/edge/face */
1524 /* int num_dmcache; *//* index to derived mesh data (face) to avoid slow lookups */
1530 prop = RNA_def_property(srna, "is_exist", PROP_BOOLEAN, PROP_NONE);
1531 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PARS_UNEXIST);
1532 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1533 RNA_def_property_ui_text(prop, "Exists", "");
1535 prop = RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE);
1536 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PARS_NO_DISP);
1537 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1538 RNA_def_property_ui_text(prop, "Visible", "");
1540 prop = RNA_def_property(srna, "alive_state", PROP_ENUM, PROP_NONE);
1541 RNA_def_property_enum_sdna(prop, NULL, "alive");
1542 RNA_def_property_enum_items(prop, alive_items);
1543 RNA_def_property_ui_text(prop, "Alive State", "");
1548 func = RNA_def_function(srna, "uv_on_emitter", "rna_Particle_uv_on_emitter");
1549 RNA_def_function_ui_description(func, "Obtain uv for particle on derived mesh");
1550 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1551 parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
1552 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
1553 parm = RNA_def_property(func, "uv", PROP_FLOAT, PROP_COORDS);
1554 RNA_def_property_array(parm, 2);
1555 RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
1556 RNA_def_function_output(func, parm);
1559 static void rna_def_particle_dupliweight(BlenderRNA *brna)
1564 srna = RNA_def_struct(brna, "ParticleDupliWeight", NULL);
1565 RNA_def_struct_ui_text(srna, "Particle Dupliobject Weight", "Weight of a particle dupliobject in a collection");
1566 RNA_def_struct_sdna(srna, "ParticleDupliWeight");
1568 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1569 RNA_def_property_string_funcs(prop, "rna_ParticleDupliWeight_name_get",
1570 "rna_ParticleDupliWeight_name_length", NULL);
1571 RNA_def_property_ui_text(prop, "Name", "Particle dupliobject name");
1572 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1573 RNA_def_struct_name_property(srna, prop);
1575 prop = RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
1576 RNA_def_property_range(prop, 0, SHRT_MAX);
1577 RNA_def_property_ui_text(prop, "Count",
1578 "The number of times this object is repeated with respect to other objects");
1579 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1582 static void rna_def_fluid_settings(BlenderRNA *brna)
1587 static const EnumPropertyItem sph_solver_items[] = {
1588 {SPH_SOLVER_DDR, "DDR", 0, "Double-Density", "An artistic solver with strong surface tension effects (original)"},
1589 {SPH_SOLVER_CLASSICAL, "CLASSICAL", 0, "Classical", "A more physically-accurate solver"},
1590 {0, NULL, 0, NULL, NULL}
1593 srna = RNA_def_struct(brna, "SPHFluidSettings", NULL);
1594 RNA_def_struct_path_func(srna, "rna_SPHFluidSettings_path");
1595 RNA_def_struct_ui_text(srna, "SPH Fluid Settings", "Settings for particle fluids physics");
1597 /* Fluid settings */
1598 prop = RNA_def_property(srna, "solver", PROP_ENUM, PROP_NONE);
1599 RNA_def_property_enum_sdna(prop, NULL, "solver");
1600 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1601 RNA_def_property_enum_items(prop, sph_solver_items);
1602 RNA_def_property_ui_text(prop, "SPH Solver", "The code used to calculate internal forces on particles");
1603 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1605 prop = RNA_def_property(srna, "spring_force", PROP_FLOAT, PROP_NONE);
1606 RNA_def_property_float_sdna(prop, NULL, "spring_k");
1607 RNA_def_property_range(prop, 0.0f, 100.0f);
1608 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
1609 RNA_def_property_ui_text(prop, "Spring Force", "Spring force");
1610 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1612 prop = RNA_def_property(srna, "fluid_radius", PROP_FLOAT, PROP_NONE);
1613 RNA_def_property_float_sdna(prop, NULL, "radius");
1614 RNA_def_property_range(prop, 0.0f, 20.0f);
1615 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
1616 RNA_def_property_ui_text(prop, "Interaction Radius", "Fluid interaction radius");
1617 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1619 prop = RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_NONE);
1620 RNA_def_property_range(prop, 0.0f, 2.0f);
1621 RNA_def_property_ui_text(prop, "Rest Length", "Spring rest length (factor of particle radius)");
1622 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1624 prop = RNA_def_property(srna, "use_viscoelastic_springs", PROP_BOOLEAN, PROP_NONE);
1625 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_VISCOELASTIC_SPRINGS);
1626 RNA_def_property_ui_text(prop, "Viscoelastic Springs", "Use viscoelastic springs instead of Hooke's springs");
1627 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1629 prop = RNA_def_property(srna, "use_initial_rest_length", PROP_BOOLEAN, PROP_NONE);
1630 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_CURRENT_REST_LENGTH);
1631 RNA_def_property_ui_text(prop, "Initial Rest Length",
1632 "Use the initial length as spring rest length instead of 2 * particle size");
1633 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1635 prop = RNA_def_property(srna, "plasticity", PROP_FLOAT, PROP_NONE);
1636 RNA_def_property_float_sdna(prop, NULL, "plasticity_constant");
1637 RNA_def_property_range(prop, 0.0f, 100.0f);
1638 RNA_def_property_ui_text(prop, "Plasticity",
1639 "How much the spring rest length can change after the elastic limit is crossed");
1640 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1642 prop = RNA_def_property(srna, "yield_ratio", PROP_FLOAT, PROP_NONE);
1643 RNA_def_property_float_sdna(prop, NULL, "yield_ratio");
1644 RNA_def_property_range(prop, 0.0f, 1.0f);
1645 RNA_def_property_ui_text(prop, "Elastic Limit",
1646 "How much the spring has to be stretched/compressed in order to change it's rest length");
1647 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1649 prop = RNA_def_property(srna, "spring_frames", PROP_INT, PROP_NONE);
1650 RNA_def_property_range(prop, 0.0f, 100.0f);
1651 RNA_def_property_ui_text(prop, "Spring Frames",
1652 "Create springs for this number of frames since particles birth (0 is always)");
1653 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1656 prop = RNA_def_property(srna, "linear_viscosity", PROP_FLOAT, PROP_NONE);
1657 RNA_def_property_float_sdna(prop, NULL, "viscosity_omega");
1658 RNA_def_property_range(prop, 0.0f, 100.0f);
1659 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
1660 RNA_def_property_ui_text(prop, "Viscosity", "Linear viscosity");
1661 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1663 prop = RNA_def_property(srna, "stiff_viscosity", PROP_FLOAT, PROP_NONE);
1664 RNA_def_property_float_sdna(prop, NULL, "viscosity_beta");
1665 RNA_def_property_range(prop, 0.0f, 100.0f);
1666 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
1667 RNA_def_property_ui_text(prop, "Stiff viscosity", "Creates viscosity for expanding fluid");
1668 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1670 /* Double density relaxation */
1671 prop = RNA_def_property(srna, "stiffness", PROP_FLOAT, PROP_NONE);
1672 RNA_def_property_float_sdna(prop, NULL, "stiffness_k");
1673 RNA_def_property_range(prop, 0.0f, 1000.0f);
1674 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
1675 RNA_def_property_ui_text(prop, "Stiffness", "How incompressible the fluid is (speed of sound)");
1676 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1678 prop = RNA_def_property(srna, "repulsion", PROP_FLOAT, PROP_NONE);
1679 RNA_def_property_float_sdna(prop, NULL, "stiffness_knear");
1680 RNA_def_property_range(prop, 0.0f, 100.0f);
1681 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
1682 RNA_def_property_ui_text(prop, "Repulsion Factor",
1683 "How strongly the fluid tries to keep from clustering (factor of stiffness)");
1684 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1686 prop = RNA_def_property(srna, "rest_density", PROP_FLOAT, PROP_NONE);
1687 RNA_def_property_float_sdna(prop, NULL, "rest_density");
1688 RNA_def_property_range(prop, 0.0f, 10000.0f);
1689 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
1690 RNA_def_property_ui_text(prop, "Rest Density", "Fluid rest density");
1691 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1694 prop = RNA_def_property(srna, "buoyancy", PROP_FLOAT, PROP_NONE);
1695 RNA_def_property_float_sdna(prop, NULL, "buoyancy");
1696 RNA_def_property_range(prop, 0.0f, 10.0f);
1697 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3);
1698 RNA_def_property_ui_text(prop, "Buoyancy",
1699 "Artificial buoyancy force in negative gravity direction based on pressure "
1700 "differences inside the fluid");
1701 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1705 prop = RNA_def_property(srna, "factor_repulsion", PROP_BOOLEAN, PROP_NONE);
1706 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_REPULSION);
1707 RNA_def_property_ui_text(prop, "Factor Repulsion", "Repulsion is a factor of stiffness");
1708 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1710 prop = RNA_def_property(srna, "use_factor_density", PROP_BOOLEAN, PROP_NONE);
1711 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_DENSITY);
1712 RNA_def_property_ui_text(prop, "Factor Density",
1713 "Density is calculated as a factor of default density (depends on particle size)");
1714 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1716 prop = RNA_def_property(srna, "factor_radius", PROP_BOOLEAN, PROP_NONE);
1717 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_RADIUS);
1718 RNA_def_property_ui_text(prop, "Factor Radius", "Interaction radius is a factor of 4 * particle size");
1719 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1721 prop = RNA_def_property(srna, "factor_stiff_viscosity", PROP_BOOLEAN, PROP_NONE);
1722 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_VISCOSITY);
1723 RNA_def_property_ui_text(prop, "Factor Stiff Viscosity", "Stiff viscosity is a factor of normal viscosity");
1724 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1726 prop = RNA_def_property(srna, "factor_rest_length", PROP_BOOLEAN, PROP_NONE);
1727 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_REST_LENGTH);
1728 RNA_def_property_ui_text(prop, "Factor Rest Length", "Spring rest length is a factor of 2 * particle size");
1729 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1732 static void rna_def_particle_settings_mtex(BlenderRNA *brna)
1737 static const EnumPropertyItem texco_items[] = {
1738 {TEXCO_GLOB, "GLOBAL", 0, "Global", "Use global coordinates for the texture coordinates"},
1739 {TEXCO_OBJECT, "OBJECT", 0, "Object", "Use linked object's coordinates for texture coordinates"},
1740 {TEXCO_UV, "UV", 0, "UV", "Use UV coordinates for texture coordinates"},
1741 {TEXCO_ORCO, "ORCO", 0, "Generated", "Use the original undeformed coordinates of the object"},
1742 {TEXCO_STRAND, "STRAND", 0, "Strand / Particle",
1743 "Use normalized strand texture coordinate (1D) or particle age (X) and trail position (Y)"},
1744 {0, NULL, 0, NULL, NULL}
1747 static const EnumPropertyItem prop_mapping_items[] = {
1748 {MTEX_FLAT, "FLAT", 0, "Flat", "Map X and Y coordinates directly"},
1749 {MTEX_CUBE, "CUBE", 0, "Cube", "Map using the normal vector"},
1750 {MTEX_TUBE, "TUBE", 0, "Tube", "Map with Z as central axis"},
1751 {MTEX_SPHERE, "SPHERE", 0, "Sphere", "Map with Z as central axis"},
1752 {0, NULL, 0, NULL, NULL}
1755 static const EnumPropertyItem prop_x_mapping_items[] = {
1756 {0, "NONE", 0, "None", ""},
1757 {1, "X", 0, "X", ""},
1758 {2, "Y", 0, "Y", ""},
1759 {3, "Z", 0, "Z", ""},
1760 {0, NULL, 0, NULL, NULL}
1763 static const EnumPropertyItem prop_y_mapping_items[] = {
1764 {0, "NONE", 0, "None", ""},
1765 {1, "X", 0, "X", ""},
1766 {2, "Y", 0, "Y", ""},
1767 {3, "Z", 0, "Z", ""},
1768 {0, NULL, 0, NULL, NULL}
1771 static const EnumPropertyItem prop_z_mapping_items[] = {
1772 {0, "NONE", 0, "None", ""},
1773 {1, "X", 0, "X", ""},
1774 {2, "Y", 0, "Y", ""},
1775 {3, "Z", 0, "Z", ""},
1776 {0, NULL, 0, NULL, NULL}
1779 srna = RNA_def_struct(brna, "ParticleSettingsTextureSlot", "TextureSlot");
1780 RNA_def_struct_sdna(srna, "MTex");
1781 RNA_def_struct_ui_text(srna, "Particle Settings Texture Slot",
1782 "Texture slot for textures in a Particle Settings data-block");
1784 prop = RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
1785 RNA_def_property_enum_sdna(prop, NULL, "texco");
1786 RNA_def_property_enum_items(prop, texco_items);
1787 RNA_def_property_ui_text(prop, "Texture Coordinates",
1788 "Texture coordinates used to map the texture onto the background");
1789 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1791 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1792 RNA_def_property_pointer_sdna(prop, NULL, "object");
1793 RNA_def_property_struct_type(prop, "Object");
1794 RNA_def_property_flag(prop, PROP_EDITABLE);
1795 RNA_def_property_ui_text(prop, "Object", "Object to use for mapping with Object texture coordinates");
1796 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1798 prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
1799 RNA_def_property_string_sdna(prop, NULL, "uvname");
1800 RNA_def_property_ui_text(prop, "UV Map", "UV map to use for mapping with UV texture coordinates");
1801 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1803 prop = RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE);
1804 RNA_def_property_enum_sdna(prop, NULL, "projx");
1805 RNA_def_property_enum_items(prop, prop_x_mapping_items);
1806 RNA_def_property_ui_text(prop, "X Mapping", "");
1807 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1809 prop = RNA_def_property(srna, "mapping_y", PROP_ENUM, PROP_NONE);
1810 RNA_def_property_enum_sdna(prop, NULL, "projy");
1811 RNA_def_property_enum_items(prop, prop_y_mapping_items);
1812 RNA_def_property_ui_text(prop, "Y Mapping", "");
1813 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1815 prop = RNA_def_property(srna, "mapping_z", PROP_ENUM, PROP_NONE);
1816 RNA_def_property_enum_sdna(prop, NULL, "projz");
1817 RNA_def_property_enum_items(prop, prop_z_mapping_items);
1818 RNA_def_property_ui_text(prop, "Z Mapping", "");
1819 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1821 prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
1822 RNA_def_property_enum_items(prop, prop_mapping_items);
1823 RNA_def_property_ui_text(prop, "Mapping", "");
1824 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1827 prop = RNA_def_property(srna, "use_map_time", PROP_BOOLEAN, PROP_NONE);
1828 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_TIME);
1829 RNA_def_property_ui_text(prop, "Emission Time", "Affect the emission time of the particles");
1830 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1832 prop = RNA_def_property(srna, "use_map_life", PROP_BOOLEAN, PROP_NONE);
1833 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_LIFE);
1834 RNA_def_property_ui_text(prop, "Life Time", "Affect the life time of the particles");
1835 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1837 prop = RNA_def_property(srna, "use_map_density", PROP_BOOLEAN, PROP_NONE);
1838 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_DENS);
1839 RNA_def_property_ui_text(prop, "Density", "Affect the density of the particles");
1840 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1842 prop = RNA_def_property(srna, "use_map_size", PROP_BOOLEAN, PROP_NONE);
1843 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_SIZE);
1844 RNA_def_property_ui_text(prop, "Size", "Affect the particle size");
1845 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1847 prop = RNA_def_property(srna, "use_map_velocity", PROP_BOOLEAN, PROP_NONE);
1848 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_IVEL);
1849 RNA_def_property_ui_text(prop, "Initial Velocity", "Affect the particle initial velocity");
1850 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1852 prop = RNA_def_property(srna, "use_map_field", PROP_BOOLEAN, PROP_NONE);
1853 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_FIELD);
1854 RNA_def_property_ui_text(prop, "Force Field", "Affect the particle force fields");
1855 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1857 prop = RNA_def_property(srna, "use_map_gravity", PROP_BOOLEAN, PROP_NONE);
1858 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_GRAVITY);
1859 RNA_def_property_ui_text(prop, "Gravity", "Affect the particle gravity");
1860 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1862 prop = RNA_def_property(srna, "use_map_damp", PROP_BOOLEAN, PROP_NONE);
1863 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_DAMP);
1864 RNA_def_property_ui_text(prop, "Damp", "Affect the particle velocity damping");
1865 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1867 prop = RNA_def_property(srna, "use_map_clump", PROP_BOOLEAN, PROP_NONE);
1868 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_CLUMP);
1869 RNA_def_property_ui_text(prop, "Clump", "Affect the child clumping");
1870 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1872 prop = RNA_def_property(srna, "use_map_kink_amp", PROP_BOOLEAN, PROP_NONE);
1873 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_KINK_AMP);
1874 RNA_def_property_ui_text(prop, "Kink Amplitude", "Affect the child kink amplitude");
1875 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1877 prop = RNA_def_property(srna, "use_map_kink_freq", PROP_BOOLEAN, PROP_NONE);
1878 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_KINK_FREQ);
1879 RNA_def_property_ui_text(prop, "Kink Frequency", "Affect the child kink frequency");
1880 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1882 prop = RNA_def_property(srna, "use_map_rough", PROP_BOOLEAN, PROP_NONE);
1883 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_ROUGH);
1884 RNA_def_property_ui_text(prop, "Rough", "Affect the child rough");
1885 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1887 prop = RNA_def_property(srna, "use_map_length", PROP_BOOLEAN, PROP_NONE);
1888 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_LENGTH);
1889 RNA_def_property_ui_text(prop, "Length", "Affect the child hair length");
1890 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1892 prop = RNA_def_property(srna, "use_map_twist", PROP_BOOLEAN, PROP_NONE);
1893 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_TWIST);
1894 RNA_def_property_ui_text(prop, "Twist", "Affect the child twist");
1895 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1897 /* influence factors */
1898 prop = RNA_def_property(srna, "time_factor", PROP_FLOAT, PROP_NONE);
1899 RNA_def_property_float_sdna(prop, NULL, "timefac");
1900 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1901 RNA_def_property_ui_text(prop, "Emission Time Factor", "Amount texture affects particle emission time");
1902 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1904 prop = RNA_def_property(srna, "life_factor", PROP_FLOAT, PROP_NONE);
1905 RNA_def_property_float_sdna(prop, NULL, "lifefac");
1906 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1907 RNA_def_property_ui_text(prop, "Life Time Factor", "Amount texture affects particle life time");
1908 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1910 prop = RNA_def_property(srna, "density_factor", PROP_FLOAT, PROP_NONE);
1911 RNA_def_property_float_sdna(prop, NULL, "padensfac");
1912 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1913 RNA_def_property_ui_text(prop, "Density Factor", "Amount texture affects particle density");
1914 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1916 prop = RNA_def_property(srna, "size_factor", PROP_FLOAT, PROP_NONE);
1917 RNA_def_property_float_sdna(prop, NULL, "sizefac");
1918 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1919 RNA_def_property_ui_text(prop, "Size Factor", "Amount texture affects physical particle size");
1920 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1922 prop = RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE);
1923 RNA_def_property_float_sdna(prop, NULL, "ivelfac");
1924 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1925 RNA_def_property_ui_text(prop, "Velocity Factor", "Amount texture affects particle initial velocity");
1926 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1929 prop = RNA_def_property(srna, "field_factor", PROP_FLOAT, PROP_NONE);
1930 RNA_def_property_float_sdna(prop, NULL, "fieldfac");
1931 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1932 RNA_def_property_ui_text(prop, "Field Factor", "Amount texture affects particle force fields");
1933 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1935 prop = RNA_def_property(srna, "gravity_factor", PROP_FLOAT, PROP_NONE);
1936 RNA_def_property_float_sdna(prop, NULL, "gravityfac");
1937 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1938 RNA_def_property_ui_text(prop, "Gravity Factor", "Amount texture affects particle gravity");
1939 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1941 prop = RNA_def_property(srna, "damp_factor", PROP_FLOAT, PROP_NONE);
1942 RNA_def_property_float_sdna(prop, NULL, "dampfac");
1943 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1944 RNA_def_property_ui_text(prop, "Damp Factor", "Amount texture affects particle damping");
1945 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1948 prop = RNA_def_property(srna, "length_factor", PROP_FLOAT, PROP_NONE);
1949 RNA_def_property_float_sdna(prop, NULL, "lengthfac");
1950 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1951 RNA_def_property_ui_text(prop, "Length Factor", "Amount texture affects child hair length");
1952 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1954 prop = RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
1955 RNA_def_property_float_sdna(prop, NULL, "clumpfac");
1956 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1957 RNA_def_property_ui_text(prop, "Clump Factor", "Amount texture affects child clump");
1958 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1960 prop = RNA_def_property(srna, "kink_amp_factor", PROP_FLOAT, PROP_NONE);
1961 RNA_def_property_float_sdna(prop, NULL, "kinkampfac");
1962 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1963 RNA_def_property_ui_text(prop, "Kink Amplitude Factor", "Amount texture affects child kink amplitude");
1964 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1966 prop = RNA_def_property(srna, "kink_freq_factor", PROP_FLOAT, PROP_NONE);
1967 RNA_def_property_float_sdna(prop, NULL, "kinkfac");
1968 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1969 RNA_def_property_ui_text(prop, "Kink Frequency Factor", "Amount texture affects child kink frequency");
1970 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1972 prop = RNA_def_property(srna, "rough_factor", PROP_FLOAT, PROP_NONE);
1973 RNA_def_property_float_sdna(prop, NULL, "roughfac");
1974 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1975 RNA_def_property_ui_text(prop, "Rough Factor", "Amount texture affects child roughness");
1976 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1978 prop = RNA_def_property(srna, "twist_factor", PROP_FLOAT, PROP_NONE);
1979 RNA_def_property_float_sdna(prop, NULL, "twistfac");
1980 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1981 RNA_def_property_ui_text(prop, "Twist Factor", "Amount texture affects child twist");
1982 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1985 static void rna_def_particle_settings(BlenderRNA *brna)
1990 static const EnumPropertyItem type_items[] = {
1991 {PART_EMITTER, "EMITTER", 0, "Emitter", ""},
1992 /*{PART_REACTOR, "REACTOR", 0, "Reactor", ""}, */
1993 {PART_HAIR, "HAIR", 0, "Hair", ""},
1994 {0, NULL, 0, NULL, NULL}
1997 static const EnumPropertyItem phys_type_items[] = {
1998 {PART_PHYS_NO, "NO", 0, "No", ""},
1999 {PART_PHYS_NEWTON, "NEWTON", 0, "Newtonian", ""},
2000 {PART_PHYS_KEYED, "KEYED", 0, "Keyed", ""},
2001 {PART_PHYS_BOIDS, "BOIDS", 0, "Boids", ""},
2002 {PART_PHYS_FLUID, "FLUID", 0, "Fluid", ""},
2003 {0, NULL, 0, NULL, NULL}
2006 static const EnumPropertyItem rot_mode_items[] = {
2007 {0, "NONE", 0, "None", ""},
2008 {PART_ROT_NOR, "NOR", 0, "Normal", ""},
2009 {PART_ROT_NOR_TAN, "NOR_TAN", 0, "Normal-Tangent", ""},
2010 {PART_ROT_VEL, "VEL", 0, "Velocity / Hair", ""},
2011 {PART_ROT_GLOB_X, "GLOB_X", 0, "Global X", ""},
2012 {PART_ROT_GLOB_Y, "GLOB_Y", 0, "Global Y", ""},
2013 {PART_ROT_GLOB_Z, "GLOB_Z", 0, "Global Z", ""},
2014 {PART_ROT_OB_X, "OB_X", 0, "Object X", ""},
2015 {PART_ROT_OB_Y, "OB_Y", 0, "Object Y", ""},
2016 {PART_ROT_OB_Z, "OB_Z", 0, "Object Z", ""},
2017 {0, NULL, 0, NULL, NULL}
2020 static const EnumPropertyItem ave_mode_items[] = {
2021 {0, "NONE", 0, "None", ""},
2022 {PART_AVE_VELOCITY, "VELOCITY", 0, "Velocity", ""},
2023 {PART_AVE_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""},
2024 {PART_AVE_VERTICAL, "VERTICAL", 0, "Vertical", ""},
2025 {PART_AVE_GLOBAL_X, "GLOBAL_X", 0, "Global X", ""},
2026 {PART_AVE_GLOBAL_Y, "GLOBAL_Y", 0, "Global Y", ""},
2027 {PART_AVE_GLOBAL_Z, "GLOBAL_Z", 0, "Global Z", ""},
2028 {PART_AVE_RAND, "RAND", 0, "Random", ""},
2029 {0, NULL, 0, NULL, NULL}
2032 static const EnumPropertyItem react_event_items[] = {
2033 {PART_EVENT_DEATH, "DEATH", 0, "Death", ""},
2034 {PART_EVENT_COLLIDE, "COLLIDE", 0, "Collision", ""},
2035 {PART_EVENT_NEAR, "NEAR", 0, "Near", ""},
2036 {0, NULL, 0, NULL, NULL}
2039 static const EnumPropertyItem child_type_items[] = {
2040 {0, "NONE", 0, "None", ""},
2041 {PART_CHILD_PARTICLES, "SIMPLE", 0, "Simple", ""},
2042 {PART_CHILD_FACES, "INTERPOLATED", 0, "Interpolated", ""},
2043 {0, NULL, 0, NULL, NULL}
2046 /*TODO: names, tooltips */
2047 static const EnumPropertyItem integrator_type_items[] = {
2048 {PART_INT_EULER, "EULER", 0, "Euler", ""},
2049 {PART_INT_VERLET, "VERLET", 0, "Verlet", ""},
2050 {PART_INT_MIDPOINT, "MIDPOINT", 0, "Midpoint", ""},
2051 {PART_INT_RK4, "RK4", 0, "RK4", ""},
2052 {0, NULL, 0, NULL, NULL}
2055 static const EnumPropertyItem kink_type_items[] = {
2056 {PART_KINK_NO, "NO", 0, "Nothing", ""},
2057 {PART_KINK_CURL, "CURL", 0, "Curl", ""},
2058 {PART_KINK_RADIAL, "RADIAL", 0, "Radial", ""},
2059 {PART_KINK_WAVE, "WAVE", 0, "Wave", ""},
2060 {PART_KINK_BRAID, "BRAID", 0, "Braid", ""},
2061 {PART_KINK_SPIRAL, "SPIRAL", 0, "Spiral", ""},
2062 {0, NULL, 0, NULL, NULL}
2065 static const EnumPropertyItem bb_align_items[] = {
2066 {PART_BB_X, "X", 0, "X", ""},
2067 {PART_BB_Y, "Y", 0, "Y", ""},
2068 {PART_BB_Z, "Z", 0, "Z", ""},
2069 {PART_BB_VIEW, "VIEW", 0, "View", ""},
2070 {PART_BB_VEL, "VEL", 0, "Velocity", ""},
2071 {0, NULL, 0, NULL, NULL}
2074 static const EnumPropertyItem bb_anim_items[] = {
2075 {PART_BB_ANIM_NONE, "NONE", 0, "None", ""},
2076 {PART_BB_ANIM_AGE, "AGE", 0, "Age", ""},
2077 {PART_BB_ANIM_FRAME, "FRAME", 0, "Frame", ""},
2078 {PART_BB_ANIM_ANGLE, "ANGLE", 0, "Angle", ""},
2079 {0, NULL, 0, NULL, NULL}
2082 static const EnumPropertyItem bb_split_offset_items[] = {
2083 {PART_BB_OFF_NONE, "NONE", 0, "None", ""},
2084 {PART_BB_OFF_LINEAR, "LINEAR", 0, "Linear", ""},
2085 {PART_BB_OFF_RANDOM, "RANDOM", 0, "Random", ""},
2086 {0, NULL, 0, NULL, NULL}
2089 static const EnumPropertyItem draw_col_items[] = {
2090 {PART_DRAW_COL_NONE, "NONE", 0, "None", ""},
2091 {PART_DRAW_COL_MAT, "MATERIAL", 0, "Material", ""},
2092 {PART_DRAW_COL_VEL, "VELOCITY", 0, "Velocity", ""},
2093 {PART_DRAW_COL_ACC, "ACCELERATION", 0, "Acceleration", ""},
2094 {0, NULL, 0, NULL, NULL}
2097 static const EnumPropertyItem part_mat_items[] = {
2098 {0, "DUMMY", 0, "Dummy", ""},
2099 {0, NULL, 0, NULL, NULL}
2102 srna = RNA_def_struct(brna, "ParticleSettings", "ID");
2103 RNA_def_struct_ui_text(srna, "Particle Settings", "Particle settings, reusable by multiple particle systems");
2104 RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
2106 rna_def_mtex_common(brna, srna, "rna_ParticleSettings_mtex_begin", "rna_ParticleSettings_active_texture_get",
2107 "rna_ParticleSettings_active_texture_set", NULL, "ParticleSettingsTextureSlot",
2108 "ParticleSettingsTextureSlots", "rna_Particle_reset", NULL);
2110 /* fluid particle type can't be checked from the type value in rna as it's not shown in the menu */
2111 prop = RNA_def_property(srna, "is_fluid", PROP_BOOLEAN, PROP_NONE);
2112 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2113 RNA_def_property_boolean_funcs(prop, "rna_PartSettings_is_fluid_get", NULL);
2114 RNA_def_property_ui_text(prop, "Fluid", "Particles were created by a fluid simulation");
2117 prop = RNA_def_property(srna, "use_react_start_end", PROP_BOOLEAN, PROP_NONE);
2118 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_STA_END);
2119 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2120 RNA_def_property_ui_text(prop, "Start/End", "Give birth to unreacted particles eventually");
2121 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2123 prop = RNA_def_property(srna, "use_react_multiple", PROP_BOOLEAN, PROP_NONE);
2124 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_MULTIPLE);
2125 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2126 RNA_def_property_ui_text(prop, "Multi React", "React multiple times");
2127 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2129 prop = RNA_def_property(srna, "regrow_hair", PROP_BOOLEAN, PROP_NONE);
2130 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_REGROW);
2131 RNA_def_property_ui_text(prop, "Regrow", "Regrow hair for each frame");
2132 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2134 prop = RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
2135 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_UNBORN);
2136 RNA_def_property_ui_text(prop, "Unborn", "Show particles before they are emitted");
2137 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2139 prop = RNA_def_property(srna, "use_dead", PROP_BOOLEAN, PROP_NONE);
2140 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_DIED);
2141 RNA_def_property_ui_text(prop, "Died", "Show particles after they have died");
2142 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2144 prop = RNA_def_property(srna, "use_emit_random", PROP_BOOLEAN, PROP_NONE);
2145 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_TRAND);
2146 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2147 RNA_def_property_ui_text(prop, "Random", "Emit in random order of elements");
2148 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2150 prop = RNA_def_property(srna, "use_even_distribution", PROP_BOOLEAN, PROP_NONE);
2151 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_EDISTR);
2152 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2153 RNA_def_property_ui_text(prop, "Even Distribution",
2154 "Use even distribution from faces based on face areas or edge lengths");
2155 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2157 prop = RNA_def_property(srna, "use_die_on_collision", PROP_BOOLEAN, PROP_NONE);
2158 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_DIE_ON_COL);
2159 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2160 RNA_def_property_ui_text(prop, "Die on hit", "Particles die when they collide with a deflector object");
2161 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2163 prop = RNA_def_property(srna, "use_size_deflect", PROP_BOOLEAN, PROP_NONE);
2164 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SIZE_DEFL);
2165 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2166 RNA_def_property_ui_text(prop, "Size Deflect", "Use particle's size in deflection");
2167 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2169 prop = RNA_def_property(srna, "use_rotations", PROP_BOOLEAN, PROP_NONE);
2170 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ROTATIONS);
2171 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2172 RNA_def_property_ui_text(prop, "Rotations", "Calculate particle rotations");
2173 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2175 prop = RNA_def_property(srna, "use_dynamic_rotation", PROP_BOOLEAN, PROP_NONE);
2176 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ROT_DYN);
2177 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2178 RNA_def_property_ui_text(prop, "Dynamic", "Particle rotations are affected by collisions and effectors");
2179 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2181 prop = RNA_def_property(srna, "use_multiply_size_mass", PROP_BOOLEAN, PROP_NONE);
2182 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SIZEMASS);
2183 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2184 RNA_def_property_ui_text(prop, "Mass from Size", "Multiply mass by particle size");
2185 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2187 prop = RNA_def_property(srna, "use_advanced_hair", PROP_BOOLEAN, PROP_NONE);
2188 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PART_HIDE_ADVANCED_HAIR);
2189 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2190 RNA_def_property_ui_text(prop, "Advanced", "Use full physics calculations for growing hair");
2191 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2193 prop = RNA_def_property(srna, "lock_boids_to_surface", PROP_BOOLEAN, PROP_NONE);
2194 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_BOIDS_2D);
2195 RNA_def_property_ui_text(prop, "Boids 2D", "Constrain boids to a surface");
2196 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2198 prop = RNA_def_property(srna, "use_hair_bspline", PROP_BOOLEAN, PROP_NONE);
2199 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_BSPLINE);
2200 RNA_def_property_ui_text(prop, "B-Spline", "Interpolate hair using B-Splines");
2201 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2203 prop = RNA_def_property(srna, "invert_grid", PROP_BOOLEAN, PROP_NONE);
2204 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GRID_INVERT);
2205 RNA_def_property_ui_text(prop, "Invert Grid", "Invert what is considered object and what is not");
2206 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2208 prop = RNA_def_property(srna, "hexagonal_grid", PROP_BOOLEAN, PROP_NONE);
2209 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GRID_HEXAGONAL);
2210 RNA_def_property_ui_text(prop, "Hexagonal Grid", "Create the grid in a hexagonal pattern");
2211 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2213 prop = RNA_def_property(srna, "apply_effector_to_children", PROP_BOOLEAN, PROP_NONE);
2214 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_EFFECT);
2215 RNA_def_property_ui_text(prop, "Effect Children", "Apply effectors to children");
2216 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2218 prop = RNA_def_property(srna, "create_long_hair_children", PROP_BOOLEAN, PROP_NONE);
2219 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_LONG_HAIR);
2220 RNA_def_property_ui_text(prop, "Long Hair", "Calculate children that suit long hair well");
2221 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2223 prop = RNA_def_property(srna, "apply_guide_to_children", PROP_BOOLEAN, PROP_NONE);
2224 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_GUIDE);
2225 RNA_def_property_ui_text(prop, "apply_guide_to_children", "");
2226 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2228 prop = RNA_def_property(srna, "use_self_effect", PROP_BOOLEAN, PROP_NONE);
2229 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SELF_EFFECT);
2230 RNA_def_property_ui_text(prop, "Self Effect", "Particle effectors affect themselves");
2231 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2234 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2235 RNA_def_property_enum_items(prop, type_items);
2236 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2237 RNA_def_property_ui_text(prop, "Type", "Particle Type");
2238 RNA_def_property_update(prop, 0, "rna_Particle_change_type");
2240 prop = RNA_def_property(srna, "emit_from", PROP_ENUM, PROP_NONE);
2241 RNA_def_property_enum_sdna(prop, NULL, "from");
2242 RNA_def_property_enum_items(prop, part_reactor_from_items);
2243 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2244 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_from_itemf");
2245 RNA_def_property_ui_text(prop, "Emit From", "Where to emit particles from");
2246 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2248 prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
2249 RNA_def_property_enum_sdna(prop, NULL, "distr");
2250 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2251 RNA_def_property_enum_items(prop, part_dist_items);
2252 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_dist_itemf");
2253 RNA_def_property_ui_text(prop, "Distribution", "How to distribute particles on selected element");
2254 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2257 prop = RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
2258 RNA_def_property_enum_sdna(prop, NULL, "phystype");
2259 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2260 RNA_def_property_enum_items(prop, phys_type_items);
2261 RNA_def_property_ui_text(prop, "Physics Type", "Particle physics type");
2262 RNA_def_property_update(prop, 0, "rna_Particle_change_physics_type");
2264 prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
2265 RNA_def_property_enum_sdna(prop, NULL, "rotmode");
2266 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2267 RNA_def_property_enum_items(prop, rot_mode_items);
2268 RNA_def_property_ui_text(prop, "Orientation axis",
2269 "Particle orientation axis (does not affect Explode modifier's results)");
2270 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2272 prop = RNA_def_property(srna, "angular_velocity_mode", PROP_ENUM, PROP_NONE);
2273 RNA_def_property_enum_sdna(prop, NULL, "avemode");
2274 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2275 RNA_def_property_enum_items(prop, ave_mode_items);
2276 RNA_def_property_ui_text(prop, "Angular Velocity Axis", "What axis is used to change particle rotation with time");
2277 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2279 prop = RNA_def_property(srna, "react_event", PROP_ENUM, PROP_NONE);
2280 RNA_def_property_enum_sdna(prop, NULL, "reactevent");
2281 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2282 RNA_def_property_enum_items(prop, react_event_items);
2283 RNA_def_property_ui_text(prop, "React On", "The event of target particles to react on");
2284 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2287 prop = RNA_def_property(srna, "show_guide_hairs", PROP_BOOLEAN, PROP_NONE);
2288 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_GUIDE_HAIRS);
2289 RNA_def_property_ui_text(prop, "Guide Hairs", "Show guide hairs");
2290 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2292 prop = RNA_def_property(srna, "show_hair_grid", PROP_BOOLEAN, PROP_NONE);
2293 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_HAIR_GRID);
2294 RNA_def_property_ui_text(prop, "Guide Hairs", "Show hair simulation grid");
2295 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2297 prop = RNA_def_property(srna, "show_velocity", PROP_BOOLEAN, PROP_NONE);
2298 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL);
2299 RNA_def_property_ui_text(prop, "Velocity", "Show particle velocity");
2300 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2302 prop = RNA_def_property(srna, "show_size", PROP_BOOLEAN, PROP_NONE);
2303 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_SIZE);
2304 RNA_def_property_ui_text(prop, "Size", "Show particle size");
2305 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2307 prop = RNA_def_property(srna, "show_health", PROP_BOOLEAN, PROP_NONE);
2308 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_HEALTH);
2309 RNA_def_property_ui_text(prop, "Health", "Draw boid health");
2310 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2312 prop = RNA_def_property(srna, "use_absolute_path_time", PROP_BOOLEAN, PROP_NONE);
2313 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_ABS_PATH_TIME);
2314 RNA_def_property_ui_text(prop, "Absolute Path Time", "Path timing is in absolute frames");
2315 RNA_def_property_update(prop, 0, "rna_Particle_abspathtime_update");
2317 prop = RNA_def_property(srna, "use_parent_particles", PROP_BOOLEAN, PROP_NONE);
2318 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_PARENT);
2319 RNA_def_property_ui_text(prop, "Parents", "Render parent particles");
2320 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2322 prop = RNA_def_property(srna, "show_number", PROP_BOOLEAN, PROP_NONE);
2323 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_NUM);
2324 RNA_def_property_ui_text(prop, "Number", "Show particle number");
2325 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2327 prop = RNA_def_property(srna, "use_collection_pick_random", PROP_BOOLEAN, PROP_NONE);
2328 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_RAND_GR);
2329 RNA_def_property_ui_text(prop, "Pick Random", "Pick objects from collection randomly");
2330 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2332 prop = RNA_def_property(srna, "use_collection_count", PROP_BOOLEAN, PROP_NONE);
2333 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_COUNT_GR);
2334 RNA_def_property_ui_text(prop, "Use Count", "Use object multiple times in the same collection");
2335 RNA_def_property_update(prop, 0, "rna_Particle_redo_count");
2337 prop = RNA_def_property(srna, "use_global_instance", PROP_BOOLEAN, PROP_NONE);
2338 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_GLOBAL_OB);
2339 RNA_def_property_ui_text(prop, "Global", "Use object's global coordinates for duplication");
2340 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2342 prop = RNA_def_property(srna, "use_rotation_instance", PROP_BOOLEAN, PROP_NONE);
2343 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_ROTATE_OB);
2344 RNA_def_property_ui_text(prop, "Rotation",
2345 "Use object's rotation for duplication (global x-axis is aligned "
2346 "particle rotation axis)");
2347 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2349 prop = RNA_def_property(srna, "use_scale_instance", PROP_BOOLEAN, PROP_NONE);
2350 RNA_def_property_boolean_negative_sdna(prop, NULL, "draw", PART_DRAW_NO_SCALE_OB);
2351 RNA_def_property_ui_text(prop, "Scale", "Use object's scale for duplication");
2352 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2354 prop = RNA_def_property(srna, "use_render_adaptive", PROP_BOOLEAN, PROP_NONE);
2355 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_ADAPT);
2356 RNA_def_property_ui_text(prop, "Adaptive Render", "Draw steps of the particle path");
2357 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2359 prop = RNA_def_property(srna, "use_velocity_length", PROP_BOOLEAN, PROP_NONE);
2360 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL_LENGTH);
2361 RNA_def_property_ui_text(prop, "Speed", "Multiply line length by particle speed");
2362 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2364 prop = RNA_def_property(srna, "use_whole_collection", PROP_BOOLEAN, PROP_NONE);
2365 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_WHOLE_GR);
2366 RNA_def_property_ui_text(prop, "Whole Collection", "Use whole collection at once");
2367 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2369 prop = RNA_def_property(srna, "use_strand_primitive", PROP_BOOLEAN, PROP_NONE);
2370 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_STRAND);
2371 RNA_def_property_ui_text(prop, "Strand Render", "Use the strand primitive for rendering");
2372 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2374 prop = RNA_def_property(srna, "display_method", PROP_ENUM, PROP_NONE);
2375 RNA_def_property_enum_sdna(prop, NULL, "draw_as");
2376 RNA_def_property_enum_items(prop, part_draw_as_items);
2377 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_draw_as_itemf");
2378 RNA_def_property_ui_text(prop, "Particle Drawing", "How particles are drawn in viewport");
2379 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2381 prop = RNA_def_property(srna, "render_type", PROP_ENUM, PROP_NONE);
2382 RNA_def_property_enum_sdna(prop, NULL, "ren_as");
2383 RNA_def_property_enum_items(prop, part_ren_as_items);
2384 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_ren_as_itemf");
2385 RNA_def_property_ui_text(prop, "Particle Rendering", "How particles are rendered");
2386 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2388 prop = RNA_def_property(srna, "display_color", PROP_ENUM, PROP_NONE);
2389 RNA_def_property_enum_sdna(prop, NULL, "draw_col");
2390 RNA_def_property_enum_items(prop, draw_col_items);
2391 RNA_def_property_ui_text(prop, "Draw Color", "Draw additional particle data as a color");
2392 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2394 prop = RNA_def_property(srna, "display_size", PROP_FLOAT, PROP_NONE);
2395 RNA_def_property_float_sdna(prop, NULL, "draw_size");
2396 RNA_def_property_range(prop, 0, 1000);
2397 RNA_def_property_ui_range(prop, 0, 100, 1, -1);
2398 RNA_def_property_ui_text(prop, "Draw Size", "Size of particles on viewport in BU");
2399 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2401 prop = RNA_def_property(srna, "child_type", PROP_ENUM, PROP_NONE);
2402 RNA_def_property_enum_sdna(prop, NULL, "childtype");
2403 RNA_def_property_enum_items(prop, child_type_items);
2404 RNA_def_property_ui_text(prop, "Children From", "Create child particles");
2405 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2407 prop = RNA_def_property(srna, "display_step", PROP_INT, PROP_NONE);
2408 RNA_def_property_int_sdna(prop, NULL, "draw_step");
2409 RNA_def_property_range(prop, 0, 10);
2410 RNA_def_property_ui_range(prop, 0, 7, 1, -1);
2411 RNA_def_property_ui_text(prop, "Steps", "How many steps paths are drawn with (power of 2)");
2412 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2414 prop = RNA_def_property(srna, "render_step", PROP_INT, PROP_NONE);
2415 RNA_def_property_int_sdna(prop, NULL, "ren_step");
2416 RNA_def_property_range(prop, 0, 20);
2417 RNA_def_property_ui_range(prop, 0, 9, 1, -1);
2418 RNA_def_property_ui_text(prop, "Render", "How many steps paths are rendered with (power of 2)");
2420 prop = RNA_def_property(srna, "hair_step", PROP_INT, PROP_NONE);
2421 RNA_def_property_range(prop, 2, SHRT_MAX);
2422 RNA_def_property_ui_range(prop, 2, 50, 1, 1);
2423 RNA_def_property_ui_text(prop, "Segments", "Number of hair segments");
2424 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2426 prop = RNA_def_property(srna, "bending_random", PROP_FLOAT, PROP_NONE);
2427 RNA_def_property_float_sdna(prop, NULL, "bending_random");
2428 RNA_def_property_range(prop, 0.0f, 1.0f);
2429 RNA_def_property_ui_text(prop, "Random Bending Stiffness", "Random stiffness of hairs");
2430 RNA_def_property_update(prop, 0, "rna_Particle_cloth_update");
2432 /*TODO: not found in UI, readonly? */
2433 prop = RNA_def_property(srna, "keys_step", PROP_INT, PROP_NONE);
2434 RNA_def_property_range(prop, 0, SHRT_MAX); /*TODO:min,max */
2435 RNA_def_property_ui_text(prop, "Keys Step", "");
2437 /* adaptive path rendering */
2438 prop = RNA_def_property(srna, "adaptive_angle", PROP_INT, PROP_NONE);
2439 RNA_def_property_int_sdna(prop, NULL, "adapt_angle");
2440 RNA_def_property_range(prop, 0, 45);
2441 RNA_def_property_ui_text(prop, "Degrees", "How many degrees path has to curve to make another render segment");
2443 prop = RNA_def_property(srna, "adaptive_pixel", PROP_INT, PROP_NONE);
2444 RNA_def_property_int_sdna(prop, NULL, "adapt_pix");
2445 RNA_def_property_range(prop, 0, 50);
2446 RNA_def_property_ui_text(prop, "Pixel", "How many pixels path has to cover to make another render segment");
2448 prop = RNA_def_property(srna, "display_percentage", PROP_INT, PROP_PERCENTAGE);
2449 RNA_def_property_int_sdna(prop, NULL, "disp");
2450 RNA_def_property_range(prop, 0, 100);
2451 RNA_def_property_ui_text(prop, "Display", "Percentage of particles to display in 3D view");
2452 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2454 prop = RNA_def_property(srna, "material", PROP_INT, PROP_NONE);
2455 RNA_def_property_int_sdna(prop, NULL, "omat");
2456 RNA_def_property_range(prop, 1, 32767);
2457 RNA_def_property_ui_text(prop, "Material Index", "Index of material slot used for rendering particles");
2458 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2460 prop = RNA_def_property(srna, "material_slot", PROP_ENUM, PROP_NONE);
2461 RNA_def_property_enum_sdna(prop, NULL, "omat");
2462 RNA_def_property_enum_items(prop, part_mat_items);
2463 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_Material_itemf");
2464 RNA_def_property_ui_text(prop, "Material Slot", "Material slot used for rendering particles");
2465 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2467 prop = RNA_def_property(srna, "integrator", PROP_ENUM, PROP_NONE);
2468 RNA_def_property_enum_items(prop, integrator_type_items);
2469 RNA_def_property_ui_text(prop, "Integration",
2470 "Algorithm used to calculate physics, from the fastest to the "
2471 "most stable/accurate: Midpoint, Euler, Verlet, RK4 (Old)");
2472 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2474 prop = RNA_def_property(srna, "kink", PROP_ENUM, PROP_NONE);
2475 RNA_def_property_enum_items(prop, kink_type_items);
2476 RNA_def_property_ui_text(prop, "Kink", "Type of periodic offset on the path");
2477 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2479 prop = RNA_def_property(srna, "kink_axis", PROP_ENUM, PROP_NONE);
2480 RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
2481 RNA_def_property_ui_text(prop, "Axis", "Which axis to use for offset");
2482 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2485 prop = RNA_def_property(srna, "lock_billboard", PROP_BOOLEAN, PROP_NONE);
2486 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_BB_LOCK);
2487 RNA_def_property_ui_text(prop, "Lock Billboard", "Lock the billboards align axis");
2488 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2490 prop = RNA_def_property(srna, "billboard_align", PROP_ENUM, PROP_NONE);
2491 RNA_def_property_enum_sdna(prop, NULL, "bb_align");
2492 RNA_def_property_enum_items(prop, bb_align_items);
2493 RNA_def_property_ui_text(prop, "Align to", "In respect to what the billboards are aligned");
2494 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2496 prop = RNA_def_property(srna, "billboard_uv_split", PROP_INT, PROP_NONE);
2497 RNA_def_property_int_sdna(prop, NULL, "bb_uv_split");
2498 RNA_def_property_range(prop, 1, 100);
2499 RNA_def_property_ui_range(prop, 1, 10, 1, -1);
2500 RNA_def_property_ui_text(prop, "UV Split", "Number of rows/columns to split UV coordinates for billboards");
2502 prop = RNA_def_property(srna, "billboard_animation", PROP_ENUM, PROP_NONE);
2503 RNA_def_property_enum_sdna(prop, NULL, "bb_anim");
2504 RNA_def_property_enum_items(prop, bb_anim_items);
2505 RNA_def_property_ui_text(prop, "Animate", "How to animate billboard textures");
2507 prop = RNA_def_property(srna, "billboard_offset_split", PROP_ENUM, PROP_NONE);
2508 RNA_def_property_enum_sdna(prop, NULL, "bb_split_offset");
2509 RNA_def_property_enum_items(prop, bb_split_offset_items);
2510 RNA_def_property_ui_text(prop, "Offset", "How to offset billboard textures");
2512 prop = RNA_def_property(srna, "billboard_tilt", PROP_FLOAT, PROP_NONE);
2513 RNA_def_property_float_sdna(prop, NULL, "bb_tilt");
2514 RNA_def_property_range(prop, -1.0f, 1.0f);
2515 RNA_def_property_ui_text(prop, "Tilt", "Tilt of the billboards");
2516 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2518 prop = RNA_def_property(srna, "color_maximum", PROP_FLOAT, PROP_NONE);
2519 RNA_def_property_float_sdna(prop, NULL, "color_vec_max");
2520 RNA_def_property_range(prop, 0.01f, 100.0f);
2521 RNA_def_property_ui_text(prop, "Color Maximum", "Maximum length of the particle color vector");
2522 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2524 prop = RNA_def_property(srna, "billboard_tilt_random", PROP_FLOAT, PROP_NONE);
2525 RNA_def_property_float_sdna(prop, NULL, "bb_rand_tilt");
2526 RNA_def_property_range(prop, 0.0f, 1.0f);
2527 RNA_def_property_ui_text(prop, "Random Tilt", "Random tilt of the billboards");
2528 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2530 prop = RNA_def_property(srna, "billboard_offset", PROP_FLOAT, PROP_TRANSLATION);
2531 RNA_def_property_float_sdna(prop, NULL, "bb_offset");
2532 RNA_def_property_array(prop, 2);
2533 RNA_def_property_range(prop, -100.0f, 100.0f);
2534 RNA_def_property_ui_range(prop, -1.0, 1.0, 0.1, 3);
2535 RNA_def_property_ui_text(prop, "Billboard Offset", "");
2536 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2538 prop = RNA_def_property(srna, "billboard_size", PROP_FLOAT, PROP_FACTOR);
2539 RNA_def_property_float_sdna(prop, NULL, "bb_size");
2540 RNA_def_property_array(prop, 2);
2541 RNA_def_property_range(prop, 0.001f, 10.0f);
2542 RNA_def_property_ui_text(prop, "Billboard Scale", "Scale billboards relative to particle size");
2543 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2545 prop = RNA_def_property(srna, "billboard_velocity_head", PROP_FLOAT, PROP_FACTOR);
2546 RNA_def_property_float_sdna(prop, NULL, "bb_vel_head");
2547 RNA_def_property_range(prop, 0.0f, 10.0f);
2548 RNA_def_property_ui_text(prop, "Billboard Velocity Head", "Scale billboards by velocity");
2549 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2551 prop = RNA_def_property(srna, "billboard_velocity_tail", PROP_FLOAT, PROP_FACTOR);
2552 RNA_def_property_float_sdna(prop, NULL, "bb_vel_tail");
2553 RNA_def_property_range(prop, 0.0f, 10.0f);
2554 RNA_def_property_ui_text(prop, "Billboard Velocity Tail", "Scale billboards by velocity");
2555 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2557 /* general values */
2558 prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
2559 RNA_def_property_float_sdna(prop, NULL, "sta"); /*optional if prop names are the same */
2560 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
2561 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2562 RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_start_set", NULL);
2563 RNA_def_property_ui_text(prop, "Start", "Frame number to start emitting particles");
2564 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2566 prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
2567 RNA_def_property_float_sdna(prop, NULL, "end");
2568 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
2570 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2571 RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_end_set", NULL);
2572 RNA_def_property_ui_text(prop, "End", "Frame number to stop emitting particles");
2573 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2575 prop = RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
2576 RNA_def_property_range(prop, 1.0f, MAXFRAMEF);
2577 RNA_def_property_ui_text(prop, "Lifetime", "Life span of the particles");
2578 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2580 prop = RNA_def_property(srna, "lifetime_random", PROP_FLOAT, PROP_NONE);
2581 RNA_def_property_float_sdna(prop, NULL, "randlife");
2582 RNA_def_property_range(prop, 0.0f, 1.0f);
2583 RNA_def_property_ui_text(prop, "Random", "Give the particle life a random variation");
2584 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2586 prop = RNA_def_property(srna, "time_tweak", PROP_FLOAT, PROP_NONE);
2587 RNA_def_property_float_sdna(prop, NULL, "timetweak");
2588 RNA_def_property_range(prop, 0.0f, 100.0f);
2589 RNA_def_property_ui_range(prop, 0, 10, 1, 3);
2590 RNA_def_property_ui_text(prop, "Tweak", "A multiplier for physics timestep (1.0 means one frame = 1/25 seconds)");
2591 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2593 prop = RNA_def_property(srna, "timestep", PROP_FLOAT, PROP_NONE);
2594 RNA_def_property_float_funcs(prop, "rna_PartSettings_timestep_get", "rna_PartSetings_timestep_set", NULL);
2595 RNA_def_property_range(prop, 0.0001, 100.0);
2596 RNA_def_property_ui_range(prop, 0.01, 10, 1, 3);
2597 RNA_def_property_ui_text(prop, "Timestep", "The simulation timestep per frame (seconds per frame)");
2598 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2600 prop = RNA_def_property(srna, "use_adaptive_subframes", PROP_BOOLEAN, PROP_NONE);
2601 RNA_def_property_boolean_sdna(prop, NULL, "time_flag", PART_TIME_AUTOSF);
2602 RNA_def_property_ui_text(prop, "Automatic Subframes", "Automatically set the number of subframes");
2603 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2605 prop = RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE);
2606 RNA_def_property_range(prop, 0, 1000);
2607 RNA_def_property_ui_text(prop, "Subframes",
2608 "Subframes to simulate for improved stability and finer granularity simulations "
2609 "(dt = timestep / (subframes + 1))");
2610 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2612 prop = RNA_def_property(srna, "courant_target", PROP_FLOAT, PROP_NONE);
2613 RNA_def_property_range(prop, 0.0001, 10);
2614 RNA_def_property_float_default(prop, 0.1);
2615 RNA_def_property_ui_text(prop, "Adaptive Subframe Threshold",
2616 "The relative distance a particle can move before requiring more subframes "
2617 "(target Courant number); 0.01-0.3 is the recommended range");
2618 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2620 prop = RNA_def_property(srna, "jitter_factor", PROP_FLOAT, PROP_NONE);
2621 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2622 RNA_def_property_float_sdna(prop, NULL, "jitfac");
2623 RNA_def_property_range(prop, 0.0f, 2.0f);
2624 RNA_def_property_ui_text(prop, "Amount", "Amount of jitter applied to the sampling");
2625 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2627 prop = RNA_def_property(srna, "effect_hair", PROP_FLOAT, PROP_NONE);
2628 RNA_def_property_float_sdna(prop, NULL, "eff_hair");
2629 RNA_def_property_range(prop, 0.0f, 1.0f);
2630 RNA_def_property_ui_text(prop, "Stiffness", "Hair stiffness for effectors");
2631 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2633 prop = RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
2634 RNA_def_property_int_sdna(prop, NULL, "totpart");
2635 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2636 /* This limit is for those freaks who have the machine power to handle it. */
2637 /* 10M particles take around 2.2 Gb of memory / disk space in saved file and */
2638 /* each cached frame takes around 0.5 Gb of memory / disk space depending on cache mode. */
2639 RNA_def_property_range(prop, 0, 10000000);
2640 RNA_def_property_ui_range(prop, 0, 100000, 1, -1);
2641 RNA_def_property_ui_text(prop, "Number", "Total number of particles");
2642 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2644 prop = RNA_def_property(srna, "userjit", PROP_INT, PROP_UNSIGNED); /*TODO: can we get a better name for userjit? */
2645 RNA_def_property_int_sdna(prop, NULL, "userjit");
2646 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2647 RNA_def_property_range(prop, 0, 1000);
2648 RNA_def_property_ui_text(prop, "P/F", "Emission locations / face (0 = automatic)");
2649 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2651 prop = RNA_def_property(srna, "grid_resolution", PROP_INT, PROP_UNSIGNED);
2652 RNA_def_property_int_sdna(prop, NULL, "grid_res");
2653 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2654 RNA_def_property_range(prop, 1, 250); /* ~15M particles in a cube (ouch!), but could be very usable in a plane */
2655 RNA_def_property_ui_range(prop, 1, 50, 1, -1); /* ~100k particles in a cube */
2656 RNA_def_property_ui_text(prop, "Resolution", "The resolution of the particle grid");
2657 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2659 prop = RNA_def_property(srna, "grid_random", PROP_FLOAT, PROP_NONE);
2660 RNA_def_property_float_sdna(prop, NULL, "grid_rand");
2661 RNA_def_property_range(prop, 0.0f, 1.0f);
2662 RNA_def_property_ui_text(prop, "Grid Randomness", "Add random offset to the grid locations");
2663 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2665 prop = RNA_def_property(srna, "effector_amount", PROP_INT, PROP_UNSIGNED);
2666 /* in theory PROP_ANIMATABLE perhaps should be cleared, but animating this can give some interesting results! */
2667 RNA_def_property_range(prop, 0, 10000); /* 10000 effectors will bel SLOW, but who knows */
2668 RNA_def_property_ui_range(prop, 0, 100, 1, -1);
2669 RNA_def_property_ui_text(prop, "Effector Number", "How many particles are effectors (0 is all particles)");
2670 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2672 /* initial velocity factors */
2673 prop = RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_NONE);
2674 RNA_def_property_float_sdna(prop, NULL, "normfac"); /*optional if prop names are the same */
2675 RNA_def_property_range(prop, -1000.0f, 1000.0f);
2676 RNA_def_property_ui_range(prop, 0, 100, 1, 3);
2677 RNA_def_property_ui_text(prop, "Normal", "Let the surface normal give the particle a starting velocity");
2678 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2680 prop = RNA_def_property(srna, "object_factor", PROP_FLOAT, PROP_NONE);
2681 RNA_def_property_float_sdna(prop, NULL, "obfac");
2682 RNA_def_property_range(prop, -200.0f, 200.0f);
2683 RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
2684 RNA_def_property_ui_text(prop, "Object", "Let the object give the particle a starting velocity");
2685 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2687 prop = RNA_def_property(srna, "factor_random", PROP_FLOAT, PROP_NONE);
2688 RNA_def_property_float_sdna(prop, NULL, "randfac"); /*optional if prop names are the same */
2689 RNA_def_property_range(prop, 0.0f, 200.0f);
2690 RNA_def_property_ui_range(prop, 0, 100, 1, 3);
2691 RNA_def_property_ui_text(prop, "Random", "Give the starting velocity a random variation");
2692 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2694 prop = RNA_def_property(srna, "particle_factor", PROP_FLOAT, PROP_NONE);
2695 RNA_def_property_float_sdna(prop, NULL, "partfac");
2696 RNA_def_property_range(prop, -200.0f, 200.0f);
2697 RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
2698 RNA_def_property_ui_text(prop, "Particle", "Let the target particle give the particle a starting velocity");
2699 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2701 prop = RNA_def_property(srna, "tangent_factor", PROP_FLOAT, PROP_NONE);
2702 RNA_def_property_float_sdna(prop, NULL, "tanfac");
2703 RNA_def_property_range(prop, -1000.0f, 1000.0f);
2704 RNA_def_property_ui_range(prop, -100, 100, 1, 2);
2705 RNA_def_property_ui_text(prop, "Tangent", "Let the surface tangent give the particle a starting velocity");
2706 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2708 prop = RNA_def_property(srna, "tangent_phase", PROP_FLOAT, PROP_NONE);
2709 RNA_def_property_float_sdna(prop, NULL, "tanphase");
2710 RNA_def_property_range(prop, -1.0f, 1.0f);
2711 RNA_def_property_ui_text(prop, "Rot", "Rotate the surface tangent");
2712 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2714 prop = RNA_def_property(srna, "reactor_factor", PROP_FLOAT, PROP_NONE);
2715 RNA_def_property_float_sdna(prop, NULL, "reactfac");
2716 RNA_def_property_range(prop, -10.0f, 10.0f);
2717 RNA_def_property_ui_text(prop, "Reactor",
2718 "Let the vector away from the target particle's location give the particle "
2719 "a starting velocity");
2720 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2722 prop = RNA_def_property(srna, "object_align_factor", PROP_FLOAT, PROP_VELOCITY);
2723 RNA_def_property_float_sdna(prop, NULL, "ob_vel");
2724 RNA_def_property_array(prop, 3);
2725 RNA_def_property_range(prop, -200.0f, 200.0f);
2726 RNA_def_property_ui_range(prop, -100, 100, 1, 3);
2727 RNA_def_property_ui_text(prop, "Object Aligned",
2728 "Let the emitter object orientation give the particle a starting velocity");
2729 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2731 prop = RNA_def_property(srna, "angular_velocity_factor", PROP_FLOAT, PROP_NONE);
2732 RNA_def_property_float_sdna(prop, NULL, "avefac");
2733 RNA_def_property_range(prop, -200.0f, 200.0f);
2734 RNA_def_property_ui_range(prop, -100, 100, 10, 3);
2735 RNA_def_property_ui_text(prop, "Angular Velocity", "Angular velocity amount (in radians per second)");
2736 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2738 prop = RNA_def_property(srna, "phase_factor", PROP_FLOAT, PROP_NONE);
2739 RNA_def_property_float_sdna(prop, NULL, "phasefac");
2740 RNA_def_property_range(prop, -1.0f, 1.0f);
2741 RNA_def_property_ui_text(prop, "Phase", "Rotation around the chosen orientation axis");
2742 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2744 prop = RNA_def_property(srna, "rotation_factor_random", PROP_FLOAT, PROP_NONE);
2745 RNA_def_property_float_sdna(prop, NULL, "randrotfac");
2746 RNA_def_property_range(prop, 0.0f, 1.0f);
2747 RNA_def_property_ui_text(prop, "Random Orientation", "Randomize particle orientation");
2748 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2750 prop = RNA_def_property(srna, "phase_factor_random", PROP_FLOAT, PROP_NONE);
2751 RNA_def_property_float_sdna(prop, NULL, "randphasefac");
2752 RNA_def_property_range(prop, 0.0f, 2.0f);
2753 RNA_def_property_ui_text(prop, "Random Phase", "Randomize rotation around the chosen orientation axis");
2754 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2756 prop = RNA_def_property(srna, "hair_length", PROP_FLOAT, PROP_NONE);
2757 RNA_def_property_float_funcs(prop, "rna_PartSetting_hairlength_get", "rna_PartSetting_hairlength_set", NULL);
2758 RNA_def_property_range(prop, 0.0f, 1000.0f);
2759 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
2760 RNA_def_property_ui_text(prop, "Hair Length", "Length of the hair");
2761 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2763 /* physical properties */
2764 prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
2765 RNA_def_property_range(prop, 0.00000001f, 100000.0f);
2766 RNA_def_property_ui_range(prop, 0.01, 100, 1, 3);
2767 RNA_def_property_ui_text(prop, "Mass", "Mass of the particles");
2768 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2770 prop = RNA_def_property(srna, "particle_size", PROP_FLOAT, PROP_NONE);
2771 RNA_def_property_float_sdna(prop, NULL, "size");
2772 RNA_def_property_range(prop, 0.001f, 100000.0f);
2773 RNA_def_property_ui_range(prop, 0.01, 100, 1, 3);
2774 RNA_def_property_ui_text(prop, "Size", "The size of the particles");
2775 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2777 prop = RNA_def_property(srna, "size_random", PROP_FLOAT, PROP_NONE);
2778 RNA_def_property_float_sdna(prop, NULL, "randsize");
2779 RNA_def_property_range(prop, 0.0f, 1.0f);
2780 RNA_def_property_ui_text(prop, "Random Size", "Give the particle size a random variation");
2781 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2783 prop = RNA_def_property(srna, "collision_collection", PROP_POINTER, PROP_NONE);
2784 RNA_def_property_struct_type(prop, "Collection");
2785 RNA_def_property_pointer_sdna(prop, NULL, "collision_group");
2786 RNA_def_property_flag(prop, PROP_EDITABLE);
2787 RNA_def_property_ui_text(prop, "Collision Collection", "Limit colliders to this collection");
2788 RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
2790 /* global physical properties */
2791 prop = RNA_def_property(srna, "drag_factor", PROP_FLOAT, PROP_NONE);
2792 RNA_def_property_float_sdna(prop, NULL, "dragfac");
2793 RNA_def_property_range(prop, 0.0f, 1.0f);
2794 RNA_def_property_ui_text(prop, "Drag", "Amount of air-drag");
2795 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2797 prop = RNA_def_property(srna, "brownian_factor", PROP_FLOAT, PROP_NONE);
2798 RNA_def_property_float_sdna(prop, NULL, "brownfac");
2799 RNA_def_property_range(prop, 0.0f, 200.0f);
2800 RNA_def_property_ui_range(prop, 0, 20, 1, 3);
2801 RNA_def_property_ui_text(prop, "Brownian", "Amount of random, erratic particle movement");
2802 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2804 prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
2805 RNA_def_property_float_sdna(prop, NULL, "dampfac");
2806 RNA_def_property_range(prop, 0.0f, 1.0f);
2807 RNA_def_property_ui_text(prop, "Damp", "Amount of damping");
2808 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2811 prop = RNA_def_property(srna, "length_random", PROP_FLOAT, PROP_NONE);
2812 RNA_def_property_float_sdna(prop, NULL, "randlength");
2813 RNA_def_property_range(prop, 0.0f, 1.0f);
2814 RNA_def_property_ui_text(prop, "Random Length", "Give path length a random variation");
2815 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2818 prop = RNA_def_property(srna, "child_nbr", PROP_INT, PROP_NONE);
2819 RNA_def_property_int_sdna(prop, NULL, "child_nbr"); /*optional if prop names are the same */
2820 RNA_def_property_range(prop, 0, 100000);
2821 RNA_def_property_ui_range(prop, 0, 1000, 1, -1);
2822 RNA_def_property_ui_text(prop, "Children Per Parent", "Number of children/parent");
2823 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2825 prop = RNA_def_property(srna, "rendered_child_count", PROP_INT, PROP_NONE);
2826 RNA_def_property_int_sdna(prop, NULL, "ren_child_nbr");
2827 RNA_def_property_range(prop, 0, 100000);
2828 RNA_def_property_ui_range(prop, 0, 10000, 1, -1);
2829 RNA_def_property_ui_text(prop, "Rendered Children", "Number of children/parent for rendering");
2831 prop = RNA_def_property(srna, "virtual_parents", PROP_FLOAT, PROP_NONE);
2832 RNA_def_property_float_sdna(prop, NULL, "parents");
2833 RNA_def_property_range(prop, 0.0f, 1.0f);
2834 RNA_def_property_ui_text(prop, "Virtual Parents", "Relative amount of virtual parents");
2835 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2837 prop = RNA_def_property(srna, "child_size", PROP_FLOAT, PROP_NONE);
2838 RNA_def_property_float_sdna(prop, NULL, "childsize");
2839 RNA_def_property_range(prop, 0.001f, 100000.0f);
2840 RNA_def_property_ui_range(prop, 0.01f, 100.0f, 0.1, 3);
2841 RNA_def_property_ui_text(prop, "Child Size", "A multiplier for the child particle size");
2842 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2844 prop = RNA_def_property(srna, "child_size_random", PROP_FLOAT, PROP_NONE);
2845 RNA_def_property_float_sdna(prop, NULL, "childrandsize");
2846 RNA_def_property_range(prop, 0.0f, 1.0f);
2847 RNA_def_property_ui_text(prop, "Random Child Size", "Random variation to the size of the child particles");
2848 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2850 prop = RNA_def_property(srna, "child_radius", PROP_FLOAT, PROP_NONE);
2851 RNA_def_property_float_sdna(prop, NULL, "childrad");
2852 RNA_def_property_range(prop, 0.0f, 10.0f);
2853 RNA_def_property_ui_text(prop, "Child Radius", "Radius of children around parent");
2854 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2856 prop = RNA_def_property(srna, "child_roundness", PROP_FLOAT, PROP_NONE);
2857 RNA_def_property_float_sdna(prop, NULL, "childflat");
2858 RNA_def_property_range(prop, 0.0f, 1.0f);
2859 RNA_def_property_ui_text(prop, "Child Roundness", "Roundness of children around parent");
2860 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2863 prop = RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
2864 RNA_def_property_float_sdna(prop, NULL, "clumpfac");
2865 RNA_def_property_range(prop, -1.0f, 1.0f);
2866 RNA_def_property_ui_text(prop, "Clump", "Amount of clumping");
2867 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2869 prop = RNA_def_property(srna, "clump_shape", PROP_FLOAT, PROP_NONE);
2870 RNA_def_property_float_sdna(prop, NULL, "clumppow");
2871 RNA_def_property_range(prop, -0.999f, 0.999f);
2872 RNA_def_property_ui_text(prop, "Shape", "Shape of clumping");
2873 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2875 prop = RNA_def_property(srna, "use_clump_curve", PROP_BOOLEAN, PROP_NONE);
2876 RNA_def_property_boolean_sdna(prop, NULL, "child_flag", PART_CHILD_USE_CLUMP_CURVE);
2877 RNA_def_property_ui_text(prop, "Use Clump Curve", "Use a curve to define clump tapering");
2878 RNA_def_property_update(prop, 0, "rna_ParticleSettings_use_clump_curve_update");
2880 prop = RNA_def_property(srna, "clump_curve", PROP_POINTER, PROP_NONE);
2881 RNA_def_property_pointer_sdna(prop, NULL, "clumpcurve");
2882 RNA_def_property_struct_type(prop, "CurveMapping");
2883 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2884 RNA_def_property_ui_text(prop, "Clump Curve", "Curve defining clump tapering");
2885 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2887 prop = RNA_def_property(srna, "use_clump_noise", PROP_BOOLEAN, PROP_NONE);
2888 RNA_def_property_boolean_sdna(prop, NULL, "child_flag", PART_CHILD_USE_CLUMP_NOISE);
2889 RNA_def_property_ui_text(prop, "Use Clump Noise", "Create random clumps around the parent");
2890 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2892 prop = RNA_def_property(srna, "clump_noise_size", PROP_FLOAT, PROP_NONE);
2893 RNA_def_property_float_sdna(prop, NULL, "clump_noise_size");
2894 RNA_def_property_range(prop, 0.00001f, 100000.0f);
2895 RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1f, 3);
2896 RNA_def_property_ui_text(prop, "Clump Noise Size", "Size of clump noise");
2897 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2900 prop = RNA_def_property(srna, "kink_amplitude", PROP_FLOAT, PROP_NONE);
2901 RNA_def_property_float_sdna(prop, NULL, "kink_amp");
2902 RNA_def_property_range(prop, -100000.0f, 100000.0f);
2903 RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
2904 RNA_def_property_ui_text(prop, "Amplitude", "The amplitude of the offset");
2905 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2907 prop = RNA_def_property(srna, "kink_amplitude_clump", PROP_FLOAT, PROP_NONE);
2908 RNA_def_property_float_sdna(prop, NULL, "kink_amp_clump");
2909 RNA_def_property_range(prop, 0.0f, 1.0f);
2910 RNA_def_property_ui_text(prop, "Amplitude Clump", "How much clump affects kink amplitude");
2911 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2913 prop = RNA_def_property(srna, "kink_amplitude_random", PROP_FLOAT, PROP_NONE);
2914 RNA_def_property_float_sdna(prop, NULL, "kink_amp_random");
2915 RNA_def_property_range(prop, 0.0f, 1.0f);
2916 RNA_def_property_ui_text(prop, "Amplitude Random", "Random variation of the amplitude");
2917 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2919 prop = RNA_def_property(srna, "kink_frequency", PROP_FLOAT, PROP_NONE);
2920 RNA_def_property_float_sdna(prop, NULL, "kink_freq");
2921 RNA_def_property_range(prop, -100000.0f, 100000.0f);
2922 RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
2923 RNA_def_property_ui_text(prop, "Frequency", "The frequency of the offset (1/total length)");
2924 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2926 prop = RNA_def_property(srna, "kink_shape", PROP_FLOAT, PROP_NONE);
2927 RNA_def_property_range(prop, -0.999f, 0.999f);
2928 RNA_def_property_ui_text(prop, "Shape", "Adjust the offset to the beginning/end");
2929 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2931 prop = RNA_def_property(srna, "kink_flat", PROP_FLOAT, PROP_NONE);
2932 RNA_def_property_range(prop, 0.0f, 1.0f);
2933 RNA_def_property_ui_text(prop, "Flatness", "How flat the hairs are");
2934 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2936 prop = RNA_def_property(srna, "kink_extra_steps", PROP_INT, PROP_NONE);
2937 RNA_def_property_range(prop, 1, INT_MAX);
2938 RNA_def_property_ui_range(prop, 1, 100, 1, -1);
2939 RNA_def_property_ui_text(prop, "Extra Steps", "Extra steps for resolution of special kink features");
2940 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2942 prop = RNA_def_property(srna, "kink_axis_random", PROP_FLOAT, PROP_NONE);
2943 RNA_def_property_range(prop, 0.0f, 1.0f);
2944 RNA_def_property_ui_text(prop, "Axis Random", "Random variation of the orientation");
2945 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2948 prop = RNA_def_property(srna, "roughness_1", PROP_FLOAT, PROP_NONE);
2949 RNA_def_property_float_sdna(prop, NULL, "rough1");
2950 RNA_def_property_range(prop, 0.0f, 100000.0f);
2951 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
2952 RNA_def_property_ui_text(prop, "Rough1", "Amount of location dependent rough");
2953 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2955 prop = RNA_def_property(srna, "roughness_1_size", PROP_FLOAT, PROP_NONE);
2956 RNA_def_property_float_sdna(prop, NULL, "rough1_size");
2957 RNA_def_property_range(prop, 0.01f, 100000.0f);
2958 RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3);
2959 RNA_def_property_ui_text(prop, "Size1", "Size of location dependent rough");
2960 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2962 prop = RNA_def_property(srna, "roughness_2", PROP_FLOAT, PROP_NONE);
2963 RNA_def_property_float_sdna(prop, NULL, "rough2");
2964 RNA_def_property_range(prop, 0.0f, 100000.0f);
2965 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
2966 RNA_def_property_ui_text(prop, "Rough2", "Amount of random rough");
2967 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2969 prop = RNA_def_property(srna, "roughness_2_size", PROP_FLOAT, PROP_NONE);
2970 RNA_def_property_float_sdna(prop, NULL, "rough2_size");
2971 RNA_def_property_range(prop, 0.01f, 100000.0f);
2972 RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3);
2973 RNA_def_property_ui_text(prop, "Size2", "Size of random rough");
2974 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2976 prop = RNA_def_property(srna, "roughness_2_threshold", PROP_FLOAT, PROP_NONE);
2977 RNA_def_property_float_sdna(prop, NULL, "rough2_thres");
2978 RNA_def_property_range(prop, 0.0f, 1.0f);
2979 RNA_def_property_ui_text(prop, "Threshold", "Amount of particles left untouched by random rough");
2980 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2982 prop = RNA_def_property(srna, "roughness_endpoint", PROP_FLOAT, PROP_NONE);
2983 RNA_def_property_float_sdna(prop, NULL, "rough_end");
2984 RNA_def_property_range(prop, 0.0f, 100000.0f);
2985 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
2986 RNA_def_property_ui_text(prop, "Rough Endpoint", "Amount of end point rough");
2987 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2989 prop = RNA_def_property(srna, "roughness_end_shape", PROP_FLOAT, PROP_NONE);
2990 RNA_def_property_float_sdna(prop, NULL, "rough_end_shape");
2991 RNA_def_property_range(prop, 0.0f, 10.0f);
2992 RNA_def_property_ui_text(prop, "Shape", "Shape of end point rough");
2993 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2995 prop = RNA_def_property(srna, "use_roughness_curve", PROP_BOOLEAN, PROP_NONE);
2996 RNA_def_property_boolean_sdna(prop, NULL, "child_flag", PART_CHILD_USE_ROUGH_CURVE);
2997 RNA_def_property_ui_text(prop, "Use Roughness Curve", "Use a curve to define roughness");
2998 RNA_def_property_update(prop, 0, "rna_ParticleSettings_use_roughness_curve_update");
3000 prop = RNA_def_property(srna, "roughness_curve", PROP_POINTER, PROP_NONE);
3001 RNA_def_property_pointer_sdna(prop, NULL, "roughcurve");
3002 RNA_def_property_struct_type(prop, "CurveMapping");
3003 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
3004 RNA_def_property_ui_text(prop, "Roughness Curve", "Curve defining roughness");
3005 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3007 prop = RNA_def_property(srna, "child_length", PROP_FLOAT, PROP_NONE);
3008 RNA_def_property_float_sdna(prop, NULL, "clength");
3009 RNA_def_property_range(prop, 0.0f, 1.0f);
3010 RNA_def_property_ui_text(prop, "Length", "Length of child paths");
3011 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3013 prop = RNA_def_property(srna, "child_length_threshold", PROP_FLOAT, PROP_NONE);
3014 RNA_def_property_float_sdna(prop, NULL, "clength_thres");
3015 RNA_def_property_range(prop, 0.0f, 1.0f);
3016 RNA_def_property_ui_text(prop, "Threshold", "Amount of particles left untouched by child path length");
3017 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3020 prop = RNA_def_property(srna, "child_parting_factor", PROP_FLOAT, PROP_NONE);
3021 RNA_def_property_float_sdna(prop, NULL, "parting_fac");
3022 RNA_def_property_range(prop, 0.0f, 1.0f);
3023 RNA_def_property_ui_text(prop, "Parting Factor", "Create parting in the children based on parent strands");
3024 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3026 prop = RNA_def_property(srna, "child_parting_min", PROP_FLOAT, PROP_NONE);
3027 RNA_def_property_float_sdna(prop, NULL, "parting_min");
3028 RNA_def_property_range(prop, 0.0f, 180.0f);
3029 RNA_def_property_ui_text(prop, "Parting Minimum",
3030 "Minimum root to tip angle (tip distance/root distance for long hair)");
3031 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3033 prop = RNA_def_property(srna, "child_parting_max", PROP_FLOAT, PROP_NONE);
3034 RNA_def_property_float_sdna(prop, NULL, "parting_max");
3035 RNA_def_property_range(prop, 0.0f, 180.0f);
3036 RNA_def_property_ui_text(prop, "Parting Maximum",
3037 "Maximum root to tip angle (tip distance/root distance for long hair)");
3038 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3041 prop = RNA_def_property(srna, "branch_threshold", PROP_FLOAT, PROP_NONE);
3042 RNA_def_property_float_sdna(prop, NULL, "branch_thres");
3043 RNA_def_property_range(prop, 0.0f, 1.0f);
3044 RNA_def_property_ui_text(prop, "Threshold", "Threshold of branching");
3045 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3048 prop = RNA_def_property(srna, "line_length_tail", PROP_FLOAT, PROP_NONE);
3049 RNA_def_property_float_funcs(prop, "rna_PartSetting_linelentail_get", "rna_PartSetting_linelentail_set", NULL);
3050 RNA_def_property_range(prop, 0.0f, 100000.0f);
3051 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
3052 RNA_def_property_ui_text(prop, "Tail", "Length of the line's tail");
3053 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3055 prop = RNA_def_property(srna, "line_length_head", PROP_FLOAT, PROP_NONE);
3056 RNA_def_property_float_funcs(prop, "rna_PartSetting_linelenhead_get", "rna_PartSetting_linelenhead_set", NULL);
3057 RNA_def_property_range(prop, 0.0f, 100000.0f);
3058 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
3059 RNA_def_property_ui_text(prop, "Head", "Length of the line's head");
3060 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3062 prop = RNA_def_property(srna, "path_start", PROP_FLOAT, PROP_NONE);
3063 RNA_def_property_float_sdna(prop, NULL, "path_start");
3064 RNA_def_property_float_funcs(prop, NULL, NULL, "rna_PartSetting_pathstartend_range");
3065 RNA_def_property_ui_text(prop, "Path Start", "Starting time of drawn path");
3066 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3068 prop = RNA_def_property(srna, "path_end", PROP_FLOAT, PROP_NONE);
3069 RNA_def_property_float_sdna(prop, NULL, "path_end");
3070 RNA_def_property_float_funcs(prop, NULL, NULL, "rna_PartSetting_pathstartend_range");
3071 RNA_def_property_ui_text(prop, "Path End", "End time of drawn path");
3072 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3074 prop = RNA_def_property(srna, "trail_count", PROP_INT, PROP_NONE);
3075 RNA_def_property_int_sdna(prop, NULL, "trail_count");
3076 RNA_def_property_range(prop, 1, 100000);
3077 RNA_def_property_ui_range(prop, 1, 100, 1, -1);
3078 RNA_def_property_ui_text(prop, "Trail Count", "Number of trail particles");
3079 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3081 /* keyed particles */
3082 prop = RNA_def_property(srna, "keyed_loops", PROP_INT, PROP_NONE);
3083 RNA_def_property_int_sdna(prop, NULL, "keyed_loops");
3084 RNA_def_property_range(prop, 1.0f, 10000.0f);
3085 RNA_def_property_ui_range(prop, 1.0f, 100.0f, 0.1, 3);
3086 RNA_def_property_ui_text(prop, "Loop count", "Number of times the keys are looped");
3087 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3089 /* modified dm support */
3090 prop = RNA_def_property(srna, "use_modifier_stack", PROP_BOOLEAN, PROP_NONE);
3091 RNA_def_property_boolean_sdna(prop, NULL, "use_modifier_stack", 0);
3092 RNA_def_property_ui_text(prop, "Use Modifier Stack", "Emit particles from mesh with modifiers applied "
3093 "(must use same subsurf level for viewport and render for correct results)");
3094 RNA_def_property_update(prop, 0, "rna_Particle_change_type");
3096 /* draw objects & collections */
3097 prop = RNA_def_property(srna, "instance_collection", PROP_POINTER, PROP_NONE);
3098 RNA_def_property_pointer_sdna(prop, NULL, "dup_group");
3099 RNA_def_property_struct_type(prop, "Collection");
3100 RNA_def_property_flag(prop, PROP_EDITABLE);
3101 RNA_def_property_ui_text(prop, "Dupli Collection", "Show Objects in this collection in place of particles");
3102 RNA_def_property_update(prop, 0, "rna_Particle_redo_count");
3104 prop = RNA_def_property(srna, "instance_weights", PROP_COLLECTION, PROP_NONE);
3105 RNA_def_property_collection_sdna(prop, NULL, "dupliweights", NULL);
3106 RNA_def_property_struct_type(prop, "ParticleDupliWeight");
3107 RNA_def_property_ui_text(prop, "Dupli Collection Weights", "Weights for all of the objects in the dupli collection");
3109 prop = RNA_def_property(srna, "active_instanceweight", PROP_POINTER, PROP_NONE);
3110 RNA_def_property_struct_type(prop, "ParticleDupliWeight");
3111 RNA_def_property_pointer_funcs(prop, "rna_ParticleDupliWeight_active_get", NULL, NULL, NULL);
3112 RNA_def_property_ui_text(prop, "Active Dupli Object", "");
3114 prop = RNA_def_property(srna, "active_instanceweight_index", PROP_INT, PROP_UNSIGNED);
3115 RNA_def_property_int_funcs(prop, "rna_ParticleDupliWeight_active_index_get",
3116 "rna_ParticleDupliWeight_active_index_set",
3117 "rna_ParticleDupliWeight_active_index_range");
3118 RNA_def_property_ui_text(prop, "Active Dupli Object Index", "");
3120 prop = RNA_def_property(srna, "instance_object", PROP_POINTER, PROP_NONE);
3121 RNA_def_property_pointer_sdna(prop, NULL, "dup_ob");
3122 RNA_def_property_struct_type(prop, "Object");
3123 RNA_def_property_flag(prop, PROP_EDITABLE);
3124 RNA_def_property_ui_text(prop, "Instance Object", "Show this Object in place of particles");
3125 RNA_def_property_update(prop, 0, "rna_Particle_redo_dependency");
3127 prop = RNA_def_property(srna, "billboard_object", PROP_POINTER, PROP_NONE);
3128 RNA_def_property_pointer_sdna(prop, NULL, "bb_ob");
3129 RNA_def_property_struct_type(prop, "Object");
3130 RNA_def_property_flag(prop, PROP_EDITABLE);
3131 RNA_def_property_ui_text(prop, "Billboard Object", "Billboards face this object (default is active camera)");
3132 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3135 prop = RNA_def_property(srna, "boids", PROP_POINTER, PROP_NONE);
3136 RNA_def_property_struct_type(prop, "BoidSettings");
3137 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
3138 RNA_def_property_ui_text(prop, "Boid Settings", "");
3140 /* Fluid particles */
3141 prop = RNA_def_property(srna, "fluid", PROP_POINTER, PROP_NONE);
3142 RNA_def_property_struct_type(prop, "SPHFluidSettings");
3143 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
3144 RNA_def_property_ui_text(prop, "SPH Fluid Settings", "");
3146 /* Effector weights */
3147 prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
3148 RNA_def_property_struct_type(prop, "EffectorWeights");
3149 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
3150 RNA_def_property_ui_text(prop, "Effector Weights", "");
3152 /* animation here? */
3153 rna_def_animdata_common(srna);
3155 prop = RNA_def_property(srna, "force_field_1", PROP_POINTER, PROP_NONE);
3156 RNA_def_property_pointer_sdna(prop, NULL, "pd");
3157 RNA_def_property_struct_type(prop, "FieldSettings");
3158 RNA_def_property_pointer_funcs(prop, "rna_Particle_field1_get", NULL, NULL, NULL);
3159 RNA_def_property_ui_text(prop, "Force Field 1", "");
3161 prop = RNA_def_property(srna, "force_field_2", PROP_POINTER, PROP_NONE);