4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * Contributor(s): Blender Foundation (2008).
23 * Copyright 2011 AutoCRC
25 * ***** END GPL LICENSE BLOCK *****
28 /** \file blender/makesrna/intern/rna_particle.c
38 #include "RNA_define.h"
39 #include "RNA_enum_types.h"
41 #include "rna_internal.h"
43 #include "DNA_material_types.h"
44 #include "DNA_meshdata_types.h"
45 #include "DNA_modifier_types.h"
46 #include "DNA_cloth_types.h"
47 #include "DNA_particle_types.h"
48 #include "DNA_object_force.h"
49 #include "DNA_object_types.h"
50 #include "DNA_scene_types.h"
51 #include "DNA_boid_types.h"
52 #include "DNA_texture_types.h"
57 EnumPropertyItem part_from_items[] = {
58 {PART_FROM_VERT, "VERT", 0, "Verts", ""},
59 {PART_FROM_FACE, "FACE", 0, "Faces", ""},
60 {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
61 {0, NULL, 0, NULL, NULL}
64 EnumPropertyItem part_reactor_from_items[] = {
65 {PART_FROM_VERT, "VERT", 0, "Verts", ""},
66 {PART_FROM_FACE, "FACE", 0, "Faces", ""},
67 {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
68 {0, NULL, 0, NULL, NULL}
71 EnumPropertyItem part_dist_items[] = {
72 {PART_DISTR_JIT, "JIT", 0, "Jittered", ""},
73 {PART_DISTR_RAND, "RAND", 0, "Random", ""},
74 {PART_DISTR_GRID, "GRID", 0, "Grid", ""},
75 {0, NULL, 0, NULL, NULL}
78 EnumPropertyItem part_hair_dist_items[] = {
79 {PART_DISTR_JIT, "JIT", 0, "Jittered", ""},
80 {PART_DISTR_RAND, "RAND", 0, "Random", ""},
81 {0, NULL, 0, NULL, NULL}
84 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}
94 EnumPropertyItem part_hair_draw_as_items[] = {
95 {PART_DRAW_NOT, "NONE", 0, "None", ""},
96 {PART_DRAW_REND, "RENDER", 0, "Rendered", ""},
97 {PART_DRAW_PATH, "PATH", 0, "Path", ""},
98 {0, NULL, 0, NULL, NULL}
101 EnumPropertyItem part_ren_as_items[] = {
102 {PART_DRAW_NOT, "NONE", 0, "None", ""},
103 {PART_DRAW_HALO, "HALO", 0, "Halo", ""},
104 {PART_DRAW_LINE, "LINE", 0, "Line", ""},
105 {PART_DRAW_PATH, "PATH", 0, "Path", ""},
106 {PART_DRAW_OB, "OBJECT", 0, "Object", ""},
107 {PART_DRAW_GR, "GROUP", 0, "Group", ""},
108 {PART_DRAW_BB, "BILLBOARD", 0, "Billboard", ""},
109 {0, NULL, 0, NULL, NULL}
112 EnumPropertyItem part_hair_ren_as_items[] = {
113 {PART_DRAW_NOT, "NONE", 0, "None", ""},
114 {PART_DRAW_PATH, "PATH", 0, "Path", ""},
115 {PART_DRAW_OB, "OBJECT", 0, "Object", ""},
116 {PART_DRAW_GR, "GROUP", 0, "Group", ""},
117 {0, NULL, 0, NULL, NULL}
122 #include "BLI_math.h"
123 #include "BLI_listbase.h"
125 #include "BKE_context.h"
126 #include "BKE_cloth.h"
127 #include "BKE_deform.h"
128 #include "BKE_depsgraph.h"
129 #include "BKE_DerivedMesh.h"
130 #include "BKE_cdderivedmesh.h"
131 #include "BKE_effect.h"
132 #include "BKE_modifier.h"
133 #include "BKE_particle.h"
134 #include "BKE_pointcache.h"
135 #include "BKE_texture.h"
137 /* use for object space hair get/set */
138 static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, ParticleSystemModifierData **psmd_pt, ParticleData **pa_pt)
140 HairKey *hkey= (HairKey *)ptr->data;
141 Object *ob = (Object *)ptr->id.data;
143 ParticleSystemModifierData *psmd=NULL;
144 ParticleSystem *psys;
151 /* given the pointer HairKey *hkey, we iterate over all particles in all
152 * particle systems in the object "ob" in order to find
153 *- the ParticleSystemData to which the HairKey (and hence the particle)
154 * belongs (will be stored in psmd_pt)
155 *- the ParticleData to which the HairKey belongs (will be stored in pa_pt)
157 * not a very efficient way of getting hair key location data,
158 * but it's the best we've got at the present
160 * IDEAS: include additional information in pointerRNA beforehand,
161 * for example a pointer to the ParticleStstemModifierData to which the
165 for (md= ob->modifiers.first; md; md=md->next) {
166 if (md->type == eModifierType_ParticleSystem) {
167 psmd= (ParticleSystemModifierData *) md;
168 if (psmd && psmd->dm && psmd->psys) {
170 for(i= 0, pa= psys->particles; i < psys->totpart; i++, pa++) {
171 /* hairkeys are stored sequentially in memory, so we can
172 * find if it's the same particle by comparing pointers,
173 * without having to iterate over them all */
174 if ((hkey >= pa->hair) && (hkey < pa->hair + pa->totkey)) {
185 static void rna_ParticleHairKey_location_object_get(PointerRNA *ptr, float *values)
187 HairKey *hkey= (HairKey *)ptr->data;
188 Object *ob = (Object *)ptr->id.data;
189 ParticleSystemModifierData *psmd;
192 rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
195 DerivedMesh *hairdm = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_dm : NULL;
198 MVert *mvert = CDDM_get_vert(hairdm, pa->hair_index + (hkey - pa->hair));
199 copy_v3_v3(values, mvert->co);
203 psys_mat_hair_to_object(ob, psmd->dm, psmd->psys->part->from, pa, hairmat);
204 copy_v3_v3(values, hkey->co);
205 mul_m4_v3(hairmat, values);
213 static void rna_ParticleHairKey_location_object_set(PointerRNA *ptr, const float *values)
215 HairKey *hkey= (HairKey *)ptr->data;
216 Object *ob = (Object *)ptr->id.data;
217 ParticleSystemModifierData *psmd;
220 rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
223 DerivedMesh *hairdm = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_dm : NULL;
226 MVert *mvert = CDDM_get_vert(hairdm, pa->hair_index + (hkey - pa->hair));
227 copy_v3_v3(mvert->co, values);
233 psys_mat_hair_to_object(ob, psmd->dm, psmd->psys->part->from, pa, hairmat);
234 invert_m4_m4(imat, hairmat);
235 copy_v3_v3(hkey->co, values);
236 mul_m4_v3(imat, hkey->co);
244 /* property update functions */
245 static void particle_recalc(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr, short flag)
247 if(ptr->type==&RNA_ParticleSystem) {
248 ParticleSystem *psys = (ParticleSystem*)ptr->data;
252 DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
255 DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA|flag);
257 WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL);
259 static void rna_Particle_redo(Main *bmain, Scene *scene, PointerRNA *ptr)
261 particle_recalc(bmain, scene, ptr, PSYS_RECALC_REDO);
264 static void rna_Particle_redo_dependency(Main *bmain, Scene *scene, PointerRNA *ptr)
266 DAG_scene_sort(bmain, scene);
267 rna_Particle_redo(bmain, scene, ptr);
270 static void rna_Particle_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
272 particle_recalc(bmain, scene, ptr, PSYS_RECALC_RESET);
275 static void rna_Particle_change_type(Main *bmain, Scene *scene, PointerRNA *ptr)
277 particle_recalc(bmain, scene, ptr, PSYS_RECALC_RESET|PSYS_RECALC_TYPE);
280 static void rna_Particle_change_physics(Main *bmain, Scene *scene, PointerRNA *ptr)
282 particle_recalc(bmain, scene, ptr, PSYS_RECALC_RESET|PSYS_RECALC_PHYS);
285 static void rna_Particle_redo_child(Main *bmain, Scene *scene, PointerRNA *ptr)
287 particle_recalc(bmain, scene, ptr, PSYS_RECALC_CHILD);
290 static ParticleSystem *rna_particle_system_for_target(Object *ob, ParticleTarget *target)
292 ParticleSystem *psys;
295 for(psys=ob->particlesystem.first; psys; psys=psys->next)
296 for(pt=psys->targets.first; pt; pt=pt->next)
303 static void rna_Particle_target_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
305 if(ptr->type==&RNA_ParticleTarget) {
306 Object *ob = (Object*)ptr->id.data;
307 ParticleTarget *pt = (ParticleTarget*)ptr->data;
308 ParticleSystem *kpsys=NULL, *psys=rna_particle_system_for_target(ob, pt);
310 if(pt->ob==ob || pt->ob==NULL) {
311 kpsys = BLI_findlink(&ob->particlesystem, pt->psys-1);
314 pt->flag |= PTARGET_VALID;
316 pt->flag &= ~PTARGET_VALID;
320 kpsys = BLI_findlink(&pt->ob->particlesystem, pt->psys-1);
323 pt->flag |= PTARGET_VALID;
325 pt->flag &= ~PTARGET_VALID;
328 psys->recalc = PSYS_RECALC_RESET;
330 DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
331 DAG_scene_sort(bmain, scene);
334 WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL);
337 static void rna_Particle_target_redo(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
339 if(ptr->type==&RNA_ParticleTarget) {
340 Object *ob = (Object*)ptr->id.data;
341 ParticleTarget *pt = (ParticleTarget*)ptr->data;
342 ParticleSystem *psys = rna_particle_system_for_target(ob, pt);
344 psys->recalc = PSYS_RECALC_REDO;
346 DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
347 WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL);
351 static void rna_Particle_hair_dynamics(Main *bmain, Scene *scene, PointerRNA *ptr)
353 Object *ob = (Object*)ptr->id.data;
354 ParticleSystem *psys = (ParticleSystem*)ptr->data;
356 if(psys && !psys->clmd) {
357 psys->clmd = (ClothModifierData*)modifier_new(eModifierType_Cloth);
358 psys->clmd->sim_parms->goalspring = 0.0f;
359 psys->clmd->sim_parms->flags |= CLOTH_SIMSETTINGS_FLAG_GOAL|CLOTH_SIMSETTINGS_FLAG_NO_SPRING_COMPRESS;
360 psys->clmd->coll_parms->flags &= ~CLOTH_COLLSETTINGS_FLAG_SELF;
361 rna_Particle_redo(bmain, scene, ptr);
364 WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL);
366 DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
368 static PointerRNA rna_particle_settings_get(PointerRNA *ptr)
370 ParticleSystem *psys= (ParticleSystem*)ptr->data;
371 ParticleSettings *part = psys->part;
373 return rna_pointer_inherit_refine(ptr, &RNA_ParticleSettings, part);
376 static void rna_particle_settings_set(PointerRNA *ptr, PointerRNA value)
378 ParticleSystem *psys= (ParticleSystem*)ptr->data;
383 old_type = psys->part->type;
387 psys->part = (ParticleSettings *)value.data;
391 psys_check_boid_data(psys);
392 if(old_type != psys->part->type)
393 psys->recalc |= PSYS_RECALC_TYPE;
396 static void rna_Particle_abspathtime_update(Main *bmain, Scene *scene, PointerRNA *ptr)
398 ParticleSettings *settings = (ParticleSettings*)ptr->data;
399 float delta = settings->end + settings->lifetime - settings->sta;
400 if(settings->draw & PART_ABS_PATH_TIME) {
401 settings->path_start = settings->sta + settings->path_start * delta;
402 settings->path_end = settings->sta + settings->path_end * delta;
405 settings->path_start = (settings->path_start - settings->sta)/delta;
406 settings->path_end = (settings->path_end - settings->sta)/delta;
408 rna_Particle_redo(bmain, scene, ptr);
410 static void rna_PartSettings_start_set(struct PointerRNA *ptr, float value)
412 ParticleSettings *settings = (ParticleSettings*)ptr->data;
414 /* check for clipping */
415 if(value > settings->end)
416 value = settings->end;
418 //if(settings->type==PART_REACTOR && value < 1.0)
421 if (value < MINAFRAMEF)
424 settings->sta = value;
427 static void rna_PartSettings_end_set(struct PointerRNA *ptr, float value)
429 ParticleSettings *settings = (ParticleSettings*)ptr->data;
431 /* check for clipping */
432 if(value < settings->sta)
433 value = settings->sta;
435 settings->end = value;
438 static void rna_PartSetings_timestep_set(struct PointerRNA *ptr, float value)
440 ParticleSettings *settings = (ParticleSettings*)ptr->data;
442 settings->timetweak = value/0.04f;
445 static float rna_PartSettings_timestep_get(struct PointerRNA *ptr)
447 ParticleSettings *settings = (ParticleSettings*)ptr->data;
449 return settings->timetweak * 0.04f;
452 static void rna_PartSetting_hairlength_set(struct PointerRNA *ptr, float value)
454 ParticleSettings *settings = (ParticleSettings*)ptr->data;
455 settings->normfac = value / 4.f;
458 static float rna_PartSetting_hairlength_get(struct PointerRNA *ptr)
460 ParticleSettings *settings = (ParticleSettings*)ptr->data;
461 return settings->normfac * 4.f;
464 static void rna_PartSetting_linelentail_set(struct PointerRNA *ptr, float value)
466 ParticleSettings *settings = (ParticleSettings*)ptr->data;
467 settings->draw_line[0] = value;
470 static float rna_PartSetting_linelentail_get(struct PointerRNA *ptr)
472 ParticleSettings *settings = (ParticleSettings*)ptr->data;
473 return settings->draw_line[0];
475 static void rna_PartSetting_pathstartend_range(PointerRNA *ptr, float *min, float *max)
477 ParticleSettings *settings = (ParticleSettings*)ptr->data;
479 if(settings->type==PART_HAIR) {
481 *max = (settings->draw & PART_ABS_PATH_TIME) ? 100.0f : 1.0f;
484 *min = (settings->draw & PART_ABS_PATH_TIME) ? settings->sta : 0.0f;
485 *max= (settings->draw & PART_ABS_PATH_TIME) ? MAXFRAMEF : 1.0f;
488 static void rna_PartSetting_linelenhead_set(struct PointerRNA *ptr, float value)
490 ParticleSettings *settings = (ParticleSettings*)ptr->data;
491 settings->draw_line[1] = value;
494 static float rna_PartSetting_linelenhead_get(struct PointerRNA *ptr)
496 ParticleSettings *settings = (ParticleSettings*)ptr->data;
497 return settings->draw_line[1];
501 static int rna_PartSettings_is_fluid_get(PointerRNA *ptr)
503 ParticleSettings *part= (ParticleSettings*)ptr->data;
505 return part->type == PART_FLUID;
508 static PointerRNA rna_ParticleSystem_active_particle_target_get(PointerRNA *ptr)
510 ParticleSystem *psys= (ParticleSystem*)ptr->data;
511 ParticleTarget *pt = psys->targets.first;
513 for(; pt; pt=pt->next) {
514 if(pt->flag & PTARGET_CURRENT)
515 return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, pt);
517 return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, NULL);
519 static void rna_ParticleSystem_active_particle_target_index_range(PointerRNA *ptr, int *min, int *max)
521 ParticleSystem *psys= (ParticleSystem*)ptr->data;
523 *max= BLI_countlist(&psys->targets)-1;
527 static int rna_ParticleSystem_active_particle_target_index_get(PointerRNA *ptr)
529 ParticleSystem *psys= (ParticleSystem*)ptr->data;
530 ParticleTarget *pt = psys->targets.first;
533 for(; pt; pt=pt->next, i++)
534 if(pt->flag & PTARGET_CURRENT)
540 static void rna_ParticleSystem_active_particle_target_index_set(struct PointerRNA *ptr, int value)
542 ParticleSystem *psys= (ParticleSystem*)ptr->data;
543 ParticleTarget *pt = psys->targets.first;
546 for(; pt; pt=pt->next, i++) {
548 pt->flag |= PTARGET_CURRENT;
550 pt->flag &= ~PTARGET_CURRENT;
553 static int rna_ParticleTarget_name_length(PointerRNA *ptr)
555 ParticleTarget *pt= ptr->data;
557 if(pt->flag & PTARGET_VALID) {
558 ParticleSystem *psys = NULL;
561 psys = BLI_findlink(&pt->ob->particlesystem, pt->psys-1);
563 Object *ob = (Object*) ptr->id.data;
564 psys = BLI_findlink(&ob->particlesystem, pt->psys-1);
569 return strlen(pt->ob->id.name+2) + 2 + strlen(psys->name);
571 return strlen(psys->name);
580 static void rna_ParticleTarget_name_get(PointerRNA *ptr, char *str)
582 ParticleTarget *pt= ptr->data;
584 if(pt->flag & PTARGET_VALID) {
585 ParticleSystem *psys = NULL;
588 psys = BLI_findlink(&pt->ob->particlesystem, pt->psys-1);
590 Object *ob = (Object*) ptr->id.data;
591 psys = BLI_findlink(&ob->particlesystem, pt->psys-1);
596 sprintf(str, "%s: %s", pt->ob->id.name+2, psys->name);
598 strcpy(str, psys->name);
601 strcpy(str, "Invalid target!");
604 strcpy(str, "Invalid target!");
607 static int particle_id_check(PointerRNA *ptr)
609 ID *id= ptr->id.data;
611 return (GS(id->name) == ID_PA);
614 static char *rna_SPHFluidSettings_path(PointerRNA *ptr)
616 SPHFluidSettings *fluid = (SPHFluidSettings *)ptr->data;
618 if(particle_id_check(ptr)) {
619 ParticleSettings *part = (ParticleSettings*)ptr->id.data;
621 if (part->fluid == fluid)
622 return BLI_sprintfN("fluid");
627 static int rna_ParticleSystem_multiple_caches_get(PointerRNA *ptr)
629 ParticleSystem *psys= (ParticleSystem*)ptr->data;
631 return (psys->ptcaches.first != psys->ptcaches.last);
633 static int rna_ParticleSystem_editable_get(PointerRNA *ptr)
635 ParticleSystem *psys= (ParticleSystem*)ptr->data;
637 return psys_check_edited(psys);
639 static int rna_ParticleSystem_edited_get(PointerRNA *ptr)
641 ParticleSystem *psys= (ParticleSystem*)ptr->data;
643 if(psys->part && psys->part->type==PART_HAIR)
644 return (psys->flag & PSYS_EDITED || (psys->edit && psys->edit->edited));
646 return (psys->pointcache->edit && psys->pointcache->edit->edited);
648 static PointerRNA rna_ParticleDupliWeight_active_get(PointerRNA *ptr)
650 ParticleSettings *part= (ParticleSettings*)ptr->id.data;
651 ParticleDupliWeight *dw = part->dupliweights.first;
653 for(; dw; dw=dw->next) {
654 if(dw->flag & PART_DUPLIW_CURRENT)
655 return rna_pointer_inherit_refine(ptr, &RNA_ParticleDupliWeight, dw);
657 return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, NULL);
659 static void rna_ParticleDupliWeight_active_index_range(PointerRNA *ptr, int *min, int *max)
661 ParticleSettings *part= (ParticleSettings*)ptr->id.data;
663 *max= BLI_countlist(&part->dupliweights)-1;
667 static int rna_ParticleDupliWeight_active_index_get(PointerRNA *ptr)
669 ParticleSettings *part= (ParticleSettings*)ptr->id.data;
670 ParticleDupliWeight *dw = part->dupliweights.first;
673 for(; dw; dw=dw->next, i++)
674 if(dw->flag & PART_DUPLIW_CURRENT)
680 static void rna_ParticleDupliWeight_active_index_set(struct PointerRNA *ptr, int value)
682 ParticleSettings *part= (ParticleSettings*)ptr->id.data;
683 ParticleDupliWeight *dw = part->dupliweights.first;
686 for(; dw; dw=dw->next, i++) {
688 dw->flag |= PART_DUPLIW_CURRENT;
690 dw->flag &= ~PART_DUPLIW_CURRENT;
694 static int rna_ParticleDupliWeight_name_length(PointerRNA *ptr)
696 ParticleDupliWeight *dw= ptr->data;
699 return strlen(dw->ob->id.name+2) + 7;
704 static void rna_ParticleDupliWeight_name_get(PointerRNA *ptr, char *str)
706 ParticleDupliWeight *dw= ptr->data;
709 sprintf(str, "%s: %i", dw->ob->id.name+2, dw->count);
711 strcpy(str, "No object");
714 static EnumPropertyItem *rna_Particle_from_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *UNUSED(free))
716 //if(part->type==PART_REACTOR)
717 // return part_reactor_from_items;
719 return part_from_items;
722 static EnumPropertyItem *rna_Particle_dist_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
724 ParticleSettings *part = ptr->id.data;
726 if(part->type==PART_HAIR)
727 return part_hair_dist_items;
729 return part_dist_items;
732 static EnumPropertyItem *rna_Particle_draw_as_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
734 ParticleSettings *part = ptr->id.data;
736 if(part->type==PART_HAIR)
737 return part_hair_draw_as_items;
739 return part_draw_as_items;
742 static EnumPropertyItem *rna_Particle_ren_as_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
744 ParticleSettings *part = ptr->id.data;
746 if(part->type==PART_HAIR)
747 return part_hair_ren_as_items;
749 return part_ren_as_items;
752 static PointerRNA rna_Particle_field1_get(PointerRNA *ptr)
754 ParticleSettings *part= (ParticleSettings*)ptr->id.data;
758 part->pd= object_add_collision_fields(0);
760 return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd);
763 static PointerRNA rna_Particle_field2_get(PointerRNA *ptr)
765 ParticleSettings *part= (ParticleSettings*)ptr->id.data;
769 part->pd2= object_add_collision_fields(0);
771 return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd2);
774 static void psys_vg_name_get__internal(PointerRNA *ptr, char *value, int index)
776 Object *ob= ptr->id.data;
777 ParticleSystem *psys= (ParticleSystem*)ptr->data;
779 if(psys->vgroup[index] > 0) {
780 bDeformGroup *defGroup= BLI_findlink(&ob->defbase, psys->vgroup[index]-1);
783 strcpy(value, defGroup->name);
790 static int psys_vg_name_len__internal(PointerRNA *ptr, int index)
792 Object *ob= ptr->id.data;
793 ParticleSystem *psys= (ParticleSystem*)ptr->data;
795 if(psys->vgroup[index] > 0) {
796 bDeformGroup *defGroup= BLI_findlink(&ob->defbase, psys->vgroup[index]-1);
799 return strlen(defGroup->name);
804 static void psys_vg_name_set__internal(PointerRNA *ptr, const char *value, int index)
806 Object *ob= ptr->id.data;
807 ParticleSystem *psys= (ParticleSystem*)ptr->data;
810 psys->vgroup[index]= 0;
813 int vgroup_num = defgroup_name_index(ob, (char*)value);
818 psys->vgroup[index]= vgroup_num + 1;
822 static char *rna_ParticleSystem_path(PointerRNA *ptr)
824 ParticleSystem *psys= (ParticleSystem*)ptr->data;
825 return BLI_sprintfN("particle_systems[\"%s\"]", psys->name);
828 static void rna_ParticleSettings_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
830 ParticleSettings *part= (ParticleSettings*)ptr->data;
831 rna_iterator_array_begin(iter, (void*)part->mtex, sizeof(MTex*), MAX_MTEX, 0, NULL);
834 static PointerRNA rna_ParticleSettings_active_texture_get(PointerRNA *ptr)
836 ParticleSettings *part= (ParticleSettings*)ptr->data;
839 tex= give_current_particle_texture(part);
840 return rna_pointer_inherit_refine(ptr, &RNA_Texture, tex);
843 static void rna_ParticleSettings_active_texture_set(PointerRNA *ptr, PointerRNA value)
845 ParticleSettings *part= (ParticleSettings*)ptr->data;
847 set_current_particle_texture(part, value.data);
850 /* irritating string functions for each index :/ */
851 static void rna_ParticleVGroup_name_get_0(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 0); }
852 static void rna_ParticleVGroup_name_get_1(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 1); }
853 static void rna_ParticleVGroup_name_get_2(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 2); }
854 static void rna_ParticleVGroup_name_get_3(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 3); }
855 static void rna_ParticleVGroup_name_get_4(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 4); }
856 static void rna_ParticleVGroup_name_get_5(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 5); }
857 static void rna_ParticleVGroup_name_get_6(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 6); }
858 static void rna_ParticleVGroup_name_get_7(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 7); }
859 static void rna_ParticleVGroup_name_get_8(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 8); }
860 static void rna_ParticleVGroup_name_get_9(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 9); }
861 static void rna_ParticleVGroup_name_get_10(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 10); }
862 static void rna_ParticleVGroup_name_get_11(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 11); }
864 static int rna_ParticleVGroup_name_len_0(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 0); }
865 static int rna_ParticleVGroup_name_len_1(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 1); }
866 static int rna_ParticleVGroup_name_len_2(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 2); }
867 static int rna_ParticleVGroup_name_len_3(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 3); }
868 static int rna_ParticleVGroup_name_len_4(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 4); }
869 static int rna_ParticleVGroup_name_len_5(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 5); }
870 static int rna_ParticleVGroup_name_len_6(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 6); }
871 static int rna_ParticleVGroup_name_len_7(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 7); }
872 static int rna_ParticleVGroup_name_len_8(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 8); }
873 static int rna_ParticleVGroup_name_len_9(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 9); }
874 static int rna_ParticleVGroup_name_len_10(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 10); }
875 static int rna_ParticleVGroup_name_len_11(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 11); }
877 static void rna_ParticleVGroup_name_set_0(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 0); }
878 static void rna_ParticleVGroup_name_set_1(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 1); }
879 static void rna_ParticleVGroup_name_set_2(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 2); }
880 static void rna_ParticleVGroup_name_set_3(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 3); }
881 static void rna_ParticleVGroup_name_set_4(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 4); }
882 static void rna_ParticleVGroup_name_set_5(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 5); }
883 static void rna_ParticleVGroup_name_set_6(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 6); }
884 static void rna_ParticleVGroup_name_set_7(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 7); }
885 static void rna_ParticleVGroup_name_set_8(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 8); }
886 static void rna_ParticleVGroup_name_set_9(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 9); }
887 static void rna_ParticleVGroup_name_set_10(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 10); }
888 static void rna_ParticleVGroup_name_set_11(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 11); }
893 static void rna_def_particle_hair_key(BlenderRNA *brna)
898 srna = RNA_def_struct(brna, "ParticleHairKey", NULL);
899 RNA_def_struct_sdna(srna, "HairKey");
900 RNA_def_struct_ui_text(srna, "Particle Hair Key", "Particle key for hair particle system");
902 prop= RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
903 RNA_def_property_ui_text(prop, "Time", "Relative time of key over hair length");
905 prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_UNSIGNED);
906 RNA_def_property_range(prop, 0.0, 1.0);
907 RNA_def_property_ui_text(prop, "Weight", "Weight for cloth simulation");
909 prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
910 RNA_def_property_array(prop, 3);
911 RNA_def_property_ui_text(prop, "Location (Object Space)", "Location of the hair key in object space");
912 RNA_def_property_float_funcs(prop, "rna_ParticleHairKey_location_object_get", "rna_ParticleHairKey_location_object_set", NULL);
914 prop= RNA_def_property(srna, "co_hair_space", PROP_FLOAT, PROP_TRANSLATION);
915 RNA_def_property_float_sdna(prop, NULL, "co");
916 RNA_def_property_ui_text(prop, "Location", "Location of the hair key in its internal coordinate system, relative to the emitting face");
919 static void rna_def_particle_key(BlenderRNA *brna)
924 srna = RNA_def_struct(brna, "ParticleKey", NULL);
925 RNA_def_struct_ui_text(srna, "Particle Key", "Key location for a particle over time");
927 prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
928 RNA_def_property_float_sdna(prop, NULL, "co");
929 RNA_def_property_ui_text(prop, "Location", "Key location");
931 prop= RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
932 RNA_def_property_float_sdna(prop, NULL, "vel");
933 RNA_def_property_ui_text(prop, "Velocity", "Key velocity");
935 prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
936 RNA_def_property_float_sdna(prop, NULL, "rot");
937 RNA_def_property_ui_text(prop, "Rotation", "Key rotation quaternion");
939 prop= RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
940 RNA_def_property_float_sdna(prop, NULL, "ave");
941 RNA_def_property_ui_text(prop, "Angular Velocity", "Key angular velocity");
943 prop= RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
944 RNA_def_property_ui_text(prop, "Time", "Time of key over the simulation");
947 static void rna_def_child_particle(BlenderRNA *brna)
952 srna = RNA_def_struct(brna, "ChildParticle", NULL);
953 RNA_def_struct_ui_text(srna, "Child Particle", "Child particle interpolated from simulated or edited particles");
955 // int num, parent; /* num is face index on the final derived mesh */
957 // int pa[4]; /* nearest particles to the child, used for the interpolation */
958 // float w[4]; /* interpolation weights for the above particles */
959 // float fuv[4], foffset; /* face vertex weights and offset */
963 static void rna_def_particle(BlenderRNA *brna)
968 static EnumPropertyItem alive_items[] = {
969 //{PARS_KILLED, "KILLED", 0, "Killed", ""},
970 {PARS_DEAD, "DEAD", 0, "Dead", ""},
971 {PARS_UNBORN, "UNBORN", 0, "Unborn", ""},
972 {PARS_ALIVE, "ALIVE", 0, "Alive", ""},
973 {PARS_DYING, "DYING", 0, "Dying", ""},
974 {0, NULL, 0, NULL, NULL}
977 srna = RNA_def_struct(brna, "Particle", NULL);
978 RNA_def_struct_sdna(srna, "ParticleData");
979 RNA_def_struct_ui_text(srna, "Particle", "Particle in a particle system");
981 /* Particle State & Previous State */
982 prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
983 RNA_def_property_float_sdna(prop, NULL, "state.co");
984 RNA_def_property_ui_text(prop, "Particle Location", "");
986 prop= RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
987 RNA_def_property_float_sdna(prop, NULL, "state.vel");
988 RNA_def_property_ui_text(prop, "Particle Velocity", "");
990 prop= RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
991 RNA_def_property_float_sdna(prop, NULL, "state.ave");
992 RNA_def_property_ui_text(prop, "Angular Velocity", "");
994 prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
995 RNA_def_property_float_sdna(prop, NULL, "state.rot");
996 RNA_def_property_ui_text(prop, "Rotation", "");
998 prop= RNA_def_property(srna, "prev_location", PROP_FLOAT, PROP_TRANSLATION);
999 RNA_def_property_float_sdna(prop, NULL, "prev_state.co");
1000 RNA_def_property_ui_text(prop, "Previous Particle Location", "");
1002 prop= RNA_def_property(srna, "prev_velocity", PROP_FLOAT, PROP_VELOCITY);
1003 RNA_def_property_float_sdna(prop, NULL, "prev_state.vel");
1004 RNA_def_property_ui_text(prop, "Previous Particle Velocity", "");
1006 prop= RNA_def_property(srna, "prev_angular_velocity", PROP_FLOAT, PROP_VELOCITY);
1007 RNA_def_property_float_sdna(prop, NULL, "prev_state.ave");
1008 RNA_def_property_ui_text(prop, "Previous Angular Velocity", "");
1010 prop= RNA_def_property(srna, "prev_rotation", PROP_FLOAT, PROP_QUATERNION);
1011 RNA_def_property_float_sdna(prop, NULL, "prev_state.rot");
1012 RNA_def_property_ui_text(prop, "Previous Rotation", "");
1014 /* Hair & Keyed Keys */
1016 prop= RNA_def_property(srna, "hair_keys", PROP_COLLECTION, PROP_NONE);
1017 RNA_def_property_collection_sdna(prop, NULL, "hair", "totkey");
1018 RNA_def_property_struct_type(prop, "ParticleHairKey");
1019 RNA_def_property_ui_text(prop, "Hair", "");
1021 prop= RNA_def_property(srna, "particle_keys", PROP_COLLECTION, PROP_NONE);
1022 RNA_def_property_collection_sdna(prop, NULL, "keys", "totkey");
1023 RNA_def_property_struct_type(prop, "ParticleKey");
1024 RNA_def_property_ui_text(prop, "Keyed States", "");
1026 // float fuv[4], foffset; /* coordinates on face/edge number "num" and depth along*/
1027 // /* face normal for volume emission */
1029 prop= RNA_def_property(srna, "birth_time", PROP_FLOAT, PROP_TIME);
1030 RNA_def_property_float_sdna(prop, NULL, "time");
1031 // RNA_def_property_range(prop, lowerLimitf, upperLimitf);
1032 RNA_def_property_ui_text(prop, "Birth Time", "");
1034 prop= RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
1035 // RNA_def_property_range(prop, lowerLimitf, upperLimitf);
1036 RNA_def_property_ui_text(prop, "Lifetime", "");
1038 prop= RNA_def_property(srna, "die_time", PROP_FLOAT, PROP_TIME);
1039 RNA_def_property_float_sdna(prop, NULL, "dietime");
1040 // RNA_def_property_range(prop, lowerLimitf, upperLimitf);
1041 RNA_def_property_ui_text(prop, "Die Time", "");
1043 prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
1044 // RNA_def_property_range(prop, lowerLimitf, upperLimitf);
1045 RNA_def_property_ui_text(prop, "Size", "");
1048 // int num; /* index to vert/edge/face */
1049 // int num_dmcache; /* index to derived mesh data (face) to avoid slow lookups */
1055 prop= RNA_def_property(srna, "is_exist", PROP_BOOLEAN, PROP_NONE);
1056 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PARS_UNEXIST);
1057 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1058 RNA_def_property_ui_text(prop, "Exists", "");
1060 prop= RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE);
1061 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PARS_NO_DISP);
1062 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1063 RNA_def_property_ui_text(prop, "Visible", "");
1065 prop= RNA_def_property(srna, "alive_state", PROP_ENUM, PROP_NONE);
1066 RNA_def_property_enum_sdna(prop, NULL, "alive");
1067 RNA_def_property_enum_items(prop, alive_items);
1068 RNA_def_property_ui_text(prop, "Alive State", "");
1073 static void rna_def_particle_dupliweight(BlenderRNA *brna)
1078 srna = RNA_def_struct(brna, "ParticleDupliWeight", NULL);
1079 RNA_def_struct_ui_text(srna, "Particle Dupliobject Weight", "Weight of a particle dupliobject in a group");
1080 RNA_def_struct_sdna(srna, "ParticleDupliWeight");
1082 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1083 RNA_def_property_string_funcs(prop, "rna_ParticleDupliWeight_name_get", "rna_ParticleDupliWeight_name_length", NULL);
1084 RNA_def_property_ui_text(prop, "Name", "Particle dupliobject name");
1085 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1086 RNA_def_struct_name_property(srna, prop);
1088 prop= RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
1089 RNA_def_property_range(prop, 0, SHRT_MAX);
1090 RNA_def_property_ui_text(prop, "Count", "The number of times this object is repeated with respect to other objects");
1091 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1094 static void rna_def_fluid_settings(BlenderRNA *brna)
1099 srna = RNA_def_struct(brna, "SPHFluidSettings", NULL);
1100 RNA_def_struct_path_func(srna, "rna_SPHFluidSettings_path");
1101 RNA_def_struct_ui_text(srna, "SPH Fluid Settings", "Settings for particle fluids physics");
1103 /* Fluid settings */
1104 prop= RNA_def_property(srna, "spring_force", PROP_FLOAT, PROP_NONE);
1105 RNA_def_property_float_sdna(prop, NULL, "spring_k");
1106 RNA_def_property_range(prop, 0.0f, 100.0f);
1107 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
1108 RNA_def_property_ui_text(prop, "Spring Force", "Spring force");
1109 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1111 prop= RNA_def_property(srna, "fluid_radius", PROP_FLOAT, PROP_NONE);
1112 RNA_def_property_float_sdna(prop, NULL, "radius");
1113 RNA_def_property_range(prop, 0.0f, 20.0f);
1114 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
1115 RNA_def_property_ui_text(prop, "Interaction Radius", "Fluid interaction radius");
1116 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1118 prop= RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_NONE);
1119 RNA_def_property_range(prop, 0.0f, 2.0f);
1120 RNA_def_property_ui_text(prop, "Rest Length", "Spring rest length (factor of particle radius)");
1121 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1123 prop= RNA_def_property(srna, "use_viscoelastic_springs", PROP_BOOLEAN, PROP_NONE);
1124 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_VISCOELASTIC_SPRINGS);
1125 RNA_def_property_ui_text(prop, "Viscoelastic Springs", "Use viscoelastic springs instead of Hooke's springs");
1126 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1128 prop= RNA_def_property(srna, "use_initial_rest_length", PROP_BOOLEAN, PROP_NONE);
1129 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_CURRENT_REST_LENGTH);
1130 RNA_def_property_ui_text(prop, "Initial Rest Length", "Use the initial length as spring rest length instead of 2 * particle size");
1131 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1133 prop= RNA_def_property(srna, "plasticity", PROP_FLOAT, PROP_NONE);
1134 RNA_def_property_float_sdna(prop, NULL, "plasticity_constant");
1135 RNA_def_property_range(prop, 0.0f, 100.0f);
1136 RNA_def_property_ui_text(prop, "Plasticity", "How much the spring rest length can change after the elastic limit is crossed");
1137 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1139 prop= RNA_def_property(srna, "yield_ratio", PROP_FLOAT, PROP_NONE);
1140 RNA_def_property_float_sdna(prop, NULL, "yield_ratio");
1141 RNA_def_property_range(prop, 0.0f, 1.0f);
1142 RNA_def_property_ui_text(prop, "Elastic Limit", "How much the spring has to be stretched/compressed in order to change it's rest length");
1143 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1145 prop= RNA_def_property(srna, "spring_frames", PROP_INT, PROP_NONE);
1146 RNA_def_property_range(prop, 0.0f, 100.0f);
1147 RNA_def_property_ui_text(prop, "Spring Frames", "Create springs for this number of frames since particles birth (0 is always)");
1148 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1151 prop= RNA_def_property(srna, "linear_viscosity", PROP_FLOAT, PROP_NONE);
1152 RNA_def_property_float_sdna(prop, NULL, "viscosity_omega");
1153 RNA_def_property_range(prop, 0.0f, 100.0f);
1154 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
1155 RNA_def_property_ui_text(prop, "Viscosity", "Linear viscosity");
1156 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1158 prop= RNA_def_property(srna, "stiff_viscosity", PROP_FLOAT, PROP_NONE);
1159 RNA_def_property_float_sdna(prop, NULL, "viscosity_beta");
1160 RNA_def_property_range(prop, 0.0f, 100.0f);
1161 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
1162 RNA_def_property_ui_text(prop, "Stiff viscosity", "Creates viscosity for expanding fluid)");
1163 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1165 /* Double density relaxation */
1166 prop= RNA_def_property(srna, "stiffness", PROP_FLOAT, PROP_NONE);
1167 RNA_def_property_float_sdna(prop, NULL, "stiffness_k");
1168 RNA_def_property_range(prop, 0.0f, 100.0f);
1169 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
1170 RNA_def_property_ui_text(prop, "Stiffness", "How incompressible the fluid is");
1171 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1173 prop= RNA_def_property(srna, "repulsion", PROP_FLOAT, PROP_NONE);
1174 RNA_def_property_float_sdna(prop, NULL, "stiffness_knear");
1175 RNA_def_property_range(prop, 0.0f, 100.0f);
1176 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
1177 RNA_def_property_ui_text(prop, "Repulsion Factor", "How strongly the fluid tries to keep from clustering (factor of stiffness)");
1178 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1180 prop= RNA_def_property(srna, "rest_density", PROP_FLOAT, PROP_NONE);
1181 RNA_def_property_float_sdna(prop, NULL, "rest_density");
1182 RNA_def_property_range(prop, 0.0f, 100.0f);
1183 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
1184 RNA_def_property_ui_text(prop, "Rest Density", "Fluid rest density");
1185 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1188 prop= RNA_def_property(srna, "buoyancy", PROP_FLOAT, PROP_NONE);
1189 RNA_def_property_float_sdna(prop, NULL, "buoyancy");
1190 RNA_def_property_range(prop, 0.0f, 10.0f);
1191 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3);
1192 RNA_def_property_ui_text(prop, "Buoyancy", "Artificial buoyancy force in negative gravity direction based on pressure differences inside the fluid");
1193 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1197 prop= RNA_def_property(srna, "factor_repulsion", PROP_BOOLEAN, PROP_NONE);
1198 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_REPULSION);
1199 RNA_def_property_ui_text(prop, "Factor Repulsion", "Repulsion is a factor of stiffness");
1200 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1202 prop= RNA_def_property(srna, "factor_density", PROP_BOOLEAN, PROP_NONE);
1203 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_DENSITY);
1204 RNA_def_property_ui_text(prop, "Factor Density", "Density is calculated as a factor of default density (depends on particle size)");
1205 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1207 prop= RNA_def_property(srna, "factor_radius", PROP_BOOLEAN, PROP_NONE);
1208 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_RADIUS);
1209 RNA_def_property_ui_text(prop, "Factor Radius", "Interaction radius is a factor of 4 * particle size");
1210 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1212 prop= RNA_def_property(srna, "factor_stiff_viscosity", PROP_BOOLEAN, PROP_NONE);
1213 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_VISCOSITY);
1214 RNA_def_property_ui_text(prop, "Factor Stiff Viscosity", "Stiff viscosity is a factor of normal viscosity");
1215 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1217 prop= RNA_def_property(srna, "factor_rest_length", PROP_BOOLEAN, PROP_NONE);
1218 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_REST_LENGTH);
1219 RNA_def_property_ui_text(prop, "Factor Rest Length", "Spring rest length is a factor of 2 * particle size");
1220 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1223 static void rna_def_particle_settings_mtex(BlenderRNA *brna)
1228 static EnumPropertyItem texco_items[] = {
1229 {TEXCO_GLOB, "GLOBAL", 0, "Global", "Uses global coordinates for the texture coordinates"},
1230 {TEXCO_OBJECT, "OBJECT", 0, "Object", "Uses linked object's coordinates for texture coordinates"},
1231 {TEXCO_UV, "UV", 0, "UV", "Uses UV coordinates for texture coordinates"},
1232 {TEXCO_ORCO, "ORCO", 0, "Generated", "Uses the original undeformed coordinates of the object"},
1233 {TEXCO_STRAND, "STRAND", 0, "Strand / Particle", "Uses normalized strand texture coordinate (1D) or particle age (X) and trail position (Y)"},
1234 {0, NULL, 0, NULL, NULL}};
1236 static EnumPropertyItem prop_mapping_items[] = {
1237 {MTEX_FLAT, "FLAT", 0, "Flat", "Maps X and Y coordinates directly"},
1238 {MTEX_CUBE, "CUBE", 0, "Cube", "Maps using the normal vector"},
1239 {MTEX_TUBE, "TUBE", 0, "Tube", "Maps with Z as central axis"},
1240 {MTEX_SPHERE, "SPHERE", 0, "Sphere", "Maps with Z as central axis"},
1241 {0, NULL, 0, NULL, NULL}};
1243 static EnumPropertyItem prop_x_mapping_items[] = {
1244 {0, "NONE", 0, "None", ""},
1245 {1, "X", 0, "X", ""},
1246 {2, "Y", 0, "Y", ""},
1247 {3, "Z", 0, "Z", ""},
1248 {0, NULL, 0, NULL, NULL}};
1250 static EnumPropertyItem prop_y_mapping_items[] = {
1251 {0, "NONE", 0, "None", ""},
1252 {1, "X", 0, "X", ""},
1253 {2, "Y", 0, "Y", ""},
1254 {3, "Z", 0, "Z", ""},
1255 {0, NULL, 0, NULL, NULL}};
1257 static EnumPropertyItem prop_z_mapping_items[] = {
1258 {0, "NONE", 0, "None", ""},
1259 {1, "X", 0, "X", ""},
1260 {2, "Y", 0, "Y", ""},
1261 {3, "Z", 0, "Z", ""},
1262 {0, NULL, 0, NULL, NULL}};
1264 srna= RNA_def_struct(brna, "ParticleSettingsTextureSlot", "TextureSlot");
1265 RNA_def_struct_sdna(srna, "MTex");
1266 RNA_def_struct_ui_text(srna, "Particle Settings Texture Slot", "Texture slot for textures in a Particle Settings datablock");
1268 prop= RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
1269 RNA_def_property_enum_sdna(prop, NULL, "texco");
1270 RNA_def_property_enum_items(prop, texco_items);
1271 RNA_def_property_ui_text(prop, "Texture Coordinates", "Texture coordinates used to map the texture onto the background");
1272 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1274 prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1275 RNA_def_property_pointer_sdna(prop, NULL, "object");
1276 RNA_def_property_struct_type(prop, "Object");
1277 RNA_def_property_flag(prop, PROP_EDITABLE);
1278 RNA_def_property_ui_text(prop, "Object", "Object to use for mapping with Object texture coordinates");
1279 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1281 prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
1282 RNA_def_property_string_sdna(prop, NULL, "uvname");
1283 RNA_def_property_ui_text(prop, "UV Layer", "UV layer to use for mapping with UV texture coordinates");
1284 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1286 prop= RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE);
1287 RNA_def_property_enum_sdna(prop, NULL, "projx");
1288 RNA_def_property_enum_items(prop, prop_x_mapping_items);
1289 RNA_def_property_ui_text(prop, "X Mapping", "");
1290 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1292 prop= RNA_def_property(srna, "mapping_y", PROP_ENUM, PROP_NONE);
1293 RNA_def_property_enum_sdna(prop, NULL, "projy");
1294 RNA_def_property_enum_items(prop, prop_y_mapping_items);
1295 RNA_def_property_ui_text(prop, "Y Mapping", "");
1296 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1298 prop= RNA_def_property(srna, "mapping_z", PROP_ENUM, PROP_NONE);
1299 RNA_def_property_enum_sdna(prop, NULL, "projz");
1300 RNA_def_property_enum_items(prop, prop_z_mapping_items);
1301 RNA_def_property_ui_text(prop, "Z Mapping", "");
1302 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1304 prop= RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
1305 RNA_def_property_enum_items(prop, prop_mapping_items);
1306 RNA_def_property_ui_text(prop, "Mapping", "");
1307 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1310 prop= RNA_def_property(srna, "use_map_time", PROP_BOOLEAN, PROP_NONE);
1311 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_TIME);
1312 RNA_def_property_ui_text(prop, "Emission Time", "Affect the emission time of the particles");
1313 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1315 prop= RNA_def_property(srna, "use_map_life", PROP_BOOLEAN, PROP_NONE);
1316 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_LIFE);
1317 RNA_def_property_ui_text(prop, "Life Time", "Affect the life time of the particles");
1318 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1320 prop= RNA_def_property(srna, "use_map_density", PROP_BOOLEAN, PROP_NONE);
1321 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_DENS);
1322 RNA_def_property_ui_text(prop, "Density", "Affect the density of the particles");
1323 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1325 prop= RNA_def_property(srna, "use_map_size", PROP_BOOLEAN, PROP_NONE);
1326 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_SIZE);
1327 RNA_def_property_ui_text(prop, "Size", "Affect the particle size");
1328 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1330 prop= RNA_def_property(srna, "use_map_velocity", PROP_BOOLEAN, PROP_NONE);
1331 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_IVEL);
1332 RNA_def_property_ui_text(prop, "Initial Velocity", "Affect the particle initial velocity");
1333 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1335 prop= RNA_def_property(srna, "use_map_field", PROP_BOOLEAN, PROP_NONE);
1336 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_FIELD);
1337 RNA_def_property_ui_text(prop, "Force Field", "Affect the particle force fields");
1338 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1340 prop= RNA_def_property(srna, "use_map_gravity", PROP_BOOLEAN, PROP_NONE);
1341 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_GRAVITY);
1342 RNA_def_property_ui_text(prop, "Gravity", "Affect the particle gravity");
1343 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1345 prop= RNA_def_property(srna, "use_map_damp", PROP_BOOLEAN, PROP_NONE);
1346 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_DAMP);
1347 RNA_def_property_ui_text(prop, "Damp", "Affect the particle velocity damping");
1348 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1350 prop= RNA_def_property(srna, "use_map_clump", PROP_BOOLEAN, PROP_NONE);
1351 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_CLUMP);
1352 RNA_def_property_ui_text(prop, "Clump", "Affect the child clumping");
1353 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1355 prop= RNA_def_property(srna, "use_map_kink", PROP_BOOLEAN, PROP_NONE);
1356 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_KINK);
1357 RNA_def_property_ui_text(prop, "Kink", "Affect the child kink");
1358 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1360 prop= RNA_def_property(srna, "use_map_rough", PROP_BOOLEAN, PROP_NONE);
1361 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_ROUGH);
1362 RNA_def_property_ui_text(prop, "Rough", "Affect the child rough");
1363 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1365 prop= RNA_def_property(srna, "use_map_length", PROP_BOOLEAN, PROP_NONE);
1366 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_LENGTH);
1367 RNA_def_property_ui_text(prop, "Length", "Affect the child hair length");
1368 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1371 /* influence factors */
1372 prop= RNA_def_property(srna, "time_factor", PROP_FLOAT, PROP_NONE);
1373 RNA_def_property_float_sdna(prop, NULL, "timefac");
1374 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1375 RNA_def_property_ui_text(prop, "Emission Time Factor", "Amount texture affects particle emission time");
1376 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1378 prop= RNA_def_property(srna, "life_factor", PROP_FLOAT, PROP_NONE);
1379 RNA_def_property_float_sdna(prop, NULL, "lifefac");
1380 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1381 RNA_def_property_ui_text(prop, "Life Time Factor", "Amount texture affects particle life time");
1382 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1384 prop= RNA_def_property(srna, "density_factor", PROP_FLOAT, PROP_NONE);
1385 RNA_def_property_float_sdna(prop, NULL, "padensfac");
1386 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1387 RNA_def_property_ui_text(prop, "Density Factor", "Amount texture affects particle density");
1388 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1390 prop= RNA_def_property(srna, "size_factor", PROP_FLOAT, PROP_NONE);
1391 RNA_def_property_float_sdna(prop, NULL, "sizefac");
1392 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1393 RNA_def_property_ui_text(prop, "Size Factor", "Amount texture affects physical particle size");
1394 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1396 prop= RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE);
1397 RNA_def_property_float_sdna(prop, NULL, "ivelfac");
1398 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1399 RNA_def_property_ui_text(prop, "Velocity Factor", "Amount texture affects particle initial velocity");
1400 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1403 prop= RNA_def_property(srna, "field_factor", PROP_FLOAT, PROP_NONE);
1404 RNA_def_property_float_sdna(prop, NULL, "fieldfac");
1405 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1406 RNA_def_property_ui_text(prop, "Field Factor", "Amount texture affects particle force fields");
1407 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1409 prop= RNA_def_property(srna, "gravity_factor", PROP_FLOAT, PROP_NONE);
1410 RNA_def_property_float_sdna(prop, NULL, "gravityfac");
1411 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1412 RNA_def_property_ui_text(prop, "Gravity Factor", "Amount texture affects particle gravity");
1413 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1415 prop= RNA_def_property(srna, "damp_factor", PROP_FLOAT, PROP_NONE);
1416 RNA_def_property_float_sdna(prop, NULL, "dampfac");
1417 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1418 RNA_def_property_ui_text(prop, "Damp Factor", "Amount texture affects particle damping");
1419 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1422 prop= RNA_def_property(srna, "length_factor", PROP_FLOAT, PROP_NONE);
1423 RNA_def_property_float_sdna(prop, NULL, "lengthfac");
1424 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1425 RNA_def_property_ui_text(prop, "Length Factor", "Amount texture affects child hair length");
1426 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1428 prop= RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
1429 RNA_def_property_float_sdna(prop, NULL, "clumpfac");
1430 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1431 RNA_def_property_ui_text(prop, "Clump Factor", "Amount texture affects child clump");
1432 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1434 prop= RNA_def_property(srna, "kink_factor", PROP_FLOAT, PROP_NONE);
1435 RNA_def_property_float_sdna(prop, NULL, "kinkfac");
1436 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1437 RNA_def_property_ui_text(prop, "Kink Factor", "Amount texture affects child kink");
1438 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1440 prop= RNA_def_property(srna, "rough_factor", PROP_FLOAT, PROP_NONE);
1441 RNA_def_property_float_sdna(prop, NULL, "roughfac");
1442 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1443 RNA_def_property_ui_text(prop, "Rough Factor", "Amount texture affects child roughness");
1444 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1447 static void rna_def_particle_settings(BlenderRNA *brna)
1452 static EnumPropertyItem type_items[] = {
1453 {PART_EMITTER, "EMITTER", 0, "Emitter", ""},
1454 //{PART_REACTOR, "REACTOR", 0, "Reactor", ""},
1455 {PART_HAIR, "HAIR", 0, "Hair", ""},
1456 {0, NULL, 0, NULL, NULL}
1459 static EnumPropertyItem phys_type_items[] = {
1460 {PART_PHYS_NO, "NO", 0, "No", ""},
1461 {PART_PHYS_NEWTON, "NEWTON", 0, "Newtonian", ""},
1462 {PART_PHYS_KEYED, "KEYED", 0, "Keyed", ""},
1463 {PART_PHYS_BOIDS, "BOIDS", 0, "Boids", ""},
1464 {PART_PHYS_FLUID, "FLUID", 0, "Fluid", ""},
1465 {0, NULL, 0, NULL, NULL}
1468 static EnumPropertyItem rot_mode_items[] = {
1469 {0, "NONE", 0, "None", ""},
1470 {PART_ROT_NOR, "NOR", 0, "Normal", ""},
1471 {PART_ROT_VEL, "VEL", 0, "Velocity", ""},
1472 {PART_ROT_GLOB_X, "GLOB_X", 0, "Global X", ""},
1473 {PART_ROT_GLOB_Y, "GLOB_Y", 0, "Global Y", ""},
1474 {PART_ROT_GLOB_Z, "GLOB_Z", 0, "Global Z", ""},
1475 {PART_ROT_OB_X, "OB_X", 0, "Object X", ""},
1476 {PART_ROT_OB_Y, "OB_Y", 0, "Object Y", ""},
1477 {PART_ROT_OB_Z, "OB_Z", 0, "Object Z", ""},
1478 {0, NULL, 0, NULL, NULL}
1481 static EnumPropertyItem ave_mode_items[] = {
1482 {0, "NONE", 0, "None", ""},
1483 {PART_AVE_SPIN, "SPIN", 0, "Spin", ""},
1484 {PART_AVE_RAND, "RAND", 0, "Random", ""} ,
1485 {0, NULL, 0, NULL, NULL}
1488 static EnumPropertyItem react_event_items[] = {
1489 {PART_EVENT_DEATH, "DEATH", 0, "Death", ""},
1490 {PART_EVENT_COLLIDE, "COLLIDE", 0, "Collision", ""},
1491 {PART_EVENT_NEAR, "NEAR", 0, "Near", ""},
1492 {0, NULL, 0, NULL, NULL}
1495 static EnumPropertyItem child_type_items[] = {
1496 {0, "NONE", 0, "None", ""},
1497 {PART_CHILD_PARTICLES, "SIMPLE", 0, "Simple", ""},
1498 {PART_CHILD_FACES, "INTERPOLATED", 0, "Interpolated", ""},
1499 {0, NULL, 0, NULL, NULL}
1502 //TODO: names, tooltips
1504 static EnumPropertyItem rot_from_items[] = {
1505 {PART_ROT_KEYS, "KEYS", 0, "keys", ""},
1506 {PART_ROT_ZINCR, "ZINCR", 0, "zincr", ""},
1507 {PART_ROT_IINCR, "IINCR", 0, "iincr", ""},
1508 {0, NULL, 0, NULL, NULL}
1511 static EnumPropertyItem integrator_type_items[] = {
1512 {PART_INT_EULER, "EULER", 0, "Euler", ""},
1513 {PART_INT_VERLET, "VERLET", 0, "Verlet", ""},
1514 {PART_INT_MIDPOINT, "MIDPOINT", 0, "Midpoint", ""},
1515 {PART_INT_RK4, "RK4", 0, "RK4", ""},
1516 {0, NULL, 0, NULL, NULL}
1519 static EnumPropertyItem kink_type_items[] = {
1520 {PART_KINK_NO, "NO", 0, "Nothing", ""},
1521 {PART_KINK_CURL, "CURL", 0, "Curl", ""},
1522 {PART_KINK_RADIAL, "RADIAL", 0, "Radial", ""},
1523 {PART_KINK_WAVE, "WAVE", 0, "Wave", ""},
1524 {PART_KINK_BRAID, "BRAID", 0, "Braid", ""},
1525 {0, NULL, 0, NULL, NULL}
1528 static EnumPropertyItem kink_axis_items[] = {
1529 {0, "X", 0, "X", ""},
1530 {1, "Y", 0, "Y", ""},
1531 {2, "Z", 0, "Z", ""},
1532 {0, NULL, 0, NULL, NULL}
1535 static EnumPropertyItem bb_align_items[] = {
1536 {PART_BB_X, "X", 0, "X", ""},
1537 {PART_BB_Y, "Y", 0, "Y", ""},
1538 {PART_BB_Z, "Z", 0, "Z", ""},
1539 {PART_BB_VIEW, "VIEW", 0, "View", ""},
1540 {PART_BB_VEL, "VEL", 0, "Velocity", ""},
1541 {0, NULL, 0, NULL, NULL}
1544 static EnumPropertyItem bb_anim_items[] = {
1545 {PART_BB_ANIM_NONE, "NONE", 0, "None", ""},
1546 {PART_BB_ANIM_AGE, "AGE", 0, "Age", ""},
1547 {PART_BB_ANIM_FRAME, "FRAME", 0, "Frame", ""},
1548 {PART_BB_ANIM_ANGLE, "ANGLE", 0, "Angle", ""},
1549 {0, NULL, 0, NULL, NULL}
1552 static EnumPropertyItem bb_split_offset_items[] = {
1553 {PART_BB_OFF_NONE, "NONE", 0, "None", ""},
1554 {PART_BB_OFF_LINEAR, "LINEAR", 0, "Linear", ""},
1555 {PART_BB_OFF_RANDOM, "RANDOM", 0, "Random", ""},
1556 {0, NULL, 0, NULL, NULL}
1559 static EnumPropertyItem draw_col_items[] = {
1560 {PART_DRAW_COL_NONE, "NONE", 0, "None", ""},
1561 {PART_DRAW_COL_MAT, "MATERIAL", 0, "Material", ""},
1562 {PART_DRAW_COL_VEL, "VELOCITY", 0, "Velocity", ""},
1563 {PART_DRAW_COL_ACC, "ACCELERATION", 0, "Acceleration", ""},
1564 {0, NULL, 0, NULL, NULL}
1567 srna= RNA_def_struct(brna, "ParticleSettings", "ID");
1568 RNA_def_struct_ui_text(srna, "Particle Settings", "Particle settings, reusable by multiple particle systems");
1569 RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
1571 rna_def_mtex_common(brna, srna, "rna_ParticleSettings_mtex_begin", "rna_ParticleSettings_active_texture_get",
1572 "rna_ParticleSettings_active_texture_set", NULL, "ParticleSettingsTextureSlot", "ParticleSettingsTextureSlots", "rna_Particle_reset");
1574 /* fluid particle type can't be checked from the type value in rna as it's not shown in the menu */
1575 prop= RNA_def_property(srna, "is_fluid", PROP_BOOLEAN, PROP_NONE);
1576 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1577 RNA_def_property_boolean_funcs(prop, "rna_PartSettings_is_fluid_get", NULL);
1578 RNA_def_property_ui_text(prop, "Fluid", "Particles were created by a fluid simulation");
1581 prop= RNA_def_property(srna, "use_react_start_end", PROP_BOOLEAN, PROP_NONE);
1582 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_STA_END);
1583 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1584 RNA_def_property_ui_text(prop, "Start/End", "Give birth to unreacted particles eventually");
1585 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1587 prop= RNA_def_property(srna, "use_react_multiple", PROP_BOOLEAN, PROP_NONE);
1588 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_MULTIPLE);
1589 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1590 RNA_def_property_ui_text(prop, "Multi React", "React multiple times");
1591 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1593 prop= RNA_def_property(srna, "regrow_hair", PROP_BOOLEAN, PROP_NONE);
1594 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_REGROW);
1595 RNA_def_property_ui_text(prop, "Regrow", "Regrow hair for each frame");
1596 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1598 prop= RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
1599 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_UNBORN);
1600 RNA_def_property_ui_text(prop, "Unborn", "Show particles before they are emitted");
1601 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1603 prop= RNA_def_property(srna, "use_dead", PROP_BOOLEAN, PROP_NONE);
1604 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_DIED);
1605 RNA_def_property_ui_text(prop, "Died", "Show particles after they have died");
1606 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1608 prop= RNA_def_property(srna, "use_emit_random", PROP_BOOLEAN, PROP_NONE);
1609 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_TRAND);
1610 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1611 RNA_def_property_ui_text(prop, "Random", "Emit in random order of elements");
1612 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1614 prop= RNA_def_property(srna, "use_even_distribution", PROP_BOOLEAN, PROP_NONE);
1615 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_EDISTR);
1616 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1617 RNA_def_property_ui_text(prop, "Even Distribution", "Use even distribution from faces based on face areas or edge lengths");
1618 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1620 prop= RNA_def_property(srna, "use_die_on_collision", PROP_BOOLEAN, PROP_NONE);
1621 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_DIE_ON_COL);
1622 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1623 RNA_def_property_ui_text(prop, "Die on hit", "Particles die when they collide with a deflector object");
1624 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1626 prop= RNA_def_property(srna, "use_size_deflect", PROP_BOOLEAN, PROP_NONE);
1627 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SIZE_DEFL);
1628 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1629 RNA_def_property_ui_text(prop, "Size Deflect", "Use particle's size in deflection");
1630 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1632 prop= RNA_def_property(srna, "use_dynamic_rotation", PROP_BOOLEAN, PROP_NONE);
1633 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ROT_DYN);
1634 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1635 RNA_def_property_ui_text(prop, "Dynamic", "Sets rotation to dynamic/constant");
1636 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1638 prop= RNA_def_property(srna, "use_multiply_size_mass", PROP_BOOLEAN, PROP_NONE);
1639 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SIZEMASS);
1640 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1641 RNA_def_property_ui_text(prop, "Mass from Size", "Multiply mass by particle size");
1642 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1644 prop= RNA_def_property(srna, "use_advanced_hair", PROP_BOOLEAN, PROP_NONE);
1645 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PART_HIDE_ADVANCED_HAIR);
1646 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1647 RNA_def_property_ui_text(prop, "Advanced", "Use full physics calculations for growing hair");
1648 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1650 prop= RNA_def_property(srna, "lock_boids_to_surface", PROP_BOOLEAN, PROP_NONE);
1651 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_BOIDS_2D);
1652 RNA_def_property_ui_text(prop, "Boids 2D", "Constrain boids to a surface");
1653 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1655 prop= RNA_def_property(srna, "use_hair_bspline", PROP_BOOLEAN, PROP_NONE);
1656 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_BSPLINE);
1657 RNA_def_property_ui_text(prop, "B-Spline", "Interpolate hair using B-Splines");
1658 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1660 prop= RNA_def_property(srna, "invert_grid", PROP_BOOLEAN, PROP_NONE);
1661 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GRID_INVERT);
1662 RNA_def_property_ui_text(prop, "Invert Grid", "Invert what is considered object and what is not");
1663 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1665 prop= RNA_def_property(srna, "hexagonal_grid", PROP_BOOLEAN, PROP_NONE);
1666 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GRID_HEXAGONAL);
1667 RNA_def_property_ui_text(prop, "Hexagonal Grid", "Create the grid in a hexagonal pattern");
1668 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1670 prop= RNA_def_property(srna, "apply_effector_to_children", PROP_BOOLEAN, PROP_NONE);
1671 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_EFFECT);
1672 RNA_def_property_ui_text(prop, "Effect Children", "Apply effectors to children");
1673 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1675 prop= RNA_def_property(srna, "create_long_hair_children", PROP_BOOLEAN, PROP_NONE);
1676 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_LONG_HAIR);
1677 RNA_def_property_ui_text(prop, "Long Hair", "Calculate children that suit long hair well");
1678 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1680 prop= RNA_def_property(srna, "apply_guide_to_children", PROP_BOOLEAN, PROP_NONE);
1681 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_GUIDE);
1682 RNA_def_property_ui_text(prop, "apply_guide_to_children", "");
1683 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1685 prop= RNA_def_property(srna, "use_self_effect", PROP_BOOLEAN, PROP_NONE);
1686 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SELF_EFFECT);
1687 RNA_def_property_ui_text(prop, "Self Effect", "Particle effectors effect themselves");
1688 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1691 prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
1692 RNA_def_property_enum_items(prop, type_items);
1693 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1694 RNA_def_property_ui_text(prop, "Type", "Particle Type");
1695 RNA_def_property_update(prop, 0, "rna_Particle_change_type");
1697 prop= RNA_def_property(srna, "emit_from", PROP_ENUM, PROP_NONE);
1698 RNA_def_property_enum_sdna(prop, NULL, "from");
1699 RNA_def_property_enum_items(prop, part_reactor_from_items);
1700 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1701 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_from_itemf");
1702 RNA_def_property_ui_text(prop, "Emit From", "Where to emit particles from");
1703 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1705 prop= RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
1706 RNA_def_property_enum_sdna(prop, NULL, "distr");
1707 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1708 RNA_def_property_enum_items(prop, part_dist_items);
1709 RNA_def_property_enum_items(prop, part_draw_as_items);
1710 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_dist_itemf");
1711 RNA_def_property_ui_text(prop, "Distribution", "How to distribute particles on selected element");
1712 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1715 prop= RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
1716 RNA_def_property_enum_sdna(prop, NULL, "phystype");
1717 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1718 RNA_def_property_enum_items(prop, phys_type_items);
1719 RNA_def_property_ui_text(prop, "Physics Type", "Particle physics type");
1720 RNA_def_property_update(prop, 0, "rna_Particle_change_physics");
1722 prop= RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
1723 RNA_def_property_enum_sdna(prop, NULL, "rotmode");
1724 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1725 RNA_def_property_enum_items(prop, rot_mode_items);
1726 RNA_def_property_ui_text(prop, "Rotation", "Particles initial rotation");
1727 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1729 prop= RNA_def_property(srna, "angular_velocity_mode", PROP_ENUM, PROP_NONE);
1730 RNA_def_property_enum_sdna(prop, NULL, "avemode");
1731 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1732 RNA_def_property_enum_items(prop, ave_mode_items);
1733 RNA_def_property_ui_text(prop, "Angular Velocity Mode", "Particle angular velocity mode");
1734 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1736 prop= RNA_def_property(srna, "react_event", PROP_ENUM, PROP_NONE);
1737 RNA_def_property_enum_sdna(prop, NULL, "reactevent");
1738 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1739 RNA_def_property_enum_items(prop, react_event_items);
1740 RNA_def_property_ui_text(prop, "React On", "The event of target particles to react on");
1741 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1744 prop= RNA_def_property(srna, "show_velocity", PROP_BOOLEAN, PROP_NONE);
1745 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL);
1746 RNA_def_property_ui_text(prop, "Velocity", "Show particle velocity");
1747 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1749 prop= RNA_def_property(srna, "show_size", PROP_BOOLEAN, PROP_NONE);
1750 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_SIZE);
1751 RNA_def_property_ui_text(prop, "Size", "Show particle size");
1752 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1754 prop= RNA_def_property(srna, "use_render_emitter", PROP_BOOLEAN, PROP_NONE);
1755 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_EMITTER);
1756 RNA_def_property_ui_text(prop, "Emitter", "Render emitter Object also");
1757 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1759 prop= RNA_def_property(srna, "show_health", PROP_BOOLEAN, PROP_NONE);
1760 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_HEALTH);
1761 RNA_def_property_ui_text(prop, "Health", "Draw boid health");
1762 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1764 prop= RNA_def_property(srna, "use_absolute_path_time", PROP_BOOLEAN, PROP_NONE);
1765 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_ABS_PATH_TIME);
1766 RNA_def_property_ui_text(prop, "Absolute Path Time", "Path timing is in absolute frames");
1767 RNA_def_property_update(prop, 0, "rna_Particle_abspathtime_update");
1769 prop= RNA_def_property(srna, "use_parent_particles", PROP_BOOLEAN, PROP_NONE);
1770 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_PARENT);
1771 RNA_def_property_ui_text(prop, "Parents", "Render parent particles");
1772 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1774 prop= RNA_def_property(srna, "show_number", PROP_BOOLEAN, PROP_NONE);
1775 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_NUM);
1776 RNA_def_property_ui_text(prop, "Number", "Show particle number");
1777 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1779 prop= RNA_def_property(srna, "use_group_pick_random", PROP_BOOLEAN, PROP_NONE);
1780 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_RAND_GR);
1781 RNA_def_property_ui_text(prop, "Pick Random", "Pick objects from group randomly");
1782 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1784 prop= RNA_def_property(srna, "use_group_count", PROP_BOOLEAN, PROP_NONE);
1785 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_COUNT_GR);
1786 RNA_def_property_ui_text(prop, "Use Count", "Use object multiple times in the same group");
1787 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1789 prop= RNA_def_property(srna, "use_global_dupli", PROP_BOOLEAN, PROP_NONE);
1790 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_GLOBAL_OB);
1791 RNA_def_property_ui_text(prop, "Use Global", "Use object's global coordinates for duplication");
1792 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1794 prop= RNA_def_property(srna, "use_render_adaptive", PROP_BOOLEAN, PROP_NONE);
1795 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_ADAPT);
1796 RNA_def_property_ui_text(prop, "Adaptive render", "Draw steps of the particle path");
1797 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1799 prop= RNA_def_property(srna, "use_velocity_length", PROP_BOOLEAN, PROP_NONE);
1800 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL_LENGTH);
1801 RNA_def_property_ui_text(prop, "Speed", "Multiply line length by particle speed");
1802 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1804 prop= RNA_def_property(srna, "use_whole_group", PROP_BOOLEAN, PROP_NONE);
1805 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_WHOLE_GR);
1806 RNA_def_property_ui_text(prop, "Whole Group", "Use whole group at once");
1807 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1809 prop= RNA_def_property(srna, "use_strand_primitive", PROP_BOOLEAN, PROP_NONE);
1810 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_STRAND);
1811 RNA_def_property_ui_text(prop, "Strand render", "Use the strand primitive for rendering");
1812 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1814 prop= RNA_def_property(srna, "draw_method", PROP_ENUM, PROP_NONE);
1815 RNA_def_property_enum_sdna(prop, NULL, "draw_as");
1816 RNA_def_property_enum_items(prop, part_draw_as_items);
1817 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_draw_as_itemf");
1818 RNA_def_property_ui_text(prop, "Particle Drawing", "How particles are drawn in viewport");
1819 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1821 prop= RNA_def_property(srna, "render_type", PROP_ENUM, PROP_NONE);
1822 RNA_def_property_enum_sdna(prop, NULL, "ren_as");
1823 RNA_def_property_enum_items(prop, part_ren_as_items);
1824 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_ren_as_itemf");
1825 RNA_def_property_ui_text(prop, "Particle Rendering", "How particles are rendered");
1826 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1828 prop= RNA_def_property(srna, "draw_color", PROP_ENUM, PROP_NONE);
1829 RNA_def_property_enum_sdna(prop, NULL, "draw_col");
1830 RNA_def_property_enum_items(prop, draw_col_items);
1831 RNA_def_property_ui_text(prop, "Draw Color", "Draw additional particle data as a color");
1832 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1834 prop= RNA_def_property(srna, "draw_size", PROP_INT, PROP_NONE);
1835 RNA_def_property_range(prop, 0, 1000);
1836 RNA_def_property_ui_range(prop, 0, 100, 1, 0);
1837 RNA_def_property_ui_text(prop, "Draw Size", "Size of particles on viewport in pixels (0=default)");
1838 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1840 prop= RNA_def_property(srna, "child_type", PROP_ENUM, PROP_NONE);
1841 RNA_def_property_enum_sdna(prop, NULL, "childtype");
1842 RNA_def_property_enum_items(prop, child_type_items);
1843 RNA_def_property_ui_text(prop, "Children From", "Create child particles");
1844 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1846 prop= RNA_def_property(srna, "draw_step", PROP_INT, PROP_NONE);
1847 RNA_def_property_range(prop, 0, 10);
1848 RNA_def_property_ui_range(prop, 0, 7, 1, 0);
1849 RNA_def_property_ui_text(prop, "Steps", "How many steps paths are drawn with (power of 2)");
1850 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1852 prop= RNA_def_property(srna, "render_step", PROP_INT, PROP_NONE);
1853 RNA_def_property_int_sdna(prop, NULL, "ren_step");
1854 RNA_def_property_range(prop, 0, 20);
1855 RNA_def_property_ui_range(prop, 0, 9, 1, 0);
1856 RNA_def_property_ui_text(prop, "Render", "How many steps paths are rendered with (power of 2)");
1858 prop= RNA_def_property(srna, "hair_step", PROP_INT, PROP_NONE);
1859 RNA_def_property_range(prop, 2, 50);
1860 RNA_def_property_ui_text(prop, "Segments", "Number of hair segments");
1861 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1864 //TODO: not found in UI, readonly?
1865 prop= RNA_def_property(srna, "keys_step", PROP_INT, PROP_NONE);
1866 RNA_def_property_range(prop, 0, SHRT_MAX);//TODO:min,max
1867 RNA_def_property_ui_text(prop, "Keys Step", "");
1869 /* adaptive path rendering */
1870 prop= RNA_def_property(srna, "adaptive_angle", PROP_INT, PROP_NONE);
1871 RNA_def_property_int_sdna(prop, NULL, "adapt_angle");
1872 RNA_def_property_range(prop, 0, 45);
1873 RNA_def_property_ui_text(prop, "Degrees", "How many degrees path has to curve to make another render segment");
1875 prop= RNA_def_property(srna, "adaptive_pixel", PROP_INT, PROP_NONE);
1876 RNA_def_property_int_sdna(prop, NULL, "adapt_pix");
1877 RNA_def_property_range(prop, 0, 50);
1878 RNA_def_property_ui_text(prop, "Pixel", "How many pixels path has to cover to make another render segment");
1880 prop= RNA_def_property(srna, "draw_percentage", PROP_INT, PROP_NONE);
1881 RNA_def_property_int_sdna(prop, NULL, "disp");
1882 RNA_def_property_range(prop, 0, 100);
1883 RNA_def_property_ui_text(prop, "Display", "Percentage of particles to display in 3D view");
1884 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1886 prop= RNA_def_property(srna, "material", PROP_INT, PROP_NONE);
1887 RNA_def_property_int_sdna(prop, NULL, "omat");
1888 RNA_def_property_range(prop, 1, 32767);
1889 RNA_def_property_ui_text(prop, "Material", "Specify material used for the particles");
1890 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1893 // not used anywhere, why is this in DNA???
1895 prop= RNA_def_property(srna, "rotate_from", PROP_ENUM, PROP_NONE);
1896 RNA_def_property_enum_sdna(prop, NULL, "rotfrom");
1897 RNA_def_property_enum_items(prop, rot_from_items);
1898 RNA_def_property_ui_text(prop, "Rotate From", "");
1901 prop= RNA_def_property(srna, "integrator", PROP_ENUM, PROP_NONE);
1902 RNA_def_property_enum_items(prop, integrator_type_items);
1903 RNA_def_property_ui_text(prop, "Integration", "Algorithm used to calculate physics. Fastest to most stable/accurate: Midpoint, Euler, Verlet, RK4 (Old)");
1904 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1906 prop= RNA_def_property(srna, "kink", PROP_ENUM, PROP_NONE);
1907 RNA_def_property_enum_items(prop, kink_type_items);
1908 RNA_def_property_ui_text(prop, "Kink", "Type of periodic offset on the path");
1909 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1911 prop= RNA_def_property(srna, "kink_axis", PROP_ENUM, PROP_NONE);
1912 RNA_def_property_enum_items(prop, kink_axis_items);
1913 RNA_def_property_ui_text(prop, "Axis", "Which axis to use for offset");
1914 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1917 prop= RNA_def_property(srna, "lock_billboard", PROP_BOOLEAN, PROP_NONE);
1918 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_BB_LOCK);
1919 RNA_def_property_ui_text(prop, "Lock Billboard", "Lock the billboards align axis");
1920 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1922 prop= RNA_def_property(srna, "billboard_align", PROP_ENUM, PROP_NONE);
1923 RNA_def_property_enum_sdna(prop, NULL, "bb_align");
1924 RNA_def_property_enum_items(prop, bb_align_items);
1925 RNA_def_property_ui_text(prop, "Align to", "In respect to what the billboards are aligned");
1926 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1928 prop= RNA_def_property(srna, "billboard_uv_split", PROP_INT, PROP_NONE);
1929 RNA_def_property_int_sdna(prop, NULL, "bb_uv_split");
1930 RNA_def_property_range(prop, 1, 100);
1931 RNA_def_property_ui_range(prop, 1, 10, 1, 0);
1932 RNA_def_property_ui_text(prop, "UV Split", "Amount of rows/columns to split UV coordinates for billboards");
1934 prop= RNA_def_property(srna, "billboard_animation", PROP_ENUM, PROP_NONE);
1935 RNA_def_property_enum_sdna(prop, NULL, "bb_anim");
1936 RNA_def_property_enum_items(prop, bb_anim_items);
1937 RNA_def_property_ui_text(prop, "Animate", "How to animate billboard textures");
1939 prop= RNA_def_property(srna, "billboard_offset_split", PROP_ENUM, PROP_NONE);
1940 RNA_def_property_enum_sdna(prop, NULL, "bb_split_offset");
1941 RNA_def_property_enum_items(prop, bb_split_offset_items);
1942 RNA_def_property_ui_text(prop, "Offset", "How to offset billboard textures");
1944 prop= RNA_def_property(srna, "billboard_tilt", PROP_FLOAT, PROP_NONE);
1945 RNA_def_property_float_sdna(prop, NULL, "bb_tilt");
1946 RNA_def_property_range(prop, -1.0f, 1.0f);
1947 RNA_def_property_ui_text(prop, "Tilt", "Tilt of the billboards");
1948 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1950 prop= RNA_def_property(srna, "color_maximum", PROP_FLOAT, PROP_NONE);
1951 RNA_def_property_float_sdna(prop, NULL, "color_vec_max");
1952 RNA_def_property_range(prop, 0.01f, 100.0f);
1953 RNA_def_property_ui_text(prop, "Color Maximum", "Maximum length of the particle color vector");
1954 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1956 prop= RNA_def_property(srna, "billboard_tilt_random", PROP_FLOAT, PROP_NONE);
1957 RNA_def_property_float_sdna(prop, NULL, "bb_rand_tilt");
1958 RNA_def_property_range(prop, 0.0f, 1.0f);
1959 RNA_def_property_ui_text(prop, "Random Tilt", "Random tilt of the billboards");
1960 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1962 prop= RNA_def_property(srna, "billboard_offset", PROP_FLOAT, PROP_TRANSLATION);
1963 RNA_def_property_float_sdna(prop, NULL, "bb_offset");
1964 RNA_def_property_array(prop, 2);
1965 RNA_def_property_range(prop, -100.0f, 100.0f);
1966 RNA_def_property_ui_range(prop, -1.0, 1.0, 0.1, 3);
1967 RNA_def_property_ui_text(prop, "Billboard Offset", "");
1968 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1970 prop= RNA_def_property(srna, "billboard_size", PROP_FLOAT, PROP_FACTOR);
1971 RNA_def_property_float_sdna(prop, NULL, "bb_size");
1972 RNA_def_property_array(prop, 2);
1973 RNA_def_property_range(prop, 0.001f, 10.0f);
1974 RNA_def_property_ui_text(prop, "Billboard Scale", "Scale billboards relative to particle size");
1975 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1977 prop= RNA_def_property(srna, "billboard_velocity_head", PROP_FLOAT, PROP_FACTOR);
1978 RNA_def_property_float_sdna(prop, NULL, "bb_vel_head");
1979 RNA_def_property_range(prop, 0.0f, 10.0f);
1980 RNA_def_property_ui_text(prop, "Billboard Velocity Head", "Scale billboards by velocity");
1981 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1983 prop= RNA_def_property(srna, "billboard_velocity_tail", PROP_FLOAT, PROP_FACTOR);
1984 RNA_def_property_float_sdna(prop, NULL, "bb_vel_tail");
1985 RNA_def_property_range(prop, 0.0f, 10.0f);
1986 RNA_def_property_ui_text(prop, "Billboard Velocity Tail", "Scale billboards by velocity");
1987 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1989 /* simplification */
1990 prop= RNA_def_property(srna, "use_simplify", PROP_BOOLEAN, PROP_NONE);
1991 RNA_def_property_boolean_sdna(prop, NULL, "simplify_flag", PART_SIMPLIFY_ENABLE);
1992 RNA_def_property_ui_text(prop, "Child Simplification", "Remove child strands as the object becomes smaller on the screen");
1994 prop= RNA_def_property(srna, "use_simplify_viewport", PROP_BOOLEAN, PROP_NONE);
1995 RNA_def_property_boolean_sdna(prop, NULL, "simplify_flag", PART_SIMPLIFY_VIEWPORT);
1996 RNA_def_property_ui_text(prop, "Viewport", "");
1998 prop= RNA_def_property(srna, "simplify_refsize", PROP_INT, PROP_UNSIGNED);
1999 RNA_def_property_int_sdna(prop, NULL, "simplify_refsize");
2000 RNA_def_property_range(prop, 1, 32768);
2001 RNA_def_property_ui_text(prop, "Reference Size", "Reference size in pixels, after which simplification begins");
2003 prop= RNA_def_property(srna, "simplify_rate", PROP_FLOAT, PROP_NONE);
2004 RNA_def_property_range(prop, 0.0f, 1.0f);
2005 RNA_def_property_ui_text(prop, "Rate", "Speed of simplification");
2007 prop= RNA_def_property(srna, "simplify_transition", PROP_FLOAT, PROP_NONE);
2008 RNA_def_property_range(prop, 0.0f, 1.0f);
2009 RNA_def_property_ui_text(prop, "Transition", "Transition period for fading out strands");
2011 prop= RNA_def_property(srna, "simplify_viewport", PROP_FLOAT, PROP_NONE);
2012 RNA_def_property_range(prop, 0.0f, 0.999f);
2013 RNA_def_property_ui_text(prop, "Rate", "Speed of Simplification");
2015 /* general values */
2016 prop= RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
2017 RNA_def_property_float_sdna(prop, NULL, "sta");//optional if prop names are the same
2018 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
2019 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2020 RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_start_set", NULL);
2021 RNA_def_property_ui_text(prop, "Start", "Frame # to start emitting particles");
2022 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2024 prop= RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
2025 RNA_def_property_float_sdna(prop, NULL, "end");
2026 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
2028 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2029 RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_end_set", NULL);
2030 RNA_def_property_ui_text(prop, "End", "Frame # to stop emitting particles");
2031 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2033 prop= RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
2034 RNA_def_property_range(prop, 1.0f, MAXFRAMEF);
2035 RNA_def_property_ui_text(prop, "Lifetime", "Specify the life span of the particles");
2036 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2038 prop= RNA_def_property(srna, "lifetime_random", PROP_FLOAT, PROP_NONE);
2039 RNA_def_property_float_sdna(prop, NULL, "randlife");
2040 RNA_def_property_range(prop, 0.0f, 1.0f);
2041 RNA_def_property_ui_text(prop, "Random", "Give the particle life a random variation");
2042 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2044 prop= RNA_def_property(srna, "time_tweak", PROP_FLOAT, PROP_NONE);
2045 RNA_def_property_float_sdna(prop, NULL, "timetweak");
2046 RNA_def_property_range(prop, 0.0f, 100.0f);
2047 RNA_def_property_ui_range(prop, 0, 10, 1, 3);
2048 RNA_def_property_ui_text(prop, "Tweak", "A multiplier for physics timestep (1.0 means one frame = 1/25 seconds)");
2049 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2051 prop= RNA_def_property(srna, "timestep", PROP_FLOAT, PROP_NONE);
2052 RNA_def_property_float_funcs(prop, "rna_PartSettings_timestep_get", "rna_PartSetings_timestep_set", NULL);
2053 RNA_def_property_range(prop, 0.0001, 100.0);
2054 RNA_def_property_ui_range(prop, 0.01, 10, 1, 3);
2055 RNA_def_property_ui_text(prop, "Timestep", "The simulation timestep per frame (seconds per frame)");
2056 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2058 prop= RNA_def_property(srna, "adaptive_subframes", PROP_BOOLEAN, PROP_NONE);
2059 RNA_def_property_boolean_sdna(prop, NULL, "time_flag", PART_TIME_AUTOSF);
2060 RNA_def_property_ui_text(prop, "Automatic Subframes", "Automatically set the number of subframes");
2061 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2063 prop= RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE);
2064 RNA_def_property_range(prop, 0, 1000);
2065 RNA_def_property_ui_text(prop, "Subframes", "Subframes to simulate for improved stability and finer granularity simulations (dt = timestep / (subframes + 1))");
2066 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2068 prop= RNA_def_property(srna, "courant_target", PROP_FLOAT, PROP_NONE);
2069 RNA_def_property_range(prop, 0.01, 10);
2070 RNA_def_property_float_default(prop, 0.2);
2071 RNA_def_property_ui_text(prop, "Adaptive Subframe Threshold", "The relative distance a particle can move before requiring more subframes (target Courant number); 0.1-0.3 is the recommended range");
2072 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2074 prop= RNA_def_property(srna, "jitter_factor", PROP_FLOAT, PROP_NONE);
2075 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2076 RNA_def_property_float_sdna(prop, NULL, "jitfac");
2077 RNA_def_property_range(prop, 0.0f, 2.0f);
2078 RNA_def_property_ui_text(prop, "Amount", "Amount of jitter applied to the sampling");
2079 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2081 prop= RNA_def_property(srna, "effect_hair", PROP_FLOAT, PROP_NONE);
2082 RNA_def_property_float_sdna(prop, NULL, "eff_hair");
2083 RNA_def_property_range(prop, 0.0f, 1.0f);
2084 RNA_def_property_ui_text(prop, "Stiffness", "Hair stiffness for effectors");
2085 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2087 prop= RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
2088 RNA_def_property_int_sdna(prop, NULL, "totpart");
2089 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2090 /* This limit is for those freaks who have the machine power to handle it. */
2091 /* 10M particles take around 2.2 Gb of memory / disk space in saved file and */
2092 /* each cached frame takes around 0.5 Gb of memory / disk space depending on cache mode. */
2093 RNA_def_property_range(prop, 0, 10000000);
2094 RNA_def_property_ui_range(prop, 0, 100000, 1, 0);
2095 RNA_def_property_ui_text(prop, "Amount", "Total number of particles");
2096 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2098 prop= RNA_def_property(srna, "userjit", PROP_INT, PROP_UNSIGNED);//TODO: can we get a better name for userjit?
2099 RNA_def_property_int_sdna(prop, NULL, "userjit");
2100 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2101 RNA_def_property_range(prop, 0, 1000);
2102 RNA_def_property_ui_text(prop, "P/F", "Emission locations / face (0 = automatic)");
2103 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2105 prop= RNA_def_property(srna, "grid_resolution", PROP_INT, PROP_UNSIGNED);
2106 RNA_def_property_int_sdna(prop, NULL, "grid_res");
2107 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2108 RNA_def_property_range(prop, 1, 250); /* ~15M particles in a cube (ouch!), but could be very usable in a plane */
2109 RNA_def_property_ui_range(prop, 1, 50, 1, 0); /* ~100k particles in a cube */
2110 RNA_def_property_ui_text(prop, "Resolution", "The resolution of the particle grid");
2111 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2113 prop= RNA_def_property(srna, "grid_random", PROP_FLOAT, PROP_NONE);
2114 RNA_def_property_float_sdna(prop, NULL, "grid_rand");
2115 RNA_def_property_range(prop, 0.0f, 1.0f);
2116 RNA_def_property_ui_text(prop, "Grid Randomness", "Add random offset to the grid locations");
2117 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2119 prop= RNA_def_property(srna, "effector_amount", PROP_INT, PROP_UNSIGNED);
2120 /* in theory PROP_ANIMATABLE perhaps should be cleared, but animating this can give some interesting results! */
2121 RNA_def_property_range(prop, 0, 10000); /* 10000 effectors will bel SLOW, but who knows */
2122 RNA_def_property_ui_range(prop, 0, 100, 1, 0);
2123 RNA_def_property_ui_text(prop, "Effector Amount", "How many particles are effectors (0 is all particles)");
2124 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2126 /* initial velocity factors */
2127 prop= RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_NONE);
2128 RNA_def_property_float_sdna(prop, NULL, "normfac");//optional if prop names are the same
2129 RNA_def_property_range(prop, -1000.0f, 1000.0f);
2130 RNA_def_property_ui_range(prop, 0, 100, 1, 3);
2131 RNA_def_property_ui_text(prop, "Normal", "Let the surface normal give the particle a starting speed");
2132 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2134 prop= RNA_def_property(srna, "object_factor", PROP_FLOAT, PROP_NONE);
2135 RNA_def_property_float_sdna(prop, NULL, "obfac");
2136 RNA_def_property_range(prop, -200.0f, 200.0f);
2137 RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
2138 RNA_def_property_ui_text(prop, "Object", "Let the object give the particle a starting speed");
2139 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2141 prop= RNA_def_property(srna, "factor_random", PROP_FLOAT, PROP_NONE);
2142 RNA_def_property_float_sdna(prop, NULL, "randfac");//optional if prop names are the same
2143 RNA_def_property_range(prop, 0.0f, 200.0f);
2144 RNA_def_property_ui_range(prop, 0, 100, 1, 3);
2145 RNA_def_property_ui_text(prop, "Random", "Give the starting speed a random variation");
2146 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2148 prop= RNA_def_property(srna, "particle_factor", PROP_FLOAT, PROP_NONE);
2149 RNA_def_property_float_sdna(prop, NULL, "partfac");
2150 RNA_def_property_range(prop, -200.0f, 200.0f);
2151 RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
2152 RNA_def_property_ui_text(prop, "Particle", "Let the target particle give the particle a starting speed");
2153 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2155 prop= RNA_def_property(srna, "tangent_factor", PROP_FLOAT, PROP_NONE);
2156 RNA_def_property_float_sdna(prop, NULL, "tanfac");
2157 RNA_def_property_range(prop, -1000.0f, 1000.0f);
2158 RNA_def_property_ui_range(prop, -100, 100, 1, 2);
2159 RNA_def_property_ui_text(prop, "Tangent", "Let the surface tangent give the particle a starting speed");
2160 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2162 prop= RNA_def_property(srna, "tangent_phase", PROP_FLOAT, PROP_NONE);
2163 RNA_def_property_float_sdna(prop, NULL, "tanphase");
2164 RNA_def_property_range(prop, -1.0f, 1.0f);
2165 RNA_def_property_ui_text(prop, "Rot", "Rotate the surface tangent");
2166 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2168 prop= RNA_def_property(srna, "reactor_factor", PROP_FLOAT, PROP_NONE);
2169 RNA_def_property_float_sdna(prop, NULL, "reactfac");
2170 RNA_def_property_range(prop, -10.0f, 10.0f);
2171 RNA_def_property_ui_text(prop, "Reactor", "Let the vector away from the target particles location give the particle a starting speed");
2172 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2174 prop= RNA_def_property(srna, "object_align_factor", PROP_FLOAT, PROP_VELOCITY);
2175 RNA_def_property_float_sdna(prop, NULL, "ob_vel");
2176 RNA_def_property_array(prop, 3);
2177 RNA_def_property_range(prop, -200.0f, 200.0f);
2178 RNA_def_property_ui_range(prop, -100, 100, 1, 3);
2179 RNA_def_property_ui_text(prop, "Object Aligned", "Let the emitter object orientation give the particle a starting speed");
2180 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2182 prop= RNA_def_property(srna, "angular_velocity_factor", PROP_FLOAT, PROP_NONE);
2183 RNA_def_property_float_sdna(prop, NULL, "avefac");
2184 RNA_def_property_range(prop, -200.0f, 200.0f);
2185 RNA_def_property_ui_range(prop, -100, 100, 10, 3);
2186 RNA_def_property_ui_text(prop, "Angular Velocity", "Angular velocity amount");
2187 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2189 prop= RNA_def_property(srna, "phase_factor", PROP_FLOAT, PROP_NONE);
2190 RNA_def_property_float_sdna(prop, NULL, "phasefac");
2191 RNA_def_property_range(prop, -1.0f, 1.0f);
2192 RNA_def_property_ui_text(prop, "Phase", "Initial rotation phase");
2193 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2195 prop= RNA_def_property(srna, "rotation_factor_random", PROP_FLOAT, PROP_NONE);
2196 RNA_def_property_float_sdna(prop, NULL, "randrotfac");
2197 RNA_def_property_range(prop, 0.0f, 1.0f);
2198 RNA_def_property_ui_text(prop, "Random Rotation", "Randomize rotation");
2199 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2201 prop= RNA_def_property(srna, "phase_factor_random", PROP_FLOAT, PROP_NONE);
2202 RNA_def_property_float_sdna(prop, NULL, "randphasefac");
2203 RNA_def_property_range(prop, 0.0f, 1.0f);
2204 RNA_def_property_ui_text(prop, "Random Phase", "Randomize rotation phase");
2205 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2207 prop= RNA_def_property(srna, "hair_length", PROP_FLOAT, PROP_NONE);
2208 RNA_def_property_float_funcs(prop, "rna_PartSetting_hairlength_get", "rna_PartSetting_hairlength_set", NULL);
2209 RNA_def_property_range(prop, 0.0f, 1000.0f);
2210 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
2211 RNA_def_property_ui_text(prop, "Hair Length", "Length of the hair");
2212 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2214 /* physical properties */
2215 prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
2216 RNA_def_property_range(prop, 0.001f, 100000.0f);
2217 RNA_def_property_ui_range(prop, 0.01, 100, 1, 3);
2218 RNA_def_property_ui_text(prop, "Mass", "Specify the mass of the particles");
2219 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2221 prop= RNA_def_property(srna, "particle_size", PROP_FLOAT, PROP_NONE);
2222 RNA_def_property_float_sdna(prop, NULL, "size");
2223 RNA_def_property_range(prop, 0.001f, 100000.0f);
2224 RNA_def_property_ui_range(prop, 0.01, 100, 1, 3);
2225 RNA_def_property_ui_text(prop, "Size", "The size of the particles");
2226 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2228 prop= RNA_def_property(srna, "size_random", PROP_FLOAT, PROP_NONE);
2229 RNA_def_property_float_sdna(prop, NULL, "randsize");
2230 RNA_def_property_range(prop, 0.0f, 1.0f);
2231 RNA_def_property_ui_text(prop, "Random Size", "Give the particle size a random variation");
2232 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2235 /* global physical properties */
2236 prop= RNA_def_property(srna, "drag_factor", PROP_FLOAT, PROP_NONE);
2237 RNA_def_property_float_sdna(prop, NULL, "dragfac");
2238 RNA_def_property_range(prop, 0.0f, 1.0f);
2239 RNA_def_property_ui_text(prop, "Drag", "Specify the amount of air-drag");
2240 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2242 prop= RNA_def_property(srna, "brownian_factor", PROP_FLOAT, PROP_NONE);
2243 RNA_def_property_float_sdna(prop, NULL, "brownfac");
2244 RNA_def_property_range(prop, 0.0f, 200.0f);
2245 RNA_def_property_ui_range(prop, 0, 20, 1, 3);
2246 RNA_def_property_ui_text(prop, "Brownian", "Specify the amount of Brownian motion");
2247 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2249 prop= RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
2250 RNA_def_property_float_sdna(prop, NULL, "dampfac");
2251 RNA_def_property_range(prop, 0.0f, 1.0f);
2252 RNA_def_property_ui_text(prop, "Damp", "Specify the amount of damping");
2253 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2256 prop= RNA_def_property(srna, "length_random", PROP_FLOAT, PROP_NONE);
2257 RNA_def_property_float_sdna(prop, NULL, "randlength");
2258 RNA_def_property_range(prop, 0.0f, 1.0f);
2259 RNA_def_property_ui_text(prop, "Random Length", "Give path length a random variation");
2260 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2263 prop= RNA_def_property(srna, "child_nbr", PROP_INT, PROP_NONE);
2264 RNA_def_property_int_sdna(prop, NULL, "child_nbr");//optional if prop names are the same
2265 RNA_def_property_range(prop, 0, 100000);
2266 RNA_def_property_ui_range(prop, 0, 1000, 1, 0);
2267 RNA_def_property_ui_text(prop, "Children Per Parent", "Amount of children/parent");
2268 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2270 prop= RNA_def_property(srna, "rendered_child_count", PROP_INT, PROP_NONE);
2271 RNA_def_property_int_sdna(prop, NULL, "ren_child_nbr");
2272 RNA_def_property_range(prop, 0, 100000);
2273 RNA_def_property_ui_range(prop, 0, 10000, 1, 0);
2274 RNA_def_property_ui_text(prop, "Rendered Children", "Amount of children/parent for rendering");
2276 prop= RNA_def_property(srna, "virtual_parents", PROP_FLOAT, PROP_NONE);
2277 RNA_def_property_float_sdna(prop, NULL, "parents");
2278 RNA_def_property_range(prop, 0.0f, 1.0f);
2279 RNA_def_property_ui_text(prop, "Virtual Parents", "Relative amount of virtual parents");
2280 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2282 prop= RNA_def_property(srna, "child_size", PROP_FLOAT, PROP_NONE);
2283 RNA_def_property_float_sdna(prop, NULL, "childsize");
2284 RNA_def_property_range(prop, 0.001f, 100000.0f);
2285 RNA_def_property_ui_range(prop, 0.01f, 100.0f, 0.1, 3);
2286 RNA_def_property_ui_text(prop, "Child Size", "A multiplier for the child particle size");
2287 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2289 prop= RNA_def_property(srna, "child_size_random", PROP_FLOAT, PROP_NONE);
2290 RNA_def_property_float_sdna(prop, NULL, "childrandsize");
2291 RNA_def_property_range(prop, 0.0f, 1.0f);
2292 RNA_def_property_ui_text(prop, "Random Child Size", "Random variation to the size of the child particles");
2293 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2295 prop= RNA_def_property(srna, "child_radius", PROP_FLOAT, PROP_NONE);
2296 RNA_def_property_float_sdna(prop, NULL, "childrad");
2297 RNA_def_property_range(prop, 0.0f, 10.0f);
2298 RNA_def_property_ui_text(prop, "Child Radius", "Radius of children around parent");
2299 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2301 prop= RNA_def_property(srna, "child_roundness", PROP_FLOAT, PROP_NONE);
2302 RNA_def_property_float_sdna(prop, NULL, "childflat");
2303 RNA_def_property_range(prop, 0.0f, 1.0f);
2304 RNA_def_property_ui_text(prop, "Child Roundness", "Roundness of children around parent");
2305 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2308 prop= RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
2309 RNA_def_property_float_sdna(prop, NULL, "clumpfac");
2310 RNA_def_property_range(prop, -1.0f, 1.0f);
2311 RNA_def_property_ui_text(prop, "Clump", "Amount of clumping");
2312 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2314 prop= RNA_def_property(srna, "clump_shape", PROP_FLOAT, PROP_NONE);
2315 RNA_def_property_float_sdna(prop, NULL, "clumppow");
2316 RNA_def_property_range(prop, -0.999f, 0.999f);
2317 RNA_def_property_ui_text(prop, "Shape", "Shape of clumping");
2318 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2322 prop= RNA_def_property(srna, "kink_amplitude", PROP_FLOAT, PROP_NONE);
2323 RNA_def_property_float_sdna(prop, NULL, "kink_amp");
2324 RNA_def_property_range(prop, -100000.0f, 100000.0f);
2325 RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
2326 RNA_def_property_ui_text(prop, "Amplitude", "The amplitude of the offset");
2327 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2329 prop= RNA_def_property(srna, "kink_amplitude_clump", PROP_FLOAT, PROP_NONE);
2330 RNA_def_property_float_sdna(prop, NULL, "kink_amp_clump");
2331 RNA_def_property_range(prop, 0.0f, 1.0f);
2332 RNA_def_property_ui_text(prop, "Amplitude Clump", "How much clump effects kink amplitude");
2333 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2335 prop= RNA_def_property(srna, "kink_frequency", PROP_FLOAT, PROP_NONE);
2336 RNA_def_property_float_sdna(prop, NULL, "kink_freq");
2337 RNA_def_property_range(prop, -100000.0f, 100000.0f);
2338 RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
2339 RNA_def_property_ui_text(prop, "Frequency", "The frequency of the offset (1/total length)");
2340 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2342 prop= RNA_def_property(srna, "kink_shape", PROP_FLOAT, PROP_NONE);
2343 RNA_def_property_range(prop, -0.999f, 0.999f);
2344 RNA_def_property_ui_text(prop, "Shape", "Adjust the offset to the beginning/end");
2345 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2347 prop= RNA_def_property(srna, "kink_flat", PROP_FLOAT, PROP_NONE);
2348 RNA_def_property_range(prop, 0.0f, 1.0f);
2349 RNA_def_property_ui_text(prop, "Flatness", "How flat the hairs are");
2350 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2353 prop= RNA_def_property(srna, "roughness_1", PROP_FLOAT, PROP_NONE);
2354 RNA_def_property_float_sdna(prop, NULL, "rough1");
2355 RNA_def_property_range(prop, 0.0f, 100000.0f);
2356 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
2357 RNA_def_property_ui_text(prop, "Rough1", "Amount of location dependent rough");
2358 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2360 prop= RNA_def_property(srna, "roughness_1_size", PROP_FLOAT, PROP_NONE);
2361 RNA_def_property_float_sdna(prop, NULL, "rough1_size");
2362 RNA_def_property_range(prop, 0.01f, 100000.0f);
2363 RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3);
2364 RNA_def_property_ui_text(prop, "Size1", "Size of location dependent rough");
2365 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2367 prop= RNA_def_property(srna, "roughness_2", PROP_FLOAT, PROP_NONE);
2368 RNA_def_property_float_sdna(prop, NULL, "rough2");
2369 RNA_def_property_range(prop, 0.0f, 100000.0f);
2370 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
2371 RNA_def_property_ui_text(prop, "Rough2", "Amount of random rough");
2372 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2374 prop= RNA_def_property(srna, "roughness_2_size", PROP_FLOAT, PROP_NONE);
2375 RNA_def_property_float_sdna(prop, NULL, "rough2_size");
2376 RNA_def_property_range(prop, 0.01f, 100000.0f);
2377 RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3);
2378 RNA_def_property_ui_text(prop, "Size2", "Size of random rough");
2379 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2381 prop= RNA_def_property(srna, "roughness_2_threshold", PROP_FLOAT, PROP_NONE);
2382 RNA_def_property_float_sdna(prop, NULL, "rough2_thres");
2383 RNA_def_property_range(prop, 0.0f, 1.0f);
2384 RNA_def_property_ui_text(prop, "Threshold", "Amount of particles left untouched by random rough");
2385 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2387 prop= RNA_def_property(srna, "roughness_endpoint", PROP_FLOAT, PROP_NONE);
2388 RNA_def_property_float_sdna(prop, NULL, "rough_end");
2389 RNA_def_property_range(prop, 0.0f, 100000.0f);
2390 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
2391 RNA_def_property_ui_text(prop, "Rough Endpoint", "Amount of end point rough");
2392 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2394 prop= RNA_def_property(srna, "roughness_end_shape", PROP_FLOAT, PROP_NONE);
2395 RNA_def_property_float_sdna(prop, NULL, "rough_end_shape");
2396 RNA_def_property_range(prop, 0.0f, 10.0f);
2397 RNA_def_property_ui_text(prop, "Shape", "Shape of end point rough");
2398 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2400 prop= RNA_def_property(srna, "child_length", PROP_FLOAT, PROP_NONE);
2401 RNA_def_property_float_sdna(prop, NULL, "clength");
2402 RNA_def_property_range(prop, 0.0f, 1.0f);
2403 RNA_def_property_ui_text(prop, "Length", "Length of child paths");
2404 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2406 prop= RNA_def_property(srna, "child_length_threshold", PROP_FLOAT, PROP_NONE);
2407 RNA_def_property_float_sdna(prop, NULL, "clength_thres");
2408 RNA_def_property_range(prop, 0.0f, 1.0f);
2409 RNA_def_property_ui_text(prop, "Threshold", "Amount of particles left untouched by child path length");
2410 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2413 prop= RNA_def_property(srna, "child_parting_factor", PROP_FLOAT, PROP_NONE);
2414 RNA_def_property_float_sdna(prop, NULL, "parting_fac");
2415 RNA_def_property_range(prop, 0.0f, 1.0f);
2416 RNA_def_property_ui_text(prop, "Parting Factor", "Create parting in the children based on parent strands");
2417 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2419 prop= RNA_def_property(srna, "child_parting_min", PROP_FLOAT, PROP_NONE);
2420 RNA_def_property_float_sdna(prop, NULL, "parting_min");
2421 RNA_def_property_range(prop, 0.0f, 180.0f);
2422 RNA_def_property_ui_text(prop, "Parting Minimum", "Minimum root to tip angle (tip distance/root distance for long hair)");
2423 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2425 prop= RNA_def_property(srna, "child_parting_max", PROP_FLOAT, PROP_NONE);
2426 RNA_def_property_float_sdna(prop, NULL, "parting_max");
2427 RNA_def_property_range(prop, 0.0f, 180.0f);
2428 RNA_def_property_ui_text(prop, "Parting Maximum", "Maximum root to tip angle (tip distance/root distance for long hair)");
2429 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2432 prop= RNA_def_property(srna, "branch_threshold", PROP_FLOAT, PROP_NONE);
2433 RNA_def_property_float_sdna(prop, NULL, "branch_thres");
2434 RNA_def_property_range(prop, 0.0f, 1.0f);
2435 RNA_def_property_ui_text(prop, "Threshold", "Threshold of branching");
2436 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2439 prop= RNA_def_property(srna, "line_length_tail", PROP_FLOAT, PROP_NONE);
2440 RNA_def_property_float_funcs(prop, "rna_PartSetting_linelentail_get", "rna_PartSetting_linelentail_set", NULL);
2441 RNA_def_property_range(prop, 0.0f, 100000.0f);
2442 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
2443 RNA_def_property_ui_text(prop, "Back", "Length of the line's tail");
2444 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2446 prop= RNA_def_property(srna, "line_length_head", PROP_FLOAT, PROP_NONE);
2447 RNA_def_property_float_funcs(prop, "rna_PartSetting_linelenhead_get", "rna_PartSetting_linelenhead_set", NULL);
2448 RNA_def_property_range(prop, 0.0f, 100000.0f);
2449 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
2450 RNA_def_property_ui_text(prop, "Head", "Length of the line's head");
2451 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2453 prop= RNA_def_property(srna, "path_start", PROP_FLOAT, PROP_NONE);
2454 RNA_def_property_float_sdna(prop, NULL, "path_start");
2455 RNA_def_property_float_funcs(prop, NULL, NULL, "rna_PartSetting_pathstartend_range");
2456 RNA_def_property_ui_text(prop, "Path Start", "Starting time of drawn path");
2457 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2459 prop= RNA_def_property(srna, "path_end", PROP_FLOAT, PROP_NONE);
2460 RNA_def_property_float_sdna(prop, NULL, "path_end");
2461 RNA_def_property_float_funcs(prop, NULL, NULL, "rna_PartSetting_pathstartend_range");
2462 RNA_def_property_ui_text(prop, "Path End", "End time of drawn path");
2463 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2465 prop= RNA_def_property(srna, "trail_count", PROP_INT, PROP_NONE);
2466 RNA_def_property_int_sdna(prop, NULL, "trail_count");
2467 RNA_def_property_range(prop, 1, 100000);
2468 RNA_def_property_ui_range(prop, 1, 100, 1, 0);
2469 RNA_def_property_ui_text(prop, "Trail Count", "Number of trail particles");
2470 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2472 /* keyed particles */
2473 prop= RNA_def_property(srna, "keyed_loops", PROP_INT, PROP_NONE);
2474 RNA_def_property_int_sdna(prop, NULL, "keyed_loops");
2475 RNA_def_property_range(prop, 1.0f, 10000.0f);
2476 RNA_def_property_ui_range(prop, 1.0f, 100.0f, 0.1, 3);
2477 RNA_def_property_ui_text(prop, "Loop count", "Number of times the keys are looped");
2478 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2480 /* draw objects & groups */
2481 prop= RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE);
2482 RNA_def_property_pointer_sdna(prop, NULL, "dup_group");
2483 RNA_def_property_struct_type(prop, "Group");
2484 RNA_def_property_flag(prop, PROP_EDITABLE);
2485 RNA_def_property_ui_text(prop, "Dupli Group", "Show Objects in this Group in place of particles");
2486 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2488 prop= RNA_def_property(srna, "dupli_weights", PROP_COLLECTION, PROP_NONE);
2489 RNA_def_property_collection_sdna(prop, NULL, "dupliweights", NULL);
2490 RNA_def_property_struct_type(prop, "ParticleDupliWeight");
2491 RNA_def_property_ui_text(prop, "Dupli Group Weights", "Weights for all of the objects in the dupli group");
2493 prop= RNA_def_property(srna, "active_dupliweight", PROP_POINTER, PROP_NONE);
2494 RNA_def_property_struct_type(prop, "ParticleDupliWeight");
2495 RNA_def_property_pointer_funcs(prop, "rna_ParticleDupliWeight_active_get", NULL, NULL, NULL);
2496 RNA_def_property_ui_text(prop, "Active Dupli Object", "");
2498 prop= RNA_def_property(srna, "active_dupliweight_index", PROP_INT, PROP_UNSIGNED);
2499 RNA_def_property_int_funcs(prop, "rna_ParticleDupliWeight_active_index_get", "rna_ParticleDupliWeight_active_index_set", "rna_ParticleDupliWeight_active_index_range");
2500 RNA_def_property_ui_text(prop, "Active Dupli Object Index", "");
2502 prop= RNA_def_property(srna, "dupli_object", PROP_POINTER, PROP_NONE);
2503 RNA_def_property_pointer_sdna(prop, NULL, "dup_ob");
2504 RNA_def_property_struct_type(prop, "Object");
2505 RNA_def_property_flag(prop, PROP_EDITABLE);
2506 RNA_def_property_ui_text(prop, "Dupli Object", "Show this Object in place of particles");
2507 RNA_def_property_update(prop, 0, "rna_Particle_redo_dependency");
2509 prop= RNA_def_property(srna, "billboard_object", PROP_POINTER, PROP_NONE);
2510 RNA_def_property_pointer_sdna(prop, NULL, "bb_ob");
2511 RNA_def_property_struct_type(prop, "Object");
2512 RNA_def_property_flag(prop, PROP_EDITABLE);
2513 RNA_def_property_ui_text(prop, "Billboard Object", "Billboards face this object (default is active camera)");
2514 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2517 prop= RNA_def_property(srna, "boids", PROP_POINTER, PROP_NONE);
2518 RNA_def_property_struct_type(prop, "BoidSettings");
2519 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2520 RNA_def_property_ui_text(prop, "Boid Settings", "");
2522 /* Fluid particles */
2523 prop= RNA_def_property(srna, "fluid", PROP_POINTER, PROP_NONE);
2524 RNA_def_property_struct_type(prop, "SPHFluidSettings");
2525 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2526 RNA_def_property_ui_text(prop, "SPH Fluid Settings", "");
2528 /* Effector weights */
2529 prop= RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
2530 RNA_def_property_struct_type(prop, "EffectorWeights");
2531 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2532 RNA_def_property_ui_text(prop, "Effector Weights", "");
2534 /* animation here? */
2535 rna_def_animdata_common(srna);
2537 prop= RNA_def_property(srna, "force_field_1", PROP_POINTER, PROP_NONE);
2538 RNA_def_property_pointer_sdna(prop, NULL, "pd");
2539 RNA_def_property_struct_type(prop, "FieldSettings");
2540 RNA_def_property_pointer_funcs(prop, "rna_Particle_field1_get", NULL, NULL, NULL);
2541 RNA_def_property_ui_text(prop, "Force Field 1", "");
2543 prop= RNA_def_property(srna, "force_field_2", PROP_POINTER, PROP_NONE);
2544 RNA_def_property_pointer_sdna(prop, NULL, "pd2");
2545 RNA_def_property_struct_type(prop, "FieldSettings");
2546 RNA_def_property_pointer_funcs(prop, "rna_Particle_field2_get", NULL, NULL, NULL);
2547 RNA_def_property_ui_text(prop, "Force Field 2", "");
2550 static void rna_def_particle_target(BlenderRNA *brna)
2555 static EnumPropertyItem mode_items[] = {
2556 {PTARGET_MODE_FRIEND, "FRIEND", 0, "Friend", ""},
2557 {PTARGET_MODE_NEUTRAL, "NEUTRAL", 0, "Neutral", ""},
2558 {PTARGET_MODE_ENEMY, "ENEMY", 0, "Enemy", ""},
2559 {0, NULL, 0, NULL, NULL}
2563 srna = RNA_def_struct(brna, "ParticleTarget", NULL);
2564 RNA_def_struct_ui_text(srna, "Particle Target", "Target particle system");
2566 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2567 RNA_def_property_string_funcs(prop, "rna_ParticleTarget_name_get", "rna_ParticleTarget_name_length", NULL);
2568 RNA_def_property_ui_text(prop, "Name", "Particle target name");
2569 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2570 RNA_def_struct_name_property(srna, prop);
2572 prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
2573 RNA_def_property_pointer_sdna(prop, NULL, "ob");
2574 RNA_def_property_flag(prop, PROP_EDITABLE);
2575 RNA_def_property_ui_text(prop, "Target Object", "The object that has the target particle system (empty if same object)");
2576 RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
2578 prop= RNA_def_property(srna, "system", PROP_INT, PROP_UNSIGNED);
2579 RNA_def_property_int_sdna(prop, NULL, "psys");
2580 RNA_def_property_range(prop, 1, INT_MAX);
2581 RNA_def_property_ui_text(prop, "Target Particle System", "The index of particle system on the target object");
2582 RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
2584 prop= RNA_def_property(srna, "time", PROP_FLOAT, PROP_TIME);
2585 RNA_def_property_float_sdna(prop, NULL, "time");
2586 RNA_def_property_range(prop, 0.0, 30000.0f); //TODO: replace 30000 with MAXFRAMEF when available in 2.5
2587 RNA_def_property_ui_text(prop, "Time", "");
2588 RNA_def_property_update(prop, 0, "rna_Particle_target_redo");
2590 prop= RNA_def_property(srna, "duration", PROP_FLOAT, PROP_NONE);
2591 RNA_def_property_float_sdna(prop, NULL, "duration");
2592 RNA_def_property_range(prop, 0.0, 30000.0f); //TODO: replace 30000 with MAXFRAMEF when available in 2.5
2593 RNA_def_property_ui_text(prop, "Duration", "");
2594 RNA_def_property_update(prop, 0, "rna_Particle_target_redo");
2596 prop= RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
2597 RNA_def_property_boolean_sdna(prop, NULL, "flag", PTARGET_VALID);
2598 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2599 RNA_def_property_ui_text(prop, "Valid", "Keyed particles target is valid");
2601 prop= RNA_def_property(srna, "alliance", PROP_ENUM, PROP_NONE);
2602 RNA_def_property_enum_sdna(prop, NULL, "mode");
2603 RNA_def_property_enum_items(prop, mode_items);
2604 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2605 RNA_def_property_ui_text(prop, "Mode", "");
2606 RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
2609 static void rna_def_particle_system(BlenderRNA *brna)
2614 srna= RNA_def_struct(brna, "ParticleSystem", NULL);
2615 RNA_def_struct_ui_text(srna, "Particle System", "Particle system in an object");
2616 RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
2618 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2619 RNA_def_property_ui_text(prop, "Name", "Particle system name");
2620 RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER|NA_RENAME, NULL);
2621 RNA_def_struct_name_property(srna, prop);
2623 /* access to particle settings is redirected through functions */
2624 /* to allow proper id-buttons functionality */
2625 prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
2626 //RNA_def_property_pointer_sdna(prop, NULL, "part");
2627 RNA_def_property_struct_type(prop, "ParticleSettings");
2628 RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_NULL);
2629 RNA_def_property_pointer_funcs(prop, "rna_particle_settings_get", "rna_particle_settings_set", NULL, NULL);
2630 RNA_def_property_ui_text(prop, "Settings", "Particle system settings");
2631 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2633 prop= RNA_def_property(srna, "particles", PROP_COLLECTION, PROP_NONE);
2634 RNA_def_property_collection_sdna(prop, NULL, "particles", "totpart");
2635 RNA_def_property_struct_type(prop, "Particle");
2636 RNA_def_property_ui_text(prop, "Particles", "Particles generated by the particle system");
2638 prop= RNA_def_property(srna, "child_particles", PROP_COLLECTION, PROP_NONE);
2639 RNA_def_property_collection_sdna(prop, NULL, "child", "totchild");
2640 RNA_def_property_struct_type(prop, "ChildParticle");
2641 RNA_def_property_ui_text(prop, "Child Particles", "Child particles generated by the particle system");
2643 prop= RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED);
2644 RNA_def_property_ui_text(prop, "Seed", "Offset in the random number table, to get a different randomized result");
2645 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2647 prop= RNA_def_property(srna, "child_seed", PROP_INT, PROP_UNSIGNED);
2648 RNA_def_property_ui_text(prop, "Child Seed", "Offset in the random number table for child particles, to get a different randomized result");
2649 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2652 prop= RNA_def_property(srna, "is_global_hair", PROP_BOOLEAN, PROP_NONE);
2653 RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_GLOBAL_HAIR);
2654 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2655 RNA_def_property_ui_text(prop, "Global Hair", "Hair keys are in global coordinate space");
2657 prop= RNA_def_property(srna, "use_hair_dynamics", PROP_BOOLEAN, PROP_NONE);
2658 RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_HAIR_DYNAMICS);
2659 RNA_def_property_ui_text(prop, "Hair Dynamics", "Enable hair dynamics using cloth simulation");
2660 RNA_def_property_update(prop, 0, "rna_Particle_hair_dynamics");
2662 prop= RNA_def_property(srna, "cloth", PROP_POINTER, PROP_NONE);
2663 RNA_def_property_pointer_sdna(prop, NULL, "clmd");
2664 RNA_def_property_struct_type(prop, "ClothModifier");
2665 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2666 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2667 RNA_def_property_ui_text(prop, "Cloth", "Cloth dynamics for hair");
2670 prop= RNA_def_property(srna, "reactor_target_object", PROP_POINTER, PROP_NONE);
2671 RNA_def_property_pointer_sdna(prop, NULL, "target_ob");
2672 RNA_def_property_flag(prop, PROP_EDITABLE);
2673 RNA_def_property_ui_text(prop, "Reactor Target Object", "For reactor systems, the object that has the target particle system (empty if same object)");
2674 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2676 prop= RNA_def_property(srna, "reactor_target_particle_system", PROP_INT, PROP_UNSIGNED);
2677 RNA_def_property_int_sdna(prop, NULL, "target_psys");
2678 RNA_def_property_range(prop, 1, SHRT_MAX);
2679 RNA_def_property_ui_text(prop, "Reactor Target Particle System", "For reactor systems, index of particle system on the target object");
2680 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2683 prop= RNA_def_property(srna, "use_keyed_timing", PROP_BOOLEAN, PROP_NONE);
2684 RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_KEYED_TIMING);
2685 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2686 RNA_def_property_ui_text(prop, "Keyed timing", "Use key times");
2687 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2689 prop= RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
2690 RNA_def_property_struct_type(prop, "ParticleTarget");
2691 RNA_def_property_ui_text(prop, "Targets", "Target particle systems");
2693 prop= RNA_def_property(srna, "active_particle_target", PROP_POINTER, PROP_NONE);
2694 RNA_def_property_struct_type(prop, "ParticleTarget");
2695 RNA_def_property_pointer_funcs(prop, "rna_ParticleSystem_active_particle_target_get", NULL, NULL, NULL);
2696 RNA_def_property_ui_text(prop, "Active Particle Target", "");
2698 prop= RNA_def_property(srna, "active_particle_target_index", PROP_INT, PROP_UNSIGNED);
2699 RNA_def_property_int_funcs(prop, "rna_ParticleSystem_active_particle_target_index_get", "rna_ParticleSystem_active_particle_target_index_set", "rna_ParticleSystem_active_particle_target_index_range");
2700 RNA_def_property_ui_text(prop, "Active Particle Target Index", "");
2704 prop= RNA_def_property(srna, "billboard_normal_uv", PROP_STRING, PROP_NONE);
2705 RNA_def_property_string_sdna(prop, NULL, "bb_uvname[0]");
2706 RNA_def_property_string_maxlength(prop, 32);
2707 RNA_def_property_ui_text(prop, "Billboard Normal UV", "UV Layer to control billboard normals");
2709 prop= RNA_def_property(srna, "billboard_time_index_uv", PROP_STRING, PROP_NONE);
2710 RNA_def_property_string_sdna(prop, NULL, "bb_uvname[1]");
2711 RNA_def_property_string_maxlength(prop, 32);
2712 RNA_def_property_ui_text(prop, "Billboard Time Index UV", "UV Layer to control billboard time index (X-Y)");
2714 prop= RNA_def_property(srna, "billboard_split_uv", PROP_STRING, PROP_NONE);
2715 RNA_def_property_string_sdna(prop, NULL, "bb_uvname[2]");
2716 RNA_def_property_string_maxlength(prop, 32);
2717 RNA_def_property_ui_text(prop, "Billboard Split UV", "UV Layer to control billboard splitting");
2721 /* note, internally store as ints, access as strings */
2722 #if 0 // int access. works ok but isnt useful for the UI
2723 prop= RNA_def_property(srna, "vertex_group_density", PROP_INT, PROP_NONE);
2724 RNA_def_property_int_sdna(prop, NULL, "vgroup[0]");
2725 RNA_def_property_ui_text(prop, "Vertex Group Density", "Vertex group to control density");
2726 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2729 prop= RNA_def_property(srna, "vertex_group_density", PROP_STRING, PROP_NONE);
2730 RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_0", "rna_ParticleVGroup_name_len_0", "rna_ParticleVGroup_name_set_0");
2731 RNA_def_property_ui_text(prop, "Vertex Group Density", "Vertex group to control density");
2732 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2734 prop= RNA_def_property(srna, "invert_vertex_group_density", PROP_BOOLEAN, PROP_NONE);
2735 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_DENSITY));
2736 RNA_def_property_ui_text(prop, "Vertex Group Density Negate", "Negate the effect of the density vertex group");
2737 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2739 prop= RNA_def_property(srna, "vertex_group_velocity", PROP_STRING, PROP_NONE);
2740 RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_1", "rna_ParticleVGroup_name_len_1", "rna_ParticleVGroup_name_set_1");
2741 RNA_def_property_ui_text(prop, "Vertex Group Velocity", "Vertex group to control velocity");
2742 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2744 prop= RNA_def_property(srna, "invert_vertex_group_velocity", PROP_BOOLEAN, PROP_NONE);
2745 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_VEL));
2746 RNA_def_property_ui_text(prop, "Vertex Group Velocity Negate", "Negate the effect of the velocity vertex group");
2747 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2749 prop= RNA_def_property(srna, "vertex_group_length", PROP_STRING, PROP_NONE);
2750 RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_2", "rna_ParticleVGroup_name_len_2", "rna_ParticleVGroup_name_set_2");
2751 RNA_def_property_ui_text(prop, "Vertex Group Length", "Vertex group to control length");
2752 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2754 prop= RNA_def_property(srna, "invert_vertex_group_length", PROP_BOOLEAN, PROP_NONE);
2755 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_LENGTH));
2756 RNA_def_property_ui_text(prop, "Vertex Group Length Negate", "Negate the effect of the length vertex group");
2757 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2759 prop= RNA_def_property(srna, "vertex_group_clump", PROP_STRING, PROP_NONE);
2760 RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_3", "rna_ParticleVGroup_name_len_3", "rna_ParticleVGroup_name_set_3");
2761 RNA_def_property_ui_text(prop, "Vertex Group Clump", "Vertex group to control clump");
2762 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2764 prop= RNA_def_property(srna, "invert_vertex_group_clump", PROP_BOOLEAN, PROP_NONE);
2765 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_CLUMP));
2766 RNA_def_property_ui_text(prop, "Vertex Group Clump Negate", "Negate the effect of the clump vertex group");
2767 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2769 prop= RNA_def_property(srna, "vertex_group_kink", PROP_STRING, PROP_NONE);
2770 RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_4", "rna_ParticleVGroup_name_len_4", "rna_ParticleVGroup_name_set_4");
2771 RNA_def_property_ui_text(prop, "Vertex Group Kink", "Vertex group to control kink");
2772 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2774 prop= RNA_def_property(srna, "invert_vertex_group_kink", PROP_BOOLEAN, PROP_NONE);
2775 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_KINK));
2776 RNA_def_property_ui_text(prop, "Vertex Group Kink Negate", "Negate the effect of the kink vertex group");
2777 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2779 prop= RNA_def_property(srna, "vertex_group_roughness_1", PROP_STRING, PROP_NONE);
2780 RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_5", "rna_ParticleVGroup_name_len_5", "rna_ParticleVGroup_name_set_5");
2781 RNA_def_property_ui_text(prop, "Vertex Group Roughness 1", "Vertex group to control roughness 1");
2782 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2784 prop= RNA_def_property(srna, "invert_vertex_group_roughness_1", PROP_BOOLEAN, PROP_NONE);
2785 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGH1));
2786 RNA_def_property_ui_text(prop, "Vertex Group Roughness 1 Negate", "Negate the effect of the roughness 1 vertex group");
2787 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2789 prop= RNA_def_property(srna, "vertex_group_roughness_2", PROP_STRING, PROP_NONE);
2790 RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_6", "rna_ParticleVGroup_name_len_6", "rna_ParticleVGroup_name_set_6");
2791 RNA_def_property_ui_text(prop, "Vertex Group Roughness 2", "Vertex group to control roughness 2");
2792 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2794 prop= RNA_def_property(srna, "invert_vertex_group_roughness_2", PROP_BOOLEAN, PROP_NONE);
2795 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGH2));
2796 RNA_def_property_ui_text(prop, "Vertex Group Roughness 2 Negate", "Negate the effect of the roughness 2 vertex group");
2797 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2799 prop= RNA_def_property(srna, "vertex_group_roughness_end", PROP_STRING, PROP_NONE);
2800 RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_7", "rna_ParticleVGroup_name_len_7", "rna_ParticleVGroup_name_set_7");
2801 RNA_def_property_ui_text(prop, "Vertex Group Roughness End", "Vertex group to control roughness end");
2802 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2804 prop= RNA_def_property(srna, "invert_vertex_group_roughness_end", PROP_BOOLEAN, PROP_NONE);
2805 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGHE));
2806 RNA_def_property_ui_text(prop, "Vertex Group Roughness End Negate", "Negate the effect of the roughness end vertex group");
2807 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2809 prop= RNA_def_property(srna, "vertex_group_size", PROP_STRING, PROP_NONE);
2810 RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_8", "rna_ParticleVGroup_name_len_8", "rna_ParticleVGroup_name_set_8");
2811 RNA_def_property_ui_text(prop, "Vertex Group Size", "Vertex group to control size");
2812 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2814 prop= RNA_def_property(srna, "invert_vertex_group_size", PROP_BOOLEAN, PROP_NONE);
2815 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_SIZE));
2816 RNA_def_property_ui_text(prop, "Vertex Group Size Negate", "Negate the effect of the size vertex group");
2817 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2819 prop= RNA_def_property(srna, "vertex_group_tangent", PROP_STRING, PROP_NONE);
2820 RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_9", "rna_ParticleVGroup_name_len_9", "rna_ParticleVGroup_name_set_9");
2821 RNA_def_property_ui_text(prop, "Vertex Group Tangent", "Vertex group to control tangent");
2822 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2824 prop= RNA_def_property(srna, "invert_vertex_group_tangent", PROP_BOOLEAN, PROP_NONE);
2825 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_TAN));
2826 RNA_def_property_ui_text(prop, "Vertex Group Tangent Negate", "Negate the effect of the tangent vertex group");
2827 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2829 prop= RNA_def_property(srna, "vertex_group_rotation", PROP_STRING, PROP_NONE);
2830 RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_10", "rna_ParticleVGroup_name_len_10", "rna_ParticleVGroup_name_set_10");
2831 RNA_def_property_ui_text(prop, "Vertex Group Rotation", "Vertex group to control rotation");
2832 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2834 prop= RNA_def_property(srna, "invert_vertex_group_rotation", PROP_BOOLEAN, PROP_NONE);
2835 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROT));
2836 RNA_def_property_ui_text(prop, "Vertex Group Rotation Negate", "Negate the effect of the rotation vertex group");
2837 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2839 prop= RNA_def_property(srna, "vertex_group_field", PROP_STRING, PROP_NONE);
2840 RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_11", "rna_ParticleVGroup_name_len_11", "rna_ParticleVGroup_name_set_11");
2841 RNA_def_property_ui_text(prop, "Vertex Group Field", "Vertex group to control field");
2842 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2844 prop= RNA_def_property(srna, "invert_vertex_group_field", PROP_BOOLEAN, PROP_NONE);
2845 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_EFFECTOR));
2846 RNA_def_property_ui_text(prop, "Vertex Group Field Negate", "Negate the effect of the field vertex group");
2847 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2850 prop= RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
2851 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2852 RNA_def_property_pointer_sdna(prop, NULL, "pointcache");
2853 RNA_def_property_struct_type(prop, "PointCache");
2854 RNA_def_property_ui_text(prop, "Point Cache", "");
2856 prop= RNA_def_property(srna, "has_multiple_caches", PROP_BOOLEAN, PROP_NONE);
2857 RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_multiple_caches_get", NULL);
2858 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2859 RNA_def_property_ui_text(prop, "Multiple Caches", "Particle system has multiple point caches");
2862 prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
2863 RNA_def_property_pointer_sdna(prop, NULL, "parent");
2864 RNA_def_property_flag(prop, PROP_EDITABLE);
2865 RNA_def_property_ui_text(prop, "Parent", "Use this object's coordinate system instead of global coordinate system");
2866 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2868 /* hair or cache editing */
2869 prop= RNA_def_property(srna, "is_editable", PROP_BOOLEAN, PROP_NONE);
2870 RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_editable_get", NULL);
2871 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2872 RNA_def_property_ui_text(prop, "Editable", "Particle system can be edited in particle mode");
2874 prop= RNA_def_property(srna, "is_edited", PROP_BOOLEAN, PROP_NONE);
2875 RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_edited_get", NULL);
2876 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2877 RNA_def_property_ui_text(prop, "Edited", "Particle system has been edited in particle mode");
2879 /* Read-only: this is calculated internally. Changing it would only affect
2880 * the next time-step. The user should change ParticlSettings.subframes or
2881 * ParticleSettings.courant_target instead. */
2882 prop= RNA_def_property(srna, "dt_frac", PROP_FLOAT, PROP_NONE);
2883 RNA_def_property_range(prop, 1.0f/101.0f, 1.0f);
2884 RNA_def_property_ui_text(prop, "Timestep", "The current simulation time step size, as a fraction of a frame");
2885 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2887 RNA_def_struct_path_func(srna, "rna_ParticleSystem_path");
2890 void RNA_def_particle(BlenderRNA *brna)
2892 rna_def_particle_target(brna);
2893 rna_def_fluid_settings(brna);
2894 rna_def_particle_hair_key(brna);
2895 rna_def_particle_key(brna);
2897 rna_def_child_particle(brna);
2898 rna_def_particle(brna);
2899 rna_def_particle_dupliweight(brna);
2900 rna_def_particle_system(brna);
2901 rna_def_particle_settings_mtex(brna);
2902 rna_def_particle_settings(brna);