2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version 2
5 * of the License, or (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software Foundation,
14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * Copyright 2011 AutoCRC
19 /** \file \ingroup RNA
26 #include "DNA_material_types.h"
27 #include "DNA_mesh_types.h"
28 #include "DNA_meshdata_types.h"
29 #include "DNA_modifier_types.h"
30 #include "DNA_cloth_types.h"
31 #include "DNA_particle_types.h"
32 #include "DNA_object_force_types.h"
33 #include "DNA_object_types.h"
34 #include "DNA_scene_types.h"
35 #include "DNA_boid_types.h"
36 #include "DNA_texture_types.h"
38 #include "RNA_define.h"
39 #include "RNA_enum_types.h"
44 #include "BLT_translation.h"
46 #include "rna_internal.h"
52 static const EnumPropertyItem part_from_items[] = {
53 {PART_FROM_VERT, "VERT", 0, "Verts", ""},
54 {PART_FROM_FACE, "FACE", 0, "Faces", ""},
55 {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
56 {0, NULL, 0, NULL, NULL},
61 static const EnumPropertyItem part_reactor_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},
69 static const EnumPropertyItem part_dist_items[] = {
70 {PART_DISTR_JIT, "JIT", 0, "Jittered", ""},
71 {PART_DISTR_RAND, "RAND", 0, "Random", ""},
72 {PART_DISTR_GRID, "GRID", 0, "Grid", ""},
73 {0, NULL, 0, NULL, NULL},
77 static const EnumPropertyItem part_hair_dist_items[] = {
78 {PART_DISTR_JIT, "JIT", 0, "Jittered", ""},
79 {PART_DISTR_RAND, "RAND", 0, "Random", ""},
80 {0, NULL, 0, NULL, NULL},
84 static const EnumPropertyItem part_draw_as_items[] = {
85 {PART_DRAW_NOT, "NONE", 0, "None", ""},
86 {PART_DRAW_REND, "RENDER", 0, "Rendered", ""},
87 {PART_DRAW_DOT, "DOT", 0, "Point", ""},
88 {PART_DRAW_CIRC, "CIRC", 0, "Circle", ""},
89 {PART_DRAW_CROSS, "CROSS", 0, "Cross", ""},
90 {PART_DRAW_AXIS, "AXIS", 0, "Axis", ""},
91 {0, NULL, 0, NULL, NULL},
95 static const EnumPropertyItem part_hair_draw_as_items[] = {
96 {PART_DRAW_NOT, "NONE", 0, "None", ""},
97 {PART_DRAW_REND, "RENDER", 0, "Rendered", ""},
98 {PART_DRAW_PATH, "PATH", 0, "Path", ""},
99 {0, NULL, 0, NULL, NULL},
103 static const EnumPropertyItem part_ren_as_items[] = {
104 {PART_DRAW_NOT, "NONE", 0, "None", ""},
105 {PART_DRAW_HALO, "HALO", 0, "Halo", ""},
106 {PART_DRAW_LINE, "LINE", 0, "Line", ""},
107 {PART_DRAW_PATH, "PATH", 0, "Path", ""},
108 {PART_DRAW_OB, "OBJECT", 0, "Object", ""},
109 {PART_DRAW_GR, "COLLECTION", 0, "Collection", ""},
110 {PART_DRAW_BB, "BILLBOARD", 0, "Billboard", ""},
111 {0, NULL, 0, NULL, NULL},
115 static const EnumPropertyItem part_hair_ren_as_items[] = {
116 {PART_DRAW_NOT, "NONE", 0, "None", ""},
117 {PART_DRAW_PATH, "PATH", 0, "Path", ""},
118 {PART_DRAW_OB, "OBJECT", 0, "Object", ""},
119 {PART_DRAW_GR, "COLLECTION", 0, "Collection", ""},
120 {0, NULL, 0, NULL, NULL},
126 #include "BLI_math.h"
127 #include "BLI_string_utils.h"
129 #include "BKE_boids.h"
130 #include "BKE_context.h"
131 #include "BKE_cloth.h"
132 #include "BKE_colortools.h"
133 #include "BKE_deform.h"
134 #include "BKE_effect.h"
135 #include "BKE_material.h"
136 #include "BKE_modifier.h"
137 #include "BKE_particle.h"
138 #include "BKE_pointcache.h"
139 #include "BKE_texture.h"
141 #include "DEG_depsgraph.h"
142 #include "DEG_depsgraph_build.h"
144 /* use for object space hair get/set */
145 static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, ParticleSystemModifierData **psmd_pt,
146 ParticleData **pa_pt)
148 HairKey *hkey = (HairKey *)ptr->data;
149 Object *ob = (Object *)ptr->id.data;
151 ParticleSystemModifierData *psmd = NULL;
152 ParticleSystem *psys;
159 /* given the pointer HairKey *hkey, we iterate over all particles in all
160 * particle systems in the object "ob" in order to find
161 * - the ParticleSystemData to which the HairKey (and hence the particle)
162 * belongs (will be stored in psmd_pt)
163 * - the ParticleData to which the HairKey belongs (will be stored in pa_pt)
165 * not a very efficient way of getting hair key location data,
166 * but it's the best we've got at the present
168 * IDEAS: include additional information in pointerRNA beforehand,
169 * for example a pointer to the ParticleStstemModifierData to which the
173 for (md = ob->modifiers.first; md; md = md->next) {
174 if (md->type == eModifierType_ParticleSystem) {
175 psmd = (ParticleSystemModifierData *) md;
176 if (psmd && psmd->mesh_final && psmd->psys) {
178 for (i = 0, pa = psys->particles; i < psys->totpart; i++, pa++) {
179 /* hairkeys are stored sequentially in memory, so we can
180 * find if it's the same particle by comparing pointers,
181 * without having to iterate over them all */
182 if ((hkey >= pa->hair) && (hkey < pa->hair + pa->totkey)) {
193 static void rna_ParticleHairKey_location_object_get(PointerRNA *ptr, float *values)
195 HairKey *hkey = (HairKey *)ptr->data;
196 Object *ob = (Object *)ptr->id.data;
197 ParticleSystemModifierData *psmd;
200 rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
203 Mesh *hair_mesh = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_mesh : NULL;
206 MVert *mvert = &hair_mesh->mvert[pa->hair_index + (hkey - pa->hair)];
207 copy_v3_v3(values, mvert->co);
211 psys_mat_hair_to_object(ob, psmd->mesh_final, psmd->psys->part->from, pa, hairmat);
212 copy_v3_v3(values, hkey->co);
213 mul_m4_v3(hairmat, values);
221 static void rna_ParticleHairKey_location_object_set(PointerRNA *ptr, const float *values)
223 HairKey *hkey = (HairKey *)ptr->data;
224 Object *ob = (Object *)ptr->id.data;
225 ParticleSystemModifierData *psmd;
228 rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
231 Mesh *hair_mesh = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_mesh : NULL;
234 MVert *mvert = &hair_mesh->mvert[pa->hair_index + (hkey - pa->hair)];
235 copy_v3_v3(mvert->co, values);
241 psys_mat_hair_to_object(ob, psmd->mesh_final, psmd->psys->part->from, pa, hairmat);
242 invert_m4_m4(imat, hairmat);
243 copy_v3_v3(hkey->co, values);
244 mul_m4_v3(imat, hkey->co);
252 static void rna_ParticleHairKey_co_object(HairKey *hairkey, Object *object, ParticleSystemModifierData *modifier, ParticleData *particle,
256 Mesh *hair_mesh = (modifier->psys->flag & PSYS_HAIR_DYNAMICS) ? modifier->psys->hair_out_mesh : NULL;
259 MVert *mvert = &hair_mesh->mvert[particle->hair_index + (hairkey - particle->hair)];
260 copy_v3_v3(n_co, mvert->co);
264 psys_mat_hair_to_object(object, modifier->mesh_final, modifier->psys->part->from, particle, hairmat);
265 copy_v3_v3(n_co, hairkey->co);
266 mul_m4_v3(hairmat, n_co);
274 static void rna_Particle_uv_on_emitter(ParticleData *particle, ReportList *reports,
275 ParticleSystemModifierData *modifier, float r_uv[2])
277 /*psys_particle_on_emitter(psmd, part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co, nor, 0, 0, sd.orco, 0);*/
279 /* get uvco & mcol */
280 int num = particle->num_dmcache;
281 int from = modifier->psys->part->from;
283 if (!CustomData_has_layer(&modifier->mesh_final->ldata, CD_MLOOPUV)) {
284 BKE_report(reports, RPT_ERROR, "Mesh has no UV data");
287 BKE_mesh_tessface_ensure(modifier->mesh_final); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
289 if (num == DMCACHE_NOTFOUND)
290 if (particle->num < modifier->mesh_final->totface)
294 if (r_uv && ELEM(from, PART_FROM_FACE, PART_FROM_VOLUME)) {
296 if (num != DMCACHE_NOTFOUND) {
300 mface = modifier->mesh_final->mface;
301 mtface = modifier->mesh_final->mtface;
303 if (mface && mtface) {
305 psys_interpolate_uvs(mtface, mface->v4, particle->fuv, r_uv);
315 static void rna_ParticleSystem_co_hair(ParticleSystem *particlesystem, Object *object,
316 int particle_no, int step, float n_co[3])
318 ParticleSettings *part = NULL;
319 ParticleData *pars = NULL;
320 ParticleCacheKey *cache = NULL;
325 if (particlesystem == NULL)
328 part = particlesystem->part;
329 pars = particlesystem->particles;
330 totpart = particlesystem->totcached;
331 totchild = particlesystem->totchildcache;
333 if (part == NULL || pars == NULL)
336 if (part->ren_as == PART_DRAW_OB || part->ren_as == PART_DRAW_GR || part->ren_as == PART_DRAW_NOT)
339 /* can happen for disconnected/global hair */
340 if (part->type == PART_HAIR && !particlesystem->childcache)
343 if (particle_no < totpart) {
344 cache = particlesystem->pathcache[particle_no];
345 max_k = (int)cache->segments;
347 else if (particle_no < totpart + totchild) {
348 cache = particlesystem->childcache[particle_no - totpart];
350 if (cache->segments < 0)
353 max_k = (int)cache->segments;
359 /* Strands key loop data stored in cache + step->co. */
360 if (step >= 0 && step <= max_k) {
361 copy_v3_v3(n_co, (cache + step)->co);
362 mul_m4_v3(particlesystem->imat, n_co);
363 mul_m4_v3(object->obmat, n_co);
368 static const EnumPropertyItem *rna_Particle_Material_itemf(
369 bContext *C, PointerRNA *UNUSED(ptr),
370 PropertyRNA *UNUSED(prop), bool *r_free)
372 Object *ob = CTX_data_pointer_get(C, "object").data;
374 EnumPropertyItem *item = NULL;
375 EnumPropertyItem tmp = {0, "", 0, "", ""};
379 if (ob && ob->totcol > 0) {
380 for (i = 1; i <= ob->totcol; i++) {
381 ma = give_current_material(ob, i);
383 tmp.icon = ICON_MATERIAL_DATA;
385 tmp.name = ma->id.name + 2;
386 tmp.identifier = tmp.name;
389 tmp.name = "Default Material";
390 tmp.identifier = tmp.name;
392 RNA_enum_item_add(&item, &totitem, &tmp);
397 tmp.icon = ICON_MATERIAL_DATA;
398 tmp.name = "Default Material";
399 tmp.identifier = tmp.name;
400 RNA_enum_item_add(&item, &totitem, &tmp);
403 RNA_enum_item_end(&item, &totitem);
409 /* return < 0 means invalid (no matching tessellated face could be found). */
410 static int rna_ParticleSystem_tessfaceidx_on_emitter(ParticleSystem *particlesystem,
411 ParticleSystemModifierData *modifier, ParticleData *particle,
412 int particle_no, float (**r_fuv)[4])
414 ParticleSettings *part = NULL;
421 BKE_mesh_tessface_ensure(modifier->mesh_final); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
422 totface = modifier->mesh_final->totface;
423 totvert = modifier->mesh_final->totvert;
425 /* 1. check that everything is ok & updated */
426 if (!particlesystem || !totface) {
430 part = particlesystem->part;
431 totpart = particlesystem->totcached;
432 totchild = particlesystem->totchildcache;
434 /* can happen for disconnected/global hair */
435 if (part->type == PART_HAIR && !particlesystem->childcache)
438 if (particle_no >= totpart + totchild)
441 /* 2. get matching face index. */
442 if (particle_no < totpart) {
443 num = (ELEM(particle->num_dmcache, DMCACHE_ISCHILD, DMCACHE_NOTFOUND)) ? particle->num : particle->num_dmcache;
445 if (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME)) {
446 if (num != DMCACHE_NOTFOUND && num < totface) {
447 *r_fuv = &particle->fuv;
451 else if (part->from == PART_FROM_VERT) {
452 if (num != DMCACHE_NOTFOUND && num < totvert) {
453 MFace *mface = modifier->mesh_final->mface;
455 *r_fuv = &particle->fuv;
457 /* This finds the first face to contain the emitting vertex,
458 * this is not ideal, but is mostly fine as UV seams generally
459 * map to equal-colored parts of a texture */
460 for (int i = 0; i < totface; i++, mface++) {
461 if (ELEM(num, mface->v1, mface->v2, mface->v3, mface->v4)) {
469 ChildParticle *cpa = particlesystem->child + particle_no - totpart;
472 if (part->childtype == PART_CHILD_FACES) {
473 if (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME, PART_FROM_VERT)) {
474 if (num != DMCACHE_NOTFOUND && num < totface) {
481 ParticleData *parent = particlesystem->particles + cpa->parent;
482 num = parent->num_dmcache;
484 if (num == DMCACHE_NOTFOUND)
487 if (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME)) {
488 if (num != DMCACHE_NOTFOUND && num < totface) {
489 *r_fuv = &parent->fuv;
493 else if (part->from == PART_FROM_VERT) {
494 if (num != DMCACHE_NOTFOUND && num < totvert) {
495 MFace *mface = modifier->mesh_final->mface;
497 *r_fuv = &parent->fuv;
499 /* This finds the first face to contain the emitting vertex,
500 * this is not ideal, but is mostly fine as UV seams generally
501 * map to equal-colored parts of a texture */
502 for (int i = 0; i < totface; i++, mface++) {
503 if (ELEM(num, mface->v1, mface->v2, mface->v3, mface->v4)) {
515 static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem, ReportList *reports,
516 ParticleSystemModifierData *modifier, ParticleData *particle,
517 int particle_no, int uv_no, float r_uv[2])
519 if (!CustomData_has_layer(&modifier->mesh_final->ldata, CD_MLOOPUV)) {
520 BKE_report(reports, RPT_ERROR, "Mesh has no UV data");
527 /* Note all sanity checks are done in this helper func. */
528 const int num = rna_ParticleSystem_tessfaceidx_on_emitter(particlesystem, modifier, particle,
532 /* No matching face found. */
536 MFace *mface = &modifier->mesh_final->mface[num];
537 MTFace *mtface = (MTFace *)CustomData_get_layer_n(&modifier->mesh_final->fdata, CD_MTFACE, uv_no);
539 psys_interpolate_uvs(&mtface[num], mface->v4, *fuv, r_uv);
544 static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem, ReportList *reports,
545 ParticleSystemModifierData *modifier, ParticleData *particle,
546 int particle_no, int vcol_no, float r_mcol[3])
548 if (!CustomData_has_layer(&modifier->mesh_final->ldata, CD_MLOOPCOL)) {
549 BKE_report(reports, RPT_ERROR, "Mesh has no VCol data");
556 /* Note all sanity checks are done in this helper func. */
557 const int num = rna_ParticleSystem_tessfaceidx_on_emitter(particlesystem, modifier, particle,
561 /* No matching face found. */
565 MFace *mface = &modifier->mesh_final->mface[num];
566 MCol *mc = (MCol *)CustomData_get_layer_n(&modifier->mesh_final->fdata, CD_MCOL, vcol_no);
569 psys_interpolate_mcol(&mc[num * 4], mface->v4, *fuv, &mcol);
570 r_mcol[0] = (float)mcol.b / 255.0f;
571 r_mcol[1] = (float)mcol.g / 255.0f;
572 r_mcol[2] = (float)mcol.r / 255.0f;
577 static void particle_recalc(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr, short flag)
579 if (ptr->type == &RNA_ParticleSystem) {
580 Object *ob = ptr->id.data;
581 ParticleSystem *psys = (ParticleSystem *)ptr->data;
585 DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
588 DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY | flag);
590 WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
592 static void rna_Particle_redo(Main *bmain, Scene *scene, PointerRNA *ptr)
594 particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_REDO);
597 static void rna_Particle_redo_dependency(Main *bmain, Scene *scene, PointerRNA *ptr)
599 DEG_relations_tag_update(bmain);
600 rna_Particle_redo(bmain, scene, ptr);
603 static void rna_Particle_redo_count(Main *bmain, Scene *scene, PointerRNA *ptr)
605 ParticleSettings *part = (ParticleSettings *)ptr->data;
606 DEG_relations_tag_update(bmain);
607 psys_check_group_weights(part);
608 particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_REDO);
611 static void rna_Particle_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
613 particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_RESET);
616 static void rna_Particle_reset_dependency(Main *bmain, Scene *scene, PointerRNA *ptr)
618 DEG_relations_tag_update(bmain);
619 rna_Particle_reset(bmain, scene, ptr);
622 static void rna_Particle_change_type(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
624 ParticleSettings *part = ptr->id.data;
626 /* Iterating over all object is slow, but no better solution exists at the moment. */
627 for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
628 for (ParticleSystem *psys = ob->particlesystem.first; psys; psys = psys->next) {
629 if (psys->part == part) {
630 psys_changed_type(ob, psys);
631 psys->recalc |= ID_RECALC_PSYS_RESET;
632 DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
637 WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
638 DEG_relations_tag_update(bmain);
641 static void rna_Particle_change_physics_type(Main *bmain, Scene *scene, PointerRNA *ptr)
643 particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_RESET | ID_RECALC_PSYS_PHYS);
645 ParticleSettings *part = (ParticleSettings *)ptr->data;
647 if (part->phystype == PART_PHYS_BOIDS && part->boids == NULL) {
650 part->boids = MEM_callocN(sizeof(BoidSettings), "Boid Settings");
651 boid_default_settings(part->boids);
653 state = boid_new_state(part->boids);
654 BLI_addtail(&state->rules, boid_new_rule(eBoidRuleType_Separate));
655 BLI_addtail(&state->rules, boid_new_rule(eBoidRuleType_Flock));
657 ((BoidRule *)state->rules.first)->flag |= BOIDRULE_CURRENT;
659 state->flag |= BOIDSTATE_CURRENT;
660 BLI_addtail(&part->boids->states, state);
662 else if (part->phystype == PART_PHYS_FLUID && part->fluid == NULL) {
663 part->fluid = MEM_callocN(sizeof(SPHFluidSettings), "SPH Fluid Settings");
664 BKE_particlesettings_fluid_default_settings(part);
667 DEG_relations_tag_update(bmain);
670 static void rna_Particle_redo_child(Main *bmain, Scene *scene, PointerRNA *ptr)
672 particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_CHILD);
675 static void rna_Particle_cloth_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
677 Object *ob = (Object *)ptr->id.data;
679 DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
680 WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
684 static ParticleSystem *rna_particle_system_for_target(Object *ob, ParticleTarget *target)
686 ParticleSystem *psys;
689 for (psys = ob->particlesystem.first; psys; psys = psys->next)
690 for (pt = psys->targets.first; pt; pt = pt->next)
697 static void rna_Particle_target_reset(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
699 if (ptr->type == &RNA_ParticleTarget) {
700 Object *ob = (Object *)ptr->id.data;
701 ParticleTarget *pt = (ParticleTarget *)ptr->data;
702 ParticleSystem *kpsys = NULL, *psys = rna_particle_system_for_target(ob, pt);
704 if (pt->ob == ob || pt->ob == NULL) {
705 kpsys = BLI_findlink(&ob->particlesystem, pt->psys - 1);
708 pt->flag |= PTARGET_VALID;
710 pt->flag &= ~PTARGET_VALID;
714 kpsys = BLI_findlink(&pt->ob->particlesystem, pt->psys - 1);
717 pt->flag |= PTARGET_VALID;
719 pt->flag &= ~PTARGET_VALID;
722 psys->recalc = ID_RECALC_PSYS_RESET;
724 DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
725 DEG_relations_tag_update(bmain);
728 WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
731 static void rna_Particle_target_redo(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
733 if (ptr->type == &RNA_ParticleTarget) {
734 Object *ob = (Object *)ptr->id.data;
735 ParticleTarget *pt = (ParticleTarget *)ptr->data;
736 ParticleSystem *psys = rna_particle_system_for_target(ob, pt);
738 psys->recalc = ID_RECALC_PSYS_REDO;
740 DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
741 WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
745 static void rna_Particle_hair_dynamics_update(Main *bmain, Scene *scene, PointerRNA *ptr)
747 Object *ob = (Object *)ptr->id.data;
748 ParticleSystem *psys = (ParticleSystem *)ptr->data;
750 if (psys && !psys->clmd) {
751 psys->clmd = (ClothModifierData *)modifier_new(eModifierType_Cloth);
752 psys->clmd->sim_parms->goalspring = 0.0f;
753 psys->clmd->sim_parms->flags |= CLOTH_SIMSETTINGS_FLAG_RESIST_SPRING_COMPRESS;
754 psys->clmd->coll_parms->flags &= ~CLOTH_COLLSETTINGS_FLAG_SELF;
755 rna_Particle_redo(bmain, scene, ptr);
758 WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
761 DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
762 DEG_relations_tag_update(bmain);
765 static PointerRNA rna_particle_settings_get(PointerRNA *ptr)
767 ParticleSystem *psys = (ParticleSystem *)ptr->data;
768 ParticleSettings *part = psys->part;
770 return rna_pointer_inherit_refine(ptr, &RNA_ParticleSettings, part);
773 static void rna_particle_settings_set(PointerRNA *ptr, PointerRNA value)
775 Object *ob = ptr->id.data;
776 ParticleSystem *psys = (ParticleSystem *)ptr->data;
781 old_type = psys->part->type;
782 id_us_min(&psys->part->id);
785 psys->part = (ParticleSettings *)value.data;
788 id_us_plus(&psys->part->id);
789 psys_check_boid_data(psys);
790 if (old_type != psys->part->type) {
791 psys_changed_type(ob, psys);
795 static void rna_Particle_abspathtime_update(Main *bmain, Scene *scene, PointerRNA *ptr)
797 ParticleSettings *settings = (ParticleSettings *)ptr->data;
798 float delta = settings->end + settings->lifetime - settings->sta;
799 if (settings->draw & PART_ABS_PATH_TIME) {
800 settings->path_start = settings->sta + settings->path_start * delta;
801 settings->path_end = settings->sta + settings->path_end * delta;
804 settings->path_start = (settings->path_start - settings->sta) / delta;
805 settings->path_end = (settings->path_end - settings->sta) / delta;
807 rna_Particle_redo(bmain, scene, ptr);
809 static void rna_PartSettings_start_set(struct PointerRNA *ptr, float value)
811 ParticleSettings *settings = (ParticleSettings *)ptr->data;
813 /* check for clipping */
814 if (value > settings->end)
815 value = settings->end;
817 /*if (settings->type==PART_REACTOR && value < 1.0) */
820 if (value < MINAFRAMEF)
823 settings->sta = value;
826 static void rna_PartSettings_end_set(struct PointerRNA *ptr, float value)
828 ParticleSettings *settings = (ParticleSettings *)ptr->data;
830 /* check for clipping */
831 if (value < settings->sta)
832 value = settings->sta;
834 settings->end = value;
837 static void rna_PartSetings_timestep_set(struct PointerRNA *ptr, float value)
839 ParticleSettings *settings = (ParticleSettings *)ptr->data;
841 settings->timetweak = value / 0.04f;
844 static float rna_PartSettings_timestep_get(struct PointerRNA *ptr)
846 ParticleSettings *settings = (ParticleSettings *)ptr->data;
848 return settings->timetweak * 0.04f;
851 static void rna_PartSetting_hairlength_set(struct PointerRNA *ptr, float value)
853 ParticleSettings *settings = (ParticleSettings *)ptr->data;
854 settings->normfac = value / 4.f;
857 static float rna_PartSetting_hairlength_get(struct PointerRNA *ptr)
859 ParticleSettings *settings = (ParticleSettings *)ptr->data;
860 return settings->normfac * 4.f;
863 static void rna_PartSetting_linelentail_set(struct PointerRNA *ptr, float value)
865 ParticleSettings *settings = (ParticleSettings *)ptr->data;
866 settings->draw_line[0] = value;
869 static float rna_PartSetting_linelentail_get(struct PointerRNA *ptr)
871 ParticleSettings *settings = (ParticleSettings *)ptr->data;
872 return settings->draw_line[0];
874 static void rna_PartSetting_pathstartend_range(PointerRNA *ptr, float *min, float *max,
875 float *UNUSED(softmin), float *UNUSED(softmax))
877 ParticleSettings *settings = (ParticleSettings *)ptr->data;
879 if (settings->type == PART_HAIR) {
881 *max = (settings->draw & PART_ABS_PATH_TIME) ? 100.0f : 1.0f;
884 *min = (settings->draw & PART_ABS_PATH_TIME) ? settings->sta : 0.0f;
885 *max = (settings->draw & PART_ABS_PATH_TIME) ? MAXFRAMEF : 1.0f;
888 static void rna_PartSetting_linelenhead_set(struct PointerRNA *ptr, float value)
890 ParticleSettings *settings = (ParticleSettings *)ptr->data;
891 settings->draw_line[1] = value;
894 static float rna_PartSetting_linelenhead_get(struct PointerRNA *ptr)
896 ParticleSettings *settings = (ParticleSettings *)ptr->data;
897 return settings->draw_line[1];
901 static bool rna_PartSettings_is_fluid_get(PointerRNA *ptr)
903 ParticleSettings *part = (ParticleSettings *)ptr->data;
905 return part->type == PART_FLUID;
908 static void rna_ParticleSettings_use_clump_curve_update(Main *bmain, Scene *scene, PointerRNA *ptr)
910 ParticleSettings *part = ptr->data;
912 if (part->child_flag & PART_CHILD_USE_CLUMP_CURVE) {
913 if (!part->clumpcurve) {
914 BKE_particlesettings_clump_curve_init(part);
918 rna_Particle_redo_child(bmain, scene, ptr);
921 static void rna_ParticleSettings_use_roughness_curve_update(Main *bmain, Scene *scene, PointerRNA *ptr)
923 ParticleSettings *part = ptr->data;
925 if (part->child_flag & PART_CHILD_USE_ROUGH_CURVE) {
926 if (!part->roughcurve) {
927 BKE_particlesettings_rough_curve_init(part);
931 rna_Particle_redo_child(bmain, scene, ptr);
934 static void rna_ParticleSettings_use_twist_curve_update(Main *bmain, Scene *scene, PointerRNA *ptr)
936 ParticleSettings *part = ptr->data;
938 if (part->child_flag & PART_CHILD_USE_TWIST_CURVE) {
939 if (!part->twistcurve) {
940 BKE_particlesettings_twist_curve_init(part);
944 rna_Particle_redo_child(bmain, scene, ptr);
947 static void rna_ParticleSystem_name_set(PointerRNA *ptr, const char *value)
949 Object *ob = ptr->id.data;
950 ParticleSystem *part = (ParticleSystem *)ptr->data;
952 /* copy the new name into the name slot */
953 BLI_strncpy_utf8(part->name, value, sizeof(part->name));
955 BLI_uniquename(&ob->particlesystem, part, DATA_("ParticleSystem"), '.', offsetof(ParticleSystem, name),
959 static PointerRNA rna_ParticleSystem_active_particle_target_get(PointerRNA *ptr)
961 ParticleSystem *psys = (ParticleSystem *)ptr->data;
962 ParticleTarget *pt = psys->targets.first;
964 for (; pt; pt = pt->next) {
965 if (pt->flag & PTARGET_CURRENT)
966 return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, pt);
968 return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, NULL);
970 static void rna_ParticleSystem_active_particle_target_index_range(PointerRNA *ptr, int *min, int *max,
971 int *UNUSED(softmin), int *UNUSED(softmax))
973 ParticleSystem *psys = (ParticleSystem *)ptr->data;
975 *max = max_ii(0, BLI_listbase_count(&psys->targets) - 1);
978 static int rna_ParticleSystem_active_particle_target_index_get(PointerRNA *ptr)
980 ParticleSystem *psys = (ParticleSystem *)ptr->data;
981 ParticleTarget *pt = psys->targets.first;
984 for (; pt; pt = pt->next, i++)
985 if (pt->flag & PTARGET_CURRENT)
991 static void rna_ParticleSystem_active_particle_target_index_set(struct PointerRNA *ptr, int value)
993 ParticleSystem *psys = (ParticleSystem *)ptr->data;
994 ParticleTarget *pt = psys->targets.first;
997 for (; pt; pt = pt->next, i++) {
999 pt->flag |= PTARGET_CURRENT;
1001 pt->flag &= ~PTARGET_CURRENT;
1005 static void rna_ParticleTarget_name_get(PointerRNA *ptr, char *str)
1007 ParticleTarget *pt = ptr->data;
1009 if (pt->flag & PTARGET_VALID) {
1010 ParticleSystem *psys = NULL;
1013 psys = BLI_findlink(&pt->ob->particlesystem, pt->psys - 1);
1015 Object *ob = (Object *) ptr->id.data;
1016 psys = BLI_findlink(&ob->particlesystem, pt->psys - 1);
1021 sprintf(str, "%s: %s", pt->ob->id.name + 2, psys->name);
1023 strcpy(str, psys->name);
1026 strcpy(str, "Invalid target!");
1029 strcpy(str, "Invalid target!");
1032 static int rna_ParticleTarget_name_length(PointerRNA *ptr)
1034 char tstr[MAX_ID_NAME + MAX_ID_NAME + 64];
1036 rna_ParticleTarget_name_get(ptr, tstr);
1038 return strlen(tstr);
1041 static int particle_id_check(PointerRNA *ptr)
1043 ID *id = ptr->id.data;
1045 return (GS(id->name) == ID_PA);
1048 static char *rna_SPHFluidSettings_path(PointerRNA *ptr)
1050 SPHFluidSettings *fluid = (SPHFluidSettings *)ptr->data;
1052 if (particle_id_check(ptr)) {
1053 ParticleSettings *part = (ParticleSettings *)ptr->id.data;
1055 if (part->fluid == fluid)
1056 return BLI_sprintfN("fluid");
1061 static bool rna_ParticleSystem_multiple_caches_get(PointerRNA *ptr)
1063 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1065 return (psys->ptcaches.first != psys->ptcaches.last);
1067 static bool rna_ParticleSystem_editable_get(PointerRNA *ptr)
1069 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1071 return psys_check_edited(psys);
1073 static bool rna_ParticleSystem_edited_get(PointerRNA *ptr)
1075 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1077 if (psys->part && psys->part->type == PART_HAIR)
1078 return (psys->flag & PSYS_EDITED || (psys->edit && psys->edit->edited));
1080 return (psys->pointcache->edit && psys->pointcache->edit->edited);
1082 static PointerRNA rna_ParticleDupliWeight_active_get(PointerRNA *ptr)
1084 ParticleSettings *part = (ParticleSettings *)ptr->id.data;
1085 ParticleDupliWeight *dw = part->dupliweights.first;
1087 for (; dw; dw = dw->next) {
1088 if (dw->flag & PART_DUPLIW_CURRENT)
1089 return rna_pointer_inherit_refine(ptr, &RNA_ParticleDupliWeight, dw);
1091 return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, NULL);
1093 static void rna_ParticleDupliWeight_active_index_range(PointerRNA *ptr, int *min, int *max,
1094 int *UNUSED(softmin), int *UNUSED(softmax))
1096 ParticleSettings *part = (ParticleSettings *)ptr->id.data;
1098 *max = max_ii(0, BLI_listbase_count(&part->dupliweights) - 1);
1101 static int rna_ParticleDupliWeight_active_index_get(PointerRNA *ptr)
1103 ParticleSettings *part = (ParticleSettings *)ptr->id.data;
1104 ParticleDupliWeight *dw = part->dupliweights.first;
1107 for (; dw; dw = dw->next, i++)
1108 if (dw->flag & PART_DUPLIW_CURRENT)
1114 static void rna_ParticleDupliWeight_active_index_set(struct PointerRNA *ptr, int value)
1116 ParticleSettings *part = (ParticleSettings *)ptr->id.data;
1117 ParticleDupliWeight *dw = part->dupliweights.first;
1120 for (; dw; dw = dw->next, i++) {
1122 dw->flag |= PART_DUPLIW_CURRENT;
1124 dw->flag &= ~PART_DUPLIW_CURRENT;
1128 static void rna_ParticleDupliWeight_name_get(PointerRNA *ptr, char *str)
1130 ParticleSettings *part = (ParticleSettings *)ptr->id.data;
1131 psys_find_group_weights(part);
1133 ParticleDupliWeight *dw = ptr->data;
1136 sprintf(str, "%s: %i", dw->ob->id.name + 2, dw->count);
1138 strcpy(str, "No object");
1141 static int rna_ParticleDupliWeight_name_length(PointerRNA *ptr)
1143 char tstr[MAX_ID_NAME + 64];
1145 rna_ParticleDupliWeight_name_get(ptr, tstr);
1147 return strlen(tstr);
1150 static const EnumPropertyItem *rna_Particle_from_itemf(
1151 bContext *UNUSED(C), PointerRNA *UNUSED(ptr),
1152 PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
1154 /*if (part->type==PART_REACTOR) */
1155 /* return part_reactor_from_items; */
1157 return part_from_items;
1160 static const EnumPropertyItem *rna_Particle_dist_itemf(
1161 bContext *UNUSED(C), PointerRNA *ptr,
1162 PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
1164 ParticleSettings *part = ptr->id.data;
1166 if (part->type == PART_HAIR)
1167 return part_hair_dist_items;
1169 return part_dist_items;
1172 static const EnumPropertyItem *rna_Particle_draw_as_itemf(
1173 bContext *UNUSED(C), PointerRNA *ptr,
1174 PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
1176 ParticleSettings *part = ptr->id.data;
1178 if (part->type == PART_HAIR)
1179 return part_hair_draw_as_items;
1181 return part_draw_as_items;
1184 static const EnumPropertyItem *rna_Particle_ren_as_itemf(
1185 bContext *UNUSED(C), PointerRNA *ptr,
1186 PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
1188 ParticleSettings *part = ptr->id.data;
1190 if (part->type == PART_HAIR)
1191 return part_hair_ren_as_items;
1193 return part_ren_as_items;
1196 static PointerRNA rna_Particle_field1_get(PointerRNA *ptr)
1198 ParticleSettings *part = (ParticleSettings *)ptr->id.data;
1202 part->pd = BKE_partdeflect_new(0);
1204 return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd);
1207 static PointerRNA rna_Particle_field2_get(PointerRNA *ptr)
1209 ParticleSettings *part = (ParticleSettings *)ptr->id.data;
1213 part->pd2 = BKE_partdeflect_new(0);
1215 return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd2);
1218 static void psys_vg_name_get__internal(PointerRNA *ptr, char *value, int index)
1220 Object *ob = ptr->id.data;
1221 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1223 if (psys->vgroup[index] > 0) {
1224 bDeformGroup *defGroup = BLI_findlink(&ob->defbase, psys->vgroup[index] - 1);
1227 strcpy(value, defGroup->name);
1234 static int psys_vg_name_len__internal(PointerRNA *ptr, int index)
1236 Object *ob = ptr->id.data;
1237 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1239 if (psys->vgroup[index] > 0) {
1240 bDeformGroup *defGroup = BLI_findlink(&ob->defbase, psys->vgroup[index] - 1);
1243 return strlen(defGroup->name);
1248 static void psys_vg_name_set__internal(PointerRNA *ptr, const char *value, int index)
1250 Object *ob = ptr->id.data;
1251 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1253 if (value[0] == '\0') {
1254 psys->vgroup[index] = 0;
1257 int defgrp_index = defgroup_name_index(ob, value);
1259 if (defgrp_index == -1)
1262 psys->vgroup[index] = defgrp_index + 1;
1266 static char *rna_ParticleSystem_path(PointerRNA *ptr)
1268 ParticleSystem *psys = (ParticleSystem *)ptr->data;
1269 char name_esc[sizeof(psys->name) * 2];
1271 BLI_strescape(name_esc, psys->name, sizeof(name_esc));
1272 return BLI_sprintfN("particle_systems[\"%s\"]", name_esc);
1275 static void rna_ParticleSettings_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
1277 ParticleSettings *part = (ParticleSettings *)ptr->data;
1278 rna_iterator_array_begin(iter, (void *)part->mtex, sizeof(MTex *), MAX_MTEX, 0, NULL);
1281 static PointerRNA rna_ParticleSettings_active_texture_get(PointerRNA *ptr)
1283 ParticleSettings *part = (ParticleSettings *)ptr->data;
1286 tex = give_current_particle_texture(part);
1287 return rna_pointer_inherit_refine(ptr, &RNA_Texture, tex);
1290 static void rna_ParticleSettings_active_texture_set(PointerRNA *ptr, PointerRNA value)
1292 ParticleSettings *part = (ParticleSettings *)ptr->data;
1294 set_current_particle_texture(part, value.data);
1297 /* irritating string functions for each index :/ */
1298 static void rna_ParticleVGroup_name_get_0(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 0); }
1299 static void rna_ParticleVGroup_name_get_1(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 1); }
1300 static void rna_ParticleVGroup_name_get_2(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 2); }
1301 static void rna_ParticleVGroup_name_get_3(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 3); }
1302 static void rna_ParticleVGroup_name_get_4(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 4); }
1303 static void rna_ParticleVGroup_name_get_5(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 5); }
1304 static void rna_ParticleVGroup_name_get_6(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 6); }
1305 static void rna_ParticleVGroup_name_get_7(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 7); }
1306 static void rna_ParticleVGroup_name_get_8(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 8); }
1307 static void rna_ParticleVGroup_name_get_9(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 9); }
1308 static void rna_ParticleVGroup_name_get_10(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 10); }
1309 static void rna_ParticleVGroup_name_get_11(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 11); }
1310 static void rna_ParticleVGroup_name_get_12(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 12); }
1312 static int rna_ParticleVGroup_name_len_0(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 0); }
1313 static int rna_ParticleVGroup_name_len_1(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 1); }
1314 static int rna_ParticleVGroup_name_len_2(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 2); }
1315 static int rna_ParticleVGroup_name_len_3(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 3); }
1316 static int rna_ParticleVGroup_name_len_4(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 4); }
1317 static int rna_ParticleVGroup_name_len_5(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 5); }
1318 static int rna_ParticleVGroup_name_len_6(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 6); }
1319 static int rna_ParticleVGroup_name_len_7(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 7); }
1320 static int rna_ParticleVGroup_name_len_8(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 8); }
1321 static int rna_ParticleVGroup_name_len_9(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 9); }
1322 static int rna_ParticleVGroup_name_len_10(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 10); }
1323 static int rna_ParticleVGroup_name_len_11(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 11); }
1324 static int rna_ParticleVGroup_name_len_12(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 12); }
1326 static void rna_ParticleVGroup_name_set_0(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 0); }
1327 static void rna_ParticleVGroup_name_set_1(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 1); }
1328 static void rna_ParticleVGroup_name_set_2(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 2); }
1329 static void rna_ParticleVGroup_name_set_3(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 3); }
1330 static void rna_ParticleVGroup_name_set_4(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 4); }
1331 static void rna_ParticleVGroup_name_set_5(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 5); }
1332 static void rna_ParticleVGroup_name_set_6(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 6); }
1333 static void rna_ParticleVGroup_name_set_7(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 7); }
1334 static void rna_ParticleVGroup_name_set_8(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 8); }
1335 static void rna_ParticleVGroup_name_set_9(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 9); }
1336 static void rna_ParticleVGroup_name_set_10(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 10); }
1337 static void rna_ParticleVGroup_name_set_11(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 11); }
1338 static void rna_ParticleVGroup_name_set_12(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 12); }
1343 static void rna_def_particle_hair_key(BlenderRNA *brna)
1351 srna = RNA_def_struct(brna, "ParticleHairKey", NULL);
1352 RNA_def_struct_sdna(srna, "HairKey");
1353 RNA_def_struct_ui_text(srna, "Particle Hair Key", "Particle key for hair particle system");
1355 prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
1356 RNA_def_property_ui_text(prop, "Time", "Relative time of key over hair length");
1358 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_UNSIGNED);
1359 RNA_def_property_range(prop, 0.0, 1.0);
1360 RNA_def_property_ui_text(prop, "Weight", "Weight for cloth simulation");
1362 prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
1363 RNA_def_property_array(prop, 3);
1364 RNA_def_property_ui_text(prop, "Location (Object Space)", "Location of the hair key in object space");
1365 RNA_def_property_float_funcs(prop, "rna_ParticleHairKey_location_object_get",
1366 "rna_ParticleHairKey_location_object_set", NULL);
1368 prop = RNA_def_property(srna, "co_local", PROP_FLOAT, PROP_TRANSLATION);
1369 RNA_def_property_float_sdna(prop, NULL, "co");
1370 RNA_def_property_ui_text(prop, "Location",
1371 "Location of the hair key in its local coordinate system, "
1372 "relative to the emitting face");
1375 func = RNA_def_function(srna, "co_object", "rna_ParticleHairKey_co_object");
1376 RNA_def_function_ui_description(func, "Obtain hairkey location with particle and modifier data");
1377 parm = RNA_def_pointer(func, "object", "Object", "", "Object");
1378 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
1379 parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
1380 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
1381 parm = RNA_def_pointer(func, "particle", "Particle", "", "hair particle");
1382 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
1383 parm = RNA_def_float_vector(func, "co", 3, NULL, -FLT_MAX, FLT_MAX, "Co",
1384 "Exported hairkey location", -1e4, 1e4);
1385 RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
1386 RNA_def_function_output(func, parm);
1389 static void rna_def_particle_key(BlenderRNA *brna)
1394 srna = RNA_def_struct(brna, "ParticleKey", NULL);
1395 RNA_def_struct_ui_text(srna, "Particle Key", "Key location for a particle over time");
1397 prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
1398 RNA_def_property_float_sdna(prop, NULL, "co");
1399 RNA_def_property_ui_text(prop, "Location", "Key location");
1401 prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
1402 RNA_def_property_float_sdna(prop, NULL, "vel");
1403 RNA_def_property_ui_text(prop, "Velocity", "Key velocity");
1405 prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
1406 RNA_def_property_float_sdna(prop, NULL, "rot");
1407 RNA_def_property_ui_text(prop, "Rotation", "Key rotation quaternion");
1409 prop = RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
1410 RNA_def_property_float_sdna(prop, NULL, "ave");
1411 RNA_def_property_ui_text(prop, "Angular Velocity", "Key angular velocity");
1413 prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
1414 RNA_def_property_ui_text(prop, "Time", "Time of key over the simulation");
1417 static void rna_def_child_particle(BlenderRNA *brna)
1420 /*PropertyRNA *prop; */
1422 srna = RNA_def_struct(brna, "ChildParticle", NULL);
1423 RNA_def_struct_ui_text(srna, "Child Particle",
1424 "Child particle interpolated from simulated or edited particles");
1426 /* int num, parent; *//* num is face index on the final derived mesh */
1428 /* int pa[4]; *//* nearest particles to the child, used for the interpolation */
1429 /* float w[4]; *//* interpolation weights for the above particles */
1430 /* float fuv[4], foffset; *//* face vertex weights and offset */
1431 /* float rand[3]; */
1434 static void rna_def_particle(BlenderRNA *brna)
1442 static const EnumPropertyItem alive_items[] = {
1443 /*{PARS_KILLED, "KILLED", 0, "Killed", ""}, */
1444 {PARS_DEAD, "DEAD", 0, "Dead", ""},
1445 {PARS_UNBORN, "UNBORN", 0, "Unborn", ""},
1446 {PARS_ALIVE, "ALIVE", 0, "Alive", ""},
1447 {PARS_DYING, "DYING", 0, "Dying", ""},
1448 {0, NULL, 0, NULL, NULL},
1451 srna = RNA_def_struct(brna, "Particle", NULL);
1452 RNA_def_struct_sdna(srna, "ParticleData");
1453 RNA_def_struct_ui_text(srna, "Particle", "Particle in a particle system");
1455 /* Particle State & Previous State */
1456 prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
1457 RNA_def_property_float_sdna(prop, NULL, "state.co");
1458 RNA_def_property_ui_text(prop, "Particle Location", "");
1460 prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
1461 RNA_def_property_float_sdna(prop, NULL, "state.vel");
1462 RNA_def_property_ui_text(prop, "Particle Velocity", "");
1464 prop = RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
1465 RNA_def_property_float_sdna(prop, NULL, "state.ave");
1466 RNA_def_property_ui_text(prop, "Angular Velocity", "");
1468 prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
1469 RNA_def_property_float_sdna(prop, NULL, "state.rot");
1470 RNA_def_property_ui_text(prop, "Rotation", "");
1472 prop = RNA_def_property(srna, "prev_location", PROP_FLOAT, PROP_TRANSLATION);
1473 RNA_def_property_float_sdna(prop, NULL, "prev_state.co");
1474 RNA_def_property_ui_text(prop, "Previous Particle Location", "");
1476 prop = RNA_def_property(srna, "prev_velocity", PROP_FLOAT, PROP_VELOCITY);
1477 RNA_def_property_float_sdna(prop, NULL, "prev_state.vel");
1478 RNA_def_property_ui_text(prop, "Previous Particle Velocity", "");
1480 prop = RNA_def_property(srna, "prev_angular_velocity", PROP_FLOAT, PROP_VELOCITY);
1481 RNA_def_property_float_sdna(prop, NULL, "prev_state.ave");
1482 RNA_def_property_ui_text(prop, "Previous Angular Velocity", "");
1484 prop = RNA_def_property(srna, "prev_rotation", PROP_FLOAT, PROP_QUATERNION);
1485 RNA_def_property_float_sdna(prop, NULL, "prev_state.rot");
1486 RNA_def_property_ui_text(prop, "Previous Rotation", "");
1488 /* Hair & Keyed Keys */
1490 prop = RNA_def_property(srna, "hair_keys", PROP_COLLECTION, PROP_NONE);
1491 RNA_def_property_collection_sdna(prop, NULL, "hair", "totkey");
1492 RNA_def_property_struct_type(prop, "ParticleHairKey");
1493 RNA_def_property_ui_text(prop, "Hair", "");
1495 prop = RNA_def_property(srna, "particle_keys", PROP_COLLECTION, PROP_NONE);
1496 RNA_def_property_collection_sdna(prop, NULL, "keys", "totkey");
1497 RNA_def_property_struct_type(prop, "ParticleKey");
1498 RNA_def_property_ui_text(prop, "Keyed States", "");
1500 /* float fuv[4], foffset; *//* coordinates on face/edge number "num" and depth along*/
1501 /* *//* face normal for volume emission */
1503 prop = RNA_def_property(srna, "birth_time", PROP_FLOAT, PROP_TIME);
1504 RNA_def_property_float_sdna(prop, NULL, "time");
1505 /* RNA_def_property_range(prop, lowerLimitf, upperLimitf); */
1506 RNA_def_property_ui_text(prop, "Birth Time", "");
1508 prop = RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
1509 /* RNA_def_property_range(prop, lowerLimitf, upperLimitf); */
1510 RNA_def_property_ui_text(prop, "Lifetime", "");
1512 prop = RNA_def_property(srna, "die_time", PROP_FLOAT, PROP_TIME);
1513 RNA_def_property_float_sdna(prop, NULL, "dietime");
1514 /* RNA_def_property_range(prop, lowerLimitf, upperLimitf); */
1515 RNA_def_property_ui_text(prop, "Die Time", "");
1517 prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
1518 /* RNA_def_property_range(prop, lowerLimitf, upperLimitf); */
1519 RNA_def_property_ui_text(prop, "Size", "");
1522 /* int num; *//* index to vert/edge/face */
1523 /* int num_dmcache; *//* index to derived mesh data (face) to avoid slow lookups */
1529 prop = RNA_def_property(srna, "is_exist", PROP_BOOLEAN, PROP_NONE);
1530 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PARS_UNEXIST);
1531 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1532 RNA_def_property_ui_text(prop, "Exists", "");
1534 prop = RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE);
1535 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PARS_NO_DISP);
1536 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1537 RNA_def_property_ui_text(prop, "Visible", "");
1539 prop = RNA_def_property(srna, "alive_state", PROP_ENUM, PROP_NONE);
1540 RNA_def_property_enum_sdna(prop, NULL, "alive");
1541 RNA_def_property_enum_items(prop, alive_items);
1542 RNA_def_property_ui_text(prop, "Alive State", "");
1547 func = RNA_def_function(srna, "uv_on_emitter", "rna_Particle_uv_on_emitter");
1548 RNA_def_function_ui_description(func, "Obtain uv for particle on derived mesh");
1549 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1550 parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
1551 RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
1552 parm = RNA_def_property(func, "uv", PROP_FLOAT, PROP_COORDS);
1553 RNA_def_property_array(parm, 2);
1554 RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
1555 RNA_def_function_output(func, parm);
1558 static void rna_def_particle_dupliweight(BlenderRNA *brna)
1563 srna = RNA_def_struct(brna, "ParticleDupliWeight", NULL);
1564 RNA_def_struct_ui_text(srna, "Particle Dupliobject Weight", "Weight of a particle dupliobject in a collection");
1565 RNA_def_struct_sdna(srna, "ParticleDupliWeight");
1567 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1568 RNA_def_property_string_funcs(prop, "rna_ParticleDupliWeight_name_get",
1569 "rna_ParticleDupliWeight_name_length", NULL);
1570 RNA_def_property_ui_text(prop, "Name", "Particle dupliobject name");
1571 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1572 RNA_def_struct_name_property(srna, prop);
1574 prop = RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
1575 RNA_def_property_range(prop, 0, SHRT_MAX);
1576 RNA_def_property_ui_text(prop, "Count",
1577 "The number of times this object is repeated with respect to other objects");
1578 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1581 static void rna_def_fluid_settings(BlenderRNA *brna)
1586 static const EnumPropertyItem sph_solver_items[] = {
1587 {SPH_SOLVER_DDR, "DDR", 0, "Double-Density", "An artistic solver with strong surface tension effects (original)"},
1588 {SPH_SOLVER_CLASSICAL, "CLASSICAL", 0, "Classical", "A more physically-accurate solver"},
1589 {0, NULL, 0, NULL, NULL},
1592 srna = RNA_def_struct(brna, "SPHFluidSettings", NULL);
1593 RNA_def_struct_path_func(srna, "rna_SPHFluidSettings_path");
1594 RNA_def_struct_ui_text(srna, "SPH Fluid Settings", "Settings for particle fluids physics");
1596 /* Fluid settings */
1597 prop = RNA_def_property(srna, "solver", PROP_ENUM, PROP_NONE);
1598 RNA_def_property_enum_sdna(prop, NULL, "solver");
1599 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1600 RNA_def_property_enum_items(prop, sph_solver_items);
1601 RNA_def_property_ui_text(prop, "SPH Solver", "The code used to calculate internal forces on particles");
1602 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1604 prop = RNA_def_property(srna, "spring_force", PROP_FLOAT, PROP_NONE);
1605 RNA_def_property_float_sdna(prop, NULL, "spring_k");
1606 RNA_def_property_range(prop, 0.0f, 100.0f);
1607 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
1608 RNA_def_property_ui_text(prop, "Spring Force", "Spring force");
1609 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1611 prop = RNA_def_property(srna, "fluid_radius", PROP_FLOAT, PROP_NONE);
1612 RNA_def_property_float_sdna(prop, NULL, "radius");
1613 RNA_def_property_range(prop, 0.0f, 20.0f);
1614 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
1615 RNA_def_property_ui_text(prop, "Interaction Radius", "Fluid interaction radius");
1616 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1618 prop = RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_NONE);
1619 RNA_def_property_range(prop, 0.0f, 2.0f);
1620 RNA_def_property_ui_text(prop, "Rest Length", "Spring rest length (factor of particle radius)");
1621 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1623 prop = RNA_def_property(srna, "use_viscoelastic_springs", PROP_BOOLEAN, PROP_NONE);
1624 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_VISCOELASTIC_SPRINGS);
1625 RNA_def_property_ui_text(prop, "Viscoelastic Springs", "Use viscoelastic springs instead of Hooke's springs");
1626 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1628 prop = RNA_def_property(srna, "use_initial_rest_length", PROP_BOOLEAN, PROP_NONE);
1629 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_CURRENT_REST_LENGTH);
1630 RNA_def_property_ui_text(prop, "Initial Rest Length",
1631 "Use the initial length as spring rest length instead of 2 * particle size");
1632 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1634 prop = RNA_def_property(srna, "plasticity", PROP_FLOAT, PROP_NONE);
1635 RNA_def_property_float_sdna(prop, NULL, "plasticity_constant");
1636 RNA_def_property_range(prop, 0.0f, 100.0f);
1637 RNA_def_property_ui_text(prop, "Plasticity",
1638 "How much the spring rest length can change after the elastic limit is crossed");
1639 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1641 prop = RNA_def_property(srna, "yield_ratio", PROP_FLOAT, PROP_NONE);
1642 RNA_def_property_float_sdna(prop, NULL, "yield_ratio");
1643 RNA_def_property_range(prop, 0.0f, 1.0f);
1644 RNA_def_property_ui_text(prop, "Elastic Limit",
1645 "How much the spring has to be stretched/compressed in order to change it's rest length");
1646 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1648 prop = RNA_def_property(srna, "spring_frames", PROP_INT, PROP_NONE);
1649 RNA_def_property_range(prop, 0.0f, 100.0f);
1650 RNA_def_property_ui_text(prop, "Spring Frames",
1651 "Create springs for this number of frames since particles birth (0 is always)");
1652 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1655 prop = RNA_def_property(srna, "linear_viscosity", PROP_FLOAT, PROP_NONE);
1656 RNA_def_property_float_sdna(prop, NULL, "viscosity_omega");
1657 RNA_def_property_range(prop, 0.0f, 100.0f);
1658 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
1659 RNA_def_property_ui_text(prop, "Viscosity", "Linear viscosity");
1660 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1662 prop = RNA_def_property(srna, "stiff_viscosity", PROP_FLOAT, PROP_NONE);
1663 RNA_def_property_float_sdna(prop, NULL, "viscosity_beta");
1664 RNA_def_property_range(prop, 0.0f, 100.0f);
1665 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
1666 RNA_def_property_ui_text(prop, "Stiff viscosity", "Creates viscosity for expanding fluid");
1667 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1669 /* Double density relaxation */
1670 prop = RNA_def_property(srna, "stiffness", PROP_FLOAT, PROP_NONE);
1671 RNA_def_property_float_sdna(prop, NULL, "stiffness_k");
1672 RNA_def_property_range(prop, 0.0f, 1000.0f);
1673 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
1674 RNA_def_property_ui_text(prop, "Stiffness", "How incompressible the fluid is (speed of sound)");
1675 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1677 prop = RNA_def_property(srna, "repulsion", PROP_FLOAT, PROP_NONE);
1678 RNA_def_property_float_sdna(prop, NULL, "stiffness_knear");
1679 RNA_def_property_range(prop, 0.0f, 100.0f);
1680 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
1681 RNA_def_property_ui_text(prop, "Repulsion Factor",
1682 "How strongly the fluid tries to keep from clustering (factor of stiffness)");
1683 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1685 prop = RNA_def_property(srna, "rest_density", PROP_FLOAT, PROP_NONE);
1686 RNA_def_property_float_sdna(prop, NULL, "rest_density");
1687 RNA_def_property_range(prop, 0.0f, 10000.0f);
1688 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
1689 RNA_def_property_ui_text(prop, "Rest Density", "Fluid rest density");
1690 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1693 prop = RNA_def_property(srna, "buoyancy", PROP_FLOAT, PROP_NONE);
1694 RNA_def_property_float_sdna(prop, NULL, "buoyancy");
1695 RNA_def_property_range(prop, 0.0f, 10.0f);
1696 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3);
1697 RNA_def_property_ui_text(prop, "Buoyancy",
1698 "Artificial buoyancy force in negative gravity direction based on pressure "
1699 "differences inside the fluid");
1700 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1704 prop = RNA_def_property(srna, "use_factor_repulsion", PROP_BOOLEAN, PROP_NONE);
1705 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_REPULSION);
1706 RNA_def_property_ui_text(prop, "Factor Repulsion", "Repulsion is a factor of stiffness");
1707 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1709 prop = RNA_def_property(srna, "use_factor_density", PROP_BOOLEAN, PROP_NONE);
1710 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_DENSITY);
1711 RNA_def_property_ui_text(prop, "Factor Density",
1712 "Density is calculated as a factor of default density (depends on particle size)");
1713 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1715 prop = RNA_def_property(srna, "use_factor_radius", PROP_BOOLEAN, PROP_NONE);
1716 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_RADIUS);
1717 RNA_def_property_ui_text(prop, "Factor Radius", "Interaction radius is a factor of 4 * particle size");
1718 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1720 prop = RNA_def_property(srna, "use_factor_stiff_viscosity", PROP_BOOLEAN, PROP_NONE);
1721 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_VISCOSITY);
1722 RNA_def_property_ui_text(prop, "Factor Stiff Viscosity", "Stiff viscosity is a factor of normal viscosity");
1723 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1725 prop = RNA_def_property(srna, "use_factor_rest_length", PROP_BOOLEAN, PROP_NONE);
1726 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_REST_LENGTH);
1727 RNA_def_property_ui_text(prop, "Factor Rest Length", "Spring rest length is a factor of 2 * particle size");
1728 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1731 static void rna_def_particle_settings_mtex(BlenderRNA *brna)
1736 static const EnumPropertyItem texco_items[] = {
1737 {TEXCO_GLOB, "GLOBAL", 0, "Global", "Use global coordinates for the texture coordinates"},
1738 {TEXCO_OBJECT, "OBJECT", 0, "Object", "Use linked object's coordinates for texture coordinates"},
1739 {TEXCO_UV, "UV", 0, "UV", "Use UV coordinates for texture coordinates"},
1740 {TEXCO_ORCO, "ORCO", 0, "Generated", "Use the original undeformed coordinates of the object"},
1741 {TEXCO_STRAND, "STRAND", 0, "Strand / Particle",
1742 "Use normalized strand texture coordinate (1D) or particle age (X) and trail position (Y)"},
1743 {0, NULL, 0, NULL, NULL},
1746 static const EnumPropertyItem prop_mapping_items[] = {
1747 {MTEX_FLAT, "FLAT", 0, "Flat", "Map X and Y coordinates directly"},
1748 {MTEX_CUBE, "CUBE", 0, "Cube", "Map using the normal vector"},
1749 {MTEX_TUBE, "TUBE", 0, "Tube", "Map with Z as central axis"},
1750 {MTEX_SPHERE, "SPHERE", 0, "Sphere", "Map with Z as central axis"},
1751 {0, NULL, 0, NULL, NULL},
1754 static const EnumPropertyItem prop_x_mapping_items[] = {
1755 {0, "NONE", 0, "None", ""},
1756 {1, "X", 0, "X", ""},
1757 {2, "Y", 0, "Y", ""},
1758 {3, "Z", 0, "Z", ""},
1759 {0, NULL, 0, NULL, NULL},
1762 static const EnumPropertyItem prop_y_mapping_items[] = {
1763 {0, "NONE", 0, "None", ""},
1764 {1, "X", 0, "X", ""},
1765 {2, "Y", 0, "Y", ""},
1766 {3, "Z", 0, "Z", ""},
1767 {0, NULL, 0, NULL, NULL},
1770 static const EnumPropertyItem prop_z_mapping_items[] = {
1771 {0, "NONE", 0, "None", ""},
1772 {1, "X", 0, "X", ""},
1773 {2, "Y", 0, "Y", ""},
1774 {3, "Z", 0, "Z", ""},
1775 {0, NULL, 0, NULL, NULL},
1778 srna = RNA_def_struct(brna, "ParticleSettingsTextureSlot", "TextureSlot");
1779 RNA_def_struct_sdna(srna, "MTex");
1780 RNA_def_struct_ui_text(srna, "Particle Settings Texture Slot",
1781 "Texture slot for textures in a Particle Settings data-block");
1783 prop = RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
1784 RNA_def_property_enum_sdna(prop, NULL, "texco");
1785 RNA_def_property_enum_items(prop, texco_items);
1786 RNA_def_property_ui_text(prop, "Texture Coordinates",
1787 "Texture coordinates used to map the texture onto the background");
1788 RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
1790 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1791 RNA_def_property_pointer_sdna(prop, NULL, "object");
1792 RNA_def_property_struct_type(prop, "Object");
1793 RNA_def_property_flag(prop, PROP_EDITABLE);
1794 RNA_def_property_ui_text(prop, "Object", "Object to use for mapping with Object texture coordinates");
1795 RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
1797 prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
1798 RNA_def_property_string_sdna(prop, NULL, "uvname");
1799 RNA_def_property_ui_text(prop, "UV Map", "UV map to use for mapping with UV texture coordinates");
1800 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1802 prop = RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE);
1803 RNA_def_property_enum_sdna(prop, NULL, "projx");
1804 RNA_def_property_enum_items(prop, prop_x_mapping_items);
1805 RNA_def_property_ui_text(prop, "X Mapping", "");
1806 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1808 prop = RNA_def_property(srna, "mapping_y", PROP_ENUM, PROP_NONE);
1809 RNA_def_property_enum_sdna(prop, NULL, "projy");
1810 RNA_def_property_enum_items(prop, prop_y_mapping_items);
1811 RNA_def_property_ui_text(prop, "Y Mapping", "");
1812 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1814 prop = RNA_def_property(srna, "mapping_z", PROP_ENUM, PROP_NONE);
1815 RNA_def_property_enum_sdna(prop, NULL, "projz");
1816 RNA_def_property_enum_items(prop, prop_z_mapping_items);
1817 RNA_def_property_ui_text(prop, "Z Mapping", "");
1818 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1820 prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
1821 RNA_def_property_enum_items(prop, prop_mapping_items);
1822 RNA_def_property_ui_text(prop, "Mapping", "");
1823 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1826 prop = RNA_def_property(srna, "use_map_time", PROP_BOOLEAN, PROP_NONE);
1827 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_TIME);
1828 RNA_def_property_ui_text(prop, "Emission Time", "Affect the emission time of the particles");
1829 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1831 prop = RNA_def_property(srna, "use_map_life", PROP_BOOLEAN, PROP_NONE);
1832 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_LIFE);
1833 RNA_def_property_ui_text(prop, "Life Time", "Affect the life time of the particles");
1834 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1836 prop = RNA_def_property(srna, "use_map_density", PROP_BOOLEAN, PROP_NONE);
1837 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_DENS);
1838 RNA_def_property_ui_text(prop, "Density", "Affect the density of the particles");
1839 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1841 prop = RNA_def_property(srna, "use_map_size", PROP_BOOLEAN, PROP_NONE);
1842 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_SIZE);
1843 RNA_def_property_ui_text(prop, "Size", "Affect the particle size");
1844 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1846 prop = RNA_def_property(srna, "use_map_velocity", PROP_BOOLEAN, PROP_NONE);
1847 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_IVEL);
1848 RNA_def_property_ui_text(prop, "Initial Velocity", "Affect the particle initial velocity");
1849 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1851 prop = RNA_def_property(srna, "use_map_field", PROP_BOOLEAN, PROP_NONE);
1852 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_FIELD);
1853 RNA_def_property_ui_text(prop, "Force Field", "Affect the particle force fields");
1854 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1856 prop = RNA_def_property(srna, "use_map_gravity", PROP_BOOLEAN, PROP_NONE);
1857 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_GRAVITY);
1858 RNA_def_property_ui_text(prop, "Gravity", "Affect the particle gravity");
1859 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1861 prop = RNA_def_property(srna, "use_map_damp", PROP_BOOLEAN, PROP_NONE);
1862 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_DAMP);
1863 RNA_def_property_ui_text(prop, "Damp", "Affect the particle velocity damping");
1864 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1866 prop = RNA_def_property(srna, "use_map_clump", PROP_BOOLEAN, PROP_NONE);
1867 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_CLUMP);
1868 RNA_def_property_ui_text(prop, "Clump", "Affect the child clumping");
1869 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1871 prop = RNA_def_property(srna, "use_map_kink_amp", PROP_BOOLEAN, PROP_NONE);
1872 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_KINK_AMP);
1873 RNA_def_property_ui_text(prop, "Kink Amplitude", "Affect the child kink amplitude");
1874 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1876 prop = RNA_def_property(srna, "use_map_kink_freq", PROP_BOOLEAN, PROP_NONE);
1877 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_KINK_FREQ);
1878 RNA_def_property_ui_text(prop, "Kink Frequency", "Affect the child kink frequency");
1879 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1881 prop = RNA_def_property(srna, "use_map_rough", PROP_BOOLEAN, PROP_NONE);
1882 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_ROUGH);
1883 RNA_def_property_ui_text(prop, "Rough", "Affect the child rough");
1884 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1886 prop = RNA_def_property(srna, "use_map_length", PROP_BOOLEAN, PROP_NONE);
1887 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_LENGTH);
1888 RNA_def_property_ui_text(prop, "Length", "Affect the child hair length");
1889 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1891 prop = RNA_def_property(srna, "use_map_twist", PROP_BOOLEAN, PROP_NONE);
1892 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_TWIST);
1893 RNA_def_property_ui_text(prop, "Twist", "Affect the child twist");
1894 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1896 /* influence factors */
1897 prop = RNA_def_property(srna, "time_factor", PROP_FLOAT, PROP_NONE);
1898 RNA_def_property_float_sdna(prop, NULL, "timefac");
1899 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1900 RNA_def_property_ui_text(prop, "Emission Time Factor", "Amount texture affects particle emission time");
1901 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1903 prop = RNA_def_property(srna, "life_factor", PROP_FLOAT, PROP_NONE);
1904 RNA_def_property_float_sdna(prop, NULL, "lifefac");
1905 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1906 RNA_def_property_ui_text(prop, "Life Time Factor", "Amount texture affects particle life time");
1907 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1909 prop = RNA_def_property(srna, "density_factor", PROP_FLOAT, PROP_NONE);
1910 RNA_def_property_float_sdna(prop, NULL, "padensfac");
1911 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1912 RNA_def_property_ui_text(prop, "Density Factor", "Amount texture affects particle density");
1913 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1915 prop = RNA_def_property(srna, "size_factor", PROP_FLOAT, PROP_NONE);
1916 RNA_def_property_float_sdna(prop, NULL, "sizefac");
1917 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1918 RNA_def_property_ui_text(prop, "Size Factor", "Amount texture affects physical particle size");
1919 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1921 prop = RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE);
1922 RNA_def_property_float_sdna(prop, NULL, "ivelfac");
1923 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1924 RNA_def_property_ui_text(prop, "Velocity Factor", "Amount texture affects particle initial velocity");
1925 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1928 prop = RNA_def_property(srna, "field_factor", PROP_FLOAT, PROP_NONE);
1929 RNA_def_property_float_sdna(prop, NULL, "fieldfac");
1930 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1931 RNA_def_property_ui_text(prop, "Field Factor", "Amount texture affects particle force fields");
1932 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1934 prop = RNA_def_property(srna, "gravity_factor", PROP_FLOAT, PROP_NONE);
1935 RNA_def_property_float_sdna(prop, NULL, "gravityfac");
1936 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1937 RNA_def_property_ui_text(prop, "Gravity Factor", "Amount texture affects particle gravity");
1938 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1940 prop = RNA_def_property(srna, "damp_factor", PROP_FLOAT, PROP_NONE);
1941 RNA_def_property_float_sdna(prop, NULL, "dampfac");
1942 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1943 RNA_def_property_ui_text(prop, "Damp Factor", "Amount texture affects particle damping");
1944 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1947 prop = RNA_def_property(srna, "length_factor", PROP_FLOAT, PROP_NONE);
1948 RNA_def_property_float_sdna(prop, NULL, "lengthfac");
1949 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1950 RNA_def_property_ui_text(prop, "Length Factor", "Amount texture affects child hair length");
1951 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1953 prop = RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
1954 RNA_def_property_float_sdna(prop, NULL, "clumpfac");
1955 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1956 RNA_def_property_ui_text(prop, "Clump Factor", "Amount texture affects child clump");
1957 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1959 prop = RNA_def_property(srna, "kink_amp_factor", PROP_FLOAT, PROP_NONE);
1960 RNA_def_property_float_sdna(prop, NULL, "kinkampfac");
1961 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1962 RNA_def_property_ui_text(prop, "Kink Amplitude Factor", "Amount texture affects child kink amplitude");
1963 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1965 prop = RNA_def_property(srna, "kink_freq_factor", PROP_FLOAT, PROP_NONE);
1966 RNA_def_property_float_sdna(prop, NULL, "kinkfac");
1967 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1968 RNA_def_property_ui_text(prop, "Kink Frequency Factor", "Amount texture affects child kink frequency");
1969 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1971 prop = RNA_def_property(srna, "rough_factor", PROP_FLOAT, PROP_NONE);
1972 RNA_def_property_float_sdna(prop, NULL, "roughfac");
1973 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1974 RNA_def_property_ui_text(prop, "Rough Factor", "Amount texture affects child roughness");
1975 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1977 prop = RNA_def_property(srna, "twist_factor", PROP_FLOAT, PROP_NONE);
1978 RNA_def_property_float_sdna(prop, NULL, "twistfac");
1979 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1980 RNA_def_property_ui_text(prop, "Twist Factor", "Amount texture affects child twist");
1981 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1984 static void rna_def_particle_settings(BlenderRNA *brna)
1989 static const EnumPropertyItem type_items[] = {
1990 {PART_EMITTER, "EMITTER", 0, "Emitter", ""},
1991 /*{PART_REACTOR, "REACTOR", 0, "Reactor", ""}, */
1992 {PART_HAIR, "HAIR", 0, "Hair", ""},
1993 {0, NULL, 0, NULL, NULL},
1996 static const EnumPropertyItem phys_type_items[] = {
1997 {PART_PHYS_NO, "NO", 0, "None", ""},
1998 {PART_PHYS_NEWTON, "NEWTON", 0, "Newtonian", ""},
1999 {PART_PHYS_KEYED, "KEYED", 0, "Keyed", ""},
2000 {PART_PHYS_BOIDS, "BOIDS", 0, "Boids", ""},
2001 {PART_PHYS_FLUID, "FLUID", 0, "Fluid", ""},
2002 {0, NULL, 0, NULL, NULL},
2005 static const EnumPropertyItem rot_mode_items[] = {
2006 {0, "NONE", 0, "None", ""},
2007 {PART_ROT_NOR, "NOR", 0, "Normal", ""},
2008 {PART_ROT_NOR_TAN, "NOR_TAN", 0, "Normal-Tangent", ""},
2009 {PART_ROT_VEL, "VEL", 0, "Velocity / Hair", ""},
2010 {PART_ROT_GLOB_X, "GLOB_X", 0, "Global X", ""},
2011 {PART_ROT_GLOB_Y, "GLOB_Y", 0, "Global Y", ""},
2012 {PART_ROT_GLOB_Z, "GLOB_Z", 0, "Global Z", ""},
2013 {PART_ROT_OB_X, "OB_X", 0, "Object X", ""},
2014 {PART_ROT_OB_Y, "OB_Y", 0, "Object Y", ""},
2015 {PART_ROT_OB_Z, "OB_Z", 0, "Object Z", ""},
2016 {0, NULL, 0, NULL, NULL},
2019 static const EnumPropertyItem ave_mode_items[] = {
2020 {0, "NONE", 0, "None", ""},
2021 {PART_AVE_VELOCITY, "VELOCITY", 0, "Velocity", ""},
2022 {PART_AVE_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""},
2023 {PART_AVE_VERTICAL, "VERTICAL", 0, "Vertical", ""},
2024 {PART_AVE_GLOBAL_X, "GLOBAL_X", 0, "Global X", ""},
2025 {PART_AVE_GLOBAL_Y, "GLOBAL_Y", 0, "Global Y", ""},
2026 {PART_AVE_GLOBAL_Z, "GLOBAL_Z", 0, "Global Z", ""},
2027 {PART_AVE_RAND, "RAND", 0, "Random", ""},
2028 {0, NULL, 0, NULL, NULL},
2031 static const EnumPropertyItem react_event_items[] = {
2032 {PART_EVENT_DEATH, "DEATH", 0, "Death", ""},
2033 {PART_EVENT_COLLIDE, "COLLIDE", 0, "Collision", ""},
2034 {PART_EVENT_NEAR, "NEAR", 0, "Near", ""},
2035 {0, NULL, 0, NULL, NULL},
2038 static const EnumPropertyItem child_type_items[] = {
2039 {0, "NONE", 0, "None", ""},
2040 {PART_CHILD_PARTICLES, "SIMPLE", 0, "Simple", ""},
2041 {PART_CHILD_FACES, "INTERPOLATED", 0, "Interpolated", ""},
2042 {0, NULL, 0, NULL, NULL},
2045 /*TODO: names, tooltips */
2046 static const EnumPropertyItem integrator_type_items[] = {
2047 {PART_INT_EULER, "EULER", 0, "Euler", ""},
2048 {PART_INT_VERLET, "VERLET", 0, "Verlet", ""},
2049 {PART_INT_MIDPOINT, "MIDPOINT", 0, "Midpoint", ""},
2050 {PART_INT_RK4, "RK4", 0, "RK4", ""},
2051 {0, NULL, 0, NULL, NULL},
2054 static const EnumPropertyItem kink_type_items[] = {
2055 {PART_KINK_NO, "NO", 0, "Nothing", ""},
2056 {PART_KINK_CURL, "CURL", 0, "Curl", ""},
2057 {PART_KINK_RADIAL, "RADIAL", 0, "Radial", ""},
2058 {PART_KINK_WAVE, "WAVE", 0, "Wave", ""},
2059 {PART_KINK_BRAID, "BRAID", 0, "Braid", ""},
2060 {PART_KINK_SPIRAL, "SPIRAL", 0, "Spiral", ""},
2061 {0, NULL, 0, NULL, NULL},
2064 static const EnumPropertyItem bb_align_items[] = {
2065 {PART_BB_X, "X", 0, "X", ""},
2066 {PART_BB_Y, "Y", 0, "Y", ""},
2067 {PART_BB_Z, "Z", 0, "Z", ""},
2068 {PART_BB_VIEW, "VIEW", 0, "View", ""},
2069 {PART_BB_VEL, "VEL", 0, "Velocity", ""},
2070 {0, NULL, 0, NULL, NULL},
2073 static const EnumPropertyItem bb_anim_items[] = {
2074 {PART_BB_ANIM_NONE, "NONE", 0, "None", ""},
2075 {PART_BB_ANIM_AGE, "AGE", 0, "Age", ""},
2076 {PART_BB_ANIM_FRAME, "FRAME", 0, "Frame", ""},
2077 {PART_BB_ANIM_ANGLE, "ANGLE", 0, "Angle", ""},
2078 {0, NULL, 0, NULL, NULL},
2081 static const EnumPropertyItem bb_split_offset_items[] = {
2082 {PART_BB_OFF_NONE, "NONE", 0, "None", ""},
2083 {PART_BB_OFF_LINEAR, "LINEAR", 0, "Linear", ""},
2084 {PART_BB_OFF_RANDOM, "RANDOM", 0, "Random", ""},
2085 {0, NULL, 0, NULL, NULL},
2088 static const EnumPropertyItem draw_col_items[] = {
2089 {PART_DRAW_COL_NONE, "NONE", 0, "None", ""},
2090 {PART_DRAW_COL_MAT, "MATERIAL", 0, "Material", ""},
2091 {PART_DRAW_COL_VEL, "VELOCITY", 0, "Velocity", ""},
2092 {PART_DRAW_COL_ACC, "ACCELERATION", 0, "Acceleration", ""},
2093 {0, NULL, 0, NULL, NULL},
2096 static const EnumPropertyItem part_mat_items[] = {
2097 {0, "DUMMY", 0, "Dummy", ""},
2098 {0, NULL, 0, NULL, NULL},
2101 srna = RNA_def_struct(brna, "ParticleSettings", "ID");
2102 RNA_def_struct_ui_text(srna, "Particle Settings", "Particle settings, reusable by multiple particle systems");
2103 RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
2105 rna_def_mtex_common(brna, srna, "rna_ParticleSettings_mtex_begin", "rna_ParticleSettings_active_texture_get",
2106 "rna_ParticleSettings_active_texture_set", NULL, "ParticleSettingsTextureSlot",
2107 "ParticleSettingsTextureSlots", "rna_Particle_reset", NULL);
2109 /* fluid particle type can't be checked from the type value in rna as it's not shown in the menu */
2110 prop = RNA_def_property(srna, "is_fluid", PROP_BOOLEAN, PROP_NONE);
2111 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2112 RNA_def_property_boolean_funcs(prop, "rna_PartSettings_is_fluid_get", NULL);
2113 RNA_def_property_ui_text(prop, "Fluid", "Particles were created by a fluid simulation");
2116 prop = RNA_def_property(srna, "use_react_start_end", PROP_BOOLEAN, PROP_NONE);
2117 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_STA_END);
2118 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2119 RNA_def_property_ui_text(prop, "Start/End", "Give birth to unreacted particles eventually");
2120 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2122 prop = RNA_def_property(srna, "use_react_multiple", PROP_BOOLEAN, PROP_NONE);
2123 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_MULTIPLE);
2124 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2125 RNA_def_property_ui_text(prop, "Multi React", "React multiple times");
2126 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2128 prop = RNA_def_property(srna, "use_regrow_hair", PROP_BOOLEAN, PROP_NONE);
2129 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_REGROW);
2130 RNA_def_property_ui_text(prop, "Regrow", "Regrow hair for each frame");
2131 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2133 prop = RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
2134 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_UNBORN);
2135 RNA_def_property_ui_text(prop, "Unborn", "Show particles before they are emitted");
2136 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2138 prop = RNA_def_property(srna, "use_dead", PROP_BOOLEAN, PROP_NONE);
2139 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_DIED);
2140 RNA_def_property_ui_text(prop, "Died", "Show particles after they have died");
2141 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2143 prop = RNA_def_property(srna, "use_emit_random", PROP_BOOLEAN, PROP_NONE);
2144 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_TRAND);
2145 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2146 RNA_def_property_ui_text(prop, "Random", "Emit in random order of elements");
2147 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2149 prop = RNA_def_property(srna, "use_even_distribution", PROP_BOOLEAN, PROP_NONE);
2150 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_EDISTR);
2151 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2152 RNA_def_property_ui_text(prop, "Even Distribution",
2153 "Use even distribution from faces based on face areas or edge lengths");
2154 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2156 prop = RNA_def_property(srna, "use_die_on_collision", PROP_BOOLEAN, PROP_NONE);
2157 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_DIE_ON_COL);
2158 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2159 RNA_def_property_ui_text(prop, "Die on hit", "Particles die when they collide with a deflector object");
2160 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2162 prop = RNA_def_property(srna, "use_size_deflect", PROP_BOOLEAN, PROP_NONE);
2163 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SIZE_DEFL);
2164 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2165 RNA_def_property_ui_text(prop, "Size Deflect", "Use particle's size in deflection");
2166 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2168 prop = RNA_def_property(srna, "use_rotations", PROP_BOOLEAN, PROP_NONE);
2169 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ROTATIONS);
2170 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2171 RNA_def_property_ui_text(prop, "Rotations", "Calculate particle rotations");
2172 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2174 prop = RNA_def_property(srna, "use_dynamic_rotation", PROP_BOOLEAN, PROP_NONE);
2175 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ROT_DYN);
2176 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2177 RNA_def_property_ui_text(prop, "Dynamic", "Particle rotations are affected by collisions and effectors");
2178 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2180 prop = RNA_def_property(srna, "use_multiply_size_mass", PROP_BOOLEAN, PROP_NONE);
2181 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SIZEMASS);
2182 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2183 RNA_def_property_ui_text(prop, "Mass from Size", "Multiply mass by particle size");
2184 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2186 prop = RNA_def_property(srna, "use_advanced_hair", PROP_BOOLEAN, PROP_NONE);
2187 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PART_HIDE_ADVANCED_HAIR);
2188 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2189 RNA_def_property_ui_text(prop, "Advanced", "Use full physics calculations for growing hair");
2190 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2192 prop = RNA_def_property(srna, "lock_boids_to_surface", PROP_BOOLEAN, PROP_NONE);
2193 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_BOIDS_2D);
2194 RNA_def_property_ui_text(prop, "Boids 2D", "Constrain boids to a surface");
2195 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2197 prop = RNA_def_property(srna, "use_hair_bspline", PROP_BOOLEAN, PROP_NONE);
2198 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_BSPLINE);
2199 RNA_def_property_ui_text(prop, "B-Spline", "Interpolate hair using B-Splines");
2200 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2202 prop = RNA_def_property(srna, "invert_grid", PROP_BOOLEAN, PROP_NONE);
2203 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GRID_INVERT);
2204 RNA_def_property_ui_text(prop, "Invert Grid", "Invert what is considered object and what is not");
2205 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2207 prop = RNA_def_property(srna, "hexagonal_grid", PROP_BOOLEAN, PROP_NONE);
2208 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GRID_HEXAGONAL);
2209 RNA_def_property_ui_text(prop, "Hexagonal Grid", "Create the grid in a hexagonal pattern");
2210 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2212 prop = RNA_def_property(srna, "apply_effector_to_children", PROP_BOOLEAN, PROP_NONE);
2213 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_EFFECT);
2214 RNA_def_property_ui_text(prop, "Effect Children", "Apply effectors to children");
2215 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2217 prop = RNA_def_property(srna, "create_long_hair_children", PROP_BOOLEAN, PROP_NONE);
2218 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_LONG_HAIR);
2219 RNA_def_property_ui_text(prop, "Long Hair", "Calculate children that suit long hair well");
2220 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2222 prop = RNA_def_property(srna, "apply_guide_to_children", PROP_BOOLEAN, PROP_NONE);
2223 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_GUIDE);
2224 RNA_def_property_ui_text(prop, "apply_guide_to_children", "");
2225 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2227 prop = RNA_def_property(srna, "use_self_effect", PROP_BOOLEAN, PROP_NONE);
2228 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SELF_EFFECT);
2229 RNA_def_property_ui_text(prop, "Self Effect", "Particle effectors affect themselves");
2230 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2233 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2234 RNA_def_property_enum_items(prop, type_items);
2235 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2236 RNA_def_property_ui_text(prop, "Type", "Particle Type");
2237 RNA_def_property_update(prop, 0, "rna_Particle_change_type");
2239 prop = RNA_def_property(srna, "emit_from", PROP_ENUM, PROP_NONE);
2240 RNA_def_property_enum_sdna(prop, NULL, "from");
2241 RNA_def_property_enum_items(prop, part_reactor_from_items);
2242 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2243 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_from_itemf");
2244 RNA_def_property_ui_text(prop, "Emit From", "Where to emit particles from");
2245 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2247 prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
2248 RNA_def_property_enum_sdna(prop, NULL, "distr");
2249 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2250 RNA_def_property_enum_items(prop, part_dist_items);
2251 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_dist_itemf");
2252 RNA_def_property_ui_text(prop, "Distribution", "How to distribute particles on selected element");
2253 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2256 prop = RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
2257 RNA_def_property_enum_sdna(prop, NULL, "phystype");
2258 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2259 RNA_def_property_enum_items(prop, phys_type_items);
2260 RNA_def_property_ui_text(prop, "Physics Type", "Particle physics type");
2261 RNA_def_property_update(prop, 0, "rna_Particle_change_physics_type");
2263 prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
2264 RNA_def_property_enum_sdna(prop, NULL, "rotmode");
2265 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2266 RNA_def_property_enum_items(prop, rot_mode_items);
2267 RNA_def_property_ui_text(prop, "Orientation axis",
2268 "Particle orientation axis (does not affect Explode modifier's results)");
2269 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2271 prop = RNA_def_property(srna, "angular_velocity_mode", PROP_ENUM, PROP_NONE);
2272 RNA_def_property_enum_sdna(prop, NULL, "avemode");
2273 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2274 RNA_def_property_enum_items(prop, ave_mode_items);
2275 RNA_def_property_ui_text(prop, "Angular Velocity Axis", "What axis is used to change particle rotation with time");
2276 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2278 prop = RNA_def_property(srna, "react_event", PROP_ENUM, PROP_NONE);
2279 RNA_def_property_enum_sdna(prop, NULL, "reactevent");
2280 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2281 RNA_def_property_enum_items(prop, react_event_items);
2282 RNA_def_property_ui_text(prop, "React On", "The event of target particles to react on");
2283 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2286 prop = RNA_def_property(srna, "show_guide_hairs", PROP_BOOLEAN, PROP_NONE);
2287 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_GUIDE_HAIRS);
2288 RNA_def_property_ui_text(prop, "Guide Hairs", "Show guide hairs");
2289 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2291 prop = RNA_def_property(srna, "show_hair_grid", PROP_BOOLEAN, PROP_NONE);
2292 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_HAIR_GRID);
2293 RNA_def_property_ui_text(prop, "Guide Hairs", "Show hair simulation grid");
2294 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2296 prop = RNA_def_property(srna, "show_velocity", PROP_BOOLEAN, PROP_NONE);
2297 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL);
2298 RNA_def_property_ui_text(prop, "Velocity", "Show particle velocity");
2299 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2301 prop = RNA_def_property(srna, "show_size", PROP_BOOLEAN, PROP_NONE);
2302 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_SIZE);
2303 RNA_def_property_ui_text(prop, "Size", "Show particle size");
2304 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2306 prop = RNA_def_property(srna, "show_health", PROP_BOOLEAN, PROP_NONE);
2307 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_HEALTH);
2308 RNA_def_property_ui_text(prop, "Health", "Draw boid health");
2309 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2311 prop = RNA_def_property(srna, "use_absolute_path_time", PROP_BOOLEAN, PROP_NONE);
2312 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_ABS_PATH_TIME);
2313 RNA_def_property_ui_text(prop, "Absolute Path Time", "Path timing is in absolute frames");
2314 RNA_def_property_update(prop, 0, "rna_Particle_abspathtime_update");
2316 prop = RNA_def_property(srna, "use_parent_particles", PROP_BOOLEAN, PROP_NONE);
2317 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_PARENT);
2318 RNA_def_property_ui_text(prop, "Parents", "Render parent particles");
2319 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2321 prop = RNA_def_property(srna, "show_number", PROP_BOOLEAN, PROP_NONE);
2322 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_NUM);
2323 RNA_def_property_ui_text(prop, "Number", "Show particle number");
2324 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2326 prop = RNA_def_property(srna, "use_collection_pick_random", PROP_BOOLEAN, PROP_NONE);
2327 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_RAND_GR);
2328 RNA_def_property_ui_text(prop, "Pick Random", "Pick objects from collection randomly");
2329 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2331 prop = RNA_def_property(srna, "use_collection_count", PROP_BOOLEAN, PROP_NONE);
2332 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_COUNT_GR);
2333 RNA_def_property_ui_text(prop, "Use Count", "Use object multiple times in the same collection");
2334 RNA_def_property_update(prop, 0, "rna_Particle_redo_count");
2336 prop = RNA_def_property(srna, "use_global_instance", PROP_BOOLEAN, PROP_NONE);
2337 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_GLOBAL_OB);
2338 RNA_def_property_ui_text(prop, "Global", "Use object's global coordinates for duplication");
2339 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2341 prop = RNA_def_property(srna, "use_rotation_instance", PROP_BOOLEAN, PROP_NONE);
2342 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_ROTATE_OB);
2343 RNA_def_property_ui_text(prop, "Rotation",
2344 "Use object's rotation for duplication (global x-axis is aligned "
2345 "particle rotation axis)");
2346 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2348 prop = RNA_def_property(srna, "use_scale_instance", PROP_BOOLEAN, PROP_NONE);
2349 RNA_def_property_boolean_negative_sdna(prop, NULL, "draw", PART_DRAW_NO_SCALE_OB);
2350 RNA_def_property_ui_text(prop, "Scale", "Use object's scale for duplication");
2351 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2353 prop = RNA_def_property(srna, "use_render_adaptive", PROP_BOOLEAN, PROP_NONE);
2354 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_ADAPT);
2355 RNA_def_property_ui_text(prop, "Adaptive Render", "Draw steps of the particle path");
2356 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2358 prop = RNA_def_property(srna, "use_velocity_length", PROP_BOOLEAN, PROP_NONE);
2359 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL_LENGTH);
2360 RNA_def_property_ui_text(prop, "Speed", "Multiply line length by particle speed");
2361 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2363 prop = RNA_def_property(srna, "use_whole_collection", PROP_BOOLEAN, PROP_NONE);
2364 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_WHOLE_GR);
2365 RNA_def_property_ui_text(prop, "Whole Collection", "Use whole collection at once");
2366 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2368 prop = RNA_def_property(srna, "use_strand_primitive", PROP_BOOLEAN, PROP_NONE);
2369 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_STRAND);
2370 RNA_def_property_ui_text(prop, "Strand Render", "Use the strand primitive for rendering");
2371 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2373 prop = RNA_def_property(srna, "display_method", PROP_ENUM, PROP_NONE);
2374 RNA_def_property_enum_sdna(prop, NULL, "draw_as");
2375 RNA_def_property_enum_items(prop, part_draw_as_items);
2376 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_draw_as_itemf");
2377 RNA_def_property_ui_text(prop, "Particle Drawing", "How particles are drawn in viewport");
2378 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2380 prop = RNA_def_property(srna, "render_type", PROP_ENUM, PROP_NONE);
2381 RNA_def_property_enum_sdna(prop, NULL, "ren_as");
2382 RNA_def_property_enum_items(prop, part_ren_as_items);
2383 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_ren_as_itemf");
2384 RNA_def_property_ui_text(prop, "Particle Rendering", "How particles are rendered");
2385 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2387 prop = RNA_def_property(srna, "display_color", PROP_ENUM, PROP_NONE);
2388 RNA_def_property_enum_sdna(prop, NULL, "draw_col");
2389 RNA_def_property_enum_items(prop, draw_col_items);
2390 RNA_def_property_ui_text(prop, "Draw Color", "Draw additional particle data as a color");
2391 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2393 prop = RNA_def_property(srna, "display_size", PROP_FLOAT, PROP_NONE);
2394 RNA_def_property_float_sdna(prop, NULL, "draw_size");
2395 RNA_def_property_range(prop, 0, 1000);
2396 RNA_def_property_ui_range(prop, 0, 100, 1, -1);
2397 RNA_def_property_ui_text(prop, "Draw Size", "Size of particles on viewport in BU");
2398 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2400 prop = RNA_def_property(srna, "child_type", PROP_ENUM, PROP_NONE);
2401 RNA_def_property_enum_sdna(prop, NULL, "childtype");
2402 RNA_def_property_enum_items(prop, child_type_items);
2403 RNA_def_property_ui_text(prop, "Children From", "Create child particles");
2404 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2406 prop = RNA_def_property(srna, "display_step", PROP_INT, PROP_NONE);
2407 RNA_def_property_int_sdna(prop, NULL, "draw_step");
2408 RNA_def_property_range(prop, 0, 10);
2409 RNA_def_property_ui_range(prop, 0, 7, 1, -1);
2410 RNA_def_property_ui_text(prop, "Steps", "How many steps paths are drawn with (power of 2)");
2411 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2413 prop = RNA_def_property(srna, "render_step", PROP_INT, PROP_NONE);
2414 RNA_def_property_int_sdna(prop, NULL, "ren_step");
2415 RNA_def_property_range(prop, 0, 20);
2416 RNA_def_property_ui_range(prop, 0, 9, 1, -1);
2417 RNA_def_property_ui_text(prop, "Render", "How many steps paths are rendered with (power of 2)");
2419 prop = RNA_def_property(srna, "hair_step", PROP_INT, PROP_NONE);
2420 RNA_def_property_range(prop, 2, SHRT_MAX);
2421 RNA_def_property_ui_range(prop, 2, 50, 1, 1);
2422 RNA_def_property_ui_text(prop, "Segments", "Number of hair segments");
2423 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2425 prop = RNA_def_property(srna, "bending_random", PROP_FLOAT, PROP_NONE);
2426 RNA_def_property_float_sdna(prop, NULL, "bending_random");
2427 RNA_def_property_range(prop, 0.0f, 1.0f);
2428 RNA_def_property_ui_text(prop, "Random Bending Stiffness", "Random stiffness of hairs");
2429 RNA_def_property_update(prop, 0, "rna_Particle_cloth_update");
2431 /*TODO: not found in UI, readonly? */
2432 prop = RNA_def_property(srna, "keys_step", PROP_INT, PROP_NONE);
2433 RNA_def_property_range(prop, 0, SHRT_MAX); /*TODO:min,max */
2434 RNA_def_property_ui_text(prop, "Keys Step", "");
2436 /* adaptive path rendering */
2437 prop = RNA_def_property(srna, "adaptive_angle", PROP_INT, PROP_NONE);
2438 RNA_def_property_int_sdna(prop, NULL, "adapt_angle");
2439 RNA_def_property_range(prop, 0, 45);
2440 RNA_def_property_ui_text(prop, "Degrees", "How many degrees path has to curve to make another render segment");
2442 prop = RNA_def_property(srna, "adaptive_pixel", PROP_INT, PROP_NONE);
2443 RNA_def_property_int_sdna(prop, NULL, "adapt_pix");
2444 RNA_def_property_range(prop, 0, 50);
2445 RNA_def_property_ui_text(prop, "Pixel", "How many pixels path has to cover to make another render segment");
2447 prop = RNA_def_property(srna, "display_percentage", PROP_INT, PROP_PERCENTAGE);
2448 RNA_def_property_int_sdna(prop, NULL, "disp");
2449 RNA_def_property_range(prop, 0, 100);
2450 RNA_def_property_ui_text(prop, "Display", "Percentage of particles to display in 3D view");
2451 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2453 prop = RNA_def_property(srna, "material", PROP_INT, PROP_NONE);
2454 RNA_def_property_int_sdna(prop, NULL, "omat");
2455 RNA_def_property_range(prop, 1, 32767);
2456 RNA_def_property_ui_text(prop, "Material Index", "Index of material slot used for rendering particles");
2457 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2459 prop = RNA_def_property(srna, "material_slot", PROP_ENUM, PROP_NONE);
2460 RNA_def_property_enum_sdna(prop, NULL, "omat");
2461 RNA_def_property_enum_items(prop, part_mat_items);
2462 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_Material_itemf");
2463 RNA_def_property_ui_text(prop, "Material Slot", "Material slot used for rendering particles");
2464 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2466 prop = RNA_def_property(srna, "integrator", PROP_ENUM, PROP_NONE);
2467 RNA_def_property_enum_items(prop, integrator_type_items);
2468 RNA_def_property_ui_text(prop, "Integration",
2469 "Algorithm used to calculate physics, from the fastest to the "
2470 "most stable/accurate: Midpoint, Euler, Verlet, RK4 (Old)");
2471 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2473 prop = RNA_def_property(srna, "kink", PROP_ENUM, PROP_NONE);
2474 RNA_def_property_enum_items(prop, kink_type_items);
2475 RNA_def_property_ui_text(prop, "Kink", "Type of periodic offset on the path");
2476 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2478 prop = RNA_def_property(srna, "kink_axis", PROP_ENUM, PROP_NONE);
2479 RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
2480 RNA_def_property_ui_text(prop, "Axis", "Which axis to use for offset");
2481 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2484 prop = RNA_def_property(srna, "lock_billboard", PROP_BOOLEAN, PROP_NONE);
2485 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_BB_LOCK);
2486 RNA_def_property_ui_text(prop, "Lock Billboard", "Lock the billboards align axis");
2487 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2489 prop = RNA_def_property(srna, "billboard_align", PROP_ENUM, PROP_NONE);
2490 RNA_def_property_enum_sdna(prop, NULL, "bb_align");
2491 RNA_def_property_enum_items(prop, bb_align_items);
2492 RNA_def_property_ui_text(prop, "Align to", "In respect to what the billboards are aligned");
2493 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2495 prop = RNA_def_property(srna, "billboard_uv_split", PROP_INT, PROP_NONE);
2496 RNA_def_property_int_sdna(prop, NULL, "bb_uv_split");
2497 RNA_def_property_range(prop, 1, 100);
2498 RNA_def_property_ui_range(prop, 1, 10, 1, -1);
2499 RNA_def_property_ui_text(prop, "UV Split", "Number of rows/columns to split UV coordinates for billboards");
2501 prop = RNA_def_property(srna, "billboard_animation", PROP_ENUM, PROP_NONE);
2502 RNA_def_property_enum_sdna(prop, NULL, "bb_anim");
2503 RNA_def_property_enum_items(prop, bb_anim_items);
2504 RNA_def_property_ui_text(prop, "Animate", "How to animate billboard textures");
2506 prop = RNA_def_property(srna, "billboard_offset_split", PROP_ENUM, PROP_NONE);
2507 RNA_def_property_enum_sdna(prop, NULL, "bb_split_offset");
2508 RNA_def_property_enum_items(prop, bb_split_offset_items);
2509 RNA_def_property_ui_text(prop, "Offset", "How to offset billboard textures");
2511 prop = RNA_def_property(srna, "billboard_tilt", PROP_FLOAT, PROP_NONE);
2512 RNA_def_property_float_sdna(prop, NULL, "bb_tilt");
2513 RNA_def_property_range(prop, -1.0f, 1.0f);
2514 RNA_def_property_ui_text(prop, "Tilt", "Tilt of the billboards");
2515 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2517 prop = RNA_def_property(srna, "color_maximum", PROP_FLOAT, PROP_NONE);
2518 RNA_def_property_float_sdna(prop, NULL, "color_vec_max");
2519 RNA_def_property_range(prop, 0.01f, 100.0f);
2520 RNA_def_property_ui_text(prop, "Color Maximum", "Maximum length of the particle color vector");
2521 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2523 prop = RNA_def_property(srna, "billboard_tilt_random", PROP_FLOAT, PROP_NONE);
2524 RNA_def_property_float_sdna(prop, NULL, "bb_rand_tilt");
2525 RNA_def_property_range(prop, 0.0f, 1.0f);
2526 RNA_def_property_ui_text(prop, "Random Tilt", "Random tilt of the billboards");
2527 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2529 prop = RNA_def_property(srna, "billboard_offset", PROP_FLOAT, PROP_TRANSLATION);
2530 RNA_def_property_float_sdna(prop, NULL, "bb_offset");
2531 RNA_def_property_array(prop, 2);
2532 RNA_def_property_range(prop, -100.0f, 100.0f);
2533 RNA_def_property_ui_range(prop, -1.0, 1.0, 0.1, 3);
2534 RNA_def_property_ui_text(prop, "Billboard Offset", "");
2535 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2537 prop = RNA_def_property(srna, "billboard_size", PROP_FLOAT, PROP_FACTOR);
2538 RNA_def_property_float_sdna(prop, NULL, "bb_size");
2539 RNA_def_property_array(prop, 2);
2540 RNA_def_property_range(prop, 0.001f, 10.0f);
2541 RNA_def_property_ui_text(prop, "Billboard Scale", "Scale billboards relative to particle size");
2542 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2544 prop = RNA_def_property(srna, "billboard_velocity_head", PROP_FLOAT, PROP_FACTOR);
2545 RNA_def_property_float_sdna(prop, NULL, "bb_vel_head");
2546 RNA_def_property_range(prop, 0.0f, 10.0f);
2547 RNA_def_property_ui_text(prop, "Billboard Velocity Head", "Scale billboards by velocity");
2548 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2550 prop = RNA_def_property(srna, "billboard_velocity_tail", PROP_FLOAT, PROP_FACTOR);
2551 RNA_def_property_float_sdna(prop, NULL, "bb_vel_tail");
2552 RNA_def_property_range(prop, 0.0f, 10.0f);
2553 RNA_def_property_ui_text(prop, "Billboard Velocity Tail", "Scale billboards by velocity");
2554 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2556 /* general values */
2557 prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
2558 RNA_def_property_float_sdna(prop, NULL, "sta"); /*optional if prop names are the same */
2559 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
2560 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2561 RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_start_set", NULL);
2562 RNA_def_property_ui_text(prop, "Start", "Frame number to start emitting particles");
2563 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2565 prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
2566 RNA_def_property_float_sdna(prop, NULL, "end");
2567 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
2569 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2570 RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_end_set", NULL);
2571 RNA_def_property_ui_text(prop, "End", "Frame number to stop emitting particles");
2572 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2574 prop = RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
2575 RNA_def_property_range(prop, 1.0f, MAXFRAMEF);
2576 RNA_def_property_ui_text(prop, "Lifetime", "Life span of the particles");
2577 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2579 prop = RNA_def_property(srna, "lifetime_random", PROP_FLOAT, PROP_NONE);
2580 RNA_def_property_float_sdna(prop, NULL, "randlife");
2581 RNA_def_property_range(prop, 0.0f, 1.0f);
2582 RNA_def_property_ui_text(prop, "Random", "Give the particle life a random variation");
2583 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2585 prop = RNA_def_property(srna, "time_tweak", PROP_FLOAT, PROP_NONE);
2586 RNA_def_property_float_sdna(prop, NULL, "timetweak");
2587 RNA_def_property_range(prop, 0.0f, 100.0f);
2588 RNA_def_property_ui_range(prop, 0, 10, 1, 3);
2589 RNA_def_property_ui_text(prop, "Tweak", "A multiplier for physics timestep (1.0 means one frame = 1/25 seconds)");
2590 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2592 prop = RNA_def_property(srna, "timestep", PROP_FLOAT, PROP_NONE);
2593 RNA_def_property_float_funcs(prop, "rna_PartSettings_timestep_get", "rna_PartSetings_timestep_set", NULL);
2594 RNA_def_property_range(prop, 0.0001, 100.0);
2595 RNA_def_property_ui_range(prop, 0.01, 10, 1, 3);
2596 RNA_def_property_ui_text(prop, "Timestep", "The simulation timestep per frame (seconds per frame)");
2597 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2599 prop = RNA_def_property(srna, "use_adaptive_subframes", PROP_BOOLEAN, PROP_NONE);
2600 RNA_def_property_boolean_sdna(prop, NULL, "time_flag", PART_TIME_AUTOSF);
2601 RNA_def_property_ui_text(prop, "Automatic Subframes", "Automatically set the number of subframes");
2602 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2604 prop = RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE);
2605 RNA_def_property_range(prop, 0, 1000);
2606 RNA_def_property_ui_text(prop, "Subframes",
2607 "Subframes to simulate for improved stability and finer granularity simulations "
2608 "(dt = timestep / (subframes + 1))");
2609 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2611 prop = RNA_def_property(srna, "courant_target", PROP_FLOAT, PROP_NONE);
2612 RNA_def_property_range(prop, 0.0001, 10);
2613 RNA_def_property_float_default(prop, 0.1);
2614 RNA_def_property_ui_text(prop, "Adaptive Subframe Threshold",
2615 "The relative distance a particle can move before requiring more subframes "
2616 "(target Courant number); 0.01-0.3 is the recommended range");
2617 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2619 prop = RNA_def_property(srna, "jitter_factor", PROP_FLOAT, PROP_NONE);
2620 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2621 RNA_def_property_float_sdna(prop, NULL, "jitfac");
2622 RNA_def_property_range(prop, 0.0f, 2.0f);
2623 RNA_def_property_ui_text(prop, "Amount", "Amount of jitter applied to the sampling");
2624 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2626 prop = RNA_def_property(srna, "effect_hair", PROP_FLOAT, PROP_NONE);
2627 RNA_def_property_float_sdna(prop, NULL, "eff_hair");
2628 RNA_def_property_range(prop, 0.0f, 1.0f);
2629 RNA_def_property_ui_text(prop, "Stiffness", "Hair stiffness for effectors");
2630 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2632 prop = RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
2633 RNA_def_property_int_sdna(prop, NULL, "totpart");
2634 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2635 /* This limit is for those freaks who have the machine power to handle it. */
2636 /* 10M particles take around 2.2 Gb of memory / disk space in saved file and */
2637 /* each cached frame takes around 0.5 Gb of memory / disk space depending on cache mode. */
2638 RNA_def_property_range(prop, 0, 10000000);
2639 RNA_def_property_ui_range(prop, 0, 100000, 1, -1);
2640 RNA_def_property_ui_text(prop, "Number", "Total number of particles");
2641 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2643 prop = RNA_def_property(srna, "userjit", PROP_INT, PROP_UNSIGNED); /*TODO: can we get a better name for userjit? */
2644 RNA_def_property_int_sdna(prop, NULL, "userjit");
2645 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2646 RNA_def_property_range(prop, 0, 1000);
2647 RNA_def_property_ui_text(prop, "P/F", "Emission locations / face (0 = automatic)");
2648 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2650 prop = RNA_def_property(srna, "grid_resolution", PROP_INT, PROP_UNSIGNED);
2651 RNA_def_property_int_sdna(prop, NULL, "grid_res");
2652 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2653 RNA_def_property_range(prop, 1, 250); /* ~15M particles in a cube (ouch!), but could be very usable in a plane */
2654 RNA_def_property_ui_range(prop, 1, 50, 1, -1); /* ~100k particles in a cube */
2655 RNA_def_property_ui_text(prop, "Resolution", "The resolution of the particle grid");
2656 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2658 prop = RNA_def_property(srna, "grid_random", PROP_FLOAT, PROP_NONE);
2659 RNA_def_property_float_sdna(prop, NULL, "grid_rand");
2660 RNA_def_property_range(prop, 0.0f, 1.0f);
2661 RNA_def_property_ui_text(prop, "Grid Randomness", "Add random offset to the grid locations");
2662 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2664 prop = RNA_def_property(srna, "effector_amount", PROP_INT, PROP_UNSIGNED);
2665 /* in theory PROP_ANIMATABLE perhaps should be cleared, but animating this can give some interesting results! */
2666 RNA_def_property_range(prop, 0, 10000); /* 10000 effectors will bel SLOW, but who knows */
2667 RNA_def_property_ui_range(prop, 0, 100, 1, -1);
2668 RNA_def_property_ui_text(prop, "Effector Number", "How many particles are effectors (0 is all particles)");
2669 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2671 /* initial velocity factors */
2672 prop = RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_NONE);
2673 RNA_def_property_float_sdna(prop, NULL, "normfac"); /*optional if prop names are the same */
2674 RNA_def_property_range(prop, -1000.0f, 1000.0f);
2675 RNA_def_property_ui_range(prop, 0, 100, 1, 3);
2676 RNA_def_property_ui_text(prop, "Normal", "Let the surface normal give the particle a starting velocity");
2677 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2679 prop = RNA_def_property(srna, "object_factor", PROP_FLOAT, PROP_NONE);
2680 RNA_def_property_float_sdna(prop, NULL, "obfac");
2681 RNA_def_property_range(prop, -200.0f, 200.0f);
2682 RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
2683 RNA_def_property_ui_text(prop, "Object", "Let the object give the particle a starting velocity");
2684 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2686 prop = RNA_def_property(srna, "factor_random", PROP_FLOAT, PROP_NONE);
2687 RNA_def_property_float_sdna(prop, NULL, "randfac"); /*optional if prop names are the same */
2688 RNA_def_property_range(prop, 0.0f, 200.0f);
2689 RNA_def_property_ui_range(prop, 0, 100, 1, 3);
2690 RNA_def_property_ui_text(prop, "Random", "Give the starting velocity a random variation");
2691 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2693 prop = RNA_def_property(srna, "particle_factor", PROP_FLOAT, PROP_NONE);
2694 RNA_def_property_float_sdna(prop, NULL, "partfac");
2695 RNA_def_property_range(prop, -200.0f, 200.0f);
2696 RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
2697 RNA_def_property_ui_text(prop, "Particle", "Let the target particle give the particle a starting velocity");
2698 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2700 prop = RNA_def_property(srna, "tangent_factor", PROP_FLOAT, PROP_NONE);
2701 RNA_def_property_float_sdna(prop, NULL, "tanfac");
2702 RNA_def_property_range(prop, -1000.0f, 1000.0f);
2703 RNA_def_property_ui_range(prop, -100, 100, 1, 2);
2704 RNA_def_property_ui_text(prop, "Tangent", "Let the surface tangent give the particle a starting velocity");
2705 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2707 prop = RNA_def_property(srna, "tangent_phase", PROP_FLOAT, PROP_NONE);
2708 RNA_def_property_float_sdna(prop, NULL, "tanphase");
2709 RNA_def_property_range(prop, -1.0f, 1.0f);
2710 RNA_def_property_ui_text(prop, "Rot", "Rotate the surface tangent");
2711 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2713 prop = RNA_def_property(srna, "reactor_factor", PROP_FLOAT, PROP_NONE);
2714 RNA_def_property_float_sdna(prop, NULL, "reactfac");
2715 RNA_def_property_range(prop, -10.0f, 10.0f);
2716 RNA_def_property_ui_text(prop, "Reactor",
2717 "Let the vector away from the target particle's location give the particle "
2718 "a starting velocity");
2719 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2721 prop = RNA_def_property(srna, "object_align_factor", PROP_FLOAT, PROP_VELOCITY);
2722 RNA_def_property_float_sdna(prop, NULL, "ob_vel");
2723 RNA_def_property_array(prop, 3);
2724 RNA_def_property_range(prop, -200.0f, 200.0f);
2725 RNA_def_property_ui_range(prop, -100, 100, 1, 3);
2726 RNA_def_property_ui_text(prop, "Object Aligned",
2727 "Let the emitter object orientation give the particle a starting velocity");
2728 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2730 prop = RNA_def_property(srna, "angular_velocity_factor", PROP_FLOAT, PROP_NONE);
2731 RNA_def_property_float_sdna(prop, NULL, "avefac");
2732 RNA_def_property_range(prop, -200.0f, 200.0f);
2733 RNA_def_property_ui_range(prop, -100, 100, 10, 3);
2734 RNA_def_property_ui_text(prop, "Angular Velocity", "Angular velocity amount (in radians per second)");
2735 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2737 prop = RNA_def_property(srna, "phase_factor", PROP_FLOAT, PROP_NONE);
2738 RNA_def_property_float_sdna(prop, NULL, "phasefac");
2739 RNA_def_property_range(prop, -1.0f, 1.0f);
2740 RNA_def_property_ui_text(prop, "Phase", "Rotation around the chosen orientation axis");
2741 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2743 prop = RNA_def_property(srna, "rotation_factor_random", PROP_FLOAT, PROP_NONE);
2744 RNA_def_property_float_sdna(prop, NULL, "randrotfac");
2745 RNA_def_property_range(prop, 0.0f, 1.0f);
2746 RNA_def_property_ui_text(prop, "Random Orientation", "Randomize particle orientation");
2747 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2749 prop = RNA_def_property(srna, "phase_factor_random", PROP_FLOAT, PROP_NONE);
2750 RNA_def_property_float_sdna(prop, NULL, "randphasefac");
2751 RNA_def_property_range(prop, 0.0f, 2.0f);
2752 RNA_def_property_ui_text(prop, "Random Phase", "Randomize rotation around the chosen orientation axis");
2753 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2755 prop = RNA_def_property(srna, "hair_length", PROP_FLOAT, PROP_NONE);
2756 RNA_def_property_float_funcs(prop, "rna_PartSetting_hairlength_get", "rna_PartSetting_hairlength_set", NULL);
2757 RNA_def_property_range(prop, 0.0f, 1000.0f);
2758 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
2759 RNA_def_property_ui_text(prop, "Hair Length", "Length of the hair");
2760 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2762 /* physical properties */
2763 prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
2764 RNA_def_property_range(prop, 0.00000001f, 100000.0f);
2765 RNA_def_property_ui_range(prop, 0.01, 100, 1, 3);
2766 RNA_def_property_ui_text(prop, "Mass", "Mass of the particles");
2767 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2769 prop = RNA_def_property(srna, "particle_size", PROP_FLOAT, PROP_NONE);
2770 RNA_def_property_float_sdna(prop, NULL, "size");
2771 RNA_def_property_range(prop, 0.001f, 100000.0f);
2772 RNA_def_property_ui_range(prop, 0.01, 100, 1, 3);
2773 RNA_def_property_ui_text(prop, "Size", "The size of the particles");
2774 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2776 prop = RNA_def_property(srna, "size_random", PROP_FLOAT, PROP_NONE);
2777 RNA_def_property_float_sdna(prop, NULL, "randsize");
2778 RNA_def_property_range(prop, 0.0f, 1.0f);
2779 RNA_def_property_ui_text(prop, "Random Size", "Give the particle size a random variation");
2780 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2782 prop = RNA_def_property(srna, "collision_collection", PROP_POINTER, PROP_NONE);
2783 RNA_def_property_struct_type(prop, "Collection");
2784 RNA_def_property_pointer_sdna(prop, NULL, "collision_group");
2785 RNA_def_property_flag(prop, PROP_EDITABLE);
2786 RNA_def_property_ui_text(prop, "Collision Collection", "Limit colliders to this collection");
2787 RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
2789 /* global physical properties */
2790 prop = RNA_def_property(srna, "drag_factor", PROP_FLOAT, PROP_NONE);
2791 RNA_def_property_float_sdna(prop, NULL, "dragfac");
2792 RNA_def_property_range(prop, 0.0f, 1.0f);
2793 RNA_def_property_ui_text(prop, "Drag", "Amount of air-drag");
2794 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2796 prop = RNA_def_property(srna, "brownian_factor", PROP_FLOAT, PROP_NONE);
2797 RNA_def_property_float_sdna(prop, NULL, "brownfac");
2798 RNA_def_property_range(prop, 0.0f, 200.0f);
2799 RNA_def_property_ui_range(prop, 0, 20, 1, 3);
2800 RNA_def_property_ui_text(prop, "Brownian", "Amount of random, erratic particle movement");
2801 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2803 prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
2804 RNA_def_property_float_sdna(prop, NULL, "dampfac");
2805 RNA_def_property_range(prop, 0.0f, 1.0f);
2806 RNA_def_property_ui_text(prop, "Damp", "Amount of damping");
2807 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2810 prop = RNA_def_property(srna, "length_random", PROP_FLOAT, PROP_NONE);
2811 RNA_def_property_float_sdna(prop, NULL, "randlength");
2812 RNA_def_property_range(prop, 0.0f, 1.0f);
2813 RNA_def_property_ui_text(prop, "Random Length", "Give path length a random variation");
2814 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2817 prop = RNA_def_property(srna, "child_nbr", PROP_INT, PROP_NONE);
2818 RNA_def_property_int_sdna(prop, NULL, "child_nbr"); /*optional if prop names are the same */
2819 RNA_def_property_range(prop, 0, 100000);
2820 RNA_def_property_ui_range(prop, 0, 1000, 1, -1);
2821 RNA_def_property_ui_text(prop, "Children Per Parent", "Number of children/parent");
2822 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2824 prop = RNA_def_property(srna, "rendered_child_count", PROP_INT, PROP_NONE);
2825 RNA_def_property_int_sdna(prop, NULL, "ren_child_nbr");
2826 RNA_def_property_range(prop, 0, 100000);
2827 RNA_def_property_ui_range(prop, 0, 10000, 1, -1);
2828 RNA_def_property_ui_text(prop, "Rendered Children", "Number of children/parent for rendering");
2830 prop = RNA_def_property(srna, "virtual_parents", PROP_FLOAT, PROP_NONE);
2831 RNA_def_property_float_sdna(prop, NULL, "parents");
2832 RNA_def_property_range(prop, 0.0f, 1.0f);
2833 RNA_def_property_ui_text(prop, "Virtual Parents", "Relative amount of virtual parents");
2834 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2836 prop = RNA_def_property(srna, "child_size", PROP_FLOAT, PROP_NONE);
2837 RNA_def_property_float_sdna(prop, NULL, "childsize");
2838 RNA_def_property_range(prop, 0.001f, 100000.0f);
2839 RNA_def_property_ui_range(prop, 0.01f, 100.0f, 0.1, 3);
2840 RNA_def_property_ui_text(prop, "Child Size", "A multiplier for the child particle size");
2841 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2843 prop = RNA_def_property(srna, "child_size_random", PROP_FLOAT, PROP_NONE);
2844 RNA_def_property_float_sdna(prop, NULL, "childrandsize");
2845 RNA_def_property_range(prop, 0.0f, 1.0f);
2846 RNA_def_property_ui_text(prop, "Random Child Size", "Random variation to the size of the child particles");
2847 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2849 prop = RNA_def_property(srna, "child_radius", PROP_FLOAT, PROP_NONE);
2850 RNA_def_property_float_sdna(prop, NULL, "childrad");
2851 RNA_def_property_range(prop, 0.0f, 10.0f);
2852 RNA_def_property_ui_text(prop, "Child Radius", "Radius of children around parent");
2853 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2855 prop = RNA_def_property(srna, "child_roundness", PROP_FLOAT, PROP_NONE);
2856 RNA_def_property_float_sdna(prop, NULL, "childflat");
2857 RNA_def_property_range(prop, 0.0f, 1.0f);
2858 RNA_def_property_ui_text(prop, "Child Roundness", "Roundness of children around parent");
2859 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2862 prop = RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
2863 RNA_def_property_float_sdna(prop, NULL, "clumpfac");
2864 RNA_def_property_range(prop, -1.0f, 1.0f);
2865 RNA_def_property_ui_text(prop, "Clump", "Amount of clumping");
2866 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2868 prop = RNA_def_property(srna, "clump_shape", PROP_FLOAT, PROP_NONE);
2869 RNA_def_property_float_sdna(prop, NULL, "clumppow");
2870 RNA_def_property_range(prop, -0.999f, 0.999f);
2871 RNA_def_property_ui_text(prop, "Shape", "Shape of clumping");
2872 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2874 prop = RNA_def_property(srna, "use_clump_curve", PROP_BOOLEAN, PROP_NONE);
2875 RNA_def_property_boolean_sdna(prop, NULL, "child_flag", PART_CHILD_USE_CLUMP_CURVE);
2876 RNA_def_property_ui_text(prop, "Use Clump Curve", "Use a curve to define clump tapering");
2877 RNA_def_property_update(prop, 0, "rna_ParticleSettings_use_clump_curve_update");
2879 prop = RNA_def_property(srna, "clump_curve", PROP_POINTER, PROP_NONE);
2880 RNA_def_property_pointer_sdna(prop, NULL, "clumpcurve");
2881 RNA_def_property_struct_type(prop, "CurveMapping");
2882 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2883 RNA_def_property_ui_text(prop, "Clump Curve", "Curve defining clump tapering");
2884 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2886 prop = RNA_def_property(srna, "use_clump_noise", PROP_BOOLEAN, PROP_NONE);
2887 RNA_def_property_boolean_sdna(prop, NULL, "child_flag", PART_CHILD_USE_CLUMP_NOISE);
2888 RNA_def_property_ui_text(prop, "Use Clump Noise", "Create random clumps around the parent");
2889 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2891 prop = RNA_def_property(srna, "clump_noise_size", PROP_FLOAT, PROP_NONE);
2892 RNA_def_property_float_sdna(prop, NULL, "clump_noise_size");
2893 RNA_def_property_range(prop, 0.00001f, 100000.0f);
2894 RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1f, 3);
2895 RNA_def_property_ui_text(prop, "Clump Noise Size", "Size of clump noise");
2896 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2899 prop = RNA_def_property(srna, "kink_amplitude", PROP_FLOAT, PROP_NONE);
2900 RNA_def_property_float_sdna(prop, NULL, "kink_amp");
2901 RNA_def_property_range(prop, -100000.0f, 100000.0f);
2902 RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
2903 RNA_def_property_ui_text(prop, "Amplitude", "The amplitude of the offset");
2904 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2906 prop = RNA_def_property(srna, "kink_amplitude_clump", PROP_FLOAT, PROP_NONE);
2907 RNA_def_property_float_sdna(prop, NULL, "kink_amp_clump");
2908 RNA_def_property_range(prop, 0.0f, 1.0f);
2909 RNA_def_property_ui_text(prop, "Amplitude Clump", "How much clump affects kink amplitude");
2910 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2912 prop = RNA_def_property(srna, "kink_amplitude_random", PROP_FLOAT, PROP_NONE);
2913 RNA_def_property_float_sdna(prop, NULL, "kink_amp_random");
2914 RNA_def_property_range(prop, 0.0f, 1.0f);
2915 RNA_def_property_ui_text(prop, "Amplitude Random", "Random variation of the amplitude");
2916 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2918 prop = RNA_def_property(srna, "kink_frequency", PROP_FLOAT, PROP_NONE);
2919 RNA_def_property_float_sdna(prop, NULL, "kink_freq");
2920 RNA_def_property_range(prop, -100000.0f, 100000.0f);
2921 RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
2922 RNA_def_property_ui_text(prop, "Frequency", "The frequency of the offset (1/total length)");
2923 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2925 prop = RNA_def_property(srna, "kink_shape", PROP_FLOAT, PROP_NONE);
2926 RNA_def_property_range(prop, -0.999f, 0.999f);
2927 RNA_def_property_ui_text(prop, "Shape", "Adjust the offset to the beginning/end");
2928 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2930 prop = RNA_def_property(srna, "kink_flat", PROP_FLOAT, PROP_NONE);
2931 RNA_def_property_range(prop, 0.0f, 1.0f);
2932 RNA_def_property_ui_text(prop, "Flatness", "How flat the hairs are");
2933 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2935 prop = RNA_def_property(srna, "kink_extra_steps", PROP_INT, PROP_NONE);
2936 RNA_def_property_range(prop, 1, INT_MAX);
2937 RNA_def_property_ui_range(prop, 1, 100, 1, -1);
2938 RNA_def_property_ui_text(prop, "Extra Steps", "Extra steps for resolution of special kink features");
2939 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2941 prop = RNA_def_property(srna, "kink_axis_random", PROP_FLOAT, PROP_NONE);
2942 RNA_def_property_range(prop, 0.0f, 1.0f);
2943 RNA_def_property_ui_text(prop, "Axis Random", "Random variation of the orientation");
2944 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2947 prop = RNA_def_property(srna, "roughness_1", PROP_FLOAT, PROP_NONE);
2948 RNA_def_property_float_sdna(prop, NULL, "rough1");
2949 RNA_def_property_range(prop, 0.0f, 100000.0f);
2950 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
2951 RNA_def_property_ui_text(prop, "Rough1", "Amount of location dependent rough");
2952 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2954 prop = RNA_def_property(srna, "roughness_1_size", PROP_FLOAT, PROP_NONE);
2955 RNA_def_property_float_sdna(prop, NULL, "rough1_size");
2956 RNA_def_property_range(prop, 0.01f, 100000.0f);
2957 RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3);
2958 RNA_def_property_ui_text(prop, "Size1", "Size of location dependent rough");
2959 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2961 prop = RNA_def_property(srna, "roughness_2", PROP_FLOAT, PROP_NONE);
2962 RNA_def_property_float_sdna(prop, NULL, "rough2");
2963 RNA_def_property_range(prop, 0.0f, 100000.0f);
2964 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
2965 RNA_def_property_ui_text(prop, "Rough2", "Amount of random rough");
2966 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2968 prop = RNA_def_property(srna, "roughness_2_size", PROP_FLOAT, PROP_NONE);
2969 RNA_def_property_float_sdna(prop, NULL, "rough2_size");
2970 RNA_def_property_range(prop, 0.01f, 100000.0f);
2971 RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3);
2972 RNA_def_property_ui_text(prop, "Size2", "Size of random rough");
2973 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2975 prop = RNA_def_property(srna, "roughness_2_threshold", PROP_FLOAT, PROP_NONE);
2976 RNA_def_property_float_sdna(prop, NULL, "rough2_thres");
2977 RNA_def_property_range(prop, 0.0f, 1.0f);
2978 RNA_def_property_ui_text(prop, "Threshold", "Amount of particles left untouched by random rough");
2979 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2981 prop = RNA_def_property(srna, "roughness_endpoint", PROP_FLOAT, PROP_NONE);
2982 RNA_def_property_float_sdna(prop, NULL, "rough_end");
2983 RNA_def_property_range(prop, 0.0f, 100000.0f);
2984 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
2985 RNA_def_property_ui_text(prop, "Rough Endpoint", "Amount of end point rough");
2986 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2988 prop = RNA_def_property(srna, "roughness_end_shape", PROP_FLOAT, PROP_NONE);
2989 RNA_def_property_float_sdna(prop, NULL, "rough_end_shape");
2990 RNA_def_property_range(prop, 0.0f, 10.0f);
2991 RNA_def_property_ui_text(prop, "Shape", "Shape of end point rough");
2992 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2994 prop = RNA_def_property(srna, "use_roughness_curve", PROP_BOOLEAN, PROP_NONE);
2995 RNA_def_property_boolean_sdna(prop, NULL, "child_flag", PART_CHILD_USE_ROUGH_CURVE);
2996 RNA_def_property_ui_text(prop, "Use Roughness Curve", "Use a curve to define roughness");
2997 RNA_def_property_update(prop, 0, "rna_ParticleSettings_use_roughness_curve_update");
2999 prop = RNA_def_property(srna, "roughness_curve", PROP_POINTER, PROP_NONE);
3000 RNA_def_property_pointer_sdna(prop, NULL, "roughcurve");
3001 RNA_def_property_struct_type(prop, "CurveMapping");
3002 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
3003 RNA_def_property_ui_text(prop, "Roughness Curve", "Curve defining roughness");
3004 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3006 prop = RNA_def_property(srna, "child_length", PROP_FLOAT, PROP_NONE);
3007 RNA_def_property_float_sdna(prop, NULL, "clength");
3008 RNA_def_property_range(prop, 0.0f, 1.0f);
3009 RNA_def_property_ui_text(prop, "Length", "Length of child paths");
3010 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3012 prop = RNA_def_property(srna, "child_length_threshold", PROP_FLOAT, PROP_NONE);
3013 RNA_def_property_float_sdna(prop, NULL, "clength_thres");
3014 RNA_def_property_range(prop, 0.0f, 1.0f);
3015 RNA_def_property_ui_text(prop, "Threshold", "Amount of particles left untouched by child path length");
3016 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3019 prop = RNA_def_property(srna, "child_parting_factor", PROP_FLOAT, PROP_NONE);
3020 RNA_def_property_float_sdna(prop, NULL, "parting_fac");
3021 RNA_def_property_range(prop, 0.0f, 1.0f);
3022 RNA_def_property_ui_text(prop, "Parting Factor", "Create parting in the children based on parent strands");
3023 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3025 prop = RNA_def_property(srna, "child_parting_min", PROP_FLOAT, PROP_NONE);
3026 RNA_def_property_float_sdna(prop, NULL, "parting_min");
3027 RNA_def_property_range(prop, 0.0f, 180.0f);
3028 RNA_def_property_ui_text(prop, "Parting Minimum",
3029 "Minimum root to tip angle (tip distance/root distance for long hair)");
3030 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3032 prop = RNA_def_property(srna, "child_parting_max", PROP_FLOAT, PROP_NONE);
3033 RNA_def_property_float_sdna(prop, NULL, "parting_max");
3034 RNA_def_property_range(prop, 0.0f, 180.0f);
3035 RNA_def_property_ui_text(prop, "Parting Maximum",
3036 "Maximum root to tip angle (tip distance/root distance for long hair)");
3037 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3040 prop = RNA_def_property(srna, "branch_threshold", PROP_FLOAT, PROP_NONE);
3041 RNA_def_property_float_sdna(prop, NULL, "branch_thres");
3042 RNA_def_property_range(prop, 0.0f, 1.0f);
3043 RNA_def_property_ui_text(prop, "Threshold", "Threshold of branching");
3044 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
3047 prop = RNA_def_property(srna, "line_length_tail", PROP_FLOAT, PROP_NONE);
3048 RNA_def_property_float_funcs(prop, "rna_PartSetting_linelentail_get", "rna_PartSetting_linelentail_set", NULL);
3049 RNA_def_property_range(prop, 0.0f, 100000.0f);
3050 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
3051 RNA_def_property_ui_text(prop, "Tail", "Length of the line's tail");
3052 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3054 prop = RNA_def_property(srna, "line_length_head", PROP_FLOAT, PROP_NONE);
3055 RNA_def_property_float_funcs(prop, "rna_PartSetting_linelenhead_get", "rna_PartSetting_linelenhead_set", NULL);
3056 RNA_def_property_range(prop, 0.0f, 100000.0f);
3057 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
3058 RNA_def_property_ui_text(prop, "Head", "Length of the line's head");
3059 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3061 prop = RNA_def_property(srna, "path_start", PROP_FLOAT, PROP_NONE);
3062 RNA_def_property_float_sdna(prop, NULL, "path_start");
3063 RNA_def_property_float_funcs(prop, NULL, NULL, "rna_PartSetting_pathstartend_range");
3064 RNA_def_property_ui_text(prop, "Path Start", "Starting time of drawn path");
3065 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3067 prop = RNA_def_property(srna, "path_end", PROP_FLOAT, PROP_NONE);
3068 RNA_def_property_float_sdna(prop, NULL, "path_end");
3069 RNA_def_property_float_funcs(prop, NULL, NULL, "rna_PartSetting_pathstartend_range");
3070 RNA_def_property_ui_text(prop, "Path End", "End time of drawn path");
3071 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3073 prop = RNA_def_property(srna, "trail_count", PROP_INT, PROP_NONE);
3074 RNA_def_property_int_sdna(prop, NULL, "trail_count");
3075 RNA_def_property_range(prop, 1, 100000);
3076 RNA_def_property_ui_range(prop, 1, 100, 1, -1);
3077 RNA_def_property_ui_text(prop, "Trail Count", "Number of trail particles");
3078 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3080 /* keyed particles */
3081 prop = RNA_def_property(srna, "keyed_loops", PROP_INT, PROP_NONE);
3082 RNA_def_property_int_sdna(prop, NULL, "keyed_loops");
3083 RNA_def_property_range(prop, 1.0f, 10000.0f);
3084 RNA_def_property_ui_range(prop, 1.0f, 100.0f, 0.1, 3);
3085 RNA_def_property_ui_text(prop, "Loop count", "Number of times the keys are looped");
3086 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3088 /* modified dm support */
3089 prop = RNA_def_property(srna, "use_modifier_stack", PROP_BOOLEAN, PROP_NONE);
3090 RNA_def_property_boolean_sdna(prop, NULL, "use_modifier_stack", 0);
3091 RNA_def_property_ui_text(prop, "Use Modifier Stack", "Emit particles from mesh with modifiers applied "
3092 "(must use same subsurf level for viewport and render for correct results)");
3093 RNA_def_property_update(prop, 0, "rna_Particle_change_type");
3095 /* draw objects & collections */
3096 prop = RNA_def_property(srna, "instance_collection", PROP_POINTER, PROP_NONE);
3097 RNA_def_property_pointer_sdna(prop, NULL, "dup_group");
3098 RNA_def_property_struct_type(prop, "Collection");
3099 RNA_def_property_flag(prop, PROP_EDITABLE);
3100 RNA_def_property_ui_text(prop, "Dupli Collection", "Show Objects in this collection in place of particles");
3101 RNA_def_property_update(prop, 0, "rna_Particle_redo_count");
3103 prop = RNA_def_property(srna, "instance_weights", PROP_COLLECTION, PROP_NONE);
3104 RNA_def_property_collection_sdna(prop, NULL, "dupliweights", NULL);
3105 RNA_def_property_struct_type(prop, "ParticleDupliWeight");
3106 RNA_def_property_ui_text(prop, "Dupli Collection Weights", "Weights for all of the objects in the dupli collection");
3108 prop = RNA_def_property(srna, "active_instanceweight", PROP_POINTER, PROP_NONE);
3109 RNA_def_property_struct_type(prop, "ParticleDupliWeight");
3110 RNA_def_property_pointer_funcs(prop, "rna_ParticleDupliWeight_active_get", NULL, NULL, NULL);
3111 RNA_def_property_ui_text(prop, "Active Dupli Object", "");
3113 prop = RNA_def_property(srna, "active_instanceweight_index", PROP_INT, PROP_UNSIGNED);
3114 RNA_def_property_int_funcs(prop, "rna_ParticleDupliWeight_active_index_get",
3115 "rna_ParticleDupliWeight_active_index_set",
3116 "rna_ParticleDupliWeight_active_index_range");
3117 RNA_def_property_ui_text(prop, "Active Dupli Object Index", "");
3119 prop = RNA_def_property(srna, "instance_object", PROP_POINTER, PROP_NONE);
3120 RNA_def_property_pointer_sdna(prop, NULL, "dup_ob");
3121 RNA_def_property_struct_type(prop, "Object");
3122 RNA_def_property_flag(prop, PROP_EDITABLE);
3123 RNA_def_property_ui_text(prop, "Instance Object", "Show this Object in place of particles");
3124 RNA_def_property_update(prop, 0, "rna_Particle_redo_dependency");
3126 prop = RNA_def_property(srna, "billboard_object", PROP_POINTER, PROP_NONE);
3127 RNA_def_property_pointer_sdna(prop, NULL, "bb_ob");
3128 RNA_def_property_struct_type(prop, "Object");
3129 RNA_def_property_flag(prop, PROP_EDITABLE);
3130 RNA_def_property_ui_text(prop, "Billboard Object", "Billboards face this object (default is active camera)");
3131 RNA_def_property_update(prop, 0, "rna_Particle_redo");
3134 prop = RNA_def_property(srna, "boids", PROP_POINTER, PROP_NONE);
3135 RNA_def_property_struct_type(prop, "BoidSettings");
3136 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
3137 RNA_def_property_ui_text(prop, "Boid Settings", "");
3139 /* Fluid particles */
3140 prop = RNA_def_property(srna, "fluid", PROP_POINTER, PROP_NONE);
3141 RNA_def_property_struct_type(prop, "SPHFluidSettings");
3142 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
3143 RNA_def_property_ui_text(prop, "SPH Fluid Settings", "");
3145 /* Effector weights */
3146 prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
3147 RNA_def_property_struct_type(prop, "EffectorWeights");
3148 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
3149 RNA_def_property_ui_text(prop, "Effector Weights", "");
3151 /* animation here? */
3152 rna_def_animdata_common(srna);
3154 prop = RNA_def_property(srna, "force_field_1", PROP_POINTER, PROP_NONE);
3155 RNA_def_property_pointer_sdna(prop, NULL, "pd");
3156 RNA_def_property_struct_type(prop, "FieldSettings");
3157 RNA_def_property_pointer_funcs(prop, "rna_Particle_field1_get", NULL, NULL, NULL);
3158 RNA_def_property_ui_text(prop, "Force Field 1", "");
3160 prop = RNA_def_property(srna, "force_field_2", PROP_POINTER, PROP_NONE);
3161 RNA_def_property_pointer_sdna(prop, NULL, "pd2");
3162 RNA_def_property_struct_type(prop, "FieldSettings");
3163 RNA_def_property_pointer_funcs(prop, "rna_Particle_field2_get", NULL, NULL, NULL);
3164 RNA_def_property_ui_text(prop, "Force Field 2", "");
<