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).
22 * ***** END GPL LICENSE BLOCK *****
25 /** \file blender/makesrna/intern/rna_particle.c
35 #include "RNA_define.h"
37 #include "rna_internal.h"
39 #include "DNA_material_types.h"
40 #include "DNA_meshdata_types.h"
41 #include "DNA_modifier_types.h"
42 #include "DNA_cloth_types.h"
43 #include "DNA_particle_types.h"
44 #include "DNA_object_force.h"
45 #include "DNA_object_types.h"
46 #include "DNA_scene_types.h"
47 #include "DNA_boid_types.h"
48 #include "DNA_texture_types.h"
53 EnumPropertyItem part_from_items[] = {
54 {PART_FROM_VERT, "VERT", 0, "Verts", ""},
55 {PART_FROM_FACE, "FACE", 0, "Faces", ""},
56 {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
57 {0, NULL, 0, NULL, NULL}
60 EnumPropertyItem part_reactor_from_items[] = {
61 {PART_FROM_VERT, "VERT", 0, "Verts", ""},
62 {PART_FROM_FACE, "FACE", 0, "Faces", ""},
63 {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
64 {0, NULL, 0, NULL, NULL}
67 EnumPropertyItem part_dist_items[] = {
68 {PART_DISTR_JIT, "JIT", 0, "Jittered", ""},
69 {PART_DISTR_RAND, "RAND", 0, "Random", ""},
70 {PART_DISTR_GRID, "GRID", 0, "Grid", ""},
71 {0, NULL, 0, NULL, NULL}
74 EnumPropertyItem part_hair_dist_items[] = {
75 {PART_DISTR_JIT, "JIT", 0, "Jittered", ""},
76 {PART_DISTR_RAND, "RAND", 0, "Random", ""},
77 {0, NULL, 0, NULL, NULL}
80 EnumPropertyItem part_draw_as_items[] = {
81 {PART_DRAW_NOT, "NONE", 0, "None", ""},
82 {PART_DRAW_REND, "RENDER", 0, "Rendered", ""},
83 {PART_DRAW_DOT, "DOT", 0, "Point", ""},
84 {PART_DRAW_CIRC, "CIRC", 0, "Circle", ""},
85 {PART_DRAW_CROSS, "CROSS", 0, "Cross", ""},
86 {PART_DRAW_AXIS, "AXIS", 0, "Axis", ""},
87 {0, NULL, 0, NULL, NULL}
90 EnumPropertyItem part_hair_draw_as_items[] = {
91 {PART_DRAW_NOT, "NONE", 0, "None", ""},
92 {PART_DRAW_REND, "RENDER", 0, "Rendered", ""},
93 {PART_DRAW_PATH, "PATH", 0, "Path", ""},
94 {0, NULL, 0, NULL, NULL}
97 EnumPropertyItem part_ren_as_items[] = {
98 {PART_DRAW_NOT, "NONE", 0, "None", ""},
99 {PART_DRAW_HALO, "HALO", 0, "Halo", ""},
100 {PART_DRAW_LINE, "LINE", 0, "Line", ""},
101 {PART_DRAW_PATH, "PATH", 0, "Path", ""},
102 {PART_DRAW_OB, "OBJECT", 0, "Object", ""},
103 {PART_DRAW_GR, "GROUP", 0, "Group", ""},
104 {PART_DRAW_BB, "BILLBOARD", 0, "Billboard", ""},
105 {0, NULL, 0, NULL, NULL}
108 EnumPropertyItem part_hair_ren_as_items[] = {
109 {PART_DRAW_NOT, "NONE", 0, "None", ""},
110 {PART_DRAW_PATH, "PATH", 0, "Path", ""},
111 {PART_DRAW_OB, "OBJECT", 0, "Object", ""},
112 {PART_DRAW_GR, "GROUP", 0, "Group", ""},
113 {0, NULL, 0, NULL, NULL}
118 #include "BLI_math.h"
119 #include "BLI_listbase.h"
121 #include "BKE_context.h"
122 #include "BKE_cloth.h"
123 #include "BKE_deform.h"
124 #include "BKE_depsgraph.h"
125 #include "BKE_DerivedMesh.h"
126 #include "BKE_cdderivedmesh.h"
127 #include "BKE_effect.h"
128 #include "BKE_modifier.h"
129 #include "BKE_particle.h"
130 #include "BKE_pointcache.h"
131 #include "BKE_texture.h"
133 /* use for object space hair get/set */
134 static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, ParticleSystemModifierData **psmd_pt, ParticleData **pa_pt)
136 HairKey *hkey= (HairKey *)ptr->data;
137 Object *ob = (Object *)ptr->id.data;
139 ParticleSystemModifierData *psmd=NULL;
140 ParticleSystem *psys;
147 /* weak, what about multiple particle systems? */
148 for (md = ob->modifiers.first; md; md=md->next) {
149 if (md->type == eModifierType_ParticleSystem)
150 psmd= (ParticleSystemModifierData*) md;
153 if (!psmd || !psmd->dm || !psmd->psys) {
159 /* not a very efficient way of getting hair key location data,
160 * but it's the best we've got at the present */
162 /* find the particle that corresponds with this HairKey */
163 for(i=0, pa=psys->particles; i<psys->totpart; i++, pa++) {
165 /* hairkeys are stored sequentially in memory, so we can find if
166 * it's the same particle by comparing pointers, without having
167 * to iterate over them all */
168 if ((hkey >= pa->hair) && (hkey < pa->hair + pa->totkey))
176 static void rna_ParticleHairKey_location_object_get(PointerRNA *ptr, float *values)
178 HairKey *hkey= (HairKey *)ptr->data;
179 Object *ob = (Object *)ptr->id.data;
180 ParticleSystemModifierData *psmd;
183 rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
186 DerivedMesh *hairdm = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_dm : NULL;
189 MVert *mvert = CDDM_get_vert(hairdm, pa->hair_index + (hkey - pa->hair));
190 copy_v3_v3(values, mvert->co);
194 psys_mat_hair_to_object(ob, psmd->dm, psmd->psys->part->from, pa, hairmat);
195 copy_v3_v3(values, hkey->co);
196 mul_m4_v3(hairmat, values);
204 static void rna_ParticleHairKey_location_object_set(PointerRNA *ptr, const float *values)
206 HairKey *hkey= (HairKey *)ptr->data;
207 Object *ob = (Object *)ptr->id.data;
208 ParticleSystemModifierData *psmd;
211 rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
214 DerivedMesh *hairdm = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_dm : NULL;
217 MVert *mvert = CDDM_get_vert(hairdm, pa->hair_index + (hkey - pa->hair));
218 copy_v3_v3(mvert->co, values);
224 psys_mat_hair_to_object(ob, psmd->dm, psmd->psys->part->from, pa, hairmat);
225 invert_m4_m4(imat, hairmat);
226 copy_v3_v3(hkey->co, values);
227 mul_m4_v3(imat, hkey->co);
235 /* property update functions */
236 static void particle_recalc(Main *bmain, Scene *scene, PointerRNA *ptr, short flag)
238 if(ptr->type==&RNA_ParticleSystem) {
239 ParticleSystem *psys = (ParticleSystem*)ptr->data;
243 DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
246 DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA|flag);
248 WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL);
250 static void rna_Particle_redo(Main *bmain, Scene *scene, PointerRNA *ptr)
252 particle_recalc(bmain, scene, ptr, PSYS_RECALC_REDO);
255 static void rna_Particle_redo_dependency(Main *bmain, Scene *scene, PointerRNA *ptr)
257 DAG_scene_sort(bmain, scene);
258 rna_Particle_redo(bmain, scene, ptr);
261 static void rna_Particle_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
263 particle_recalc(bmain, scene, ptr, PSYS_RECALC_RESET);
266 static void rna_Particle_change_type(Main *bmain, Scene *scene, PointerRNA *ptr)
268 particle_recalc(bmain, scene, ptr, PSYS_RECALC_RESET|PSYS_RECALC_TYPE);
271 static void rna_Particle_change_physics(Main *bmain, Scene *scene, PointerRNA *ptr)
273 particle_recalc(bmain, scene, ptr, PSYS_RECALC_RESET|PSYS_RECALC_PHYS);
276 static void rna_Particle_redo_child(Main *bmain, Scene *scene, PointerRNA *ptr)
278 particle_recalc(bmain, scene, ptr, PSYS_RECALC_CHILD);
281 static ParticleSystem *rna_particle_system_for_target(Object *ob, ParticleTarget *target)
283 ParticleSystem *psys;
286 for(psys=ob->particlesystem.first; psys; psys=psys->next)
287 for(pt=psys->targets.first; pt; pt=pt->next)
294 static void rna_Particle_target_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
296 if(ptr->type==&RNA_ParticleTarget) {
297 Object *ob = (Object*)ptr->id.data;
298 ParticleTarget *pt = (ParticleTarget*)ptr->data;
299 ParticleSystem *kpsys=NULL, *psys=rna_particle_system_for_target(ob, pt);
301 if(pt->ob==ob || pt->ob==NULL) {
302 kpsys = BLI_findlink(&ob->particlesystem, pt->psys-1);
305 pt->flag |= PTARGET_VALID;
307 pt->flag &= ~PTARGET_VALID;
311 kpsys = BLI_findlink(&pt->ob->particlesystem, pt->psys-1);
314 pt->flag |= PTARGET_VALID;
316 pt->flag &= ~PTARGET_VALID;
319 psys->recalc = PSYS_RECALC_RESET;
321 DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
322 DAG_scene_sort(bmain, scene);
325 WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL);
328 static void rna_Particle_target_redo(Main *bmain, Scene *scene, PointerRNA *ptr)
330 if(ptr->type==&RNA_ParticleTarget) {
331 Object *ob = (Object*)ptr->id.data;
332 ParticleTarget *pt = (ParticleTarget*)ptr->data;
333 ParticleSystem *psys = rna_particle_system_for_target(ob, pt);
335 psys->recalc = PSYS_RECALC_REDO;
337 DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
338 WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL);
342 static void rna_Particle_hair_dynamics(Main *bmain, Scene *scene, PointerRNA *ptr)
344 Object *ob = (Object*)ptr->id.data;
345 ParticleSystem *psys = (ParticleSystem*)ptr->data;
347 if(psys && !psys->clmd) {
348 psys->clmd = (ClothModifierData*)modifier_new(eModifierType_Cloth);
349 psys->clmd->sim_parms->goalspring = 0.0f;
350 psys->clmd->sim_parms->flags |= CLOTH_SIMSETTINGS_FLAG_GOAL|CLOTH_SIMSETTINGS_FLAG_NO_SPRING_COMPRESS;
351 psys->clmd->coll_parms->flags &= ~CLOTH_COLLSETTINGS_FLAG_SELF;
352 rna_Particle_redo(bmain, scene, ptr);
355 WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL);
357 DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
359 static PointerRNA rna_particle_settings_get(PointerRNA *ptr)
361 ParticleSystem *psys= (ParticleSystem*)ptr->data;
362 ParticleSettings *part = psys->part;
364 return rna_pointer_inherit_refine(ptr, &RNA_ParticleSettings, part);
367 static void rna_particle_settings_set(PointerRNA *ptr, PointerRNA value)
369 ParticleSystem *psys= (ParticleSystem*)ptr->data;
374 old_type = psys->part->type;
378 psys->part = (ParticleSettings *)value.data;
382 psys_check_boid_data(psys);
383 if(old_type != psys->part->type)
384 psys->recalc |= PSYS_RECALC_TYPE;
387 static void rna_Particle_abspathtime_update(Main *bmain, Scene *scene, PointerRNA *ptr)
389 ParticleSettings *settings = (ParticleSettings*)ptr->data;
390 float delta = settings->end + settings->lifetime - settings->sta;
391 if(settings->draw & PART_ABS_PATH_TIME) {
392 settings->path_start = settings->sta + settings->path_start * delta;
393 settings->path_end = settings->sta + settings->path_end * delta;
396 settings->path_start = (settings->path_start - settings->sta)/delta;
397 settings->path_end = (settings->path_end - settings->sta)/delta;
399 rna_Particle_redo(bmain, scene, ptr);
401 static void rna_PartSettings_start_set(struct PointerRNA *ptr, float value)
403 ParticleSettings *settings = (ParticleSettings*)ptr->data;
405 /* check for clipping */
406 if(value > settings->end)
407 value = settings->end;
409 //if(settings->type==PART_REACTOR && value < 1.0)
412 if (value < MINAFRAMEF)
415 settings->sta = value;
418 static void rna_PartSettings_end_set(struct PointerRNA *ptr, float value)
420 ParticleSettings *settings = (ParticleSettings*)ptr->data;
422 /* check for clipping */
423 if(value < settings->sta)
424 value = settings->sta;
426 settings->end = value;
429 static void rna_PartSetings_timestep_set(struct PointerRNA *ptr, float value)
431 ParticleSettings *settings = (ParticleSettings*)ptr->data;
433 settings->timetweak = value/0.04f;
436 static float rna_PartSettings_timestep_get(struct PointerRNA *ptr)
438 ParticleSettings *settings = (ParticleSettings*)ptr->data;
440 return settings->timetweak * 0.04f;
443 static void rna_PartSetting_hairlength_set(struct PointerRNA *ptr, float value)
445 ParticleSettings *settings = (ParticleSettings*)ptr->data;
446 settings->normfac = value / 4.f;
449 static float rna_PartSetting_hairlength_get(struct PointerRNA *ptr)
451 ParticleSettings *settings = (ParticleSettings*)ptr->data;
452 return settings->normfac * 4.f;
455 static void rna_PartSetting_linelentail_set(struct PointerRNA *ptr, float value)
457 ParticleSettings *settings = (ParticleSettings*)ptr->data;
458 settings->draw_line[0] = value;
461 static float rna_PartSetting_linelentail_get(struct PointerRNA *ptr)
463 ParticleSettings *settings = (ParticleSettings*)ptr->data;
464 return settings->draw_line[0];
466 static void rna_PartSetting_pathstartend_range(PointerRNA *ptr, float *min, float *max)
468 ParticleSettings *settings = (ParticleSettings*)ptr->data;
470 if(settings->type==PART_HAIR) {
472 *max = (settings->draw & PART_ABS_PATH_TIME) ? 100.0f : 1.0f;
475 *min = (settings->draw & PART_ABS_PATH_TIME) ? settings->sta : 0.0f;
476 *max= (settings->draw & PART_ABS_PATH_TIME) ? MAXFRAMEF : 1.0f;
479 static void rna_PartSetting_linelenhead_set(struct PointerRNA *ptr, float value)
481 ParticleSettings *settings = (ParticleSettings*)ptr->data;
482 settings->draw_line[1] = value;
485 static float rna_PartSetting_linelenhead_get(struct PointerRNA *ptr)
487 ParticleSettings *settings = (ParticleSettings*)ptr->data;
488 return settings->draw_line[1];
492 static int rna_PartSettings_is_fluid_get(PointerRNA *ptr)
494 ParticleSettings *part= (ParticleSettings*)ptr->data;
496 return part->type == PART_FLUID;
499 static PointerRNA rna_ParticleSystem_active_particle_target_get(PointerRNA *ptr)
501 ParticleSystem *psys= (ParticleSystem*)ptr->data;
502 ParticleTarget *pt = psys->targets.first;
504 for(; pt; pt=pt->next) {
505 if(pt->flag & PTARGET_CURRENT)
506 return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, pt);
508 return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, NULL);
510 static void rna_ParticleSystem_active_particle_target_index_range(PointerRNA *ptr, int *min, int *max)
512 ParticleSystem *psys= (ParticleSystem*)ptr->data;
514 *max= BLI_countlist(&psys->targets)-1;
518 static int rna_ParticleSystem_active_particle_target_index_get(PointerRNA *ptr)
520 ParticleSystem *psys= (ParticleSystem*)ptr->data;
521 ParticleTarget *pt = psys->targets.first;
524 for(; pt; pt=pt->next, i++)
525 if(pt->flag & PTARGET_CURRENT)
531 static void rna_ParticleSystem_active_particle_target_index_set(struct PointerRNA *ptr, int value)
533 ParticleSystem *psys= (ParticleSystem*)ptr->data;
534 ParticleTarget *pt = psys->targets.first;
537 for(; pt; pt=pt->next, i++) {
539 pt->flag |= PTARGET_CURRENT;
541 pt->flag &= ~PTARGET_CURRENT;
544 static int rna_ParticleTarget_name_length(PointerRNA *ptr)
546 ParticleTarget *pt= ptr->data;
548 if(pt->flag & PTARGET_VALID) {
549 ParticleSystem *psys = NULL;
552 psys = BLI_findlink(&pt->ob->particlesystem, pt->psys-1);
554 Object *ob = (Object*) ptr->id.data;
555 psys = BLI_findlink(&ob->particlesystem, pt->psys-1);
560 return strlen(pt->ob->id.name+2) + 2 + strlen(psys->name);
562 return strlen(psys->name);
571 static void rna_ParticleTarget_name_get(PointerRNA *ptr, char *str)
573 ParticleTarget *pt= ptr->data;
575 if(pt->flag & PTARGET_VALID) {
576 ParticleSystem *psys = NULL;
579 psys = BLI_findlink(&pt->ob->particlesystem, pt->psys-1);
581 Object *ob = (Object*) ptr->id.data;
582 psys = BLI_findlink(&ob->particlesystem, pt->psys-1);
587 sprintf(str, "%s: %s", pt->ob->id.name+2, psys->name);
589 strcpy(str, psys->name);
592 strcpy(str, "Invalid target!");
595 strcpy(str, "Invalid target!");
598 static int particle_id_check(PointerRNA *ptr)
600 ID *id= ptr->id.data;
602 return (GS(id->name) == ID_PA);
605 static char *rna_SPHFluidSettings_path(PointerRNA *ptr)
607 SPHFluidSettings *fluid = (SPHFluidSettings *)ptr->data;
609 if(particle_id_check(ptr)) {
610 ParticleSettings *part = (ParticleSettings*)ptr->id.data;
612 if (part->fluid == fluid)
613 return BLI_sprintfN("fluid");
618 static int rna_ParticleSystem_multiple_caches_get(PointerRNA *ptr)
620 ParticleSystem *psys= (ParticleSystem*)ptr->data;
622 return (psys->ptcaches.first != psys->ptcaches.last);
624 static int rna_ParticleSystem_editable_get(PointerRNA *ptr)
626 ParticleSystem *psys= (ParticleSystem*)ptr->data;
628 return psys_check_edited(psys);
630 static int rna_ParticleSystem_edited_get(PointerRNA *ptr)
632 ParticleSystem *psys= (ParticleSystem*)ptr->data;
634 if(psys->part && psys->part->type==PART_HAIR)
635 return (psys->flag & PSYS_EDITED || (psys->edit && psys->edit->edited));
637 return (psys->pointcache->edit && psys->pointcache->edit->edited);
639 static PointerRNA rna_ParticleDupliWeight_active_get(PointerRNA *ptr)
641 ParticleSettings *part= (ParticleSettings*)ptr->id.data;
642 ParticleDupliWeight *dw = part->dupliweights.first;
644 for(; dw; dw=dw->next) {
645 if(dw->flag & PART_DUPLIW_CURRENT)
646 return rna_pointer_inherit_refine(ptr, &RNA_ParticleDupliWeight, dw);
648 return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, NULL);
650 static void rna_ParticleDupliWeight_active_index_range(PointerRNA *ptr, int *min, int *max)
652 ParticleSettings *part= (ParticleSettings*)ptr->id.data;
654 *max= BLI_countlist(&part->dupliweights)-1;
658 static int rna_ParticleDupliWeight_active_index_get(PointerRNA *ptr)
660 ParticleSettings *part= (ParticleSettings*)ptr->id.data;
661 ParticleDupliWeight *dw = part->dupliweights.first;
664 for(; dw; dw=dw->next, i++)
665 if(dw->flag & PART_DUPLIW_CURRENT)
671 static void rna_ParticleDupliWeight_active_index_set(struct PointerRNA *ptr, int value)
673 ParticleSettings *part= (ParticleSettings*)ptr->id.data;
674 ParticleDupliWeight *dw = part->dupliweights.first;
677 for(; dw; dw=dw->next, i++) {
679 dw->flag |= PART_DUPLIW_CURRENT;
681 dw->flag &= ~PART_DUPLIW_CURRENT;
685 static int rna_ParticleDupliWeight_name_length(PointerRNA *ptr)
687 ParticleDupliWeight *dw= ptr->data;
690 return strlen(dw->ob->id.name+2) + 7;
695 static void rna_ParticleDupliWeight_name_get(PointerRNA *ptr, char *str)
697 ParticleDupliWeight *dw= ptr->data;
700 sprintf(str, "%s: %i", dw->ob->id.name+2, dw->count);
702 strcpy(str, "No object");
705 static EnumPropertyItem *rna_Particle_from_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
707 //if(part->type==PART_REACTOR)
708 // return part_reactor_from_items;
710 return part_from_items;
713 static EnumPropertyItem *rna_Particle_dist_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
715 ParticleSettings *part = ptr->id.data;
717 if(part->type==PART_HAIR)
718 return part_hair_dist_items;
720 return part_dist_items;
723 static EnumPropertyItem *rna_Particle_draw_as_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
725 ParticleSettings *part = ptr->id.data;
727 if(part->type==PART_HAIR)
728 return part_hair_draw_as_items;
730 return part_draw_as_items;
733 static EnumPropertyItem *rna_Particle_ren_as_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
735 ParticleSettings *part = ptr->id.data;
737 if(part->type==PART_HAIR)
738 return part_hair_ren_as_items;
740 return part_ren_as_items;
743 static PointerRNA rna_Particle_field1_get(PointerRNA *ptr)
745 ParticleSettings *part= (ParticleSettings*)ptr->id.data;
749 part->pd= object_add_collision_fields(0);
751 return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd);
754 static PointerRNA rna_Particle_field2_get(PointerRNA *ptr)
756 ParticleSettings *part= (ParticleSettings*)ptr->id.data;
760 part->pd2= object_add_collision_fields(0);
762 return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd2);
765 static void psys_vg_name_get__internal(PointerRNA *ptr, char *value, int index)
767 Object *ob= ptr->id.data;
768 ParticleSystem *psys= (ParticleSystem*)ptr->data;
770 if(psys->vgroup[index] > 0) {
771 bDeformGroup *defGroup= BLI_findlink(&ob->defbase, psys->vgroup[index]-1);
774 strcpy(value, defGroup->name);
781 static int psys_vg_name_len__internal(PointerRNA *ptr, int index)
783 Object *ob= ptr->id.data;
784 ParticleSystem *psys= (ParticleSystem*)ptr->data;
786 if(psys->vgroup[index] > 0) {
787 bDeformGroup *defGroup= BLI_findlink(&ob->defbase, psys->vgroup[index]-1);
790 return strlen(defGroup->name);
795 static void psys_vg_name_set__internal(PointerRNA *ptr, const char *value, int index)
797 Object *ob= ptr->id.data;
798 ParticleSystem *psys= (ParticleSystem*)ptr->data;
801 psys->vgroup[index]= 0;
804 int vgroup_num = defgroup_name_index(ob, (char*)value);
809 psys->vgroup[index]= vgroup_num + 1;
813 static char *rna_ParticleSystem_path(PointerRNA *ptr)
815 ParticleSystem *psys= (ParticleSystem*)ptr->data;
816 return BLI_sprintfN("particle_systems[\"%s\"]", psys->name);
819 static void rna_ParticleSettings_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
821 ParticleSettings *part= (ParticleSettings*)ptr->data;
822 rna_iterator_array_begin(iter, (void*)part->mtex, sizeof(MTex*), MAX_MTEX, 0, NULL);
825 static PointerRNA rna_ParticleSettings_active_texture_get(PointerRNA *ptr)
827 ParticleSettings *part= (ParticleSettings*)ptr->data;
830 tex= give_current_particle_texture(part);
831 return rna_pointer_inherit_refine(ptr, &RNA_Texture, tex);
834 static void rna_ParticleSettings_active_texture_set(PointerRNA *ptr, PointerRNA value)
836 ParticleSettings *part= (ParticleSettings*)ptr->data;
838 set_current_particle_texture(part, value.data);
841 /* irritating string functions for each index :/ */
842 static void rna_ParticleVGroup_name_get_0(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 0); }
843 static void rna_ParticleVGroup_name_get_1(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 1); }
844 static void rna_ParticleVGroup_name_get_2(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 2); }
845 static void rna_ParticleVGroup_name_get_3(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 3); }
846 static void rna_ParticleVGroup_name_get_4(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 4); }
847 static void rna_ParticleVGroup_name_get_5(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 5); }
848 static void rna_ParticleVGroup_name_get_6(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 6); }
849 static void rna_ParticleVGroup_name_get_7(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 7); }
850 static void rna_ParticleVGroup_name_get_8(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 8); }
851 static void rna_ParticleVGroup_name_get_9(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 9); }
852 static void rna_ParticleVGroup_name_get_10(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 10); }
853 static void rna_ParticleVGroup_name_get_11(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 11); }
855 static int rna_ParticleVGroup_name_len_0(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 0); }
856 static int rna_ParticleVGroup_name_len_1(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 1); }
857 static int rna_ParticleVGroup_name_len_2(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 2); }
858 static int rna_ParticleVGroup_name_len_3(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 3); }
859 static int rna_ParticleVGroup_name_len_4(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 4); }
860 static int rna_ParticleVGroup_name_len_5(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 5); }
861 static int rna_ParticleVGroup_name_len_6(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 6); }
862 static int rna_ParticleVGroup_name_len_7(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 7); }
863 static int rna_ParticleVGroup_name_len_8(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 8); }
864 static int rna_ParticleVGroup_name_len_9(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 9); }
865 static int rna_ParticleVGroup_name_len_10(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 10); }
866 static int rna_ParticleVGroup_name_len_11(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 11); }
868 static void rna_ParticleVGroup_name_set_0(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 0); }
869 static void rna_ParticleVGroup_name_set_1(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 1); }
870 static void rna_ParticleVGroup_name_set_2(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 2); }
871 static void rna_ParticleVGroup_name_set_3(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 3); }
872 static void rna_ParticleVGroup_name_set_4(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 4); }
873 static void rna_ParticleVGroup_name_set_5(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 5); }
874 static void rna_ParticleVGroup_name_set_6(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 6); }
875 static void rna_ParticleVGroup_name_set_7(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 7); }
876 static void rna_ParticleVGroup_name_set_8(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 8); }
877 static void rna_ParticleVGroup_name_set_9(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 9); }
878 static void rna_ParticleVGroup_name_set_10(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 10); }
879 static void rna_ParticleVGroup_name_set_11(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 11); }
884 static void rna_def_particle_hair_key(BlenderRNA *brna)
889 srna = RNA_def_struct(brna, "ParticleHairKey", NULL);
890 RNA_def_struct_sdna(srna, "HairKey");
891 RNA_def_struct_ui_text(srna, "Particle Hair Key", "Particle key for hair particle system");
893 prop= RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
894 RNA_def_property_ui_text(prop, "Time", "Relative time of key over hair length");
896 prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_UNSIGNED);
897 RNA_def_property_range(prop, 0.0, 1.0);
898 RNA_def_property_ui_text(prop, "Weight", "Weight for cloth simulation");
900 prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
901 RNA_def_property_array(prop, 3);
902 RNA_def_property_ui_text(prop, "Location (Object Space)", "Location of the hair key in object space");
903 RNA_def_property_float_funcs(prop, "rna_ParticleHairKey_location_object_get", "rna_ParticleHairKey_location_object_set", NULL);
905 prop= RNA_def_property(srna, "co_hair_space", PROP_FLOAT, PROP_TRANSLATION);
906 RNA_def_property_float_sdna(prop, NULL, "co");
907 RNA_def_property_ui_text(prop, "Location", "Location of the hair key in its internal coordinate system, relative to the emitting face");
910 static void rna_def_particle_key(BlenderRNA *brna)
915 srna = RNA_def_struct(brna, "ParticleKey", NULL);
916 RNA_def_struct_ui_text(srna, "Particle Key", "Key location for a particle over time");
918 prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
919 RNA_def_property_float_sdna(prop, NULL, "co");
920 RNA_def_property_ui_text(prop, "Location", "Key location");
922 prop= RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
923 RNA_def_property_float_sdna(prop, NULL, "vel");
924 RNA_def_property_ui_text(prop, "Velocity", "Key velocity");
926 prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
927 RNA_def_property_float_sdna(prop, NULL, "rot");
928 RNA_def_property_ui_text(prop, "Rotation", "Key rotation quaternion");
930 prop= RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
931 RNA_def_property_float_sdna(prop, NULL, "ave");
932 RNA_def_property_ui_text(prop, "Angular Velocity", "Key angular velocity");
934 prop= RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
935 RNA_def_property_ui_text(prop, "Time", "Time of key over the simulation");
938 static void rna_def_child_particle(BlenderRNA *brna)
943 srna = RNA_def_struct(brna, "ChildParticle", NULL);
944 RNA_def_struct_ui_text(srna, "Child Particle", "Child particle interpolated from simulated or edited particles");
946 // int num, parent; /* num is face index on the final derived mesh */
948 // int pa[4]; /* nearest particles to the child, used for the interpolation */
949 // float w[4]; /* interpolation weights for the above particles */
950 // float fuv[4], foffset; /* face vertex weights and offset */
954 static void rna_def_particle(BlenderRNA *brna)
959 static EnumPropertyItem alive_items[] = {
960 //{PARS_KILLED, "KILLED", 0, "Killed", ""},
961 {PARS_DEAD, "DEAD", 0, "Dead", ""},
962 {PARS_UNBORN, "UNBORN", 0, "Unborn", ""},
963 {PARS_ALIVE, "ALIVE", 0, "Alive", ""},
964 {PARS_DYING, "DYING", 0, "Dying", ""},
965 {0, NULL, 0, NULL, NULL}
968 srna = RNA_def_struct(brna, "Particle", NULL);
969 RNA_def_struct_sdna(srna, "ParticleData");
970 RNA_def_struct_ui_text(srna, "Particle", "Particle in a particle system");
972 /* Particle State & Previous State */
973 prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
974 RNA_def_property_float_sdna(prop, NULL, "state.co");
975 RNA_def_property_ui_text(prop, "Particle Location", "");
977 prop= RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
978 RNA_def_property_float_sdna(prop, NULL, "state.vel");
979 RNA_def_property_ui_text(prop, "Particle Velocity", "");
981 prop= RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
982 RNA_def_property_float_sdna(prop, NULL, "state.ave");
983 RNA_def_property_ui_text(prop, "Angular Velocity", "");
985 prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
986 RNA_def_property_float_sdna(prop, NULL, "state.rot");
987 RNA_def_property_ui_text(prop, "Rotation", "");
989 prop= RNA_def_property(srna, "prev_location", PROP_FLOAT, PROP_TRANSLATION);
990 RNA_def_property_float_sdna(prop, NULL, "prev_state.co");
991 RNA_def_property_ui_text(prop, "Previous Particle Location", "");
993 prop= RNA_def_property(srna, "prev_velocity", PROP_FLOAT, PROP_VELOCITY);
994 RNA_def_property_float_sdna(prop, NULL, "prev_state.vel");
995 RNA_def_property_ui_text(prop, "Previous Particle Velocity", "");
997 prop= RNA_def_property(srna, "prev_angular_velocity", PROP_FLOAT, PROP_VELOCITY);
998 RNA_def_property_float_sdna(prop, NULL, "prev_state.ave");
999 RNA_def_property_ui_text(prop, "Previous Angular Velocity", "");
1001 prop= RNA_def_property(srna, "prev_rotation", PROP_FLOAT, PROP_QUATERNION);
1002 RNA_def_property_float_sdna(prop, NULL, "prev_state.rot");
1003 RNA_def_property_ui_text(prop, "Previous Rotation", "");
1005 /* Hair & Keyed Keys */
1007 prop= RNA_def_property(srna, "hair_keys", PROP_COLLECTION, PROP_NONE);
1008 RNA_def_property_collection_sdna(prop, NULL, "hair", "totkey");
1009 RNA_def_property_struct_type(prop, "ParticleHairKey");
1010 RNA_def_property_ui_text(prop, "Hair", "");
1012 prop= RNA_def_property(srna, "particle_keys", PROP_COLLECTION, PROP_NONE);
1013 RNA_def_property_collection_sdna(prop, NULL, "keys", "totkey");
1014 RNA_def_property_struct_type(prop, "ParticleKey");
1015 RNA_def_property_ui_text(prop, "Keyed States", "");
1017 // float fuv[4], foffset; /* coordinates on face/edge number "num" and depth along*/
1018 // /* face normal for volume emission */
1020 prop= RNA_def_property(srna, "birth_time", PROP_FLOAT, PROP_TIME);
1021 RNA_def_property_float_sdna(prop, NULL, "time");
1022 // RNA_def_property_range(prop, lowerLimitf, upperLimitf);
1023 RNA_def_property_ui_text(prop, "Birth Time", "");
1025 prop= RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
1026 // RNA_def_property_range(prop, lowerLimitf, upperLimitf);
1027 RNA_def_property_ui_text(prop, "Lifetime", "");
1029 prop= RNA_def_property(srna, "die_time", PROP_FLOAT, PROP_TIME);
1030 RNA_def_property_float_sdna(prop, NULL, "dietime");
1031 // RNA_def_property_range(prop, lowerLimitf, upperLimitf);
1032 RNA_def_property_ui_text(prop, "Die Time", "");
1034 prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
1035 // RNA_def_property_range(prop, lowerLimitf, upperLimitf);
1036 RNA_def_property_ui_text(prop, "Size", "");
1039 // int num; /* index to vert/edge/face */
1040 // int num_dmcache; /* index to derived mesh data (face) to avoid slow lookups */
1046 prop= RNA_def_property(srna, "is_exist", PROP_BOOLEAN, PROP_NONE);
1047 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PARS_UNEXIST);
1048 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1049 RNA_def_property_ui_text(prop, "Exists", "");
1051 prop= RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE);
1052 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PARS_NO_DISP);
1053 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1054 RNA_def_property_ui_text(prop, "Visible", "");
1056 prop= RNA_def_property(srna, "alive_state", PROP_ENUM, PROP_NONE);
1057 RNA_def_property_enum_sdna(prop, NULL, "alive");
1058 RNA_def_property_enum_items(prop, alive_items);
1059 RNA_def_property_ui_text(prop, "Alive State", "");
1064 static void rna_def_particle_dupliweight(BlenderRNA *brna)
1069 srna = RNA_def_struct(brna, "ParticleDupliWeight", NULL);
1070 RNA_def_struct_ui_text(srna, "Particle Dupliobject Weight", "Weight of a particle dupliobject in a group");
1071 RNA_def_struct_sdna(srna, "ParticleDupliWeight");
1073 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1074 RNA_def_property_string_funcs(prop, "rna_ParticleDupliWeight_name_get", "rna_ParticleDupliWeight_name_length", NULL);
1075 RNA_def_property_ui_text(prop, "Name", "Particle dupliobject name");
1076 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1077 RNA_def_struct_name_property(srna, prop);
1079 prop= RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
1080 RNA_def_property_range(prop, 0, SHRT_MAX);
1081 RNA_def_property_ui_text(prop, "Count", "The number of times this object is repeated with respect to other objects");
1082 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1085 static void rna_def_fluid_settings(BlenderRNA *brna)
1090 srna = RNA_def_struct(brna, "SPHFluidSettings", NULL);
1091 RNA_def_struct_path_func(srna, "rna_SPHFluidSettings_path");
1092 RNA_def_struct_ui_text(srna, "SPH Fluid Settings", "Settings for particle fluids physics");
1094 /* Fluid settings */
1095 prop= RNA_def_property(srna, "spring_force", PROP_FLOAT, PROP_NONE);
1096 RNA_def_property_float_sdna(prop, NULL, "spring_k");
1097 RNA_def_property_range(prop, 0.0f, 100.0f);
1098 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
1099 RNA_def_property_ui_text(prop, "Spring Force", "Spring force");
1100 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1102 prop= RNA_def_property(srna, "fluid_radius", PROP_FLOAT, PROP_NONE);
1103 RNA_def_property_float_sdna(prop, NULL, "radius");
1104 RNA_def_property_range(prop, 0.0f, 20.0f);
1105 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
1106 RNA_def_property_ui_text(prop, "Interaction Radius", "Fluid interaction radius");
1107 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1109 prop= RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_NONE);
1110 RNA_def_property_range(prop, 0.0f, 2.0f);
1111 RNA_def_property_ui_text(prop, "Rest Length", "Spring rest length (factor of particle radius)");
1112 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1114 prop= RNA_def_property(srna, "use_viscoelastic_springs", PROP_BOOLEAN, PROP_NONE);
1115 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_VISCOELASTIC_SPRINGS);
1116 RNA_def_property_ui_text(prop, "Viscoelastic Springs", "Use viscoelastic springs instead of Hooke's springs");
1117 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1119 prop= RNA_def_property(srna, "use_initial_rest_length", PROP_BOOLEAN, PROP_NONE);
1120 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_CURRENT_REST_LENGTH);
1121 RNA_def_property_ui_text(prop, "Initial Rest Length", "Use the initial length as spring rest length instead of 2 * particle size");
1122 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1124 prop= RNA_def_property(srna, "plasticity", PROP_FLOAT, PROP_NONE);
1125 RNA_def_property_float_sdna(prop, NULL, "plasticity_constant");
1126 RNA_def_property_range(prop, 0.0f, 100.0f);
1127 RNA_def_property_ui_text(prop, "Plasticity", "How much the spring rest length can change after the elastic limit is crossed");
1128 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1130 prop= RNA_def_property(srna, "yield_ratio", PROP_FLOAT, PROP_NONE);
1131 RNA_def_property_float_sdna(prop, NULL, "yield_ratio");
1132 RNA_def_property_range(prop, 0.0f, 1.0f);
1133 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");
1134 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1136 prop= RNA_def_property(srna, "spring_frames", PROP_INT, PROP_NONE);
1137 RNA_def_property_range(prop, 0.0f, 100.0f);
1138 RNA_def_property_ui_text(prop, "Spring Frames", "Create springs for this number of frames since particles birth (0 is always)");
1139 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1142 prop= RNA_def_property(srna, "linear_viscosity", PROP_FLOAT, PROP_NONE);
1143 RNA_def_property_float_sdna(prop, NULL, "viscosity_omega");
1144 RNA_def_property_range(prop, 0.0f, 100.0f);
1145 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
1146 RNA_def_property_ui_text(prop, "Viscosity", "Linear viscosity");
1147 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1149 prop= RNA_def_property(srna, "stiff_viscosity", PROP_FLOAT, PROP_NONE);
1150 RNA_def_property_float_sdna(prop, NULL, "viscosity_beta");
1151 RNA_def_property_range(prop, 0.0f, 100.0f);
1152 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
1153 RNA_def_property_ui_text(prop, "Stiff viscosity", "Creates viscosity for expanding fluid)");
1154 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1156 /* Double density relaxation */
1157 prop= RNA_def_property(srna, "stiffness", PROP_FLOAT, PROP_NONE);
1158 RNA_def_property_float_sdna(prop, NULL, "stiffness_k");
1159 RNA_def_property_range(prop, 0.0f, 100.0f);
1160 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
1161 RNA_def_property_ui_text(prop, "Stiffness", "How incompressible the fluid is");
1162 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1164 prop= RNA_def_property(srna, "repulsion", PROP_FLOAT, PROP_NONE);
1165 RNA_def_property_float_sdna(prop, NULL, "stiffness_knear");
1166 RNA_def_property_range(prop, 0.0f, 100.0f);
1167 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
1168 RNA_def_property_ui_text(prop, "Repulsion Factor", "How strongly the fluid tries to keep from clustering (factor of stiffness)");
1169 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1171 prop= RNA_def_property(srna, "rest_density", PROP_FLOAT, PROP_NONE);
1172 RNA_def_property_float_sdna(prop, NULL, "rest_density");
1173 RNA_def_property_range(prop, 0.0f, 100.0f);
1174 RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
1175 RNA_def_property_ui_text(prop, "Rest Density", "Fluid rest density");
1176 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1179 prop= RNA_def_property(srna, "buoyancy", PROP_FLOAT, PROP_NONE);
1180 RNA_def_property_float_sdna(prop, NULL, "buoyancy");
1181 RNA_def_property_range(prop, 0.0f, 10.0f);
1182 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3);
1183 RNA_def_property_ui_text(prop, "Buoyancy", "Artificial buoyancy force in negative gravity direction based on pressure differences inside the fluid");
1184 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1188 prop= RNA_def_property(srna, "factor_repulsion", PROP_BOOLEAN, PROP_NONE);
1189 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_REPULSION);
1190 RNA_def_property_ui_text(prop, "Factor Repulsion", "Repulsion is a factor of stiffness");
1191 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1193 prop= RNA_def_property(srna, "factor_density", PROP_BOOLEAN, PROP_NONE);
1194 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_DENSITY);
1195 RNA_def_property_ui_text(prop, "Factor Density", "Density is calculated as a factor of default density (depends on particle size)");
1196 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1198 prop= RNA_def_property(srna, "factor_radius", PROP_BOOLEAN, PROP_NONE);
1199 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_RADIUS);
1200 RNA_def_property_ui_text(prop, "Factor Radius", "Interaction radius is a factor of 4 * particle size");
1201 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1203 prop= RNA_def_property(srna, "factor_stiff_viscosity", PROP_BOOLEAN, PROP_NONE);
1204 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_VISCOSITY);
1205 RNA_def_property_ui_text(prop, "Factor Stiff Viscosity", "Stiff viscosity is a factor of normal viscosity");
1206 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1208 prop= RNA_def_property(srna, "factor_rest_length", PROP_BOOLEAN, PROP_NONE);
1209 RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_REST_LENGTH);
1210 RNA_def_property_ui_text(prop, "Factor Rest Length", "Spring rest length is a factor of 2 * particle size");
1211 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1214 static void rna_def_particle_settings_mtex(BlenderRNA *brna)
1219 static EnumPropertyItem texco_items[] = {
1220 {TEXCO_GLOB, "GLOBAL", 0, "Global", "Uses global coordinates for the texture coordinates"},
1221 {TEXCO_OBJECT, "OBJECT", 0, "Object", "Uses linked object's coordinates for texture coordinates"},
1222 {TEXCO_UV, "UV", 0, "UV", "Uses UV coordinates for texture coordinates"},
1223 {TEXCO_ORCO, "ORCO", 0, "Generated", "Uses the original undeformed coordinates of the object"},
1224 {TEXCO_STRAND, "STRAND", 0, "Strand / Particle", "Uses normalized strand texture coordinate (1D) or particle age (X) and trail position (Y)"},
1225 {0, NULL, 0, NULL, NULL}};
1227 static EnumPropertyItem prop_mapping_items[] = {
1228 {MTEX_FLAT, "FLAT", 0, "Flat", "Maps X and Y coordinates directly"},
1229 {MTEX_CUBE, "CUBE", 0, "Cube", "Maps using the normal vector"},
1230 {MTEX_TUBE, "TUBE", 0, "Tube", "Maps with Z as central axis"},
1231 {MTEX_SPHERE, "SPHERE", 0, "Sphere", "Maps with Z as central axis"},
1232 {0, NULL, 0, NULL, NULL}};
1234 static EnumPropertyItem prop_x_mapping_items[] = {
1235 {0, "NONE", 0, "None", ""},
1236 {1, "X", 0, "X", ""},
1237 {2, "Y", 0, "Y", ""},
1238 {3, "Z", 0, "Z", ""},
1239 {0, NULL, 0, NULL, NULL}};
1241 static EnumPropertyItem prop_y_mapping_items[] = {
1242 {0, "NONE", 0, "None", ""},
1243 {1, "X", 0, "X", ""},
1244 {2, "Y", 0, "Y", ""},
1245 {3, "Z", 0, "Z", ""},
1246 {0, NULL, 0, NULL, NULL}};
1248 static EnumPropertyItem prop_z_mapping_items[] = {
1249 {0, "NONE", 0, "None", ""},
1250 {1, "X", 0, "X", ""},
1251 {2, "Y", 0, "Y", ""},
1252 {3, "Z", 0, "Z", ""},
1253 {0, NULL, 0, NULL, NULL}};
1255 srna= RNA_def_struct(brna, "ParticleSettingsTextureSlot", "TextureSlot");
1256 RNA_def_struct_sdna(srna, "MTex");
1257 RNA_def_struct_ui_text(srna, "Particle Settings Texture Slot", "Texture slot for textures in a Particle Settings datablock");
1259 prop= RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
1260 RNA_def_property_enum_sdna(prop, NULL, "texco");
1261 RNA_def_property_enum_items(prop, texco_items);
1262 RNA_def_property_ui_text(prop, "Texture Coordinates", "Texture coordinates used to map the texture onto the background");
1263 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1265 prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1266 RNA_def_property_pointer_sdna(prop, NULL, "object");
1267 RNA_def_property_struct_type(prop, "Object");
1268 RNA_def_property_flag(prop, PROP_EDITABLE);
1269 RNA_def_property_ui_text(prop, "Object", "Object to use for mapping with Object texture coordinates");
1270 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1272 prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
1273 RNA_def_property_string_sdna(prop, NULL, "uvname");
1274 RNA_def_property_ui_text(prop, "UV Layer", "UV layer to use for mapping with UV texture coordinates");
1275 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1277 prop= RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE);
1278 RNA_def_property_enum_sdna(prop, NULL, "projx");
1279 RNA_def_property_enum_items(prop, prop_x_mapping_items);
1280 RNA_def_property_ui_text(prop, "X Mapping", "");
1281 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1283 prop= RNA_def_property(srna, "mapping_y", PROP_ENUM, PROP_NONE);
1284 RNA_def_property_enum_sdna(prop, NULL, "projy");
1285 RNA_def_property_enum_items(prop, prop_y_mapping_items);
1286 RNA_def_property_ui_text(prop, "Y Mapping", "");
1287 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1289 prop= RNA_def_property(srna, "mapping_z", PROP_ENUM, PROP_NONE);
1290 RNA_def_property_enum_sdna(prop, NULL, "projz");
1291 RNA_def_property_enum_items(prop, prop_z_mapping_items);
1292 RNA_def_property_ui_text(prop, "Z Mapping", "");
1293 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1295 prop= RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
1296 RNA_def_property_enum_items(prop, prop_mapping_items);
1297 RNA_def_property_ui_text(prop, "Mapping", "");
1298 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1301 prop= RNA_def_property(srna, "use_map_time", PROP_BOOLEAN, PROP_NONE);
1302 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_TIME);
1303 RNA_def_property_ui_text(prop, "Emission Time", "Affect the emission time of the particles");
1304 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1306 prop= RNA_def_property(srna, "use_map_life", PROP_BOOLEAN, PROP_NONE);
1307 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_LIFE);
1308 RNA_def_property_ui_text(prop, "Life Time", "Affect the life time of the particles");
1309 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1311 prop= RNA_def_property(srna, "use_map_density", PROP_BOOLEAN, PROP_NONE);
1312 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_DENS);
1313 RNA_def_property_ui_text(prop, "Density", "Affect the density of the particles");
1314 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1316 prop= RNA_def_property(srna, "use_map_size", PROP_BOOLEAN, PROP_NONE);
1317 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_SIZE);
1318 RNA_def_property_ui_text(prop, "Size", "Affect the particle size");
1319 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1321 prop= RNA_def_property(srna, "use_map_velocity", PROP_BOOLEAN, PROP_NONE);
1322 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_IVEL);
1323 RNA_def_property_ui_text(prop, "Initial Velocity", "Affect the particle initial velocity");
1324 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1326 prop= RNA_def_property(srna, "use_map_field", PROP_BOOLEAN, PROP_NONE);
1327 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_FIELD);
1328 RNA_def_property_ui_text(prop, "Force Field", "Affect the particle force fields");
1329 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1331 prop= RNA_def_property(srna, "use_map_gravity", PROP_BOOLEAN, PROP_NONE);
1332 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_GRAVITY);
1333 RNA_def_property_ui_text(prop, "Gravity", "Affect the particle gravity");
1334 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1336 prop= RNA_def_property(srna, "use_map_damp", PROP_BOOLEAN, PROP_NONE);
1337 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_DAMP);
1338 RNA_def_property_ui_text(prop, "Damp", "Affect the particle velocity damping");
1339 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1341 prop= RNA_def_property(srna, "use_map_clump", PROP_BOOLEAN, PROP_NONE);
1342 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_CLUMP);
1343 RNA_def_property_ui_text(prop, "Clump", "Affect the child clumping");
1344 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1346 prop= RNA_def_property(srna, "use_map_kink", PROP_BOOLEAN, PROP_NONE);
1347 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_KINK);
1348 RNA_def_property_ui_text(prop, "Kink", "Affect the child kink");
1349 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1351 prop= RNA_def_property(srna, "use_map_rough", PROP_BOOLEAN, PROP_NONE);
1352 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_ROUGH);
1353 RNA_def_property_ui_text(prop, "Rough", "Affect the child rough");
1354 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1356 prop= RNA_def_property(srna, "use_map_length", PROP_BOOLEAN, PROP_NONE);
1357 RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_LENGTH);
1358 RNA_def_property_ui_text(prop, "Length", "Affect the child hair length");
1359 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1362 /* influence factors */
1363 prop= RNA_def_property(srna, "time_factor", PROP_FLOAT, PROP_NONE);
1364 RNA_def_property_float_sdna(prop, NULL, "timefac");
1365 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1366 RNA_def_property_ui_text(prop, "Emission Time Factor", "Amount texture affects particle emission time");
1367 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1369 prop= RNA_def_property(srna, "life_factor", PROP_FLOAT, PROP_NONE);
1370 RNA_def_property_float_sdna(prop, NULL, "lifefac");
1371 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1372 RNA_def_property_ui_text(prop, "Life Time Factor", "Amount texture affects particle life time");
1373 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1375 prop= RNA_def_property(srna, "density_factor", PROP_FLOAT, PROP_NONE);
1376 RNA_def_property_float_sdna(prop, NULL, "padensfac");
1377 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1378 RNA_def_property_ui_text(prop, "Density Factor", "Amount texture affects particle density");
1379 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1381 prop= RNA_def_property(srna, "size_factor", PROP_FLOAT, PROP_NONE);
1382 RNA_def_property_float_sdna(prop, NULL, "sizefac");
1383 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1384 RNA_def_property_ui_text(prop, "Size Factor", "Amount texture affects physical particle size");
1385 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1387 prop= RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE);
1388 RNA_def_property_float_sdna(prop, NULL, "ivelfac");
1389 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1390 RNA_def_property_ui_text(prop, "Velocity Factor", "Amount texture affects particle initial velocity");
1391 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1394 prop= RNA_def_property(srna, "field_factor", PROP_FLOAT, PROP_NONE);
1395 RNA_def_property_float_sdna(prop, NULL, "fieldfac");
1396 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1397 RNA_def_property_ui_text(prop, "Field Factor", "Amount texture affects particle force fields");
1398 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1400 prop= RNA_def_property(srna, "gravity_factor", PROP_FLOAT, PROP_NONE);
1401 RNA_def_property_float_sdna(prop, NULL, "gravityfac");
1402 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1403 RNA_def_property_ui_text(prop, "Gravity Factor", "Amount texture affects particle gravity");
1404 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1406 prop= RNA_def_property(srna, "damp_factor", PROP_FLOAT, PROP_NONE);
1407 RNA_def_property_float_sdna(prop, NULL, "dampfac");
1408 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1409 RNA_def_property_ui_text(prop, "Damp Factor", "Amount texture affects particle damping");
1410 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1413 prop= RNA_def_property(srna, "length_factor", PROP_FLOAT, PROP_NONE);
1414 RNA_def_property_float_sdna(prop, NULL, "lengthfac");
1415 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1416 RNA_def_property_ui_text(prop, "Length Factor", "Amount texture affects child hair length");
1417 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1419 prop= RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
1420 RNA_def_property_float_sdna(prop, NULL, "clumpfac");
1421 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1422 RNA_def_property_ui_text(prop, "Clump Factor", "Amount texture affects child clump");
1423 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1425 prop= RNA_def_property(srna, "kink_factor", PROP_FLOAT, PROP_NONE);
1426 RNA_def_property_float_sdna(prop, NULL, "kinkfac");
1427 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1428 RNA_def_property_ui_text(prop, "Kink Factor", "Amount texture affects child kink");
1429 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1431 prop= RNA_def_property(srna, "rough_factor", PROP_FLOAT, PROP_NONE);
1432 RNA_def_property_float_sdna(prop, NULL, "roughfac");
1433 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1434 RNA_def_property_ui_text(prop, "Rough Factor", "Amount texture affects child roughness");
1435 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1438 static void rna_def_particle_settings(BlenderRNA *brna)
1443 static EnumPropertyItem type_items[] = {
1444 {PART_EMITTER, "EMITTER", 0, "Emitter", ""},
1445 //{PART_REACTOR, "REACTOR", 0, "Reactor", ""},
1446 {PART_HAIR, "HAIR", 0, "Hair", ""},
1447 {0, NULL, 0, NULL, NULL}
1450 static EnumPropertyItem phys_type_items[] = {
1451 {PART_PHYS_NO, "NO", 0, "No", ""},
1452 {PART_PHYS_NEWTON, "NEWTON", 0, "Newtonian", ""},
1453 {PART_PHYS_KEYED, "KEYED", 0, "Keyed", ""},
1454 {PART_PHYS_BOIDS, "BOIDS", 0, "Boids", ""},
1455 {PART_PHYS_FLUID, "FLUID", 0, "Fluid", ""},
1456 {0, NULL, 0, NULL, NULL}
1459 static EnumPropertyItem rot_mode_items[] = {
1460 {0, "NONE", 0, "None", ""},
1461 {PART_ROT_NOR, "NOR", 0, "Normal", ""},
1462 {PART_ROT_VEL, "VEL", 0, "Velocity", ""},
1463 {PART_ROT_GLOB_X, "GLOB_X", 0, "Global X", ""},
1464 {PART_ROT_GLOB_Y, "GLOB_Y", 0, "Global Y", ""},
1465 {PART_ROT_GLOB_Z, "GLOB_Z", 0, "Global Z", ""},
1466 {PART_ROT_OB_X, "OB_X", 0, "Object X", ""},
1467 {PART_ROT_OB_Y, "OB_Y", 0, "Object Y", ""},
1468 {PART_ROT_OB_Z, "OB_Z", 0, "Object Z", ""},
1469 {0, NULL, 0, NULL, NULL}
1472 static EnumPropertyItem ave_mode_items[] = {
1473 {0, "NONE", 0, "None", ""},
1474 {PART_AVE_SPIN, "SPIN", 0, "Spin", ""},
1475 {PART_AVE_RAND, "RAND", 0, "Random", ""} ,
1476 {0, NULL, 0, NULL, NULL}
1479 static EnumPropertyItem react_event_items[] = {
1480 {PART_EVENT_DEATH, "DEATH", 0, "Death", ""},
1481 {PART_EVENT_COLLIDE, "COLLIDE", 0, "Collision", ""},
1482 {PART_EVENT_NEAR, "NEAR", 0, "Near", ""},
1483 {0, NULL, 0, NULL, NULL}
1486 static EnumPropertyItem child_type_items[] = {
1487 {0, "NONE", 0, "None", ""},
1488 {PART_CHILD_PARTICLES, "SIMPLE", 0, "Simple", ""},
1489 {PART_CHILD_FACES, "INTERPOLATED", 0, "Interpolated", ""},
1490 {0, NULL, 0, NULL, NULL}
1493 //TODO: names, tooltips
1495 static EnumPropertyItem rot_from_items[] = {
1496 {PART_ROT_KEYS, "KEYS", 0, "keys", ""},
1497 {PART_ROT_ZINCR, "ZINCR", 0, "zincr", ""},
1498 {PART_ROT_IINCR, "IINCR", 0, "iincr", ""},
1499 {0, NULL, 0, NULL, NULL}
1502 static EnumPropertyItem integrator_type_items[] = {
1503 {PART_INT_EULER, "EULER", 0, "Euler", ""},
1504 {PART_INT_VERLET, "VERLET", 0, "Verlet", ""},
1505 {PART_INT_MIDPOINT, "MIDPOINT", 0, "Midpoint", ""},
1506 {PART_INT_RK4, "RK4", 0, "RK4", ""},
1507 {0, NULL, 0, NULL, NULL}
1510 static EnumPropertyItem kink_type_items[] = {
1511 {PART_KINK_NO, "NO", 0, "Nothing", ""},
1512 {PART_KINK_CURL, "CURL", 0, "Curl", ""},
1513 {PART_KINK_RADIAL, "RADIAL", 0, "Radial", ""},
1514 {PART_KINK_WAVE, "WAVE", 0, "Wave", ""},
1515 {PART_KINK_BRAID, "BRAID", 0, "Braid", ""},
1516 {0, NULL, 0, NULL, NULL}
1519 static EnumPropertyItem kink_axis_items[] = {
1520 {0, "X", 0, "X", ""},
1521 {1, "Y", 0, "Y", ""},
1522 {2, "Z", 0, "Z", ""},
1523 {0, NULL, 0, NULL, NULL}
1526 static EnumPropertyItem bb_align_items[] = {
1527 {PART_BB_X, "X", 0, "X", ""},
1528 {PART_BB_Y, "Y", 0, "Y", ""},
1529 {PART_BB_Z, "Z", 0, "Z", ""},
1530 {PART_BB_VIEW, "VIEW", 0, "View", ""},
1531 {PART_BB_VEL, "VEL", 0, "Velocity", ""},
1532 {0, NULL, 0, NULL, NULL}
1535 static EnumPropertyItem bb_anim_items[] = {
1536 {PART_BB_ANIM_NONE, "NONE", 0, "None", ""},
1537 {PART_BB_ANIM_AGE, "AGE", 0, "Age", ""},
1538 {PART_BB_ANIM_FRAME, "FRAME", 0, "Frame", ""},
1539 {PART_BB_ANIM_ANGLE, "ANGLE", 0, "Angle", ""},
1540 {0, NULL, 0, NULL, NULL}
1543 static EnumPropertyItem bb_split_offset_items[] = {
1544 {PART_BB_OFF_NONE, "NONE", 0, "None", ""},
1545 {PART_BB_OFF_LINEAR, "LINEAR", 0, "Linear", ""},
1546 {PART_BB_OFF_RANDOM, "RANDOM", 0, "Random", ""},
1547 {0, NULL, 0, NULL, NULL}
1550 static EnumPropertyItem draw_col_items[] = {
1551 {PART_DRAW_COL_NONE, "NONE", 0, "None", ""},
1552 {PART_DRAW_COL_MAT, "MATERIAL", 0, "Material", ""},
1553 {PART_DRAW_COL_VEL, "VELOCITY", 0, "Velocity", ""},
1554 {PART_DRAW_COL_ACC, "ACCELERATION", 0, "Acceleration", ""},
1555 {0, NULL, 0, NULL, NULL}
1558 srna= RNA_def_struct(brna, "ParticleSettings", "ID");
1559 RNA_def_struct_ui_text(srna, "Particle Settings", "Particle settings, reusable by multiple particle systems");
1560 RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
1562 rna_def_mtex_common(brna, srna, "rna_ParticleSettings_mtex_begin", "rna_ParticleSettings_active_texture_get",
1563 "rna_ParticleSettings_active_texture_set", "ParticleSettingsTextureSlot", "ParticleSettingsTextureSlots", "rna_Particle_reset");
1565 /* fluid particle type can't be checked from the type value in rna as it's not shown in the menu */
1566 prop= RNA_def_property(srna, "is_fluid", PROP_BOOLEAN, PROP_NONE);
1567 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1568 RNA_def_property_boolean_funcs(prop, "rna_PartSettings_is_fluid_get", NULL);
1569 RNA_def_property_ui_text(prop, "Fluid", "Particles were created by a fluid simulation");
1572 prop= RNA_def_property(srna, "use_react_start_end", PROP_BOOLEAN, PROP_NONE);
1573 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_STA_END);
1574 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1575 RNA_def_property_ui_text(prop, "Start/End", "Give birth to unreacted particles eventually");
1576 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1578 prop= RNA_def_property(srna, "use_react_multiple", PROP_BOOLEAN, PROP_NONE);
1579 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_MULTIPLE);
1580 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1581 RNA_def_property_ui_text(prop, "Multi React", "React multiple times");
1582 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1584 prop= RNA_def_property(srna, "regrow_hair", PROP_BOOLEAN, PROP_NONE);
1585 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_REGROW);
1586 RNA_def_property_ui_text(prop, "Regrow", "Regrow hair for each frame");
1587 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1589 prop= RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
1590 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_UNBORN);
1591 RNA_def_property_ui_text(prop, "Unborn", "Show particles before they are emitted");
1592 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1594 prop= RNA_def_property(srna, "use_dead", PROP_BOOLEAN, PROP_NONE);
1595 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_DIED);
1596 RNA_def_property_ui_text(prop, "Died", "Show particles after they have died");
1597 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1599 prop= RNA_def_property(srna, "use_emit_random", PROP_BOOLEAN, PROP_NONE);
1600 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_TRAND);
1601 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1602 RNA_def_property_ui_text(prop, "Random", "Emit in random order of elements");
1603 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1605 prop= RNA_def_property(srna, "use_even_distribution", PROP_BOOLEAN, PROP_NONE);
1606 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_EDISTR);
1607 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1608 RNA_def_property_ui_text(prop, "Even Distribution", "Use even distribution from faces based on face areas or edge lengths");
1609 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1611 prop= RNA_def_property(srna, "use_die_on_collision", PROP_BOOLEAN, PROP_NONE);
1612 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_DIE_ON_COL);
1613 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1614 RNA_def_property_ui_text(prop, "Die on hit", "Particles die when they collide with a deflector object");
1615 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1617 prop= RNA_def_property(srna, "use_size_deflect", PROP_BOOLEAN, PROP_NONE);
1618 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SIZE_DEFL);
1619 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1620 RNA_def_property_ui_text(prop, "Size Deflect", "Use particle's size in deflection");
1621 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1623 prop= RNA_def_property(srna, "use_dynamic_rotation", PROP_BOOLEAN, PROP_NONE);
1624 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ROT_DYN);
1625 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1626 RNA_def_property_ui_text(prop, "Dynamic", "Sets rotation to dynamic/constant");
1627 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1629 prop= RNA_def_property(srna, "use_multiply_size_mass", PROP_BOOLEAN, PROP_NONE);
1630 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SIZEMASS);
1631 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1632 RNA_def_property_ui_text(prop, "Mass from Size", "Multiply mass by particle size");
1633 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1635 prop= RNA_def_property(srna, "use_advanced_hair", PROP_BOOLEAN, PROP_NONE);
1636 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PART_HIDE_ADVANCED_HAIR);
1637 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1638 RNA_def_property_ui_text(prop, "Advanced", "Use full physics calculations for growing hair");
1639 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1641 prop= RNA_def_property(srna, "lock_boids_to_surface", PROP_BOOLEAN, PROP_NONE);
1642 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_BOIDS_2D);
1643 RNA_def_property_ui_text(prop, "Boids 2D", "Constrain boids to a surface");
1644 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1646 prop= RNA_def_property(srna, "use_hair_bspline", PROP_BOOLEAN, PROP_NONE);
1647 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_BSPLINE);
1648 RNA_def_property_ui_text(prop, "B-Spline", "Interpolate hair using B-Splines");
1649 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1651 prop= RNA_def_property(srna, "invert_grid", PROP_BOOLEAN, PROP_NONE);
1652 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GRID_INVERT);
1653 RNA_def_property_ui_text(prop, "Invert Grid", "Invert what is considered object and what is not");
1654 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1656 prop= RNA_def_property(srna, "hexagonal_grid", PROP_BOOLEAN, PROP_NONE);
1657 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GRID_HEXAGONAL);
1658 RNA_def_property_ui_text(prop, "Hexagonal Grid", "Create the grid in a hexagonal pattern");
1659 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1661 prop= RNA_def_property(srna, "apply_effector_to_children", PROP_BOOLEAN, PROP_NONE);
1662 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_EFFECT);
1663 RNA_def_property_ui_text(prop, "Effect Children", "Apply effectors to children");
1664 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1666 prop= RNA_def_property(srna, "create_long_hair_children", PROP_BOOLEAN, PROP_NONE);
1667 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_LONG_HAIR);
1668 RNA_def_property_ui_text(prop, "Long Hair", "Calculate children that suit long hair well");
1669 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1671 prop= RNA_def_property(srna, "apply_guide_to_children", PROP_BOOLEAN, PROP_NONE);
1672 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_GUIDE);
1673 RNA_def_property_ui_text(prop, "apply_guide_to_children", "");
1674 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1676 prop= RNA_def_property(srna, "use_self_effect", PROP_BOOLEAN, PROP_NONE);
1677 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SELF_EFFECT);
1678 RNA_def_property_ui_text(prop, "Self Effect", "Particle effectors effect themselves");
1679 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1682 prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
1683 RNA_def_property_enum_items(prop, type_items);
1684 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1685 RNA_def_property_ui_text(prop, "Type", "Particle Type");
1686 RNA_def_property_update(prop, 0, "rna_Particle_change_type");
1688 prop= RNA_def_property(srna, "emit_from", PROP_ENUM, PROP_NONE);
1689 RNA_def_property_enum_sdna(prop, NULL, "from");
1690 RNA_def_property_enum_items(prop, part_reactor_from_items);
1691 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1692 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_from_itemf");
1693 RNA_def_property_ui_text(prop, "Emit From", "Where to emit particles from");
1694 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1696 prop= RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
1697 RNA_def_property_enum_sdna(prop, NULL, "distr");
1698 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1699 RNA_def_property_enum_items(prop, part_dist_items);
1700 RNA_def_property_enum_items(prop, part_draw_as_items);
1701 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_dist_itemf");
1702 RNA_def_property_ui_text(prop, "Distribution", "How to distribute particles on selected element");
1703 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1706 prop= RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
1707 RNA_def_property_enum_sdna(prop, NULL, "phystype");
1708 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1709 RNA_def_property_enum_items(prop, phys_type_items);
1710 RNA_def_property_ui_text(prop, "Physics Type", "Particle physics type");
1711 RNA_def_property_update(prop, 0, "rna_Particle_change_physics");
1713 prop= RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
1714 RNA_def_property_enum_sdna(prop, NULL, "rotmode");
1715 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1716 RNA_def_property_enum_items(prop, rot_mode_items);
1717 RNA_def_property_ui_text(prop, "Rotation", "Particles initial rotation");
1718 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1720 prop= RNA_def_property(srna, "angular_velocity_mode", PROP_ENUM, PROP_NONE);
1721 RNA_def_property_enum_sdna(prop, NULL, "avemode");
1722 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1723 RNA_def_property_enum_items(prop, ave_mode_items);
1724 RNA_def_property_ui_text(prop, "Angular Velocity Mode", "Particle angular velocity mode");
1725 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1727 prop= RNA_def_property(srna, "react_event", PROP_ENUM, PROP_NONE);
1728 RNA_def_property_enum_sdna(prop, NULL, "reactevent");
1729 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1730 RNA_def_property_enum_items(prop, react_event_items);
1731 RNA_def_property_ui_text(prop, "React On", "The event of target particles to react on");
1732 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1735 prop= RNA_def_property(srna, "show_velocity", PROP_BOOLEAN, PROP_NONE);
1736 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL);
1737 RNA_def_property_ui_text(prop, "Velocity", "Show particle velocity");
1738 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1740 prop= RNA_def_property(srna, "show_size", PROP_BOOLEAN, PROP_NONE);
1741 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_SIZE);
1742 RNA_def_property_ui_text(prop, "Size", "Show particle size");
1743 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1745 prop= RNA_def_property(srna, "use_render_emitter", PROP_BOOLEAN, PROP_NONE);
1746 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_EMITTER);
1747 RNA_def_property_ui_text(prop, "Emitter", "Render emitter Object also");
1748 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1750 prop= RNA_def_property(srna, "show_health", PROP_BOOLEAN, PROP_NONE);
1751 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_HEALTH);
1752 RNA_def_property_ui_text(prop, "Health", "Draw boid health");
1753 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1755 prop= RNA_def_property(srna, "use_absolute_path_time", PROP_BOOLEAN, PROP_NONE);
1756 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_ABS_PATH_TIME);
1757 RNA_def_property_ui_text(prop, "Absolute Path Time", "Path timing is in absolute frames");
1758 RNA_def_property_update(prop, 0, "rna_Particle_abspathtime_update");
1760 prop= RNA_def_property(srna, "lock_billboard", PROP_BOOLEAN, PROP_NONE);
1761 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_BB_LOCK);
1762 RNA_def_property_ui_text(prop, "Lock Billboard", "Lock the billboards align axis");
1763 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1765 prop= RNA_def_property(srna, "use_parent_particles", PROP_BOOLEAN, PROP_NONE);
1766 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_PARENT);
1767 RNA_def_property_ui_text(prop, "Parents", "Render parent particles");
1768 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1770 prop= RNA_def_property(srna, "show_number", PROP_BOOLEAN, PROP_NONE);
1771 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_NUM);
1772 RNA_def_property_ui_text(prop, "Number", "Show particle number");
1773 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1775 prop= RNA_def_property(srna, "use_group_pick_random", PROP_BOOLEAN, PROP_NONE);
1776 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_RAND_GR);
1777 RNA_def_property_ui_text(prop, "Pick Random", "Pick objects from group randomly");
1778 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1780 prop= RNA_def_property(srna, "use_group_count", PROP_BOOLEAN, PROP_NONE);
1781 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_COUNT_GR);
1782 RNA_def_property_ui_text(prop, "Use Count", "Use object multiple times in the same group");
1783 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1785 prop= RNA_def_property(srna, "use_global_dupli", PROP_BOOLEAN, PROP_NONE);
1786 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_GLOBAL_OB);
1787 RNA_def_property_ui_text(prop, "Use Global", "Use object's global coordinates for duplication");
1788 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1790 prop= RNA_def_property(srna, "use_render_adaptive", PROP_BOOLEAN, PROP_NONE);
1791 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_ADAPT);
1792 RNA_def_property_ui_text(prop, "Adaptive render", "Draw steps of the particle path");
1793 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1795 prop= RNA_def_property(srna, "use_velocity_length", PROP_BOOLEAN, PROP_NONE);
1796 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL_LENGTH);
1797 RNA_def_property_ui_text(prop, "Speed", "Multiply line length by particle speed");
1798 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1800 prop= RNA_def_property(srna, "use_whole_group", PROP_BOOLEAN, PROP_NONE);
1801 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_WHOLE_GR);
1802 RNA_def_property_ui_text(prop, "Whole Group", "Use whole group at once");
1803 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1805 prop= RNA_def_property(srna, "use_strand_primitive", PROP_BOOLEAN, PROP_NONE);
1806 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_STRAND);
1807 RNA_def_property_ui_text(prop, "Strand render", "Use the strand primitive for rendering");
1808 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1810 prop= RNA_def_property(srna, "draw_method", PROP_ENUM, PROP_NONE);
1811 RNA_def_property_enum_sdna(prop, NULL, "draw_as");
1812 RNA_def_property_enum_items(prop, part_draw_as_items);
1813 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_draw_as_itemf");
1814 RNA_def_property_ui_text(prop, "Particle Drawing", "How particles are drawn in viewport");
1815 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1817 prop= RNA_def_property(srna, "render_type", PROP_ENUM, PROP_NONE);
1818 RNA_def_property_enum_sdna(prop, NULL, "ren_as");
1819 RNA_def_property_enum_items(prop, part_ren_as_items);
1820 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_ren_as_itemf");
1821 RNA_def_property_ui_text(prop, "Particle Rendering", "How particles are rendered");
1822 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1824 prop= RNA_def_property(srna, "draw_color", PROP_ENUM, PROP_NONE);
1825 RNA_def_property_enum_sdna(prop, NULL, "draw_col");
1826 RNA_def_property_enum_items(prop, draw_col_items);
1827 RNA_def_property_ui_text(prop, "Draw Color", "Draw additional particle data as a color");
1828 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1830 prop= RNA_def_property(srna, "draw_size", PROP_INT, PROP_NONE);
1831 RNA_def_property_range(prop, 0, 1000);
1832 RNA_def_property_ui_range(prop, 0, 100, 1, 0);
1833 RNA_def_property_ui_text(prop, "Draw Size", "Size of particles on viewport in pixels (0=default)");
1834 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1836 prop= RNA_def_property(srna, "child_type", PROP_ENUM, PROP_NONE);
1837 RNA_def_property_enum_sdna(prop, NULL, "childtype");
1838 RNA_def_property_enum_items(prop, child_type_items);
1839 RNA_def_property_ui_text(prop, "Children From", "Create child particles");
1840 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1842 prop= RNA_def_property(srna, "draw_step", PROP_INT, PROP_NONE);
1843 RNA_def_property_range(prop, 0, 10);
1844 RNA_def_property_ui_range(prop, 0, 7, 1, 0);
1845 RNA_def_property_ui_text(prop, "Steps", "How many steps paths are drawn with (power of 2)");
1846 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1848 prop= RNA_def_property(srna, "render_step", PROP_INT, PROP_NONE);
1849 RNA_def_property_int_sdna(prop, NULL, "ren_step");
1850 RNA_def_property_range(prop, 0, 20);
1851 RNA_def_property_ui_range(prop, 0, 9, 1, 0);
1852 RNA_def_property_ui_text(prop, "Render", "How many steps paths are rendered with (power of 2)");
1854 prop= RNA_def_property(srna, "hair_step", PROP_INT, PROP_NONE);
1855 RNA_def_property_range(prop, 2, 50);
1856 RNA_def_property_ui_text(prop, "Segments", "Number of hair segments");
1857 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1860 //TODO: not found in UI, readonly?
1861 prop= RNA_def_property(srna, "keys_step", PROP_INT, PROP_NONE);
1862 RNA_def_property_range(prop, 0, SHRT_MAX);//TODO:min,max
1863 RNA_def_property_ui_text(prop, "Keys Step", "");
1865 /* adaptive path rendering */
1866 prop= RNA_def_property(srna, "adaptive_angle", PROP_INT, PROP_NONE);
1867 RNA_def_property_int_sdna(prop, NULL, "adapt_angle");
1868 RNA_def_property_range(prop, 0, 45);
1869 RNA_def_property_ui_text(prop, "Degrees", "How many degrees path has to curve to make another render segment");
1871 prop= RNA_def_property(srna, "adaptive_pixel", PROP_INT, PROP_NONE);
1872 RNA_def_property_int_sdna(prop, NULL, "adapt_pix");
1873 RNA_def_property_range(prop, 0, 50);
1874 RNA_def_property_ui_text(prop, "Pixel", "How many pixels path has to cover to make another render segment");
1876 prop= RNA_def_property(srna, "draw_percentage", PROP_INT, PROP_NONE);
1877 RNA_def_property_int_sdna(prop, NULL, "disp");
1878 RNA_def_property_range(prop, 0, 100);
1879 RNA_def_property_ui_text(prop, "Display", "Percentage of particles to display in 3D view");
1880 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1882 prop= RNA_def_property(srna, "material", PROP_INT, PROP_NONE);
1883 RNA_def_property_int_sdna(prop, NULL, "omat");
1884 RNA_def_property_range(prop, 1, 32767);
1885 RNA_def_property_ui_text(prop, "Material", "Specify material used for the particles");
1886 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1889 // not used anywhere, why is this in DNA???
1891 prop= RNA_def_property(srna, "rotate_from", PROP_ENUM, PROP_NONE);
1892 RNA_def_property_enum_sdna(prop, NULL, "rotfrom");
1893 RNA_def_property_enum_items(prop, rot_from_items);
1894 RNA_def_property_ui_text(prop, "Rotate From", "");
1897 prop= RNA_def_property(srna, "integrator", PROP_ENUM, PROP_NONE);
1898 RNA_def_property_enum_items(prop, integrator_type_items);
1899 RNA_def_property_ui_text(prop, "Integration", "Algorithm used to calculate physics. Fastest to most stable/accurate: Midpoint, Euler, Verlet, RK4 (Old)");
1900 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1902 prop= RNA_def_property(srna, "kink", PROP_ENUM, PROP_NONE);
1903 RNA_def_property_enum_items(prop, kink_type_items);
1904 RNA_def_property_ui_text(prop, "Kink", "Type of periodic offset on the path");
1905 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1907 prop= RNA_def_property(srna, "kink_axis", PROP_ENUM, PROP_NONE);
1908 RNA_def_property_enum_items(prop, kink_axis_items);
1909 RNA_def_property_ui_text(prop, "Axis", "Which axis to use for offset");
1910 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1913 prop= RNA_def_property(srna, "billboard_align", PROP_ENUM, PROP_NONE);
1914 RNA_def_property_enum_sdna(prop, NULL, "bb_align");
1915 RNA_def_property_enum_items(prop, bb_align_items);
1916 RNA_def_property_ui_text(prop, "Align to", "In respect to what the billboards are aligned");
1917 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1919 prop= RNA_def_property(srna, "billboard_uv_split", PROP_INT, PROP_NONE);
1920 RNA_def_property_int_sdna(prop, NULL, "bb_uv_split");
1921 RNA_def_property_range(prop, 1, 100);
1922 RNA_def_property_ui_range(prop, 1, 10, 1, 0);
1923 RNA_def_property_ui_text(prop, "UV Split", "Amount of rows/columns to split UV coordinates for billboards");
1925 prop= RNA_def_property(srna, "billboard_animation", PROP_ENUM, PROP_NONE);
1926 RNA_def_property_enum_sdna(prop, NULL, "bb_anim");
1927 RNA_def_property_enum_items(prop, bb_anim_items);
1928 RNA_def_property_ui_text(prop, "Animate", "How to animate billboard textures");
1930 prop= RNA_def_property(srna, "billboard_offset_split", PROP_ENUM, PROP_NONE);
1931 RNA_def_property_enum_sdna(prop, NULL, "bb_split_offset");
1932 RNA_def_property_enum_items(prop, bb_split_offset_items);
1933 RNA_def_property_ui_text(prop, "Offset", "How to offset billboard textures");
1935 prop= RNA_def_property(srna, "billboard_tilt", PROP_FLOAT, PROP_NONE);
1936 RNA_def_property_float_sdna(prop, NULL, "bb_tilt");
1937 RNA_def_property_range(prop, -1.0f, 1.0f);
1938 RNA_def_property_ui_text(prop, "Tilt", "Tilt of the billboards");
1939 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1941 prop= RNA_def_property(srna, "color_maximum", PROP_FLOAT, PROP_NONE);
1942 RNA_def_property_float_sdna(prop, NULL, "color_vec_max");
1943 RNA_def_property_range(prop, 0.01f, 100.0f);
1944 RNA_def_property_ui_text(prop, "Color Maximum", "Maximum length of the particle color vector");
1945 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1947 prop= RNA_def_property(srna, "billboard_tilt_random", PROP_FLOAT, PROP_NONE);
1948 RNA_def_property_float_sdna(prop, NULL, "bb_rand_tilt");
1949 RNA_def_property_range(prop, 0.0f, 1.0f);
1950 RNA_def_property_ui_text(prop, "Random Tilt", "Random tilt of the billboards");
1951 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1953 prop= RNA_def_property(srna, "billboard_offset", PROP_FLOAT, PROP_TRANSLATION);
1954 RNA_def_property_float_sdna(prop, NULL, "bb_offset");
1955 RNA_def_property_array(prop, 2);
1956 RNA_def_property_range(prop, -100.0f, 100.0f);
1957 RNA_def_property_ui_range(prop, -1.0, 1.0, 0.1, 3);
1958 RNA_def_property_ui_text(prop, "Billboard Offset", "");
1959 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1961 /* simplification */
1962 prop= RNA_def_property(srna, "use_simplify", PROP_BOOLEAN, PROP_NONE);
1963 RNA_def_property_boolean_sdna(prop, NULL, "simplify_flag", PART_SIMPLIFY_ENABLE);
1964 RNA_def_property_ui_text(prop, "Child Simplification", "Remove child strands as the object becomes smaller on the screen");
1966 prop= RNA_def_property(srna, "use_simplify_viewport", PROP_BOOLEAN, PROP_NONE);
1967 RNA_def_property_boolean_sdna(prop, NULL, "simplify_flag", PART_SIMPLIFY_VIEWPORT);
1968 RNA_def_property_ui_text(prop, "Viewport", "");
1970 prop= RNA_def_property(srna, "simplify_refsize", PROP_INT, PROP_UNSIGNED);
1971 RNA_def_property_int_sdna(prop, NULL, "simplify_refsize");
1972 RNA_def_property_range(prop, 1, 32768);
1973 RNA_def_property_ui_text(prop, "Reference Size", "Reference size in pixels, after which simplification begins");
1975 prop= RNA_def_property(srna, "simplify_rate", PROP_FLOAT, PROP_NONE);
1976 RNA_def_property_range(prop, 0.0f, 1.0f);
1977 RNA_def_property_ui_text(prop, "Rate", "Speed of simplification");
1979 prop= RNA_def_property(srna, "simplify_transition", PROP_FLOAT, PROP_NONE);
1980 RNA_def_property_range(prop, 0.0f, 1.0f);
1981 RNA_def_property_ui_text(prop, "Transition", "Transition period for fading out strands");
1983 prop= RNA_def_property(srna, "simplify_viewport", PROP_FLOAT, PROP_NONE);
1984 RNA_def_property_range(prop, 0.0f, 0.999f);
1985 RNA_def_property_ui_text(prop, "Rate", "Speed of Simplification");
1987 /* general values */
1988 prop= RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
1989 RNA_def_property_float_sdna(prop, NULL, "sta");//optional if prop names are the same
1990 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
1991 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1992 RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_start_set", NULL);
1993 RNA_def_property_ui_text(prop, "Start", "Frame # to start emitting particles");
1994 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1996 prop= RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
1997 RNA_def_property_float_sdna(prop, NULL, "end");
1998 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
2000 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2001 RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_end_set", NULL);
2002 RNA_def_property_ui_text(prop, "End", "Frame # to stop emitting particles");
2003 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2005 prop= RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
2006 RNA_def_property_range(prop, 1.0f, MAXFRAMEF);
2007 RNA_def_property_ui_text(prop, "Lifetime", "Specify the life span of the particles");
2008 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2010 prop= RNA_def_property(srna, "lifetime_random", PROP_FLOAT, PROP_NONE);
2011 RNA_def_property_float_sdna(prop, NULL, "randlife");
2012 RNA_def_property_range(prop, 0.0f, 1.0f);
2013 RNA_def_property_ui_text(prop, "Random", "Give the particle life a random variation");
2014 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2016 prop= RNA_def_property(srna, "time_tweak", PROP_FLOAT, PROP_NONE);
2017 RNA_def_property_float_sdna(prop, NULL, "timetweak");
2018 RNA_def_property_range(prop, 0.0f, 100.0f);
2019 RNA_def_property_ui_range(prop, 0, 10, 1, 3);
2020 RNA_def_property_ui_text(prop, "Tweak", "A multiplier for physics timestep (1.0 means one frame = 1/25 seconds)");
2021 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2023 prop= RNA_def_property(srna, "timestep", PROP_FLOAT, PROP_NONE);
2024 RNA_def_property_float_funcs(prop, "rna_PartSettings_timestep_get", "rna_PartSetings_timestep_set", NULL);
2025 RNA_def_property_range(prop, 0.0001, 100.0);
2026 RNA_def_property_ui_range(prop, 0.01, 10, 1, 3);
2027 RNA_def_property_ui_text(prop, "Timestep", "The simulation timestep per frame (in seconds)");
2028 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2030 prop= RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE);
2031 RNA_def_property_range(prop, 0, 1000);
2032 RNA_def_property_ui_text(prop, "Subframes", "Subframes to simulate for improved stability and finer granularity simulations");
2033 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2035 prop= RNA_def_property(srna, "jitter_factor", PROP_FLOAT, PROP_NONE);
2036 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2037 RNA_def_property_float_sdna(prop, NULL, "jitfac");
2038 RNA_def_property_range(prop, 0.0f, 2.0f);
2039 RNA_def_property_ui_text(prop, "Amount", "Amount of jitter applied to the sampling");
2040 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2042 prop= RNA_def_property(srna, "effect_hair", PROP_FLOAT, PROP_NONE);
2043 RNA_def_property_float_sdna(prop, NULL, "eff_hair");
2044 RNA_def_property_range(prop, 0.0f, 1.0f);
2045 RNA_def_property_ui_text(prop, "Stiffness", "Hair stiffness for effectors");
2046 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2048 prop= RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
2049 RNA_def_property_int_sdna(prop, NULL, "totpart");
2050 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2051 /* This limit is for those freaks who have the machine power to handle it. */
2052 /* 10M particles take around 2.2 Gb of memory / disk space in saved file and */
2053 /* each cached frame takes around 0.5 Gb of memory / disk space depending on cache mode. */
2054 RNA_def_property_range(prop, 0, 10000000);
2055 RNA_def_property_ui_range(prop, 0, 100000, 1, 0);
2056 RNA_def_property_ui_text(prop, "Amount", "Total number of particles");
2057 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2059 prop= RNA_def_property(srna, "userjit", PROP_INT, PROP_UNSIGNED);//TODO: can we get a better name for userjit?
2060 RNA_def_property_int_sdna(prop, NULL, "userjit");
2061 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2062 RNA_def_property_range(prop, 0, 1000);
2063 RNA_def_property_ui_text(prop, "P/F", "Emission locations / face (0 = automatic)");
2064 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2066 prop= RNA_def_property(srna, "grid_resolution", PROP_INT, PROP_UNSIGNED);
2067 RNA_def_property_int_sdna(prop, NULL, "grid_res");
2068 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2069 RNA_def_property_range(prop, 1, 250); /* ~15M particles in a cube (ouch!), but could be very usable in a plane */
2070 RNA_def_property_ui_range(prop, 1, 50, 1, 0); /* ~100k particles in a cube */
2071 RNA_def_property_ui_text(prop, "Resolution", "The resolution of the particle grid");
2072 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2074 prop= RNA_def_property(srna, "grid_random", PROP_FLOAT, PROP_NONE);
2075 RNA_def_property_float_sdna(prop, NULL, "grid_rand");
2076 RNA_def_property_range(prop, 0.0f, 1.0f);
2077 RNA_def_property_ui_text(prop, "Grid Randomness", "Add random offset to the grid locations");
2078 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2080 prop= RNA_def_property(srna, "effector_amount", PROP_INT, PROP_UNSIGNED);
2081 /* in theory PROP_ANIMATABLE perhaps should be cleared, but animating this can give some interesting results! */
2082 RNA_def_property_range(prop, 0, 10000); /* 10000 effectors will bel SLOW, but who knows */
2083 RNA_def_property_ui_range(prop, 0, 100, 1, 0);
2084 RNA_def_property_ui_text(prop, "Effector Amount", "How many particles are effectors (0 is all particles)");
2085 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2087 /* initial velocity factors */
2088 prop= RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_NONE);
2089 RNA_def_property_float_sdna(prop, NULL, "normfac");//optional if prop names are the same
2090 RNA_def_property_range(prop, -1000.0f, 1000.0f);
2091 RNA_def_property_ui_range(prop, 0, 100, 1, 3);
2092 RNA_def_property_ui_text(prop, "Normal", "Let the surface normal give the particle a starting speed");
2093 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2095 prop= RNA_def_property(srna, "object_factor", PROP_FLOAT, PROP_NONE);
2096 RNA_def_property_float_sdna(prop, NULL, "obfac");
2097 RNA_def_property_range(prop, -200.0f, 200.0f);
2098 RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
2099 RNA_def_property_ui_text(prop, "Object", "Let the object give the particle a starting speed");
2100 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2102 prop= RNA_def_property(srna, "factor_random", PROP_FLOAT, PROP_NONE);
2103 RNA_def_property_float_sdna(prop, NULL, "randfac");//optional if prop names are the same
2104 RNA_def_property_range(prop, 0.0f, 200.0f);
2105 RNA_def_property_ui_range(prop, 0, 100, 1, 3);
2106 RNA_def_property_ui_text(prop, "Random", "Give the starting speed a random variation");
2107 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2109 prop= RNA_def_property(srna, "particle_factor", PROP_FLOAT, PROP_NONE);
2110 RNA_def_property_float_sdna(prop, NULL, "partfac");
2111 RNA_def_property_range(prop, -200.0f, 200.0f);
2112 RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
2113 RNA_def_property_ui_text(prop, "Particle", "Let the target particle give the particle a starting speed");
2114 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2116 prop= RNA_def_property(srna, "tangent_factor", PROP_FLOAT, PROP_NONE);
2117 RNA_def_property_float_sdna(prop, NULL, "tanfac");
2118 RNA_def_property_range(prop, -1000.0f, 1000.0f);
2119 RNA_def_property_ui_range(prop, -100, 100, 1, 2);
2120 RNA_def_property_ui_text(prop, "Tangent", "Let the surface tangent give the particle a starting speed");
2121 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2123 prop= RNA_def_property(srna, "tangent_phase", PROP_FLOAT, PROP_NONE);
2124 RNA_def_property_float_sdna(prop, NULL, "tanphase");
2125 RNA_def_property_range(prop, -1.0f, 1.0f);
2126 RNA_def_property_ui_text(prop, "Rot", "Rotate the surface tangent");
2127 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2129 prop= RNA_def_property(srna, "reactor_factor", PROP_FLOAT, PROP_NONE);
2130 RNA_def_property_float_sdna(prop, NULL, "reactfac");
2131 RNA_def_property_range(prop, -10.0f, 10.0f);
2132 RNA_def_property_ui_text(prop, "Reactor", "Let the vector away from the target particles location give the particle a starting speed");
2133 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2135 prop= RNA_def_property(srna, "object_align_factor", PROP_FLOAT, PROP_VELOCITY);
2136 RNA_def_property_float_sdna(prop, NULL, "ob_vel");
2137 RNA_def_property_array(prop, 3);
2138 RNA_def_property_range(prop, -200.0f, 200.0f);
2139 RNA_def_property_ui_range(prop, -100, 100, 1, 3);
2140 RNA_def_property_ui_text(prop, "Object Aligned", "Let the emitter object orientation give the particle a starting speed");
2141 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2143 prop= RNA_def_property(srna, "angular_velocity_factor", PROP_FLOAT, PROP_NONE);
2144 RNA_def_property_float_sdna(prop, NULL, "avefac");
2145 RNA_def_property_range(prop, -200.0f, 200.0f);
2146 RNA_def_property_ui_range(prop, -100, 100, 10, 3);
2147 RNA_def_property_ui_text(prop, "Angular Velocity", "Angular velocity amount");
2148 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2150 prop= RNA_def_property(srna, "phase_factor", PROP_FLOAT, PROP_NONE);
2151 RNA_def_property_float_sdna(prop, NULL, "phasefac");
2152 RNA_def_property_range(prop, -1.0f, 1.0f);
2153 RNA_def_property_ui_text(prop, "Phase", "Initial rotation phase");
2154 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2156 prop= RNA_def_property(srna, "rotation_factor_random", PROP_FLOAT, PROP_NONE);
2157 RNA_def_property_float_sdna(prop, NULL, "randrotfac");
2158 RNA_def_property_range(prop, 0.0f, 1.0f);
2159 RNA_def_property_ui_text(prop, "Random Rotation", "Randomize rotation");
2160 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2162 prop= RNA_def_property(srna, "phase_factor_random", PROP_FLOAT, PROP_NONE);
2163 RNA_def_property_float_sdna(prop, NULL, "randphasefac");
2164 RNA_def_property_range(prop, 0.0f, 1.0f);
2165 RNA_def_property_ui_text(prop, "Random Phase", "Randomize rotation phase");
2166 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2168 prop= RNA_def_property(srna, "hair_length", PROP_FLOAT, PROP_NONE);
2169 RNA_def_property_float_funcs(prop, "rna_PartSetting_hairlength_get", "rna_PartSetting_hairlength_set", NULL);
2170 RNA_def_property_range(prop, 0.0f, 1000.0f);
2171 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
2172 RNA_def_property_ui_text(prop, "Hair Length", "Length of the hair");
2173 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2175 /* physical properties */
2176 prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
2177 RNA_def_property_range(prop, 0.001f, 100000.0f);
2178 RNA_def_property_ui_range(prop, 0.01, 100, 1, 3);
2179 RNA_def_property_ui_text(prop, "Mass", "Specify the mass of the particles");
2180 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2182 prop= RNA_def_property(srna, "particle_size", PROP_FLOAT, PROP_NONE);
2183 RNA_def_property_float_sdna(prop, NULL, "size");
2184 RNA_def_property_range(prop, 0.001f, 100000.0f);
2185 RNA_def_property_ui_range(prop, 0.01, 100, 1, 3);
2186 RNA_def_property_ui_text(prop, "Size", "The size of the particles");
2187 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2189 prop= RNA_def_property(srna, "size_random", PROP_FLOAT, PROP_NONE);
2190 RNA_def_property_float_sdna(prop, NULL, "randsize");
2191 RNA_def_property_range(prop, 0.0f, 1.0f);
2192 RNA_def_property_ui_text(prop, "Random Size", "Give the particle size a random variation");
2193 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2196 /* global physical properties */
2197 prop= RNA_def_property(srna, "drag_factor", PROP_FLOAT, PROP_NONE);
2198 RNA_def_property_float_sdna(prop, NULL, "dragfac");
2199 RNA_def_property_range(prop, 0.0f, 1.0f);
2200 RNA_def_property_ui_text(prop, "Drag", "Specify the amount of air-drag");
2201 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2203 prop= RNA_def_property(srna, "brownian_factor", PROP_FLOAT, PROP_NONE);
2204 RNA_def_property_float_sdna(prop, NULL, "brownfac");
2205 RNA_def_property_range(prop, 0.0f, 200.0f);
2206 RNA_def_property_ui_range(prop, 0, 20, 1, 3);
2207 RNA_def_property_ui_text(prop, "Brownian", "Specify the amount of Brownian motion");
2208 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2210 prop= RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
2211 RNA_def_property_float_sdna(prop, NULL, "dampfac");
2212 RNA_def_property_range(prop, 0.0f, 1.0f);
2213 RNA_def_property_ui_text(prop, "Damp", "Specify the amount of damping");
2214 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2217 prop= RNA_def_property(srna, "length_random", PROP_FLOAT, PROP_NONE);
2218 RNA_def_property_float_sdna(prop, NULL, "randlength");
2219 RNA_def_property_range(prop, 0.0f, 1.0f);
2220 RNA_def_property_ui_text(prop, "Random Length", "Give path length a random variation");
2221 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2224 prop= RNA_def_property(srna, "child_nbr", PROP_INT, PROP_NONE);
2225 RNA_def_property_int_sdna(prop, NULL, "child_nbr");//optional if prop names are the same
2226 RNA_def_property_range(prop, 0, 100000);
2227 RNA_def_property_ui_range(prop, 0, 1000, 1, 0);
2228 RNA_def_property_ui_text(prop, "Children Per Parent", "Amount of children/parent");
2229 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2231 prop= RNA_def_property(srna, "rendered_child_count", PROP_INT, PROP_NONE);
2232 RNA_def_property_int_sdna(prop, NULL, "ren_child_nbr");
2233 RNA_def_property_range(prop, 0, 100000);
2234 RNA_def_property_ui_range(prop, 0, 10000, 1, 0);
2235 RNA_def_property_ui_text(prop, "Rendered Children", "Amount of children/parent for rendering");
2237 prop= RNA_def_property(srna, "virtual_parents", PROP_FLOAT, PROP_NONE);
2238 RNA_def_property_float_sdna(prop, NULL, "parents");
2239 RNA_def_property_range(prop, 0.0f, 1.0f);
2240 RNA_def_property_ui_text(prop, "Virtual Parents", "Relative amount of virtual parents");
2241 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2243 prop= RNA_def_property(srna, "child_size", PROP_FLOAT, PROP_NONE);
2244 RNA_def_property_float_sdna(prop, NULL, "childsize");
2245 RNA_def_property_range(prop, 0.001f, 100000.0f);
2246 RNA_def_property_ui_range(prop, 0.01f, 100.0f, 0.1, 3);
2247 RNA_def_property_ui_text(prop, "Child Size", "A multiplier for the child particle size");
2248 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2250 prop= RNA_def_property(srna, "child_size_random", PROP_FLOAT, PROP_NONE);
2251 RNA_def_property_float_sdna(prop, NULL, "childrandsize");
2252 RNA_def_property_range(prop, 0.0f, 1.0f);
2253 RNA_def_property_ui_text(prop, "Random Child Size", "Random variation to the size of the child particles");
2254 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2256 prop= RNA_def_property(srna, "child_radius", PROP_FLOAT, PROP_NONE);
2257 RNA_def_property_float_sdna(prop, NULL, "childrad");
2258 RNA_def_property_range(prop, 0.0f, 10.0f);
2259 RNA_def_property_ui_text(prop, "Child Radius", "Radius of children around parent");
2260 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2262 prop= RNA_def_property(srna, "child_roundness", PROP_FLOAT, PROP_NONE);
2263 RNA_def_property_float_sdna(prop, NULL, "childflat");
2264 RNA_def_property_range(prop, 0.0f, 1.0f);
2265 RNA_def_property_ui_text(prop, "Child Roundness", "Roundness of children around parent");
2266 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2269 prop= RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
2270 RNA_def_property_float_sdna(prop, NULL, "clumpfac");
2271 RNA_def_property_range(prop, -1.0f, 1.0f);
2272 RNA_def_property_ui_text(prop, "Clump", "Amount of clumping");
2273 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2275 prop= RNA_def_property(srna, "clump_shape", PROP_FLOAT, PROP_NONE);
2276 RNA_def_property_float_sdna(prop, NULL, "clumppow");
2277 RNA_def_property_range(prop, -0.999f, 0.999f);
2278 RNA_def_property_ui_text(prop, "Shape", "Shape of clumping");
2279 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2283 prop= RNA_def_property(srna, "kink_amplitude", PROP_FLOAT, PROP_NONE);
2284 RNA_def_property_float_sdna(prop, NULL, "kink_amp");
2285 RNA_def_property_range(prop, -100000.0f, 100000.0f);
2286 RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
2287 RNA_def_property_ui_text(prop, "Amplitude", "The amplitude of the offset");
2288 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2290 prop= RNA_def_property(srna, "kink_amplitude_clump", PROP_FLOAT, PROP_NONE);
2291 RNA_def_property_float_sdna(prop, NULL, "kink_amp_clump");
2292 RNA_def_property_range(prop, 0.0f, 1.0f);
2293 RNA_def_property_ui_text(prop, "Amplitude Clump", "How much clump effects kink amplitude");
2294 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2296 prop= RNA_def_property(srna, "kink_frequency", PROP_FLOAT, PROP_NONE);
2297 RNA_def_property_float_sdna(prop, NULL, "kink_freq");
2298 RNA_def_property_range(prop, -100000.0f, 100000.0f);
2299 RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
2300 RNA_def_property_ui_text(prop, "Frequency", "The frequency of the offset (1/total length)");
2301 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2303 prop= RNA_def_property(srna, "kink_shape", PROP_FLOAT, PROP_NONE);
2304 RNA_def_property_range(prop, -0.999f, 0.999f);
2305 RNA_def_property_ui_text(prop, "Shape", "Adjust the offset to the beginning/end");
2306 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2308 prop= RNA_def_property(srna, "kink_flat", PROP_FLOAT, PROP_NONE);
2309 RNA_def_property_range(prop, 0.0f, 1.0f);
2310 RNA_def_property_ui_text(prop, "Flatness", "How flat the hairs are");
2311 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2314 prop= RNA_def_property(srna, "roughness_1", PROP_FLOAT, PROP_NONE);
2315 RNA_def_property_float_sdna(prop, NULL, "rough1");
2316 RNA_def_property_range(prop, 0.0f, 100000.0f);
2317 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
2318 RNA_def_property_ui_text(prop, "Rough1", "Amount of location dependent rough");
2319 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2321 prop= RNA_def_property(srna, "roughness_1_size", PROP_FLOAT, PROP_NONE);
2322 RNA_def_property_float_sdna(prop, NULL, "rough1_size");
2323 RNA_def_property_range(prop, 0.01f, 100000.0f);
2324 RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3);
2325 RNA_def_property_ui_text(prop, "Size1", "Size of location dependent rough");
2326 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2328 prop= RNA_def_property(srna, "roughness_2", PROP_FLOAT, PROP_NONE);
2329 RNA_def_property_float_sdna(prop, NULL, "rough2");
2330 RNA_def_property_range(prop, 0.0f, 100000.0f);
2331 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
2332 RNA_def_property_ui_text(prop, "Rough2", "Amount of random rough");
2333 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2335 prop= RNA_def_property(srna, "roughness_2_size", PROP_FLOAT, PROP_NONE);
2336 RNA_def_property_float_sdna(prop, NULL, "rough2_size");
2337 RNA_def_property_range(prop, 0.01f, 100000.0f);
2338 RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3);
2339 RNA_def_property_ui_text(prop, "Size2", "Size of random rough");
2340 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2342 prop= RNA_def_property(srna, "roughness_2_threshold", PROP_FLOAT, PROP_NONE);
2343 RNA_def_property_float_sdna(prop, NULL, "rough2_thres");
2344 RNA_def_property_range(prop, 0.0f, 1.0f);
2345 RNA_def_property_ui_text(prop, "Threshold", "Amount of particles left untouched by random rough");
2346 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2348 prop= RNA_def_property(srna, "roughness_endpoint", PROP_FLOAT, PROP_NONE);
2349 RNA_def_property_float_sdna(prop, NULL, "rough_end");
2350 RNA_def_property_range(prop, 0.0f, 100000.0f);
2351 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
2352 RNA_def_property_ui_text(prop, "Rough Endpoint", "Amount of end point rough");
2353 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2355 prop= RNA_def_property(srna, "roughness_end_shape", PROP_FLOAT, PROP_NONE);
2356 RNA_def_property_float_sdna(prop, NULL, "rough_end_shape");
2357 RNA_def_property_range(prop, 0.0f, 10.0f);
2358 RNA_def_property_ui_text(prop, "Shape", "Shape of end point rough");
2359 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2361 prop= RNA_def_property(srna, "child_length", PROP_FLOAT, PROP_NONE);
2362 RNA_def_property_float_sdna(prop, NULL, "clength");
2363 RNA_def_property_range(prop, 0.0f, 1.0f);
2364 RNA_def_property_ui_text(prop, "Length", "Length of child paths");
2365 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2367 prop= RNA_def_property(srna, "child_length_threshold", PROP_FLOAT, PROP_NONE);
2368 RNA_def_property_float_sdna(prop, NULL, "clength_thres");
2369 RNA_def_property_range(prop, 0.0f, 1.0f);
2370 RNA_def_property_ui_text(prop, "Threshold", "Amount of particles left untouched by child path length");
2371 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2374 prop= RNA_def_property(srna, "child_parting_factor", PROP_FLOAT, PROP_NONE);
2375 RNA_def_property_float_sdna(prop, NULL, "parting_fac");
2376 RNA_def_property_range(prop, 0.0f, 1.0f);
2377 RNA_def_property_ui_text(prop, "Parting Factor", "Create parting in the children based on parent strands");
2378 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2380 prop= RNA_def_property(srna, "child_parting_min", PROP_FLOAT, PROP_NONE);
2381 RNA_def_property_float_sdna(prop, NULL, "parting_min");
2382 RNA_def_property_range(prop, 0.0f, 180.0f);
2383 RNA_def_property_ui_text(prop, "Parting Minimum", "Minimum root to tip angle (tip distance/root distance for long hair)");
2384 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2386 prop= RNA_def_property(srna, "child_parting_max", PROP_FLOAT, PROP_NONE);
2387 RNA_def_property_float_sdna(prop, NULL, "parting_max");
2388 RNA_def_property_range(prop, 0.0f, 180.0f);
2389 RNA_def_property_ui_text(prop, "Parting Maximum", "Maximum root to tip angle (tip distance/root distance for long hair)");
2390 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2393 prop= RNA_def_property(srna, "branch_threshold", PROP_FLOAT, PROP_NONE);
2394 RNA_def_property_float_sdna(prop, NULL, "branch_thres");
2395 RNA_def_property_range(prop, 0.0f, 1.0f);
2396 RNA_def_property_ui_text(prop, "Threshold", "Threshold of branching");
2397 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2400 prop= RNA_def_property(srna, "line_length_tail", PROP_FLOAT, PROP_NONE);
2401 RNA_def_property_float_funcs(prop, "rna_PartSetting_linelentail_get", "rna_PartSetting_linelentail_set", NULL);
2402 RNA_def_property_range(prop, 0.0f, 100000.0f);
2403 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
2404 RNA_def_property_ui_text(prop, "Back", "Length of the line's tail");
2405 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2407 prop= RNA_def_property(srna, "line_length_head", PROP_FLOAT, PROP_NONE);
2408 RNA_def_property_float_funcs(prop, "rna_PartSetting_linelenhead_get", "rna_PartSetting_linelenhead_set", NULL);
2409 RNA_def_property_range(prop, 0.0f, 100000.0f);
2410 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
2411 RNA_def_property_ui_text(prop, "Head", "Length of the line's head");
2412 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2414 prop= RNA_def_property(srna, "path_start", PROP_FLOAT, PROP_NONE);
2415 RNA_def_property_float_sdna(prop, NULL, "path_start");
2416 RNA_def_property_float_funcs(prop, NULL, NULL, "rna_PartSetting_pathstartend_range");
2417 RNA_def_property_ui_text(prop, "Path Start", "Starting time of drawn path");
2418 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2420 prop= RNA_def_property(srna, "path_end", PROP_FLOAT, PROP_NONE);
2421 RNA_def_property_float_sdna(prop, NULL, "path_end");
2422 RNA_def_property_float_funcs(prop, NULL, NULL, "rna_PartSetting_pathstartend_range");
2423 RNA_def_property_ui_text(prop, "Path End", "End time of drawn path");
2424 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2426 prop= RNA_def_property(srna, "trail_count", PROP_INT, PROP_NONE);
2427 RNA_def_property_int_sdna(prop, NULL, "trail_count");
2428 RNA_def_property_range(prop, 1, 100000);
2429 RNA_def_property_ui_range(prop, 1, 100, 1, 0);
2430 RNA_def_property_ui_text(prop, "Trail Count", "Number of trail particles");
2431 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2433 /* keyed particles */
2434 prop= RNA_def_property(srna, "keyed_loops", PROP_INT, PROP_NONE);
2435 RNA_def_property_int_sdna(prop, NULL, "keyed_loops");
2436 RNA_def_property_range(prop, 1.0f, 10000.0f);
2437 RNA_def_property_ui_range(prop, 1.0f, 100.0f, 0.1, 3);
2438 RNA_def_property_ui_text(prop, "Loop count", "Number of times the keys are looped");
2439 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2441 /* draw objects & groups */
2442 prop= RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE);
2443 RNA_def_property_pointer_sdna(prop, NULL, "dup_group");
2444 RNA_def_property_struct_type(prop, "Group");
2445 RNA_def_property_flag(prop, PROP_EDITABLE);
2446 RNA_def_property_ui_text(prop, "Dupli Group", "Show Objects in this Group in place of particles");
2447 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2449 prop= RNA_def_property(srna, "dupli_weights", PROP_COLLECTION, PROP_NONE);
2450 RNA_def_property_collection_sdna(prop, NULL, "dupliweights", NULL);
2451 RNA_def_property_struct_type(prop, "ParticleDupliWeight");
2452 RNA_def_property_ui_text(prop, "Dupli Group Weights", "Weights for all of the objects in the dupli group");
2454 prop= RNA_def_property(srna, "active_dupliweight", PROP_POINTER, PROP_NONE);
2455 RNA_def_property_struct_type(prop, "ParticleDupliWeight");
2456 RNA_def_property_pointer_funcs(prop, "rna_ParticleDupliWeight_active_get", NULL, NULL, NULL);
2457 RNA_def_property_ui_text(prop, "Active Dupli Object", "");
2459 prop= RNA_def_property(srna, "active_dupliweight_index", PROP_INT, PROP_UNSIGNED);
2460 RNA_def_property_int_funcs(prop, "rna_ParticleDupliWeight_active_index_get", "rna_ParticleDupliWeight_active_index_set", "rna_ParticleDupliWeight_active_index_range");
2461 RNA_def_property_ui_text(prop, "Active Dupli Object Index", "");
2463 prop= RNA_def_property(srna, "dupli_object", PROP_POINTER, PROP_NONE);
2464 RNA_def_property_pointer_sdna(prop, NULL, "dup_ob");
2465 RNA_def_property_struct_type(prop, "Object");
2466 RNA_def_property_flag(prop, PROP_EDITABLE);
2467 RNA_def_property_ui_text(prop, "Dupli Object", "Show this Object in place of particles");
2468 RNA_def_property_update(prop, 0, "rna_Particle_redo_dependency");
2470 prop= RNA_def_property(srna, "billboard_object", PROP_POINTER, PROP_NONE);
2471 RNA_def_property_pointer_sdna(prop, NULL, "bb_ob");
2472 RNA_def_property_struct_type(prop, "Object");
2473 RNA_def_property_flag(prop, PROP_EDITABLE);
2474 RNA_def_property_ui_text(prop, "Billboard Object", "Billboards face this object (default is active camera)");
2475 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2478 prop= RNA_def_property(srna, "boids", PROP_POINTER, PROP_NONE);
2479 RNA_def_property_struct_type(prop, "BoidSettings");
2480 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2481 RNA_def_property_ui_text(prop, "Boid Settings", "");
2483 /* Fluid particles */
2484 prop= RNA_def_property(srna, "fluid", PROP_POINTER, PROP_NONE);
2485 RNA_def_property_struct_type(prop, "SPHFluidSettings");
2486 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2487 RNA_def_property_ui_text(prop, "SPH Fluid Settings", "");
2489 /* Effector weights */
2490 prop= RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
2491 RNA_def_property_struct_type(prop, "EffectorWeights");
2492 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2493 RNA_def_property_ui_text(prop, "Effector Weights", "");
2495 /* animation here? */
2496 rna_def_animdata_common(srna);
2498 prop= RNA_def_property(srna, "force_field_1", PROP_POINTER, PROP_NONE);
2499 RNA_def_property_pointer_sdna(prop, NULL, "pd");
2500 RNA_def_property_struct_type(prop, "FieldSettings");
2501 RNA_def_property_pointer_funcs(prop, "rna_Particle_field1_get", NULL, NULL, NULL);
2502 RNA_def_property_ui_text(prop, "Force Field 1", "");
2504 prop= RNA_def_property(srna, "force_field_2", PROP_POINTER, PROP_NONE);
2505 RNA_def_property_pointer_sdna(prop, NULL, "pd2");
2506 RNA_def_property_struct_type(prop, "FieldSettings");
2507 RNA_def_property_pointer_funcs(prop, "rna_Particle_field2_get", NULL, NULL, NULL);
2508 RNA_def_property_ui_text(prop, "Force Field 2", "");
2511 static void rna_def_particle_target(BlenderRNA *brna)
2516 static EnumPropertyItem mode_items[] = {
2517 {PTARGET_MODE_FRIEND, "FRIEND", 0, "Friend", ""},
2518 {PTARGET_MODE_NEUTRAL, "NEUTRAL", 0, "Neutral", ""},
2519 {PTARGET_MODE_ENEMY, "ENEMY", 0, "Enemy", ""},
2520 {0, NULL, 0, NULL, NULL}
2524 srna = RNA_def_struct(brna, "ParticleTarget", NULL);
2525 RNA_def_struct_ui_text(srna, "Particle Target", "Target particle system");
2527 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2528 RNA_def_property_string_funcs(prop, "rna_ParticleTarget_name_get", "rna_ParticleTarget_name_length", NULL);
2529 RNA_def_property_ui_text(prop, "Name", "Particle target name");
2530 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2531 RNA_def_struct_name_property(srna, prop);
2533 prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
2534 RNA_def_property_pointer_sdna(prop, NULL, "ob");
2535 RNA_def_property_flag(prop, PROP_EDITABLE);
2536 RNA_def_property_ui_text(prop, "Target Object", "The object that has the target particle system (empty if same object)");
2537 RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
2539 prop= RNA_def_property(srna, "system", PROP_INT, PROP_UNSIGNED);
2540 RNA_def_property_int_sdna(prop, NULL, "psys");
2541 RNA_def_property_range(prop, 1, INT_MAX);
2542 RNA_def_property_ui_text(prop, "Target Particle System", "The index of particle system on the target object");
2543 RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
2545 prop= RNA_def_property(srna, "time", PROP_FLOAT, PROP_TIME);
2546 RNA_def_property_float_sdna(prop, NULL, "time");
2547 RNA_def_property_range(prop, 0.0, 30000.0f); //TODO: replace 30000 with MAXFRAMEF when available in 2.5
2548 RNA_def_property_ui_text(prop, "Time", "");
2549 RNA_def_property_update(prop, 0, "rna_Particle_target_redo");
2551 prop= RNA_def_property(srna, "duration", PROP_FLOAT, PROP_NONE);
2552 RNA_def_property_float_sdna(prop, NULL, "duration");
2553 RNA_def_property_range(prop, 0.0, 30000.0f); //TODO: replace 30000 with MAXFRAMEF when available in 2.5
2554 RNA_def_property_ui_text(prop, "Duration", "");
2555 RNA_def_property_update(prop, 0, "rna_Particle_target_redo");
2557 prop= RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
2558 RNA_def_property_boolean_sdna(prop, NULL, "flag", PTARGET_VALID);
2559 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2560 RNA_def_property_ui_text(prop, "Valid", "Keyed particles target is valid");
2562 prop= RNA_def_property(srna, "alliance", PROP_ENUM, PROP_NONE);
2563 RNA_def_property_enum_sdna(prop, NULL, "mode");
2564 RNA_def_property_enum_items(prop, mode_items);
2565 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2566 RNA_def_property_ui_text(prop, "Mode", "");
2567 RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
2570 static void rna_def_particle_system(BlenderRNA *brna)
2575 srna= RNA_def_struct(brna, "ParticleSystem", NULL);
2576 RNA_def_struct_ui_text(srna, "Particle System", "Particle system in an object");
2577 RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
2579 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2580 RNA_def_property_ui_text(prop, "Name", "Particle system name");
2581 RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER|NA_RENAME, NULL);
2582 RNA_def_struct_name_property(srna, prop);
2584 /* access to particle settings is redirected through functions */
2585 /* to allow proper id-buttons functionality */
2586 prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
2587 //RNA_def_property_pointer_sdna(prop, NULL, "part");
2588 RNA_def_property_struct_type(prop, "ParticleSettings");
2589 RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_NULL);
2590 RNA_def_property_pointer_funcs(prop, "rna_particle_settings_get", "rna_particle_settings_set", NULL, NULL);
2591 RNA_def_property_ui_text(prop, "Settings", "Particle system settings");
2592 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2594 prop= RNA_def_property(srna, "particles", PROP_COLLECTION, PROP_NONE);
2595 RNA_def_property_collection_sdna(prop, NULL, "particles", "totpart");
2596 RNA_def_property_struct_type(prop, "Particle");
2597 RNA_def_property_ui_text(prop, "Particles", "Particles generated by the particle system");
2599 prop= RNA_def_property(srna, "child_particles", PROP_COLLECTION, PROP_NONE);
2600 RNA_def_property_collection_sdna(prop, NULL, "child", "totchild");
2601 RNA_def_property_struct_type(prop, "ChildParticle");
2602 RNA_def_property_ui_text(prop, "Child Particles", "Child particles generated by the particle system");
2604 prop= RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED);
2605 RNA_def_property_ui_text(prop, "Seed", "Offset in the random number table, to get a different randomized result");
2606 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2608 prop= RNA_def_property(srna, "child_seed", PROP_INT, PROP_UNSIGNED);
2609 RNA_def_property_ui_text(prop, "Child Seed", "Offset in the random number table for child particles, to get a different randomized result");
2610 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2613 prop= RNA_def_property(srna, "is_global_hair", PROP_BOOLEAN, PROP_NONE);
2614 RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_GLOBAL_HAIR);
2615 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2616 RNA_def_property_ui_text(prop, "Global Hair", "Hair keys are in global coordinate space");
2618 prop= RNA_def_property(srna, "use_hair_dynamics", PROP_BOOLEAN, PROP_NONE);
2619 RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_HAIR_DYNAMICS);
2620 RNA_def_property_ui_text(prop, "Hair Dynamics", "Enable hair dynamics using cloth simulation");
2621 RNA_def_property_update(prop, 0, "rna_Particle_hair_dynamics");
2623 prop= RNA_def_property(srna, "cloth", PROP_POINTER, PROP_NONE);
2624 RNA_def_property_pointer_sdna(prop, NULL, "clmd");
2625 RNA_def_property_struct_type(prop, "ClothModifier");
2626 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2627 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2628 RNA_def_property_ui_text(prop, "Cloth", "Cloth dynamics for hair");
2631 prop= RNA_def_property(srna, "reactor_target_object", PROP_POINTER, PROP_NONE);
2632 RNA_def_property_pointer_sdna(prop, NULL, "target_ob");
2633 RNA_def_property_flag(prop, PROP_EDITABLE);
2634 RNA_def_property_ui_text(prop, "Reactor Target Object", "For reactor systems, the object that has the target particle system (empty if same object)");
2635 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2637 prop= RNA_def_property(srna, "reactor_target_particle_system", PROP_INT, PROP_UNSIGNED);
2638 RNA_def_property_int_sdna(prop, NULL, "target_psys");
2639 RNA_def_property_range(prop, 1, SHRT_MAX);
2640 RNA_def_property_ui_text(prop, "Reactor Target Particle System", "For reactor systems, index of particle system on the target object");
2641 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2644 prop= RNA_def_property(srna, "use_keyed_timing", PROP_BOOLEAN, PROP_NONE);
2645 RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_KEYED_TIMING);
2646 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2647 RNA_def_property_ui_text(prop, "Keyed timing", "Use key times");
2648 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2650 prop= RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
2651 RNA_def_property_struct_type(prop, "ParticleTarget");
2652 RNA_def_property_ui_text(prop, "Targets", "Target particle systems");
2654 prop= RNA_def_property(srna, "active_particle_target", PROP_POINTER, PROP_NONE);
2655 RNA_def_property_struct_type(prop, "ParticleTarget");
2656 RNA_def_property_pointer_funcs(prop, "rna_ParticleSystem_active_particle_target_get", NULL, NULL, NULL);
2657 RNA_def_property_ui_text(prop, "Active Particle Target", "");
2659 prop= RNA_def_property(srna, "active_particle_target_index", PROP_INT, PROP_UNSIGNED);
2660 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");
2661 RNA_def_property_ui_text(prop, "Active Particle Target Index", "");
2665 prop= RNA_def_property(srna, "billboard_normal_uv", PROP_STRING, PROP_NONE);
2666 RNA_def_property_string_sdna(prop, NULL, "bb_uvname[0]");
2667 RNA_def_property_string_maxlength(prop, 32);
2668 RNA_def_property_ui_text(prop, "Billboard Normal UV", "UV Layer to control billboard normals");
2670 prop= RNA_def_property(srna, "billboard_time_index_uv", PROP_STRING, PROP_NONE);
2671 RNA_def_property_string_sdna(prop, NULL, "bb_uvname[1]");
2672 RNA_def_property_string_maxlength(prop, 32);
2673 RNA_def_property_ui_text(prop, "Billboard Time Index UV", "UV Layer to control billboard time index (X-Y)");
2675 prop= RNA_def_property(srna, "billboard_split_uv", PROP_STRING, PROP_NONE);
2676 RNA_def_property_string_sdna(prop, NULL, "bb_uvname[2]");
2677 RNA_def_property_string_maxlength(prop, 32);
2678 RNA_def_property_ui_text(prop, "Billboard Split UV", "UV Layer to control billboard splitting");
2682 /* note, internally store as ints, access as strings */
2683 #if 0 // int access. works ok but isnt useful for the UI
2684 prop= RNA_def_property(srna, "vertex_group_density", PROP_INT, PROP_NONE);
2685 RNA_def_property_int_sdna(prop, NULL, "vgroup[0]");
2686 RNA_def_property_ui_text(prop, "Vertex Group Density", "Vertex group to control density");
2687 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2690 prop= RNA_def_property(srna, "vertex_group_density", PROP_STRING, PROP_NONE);
2691 RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_0", "rna_ParticleVGroup_name_len_0", "rna_ParticleVGroup_name_set_0");
2692 RNA_def_property_ui_text(prop, "Vertex Group Density", "Vertex group to control density");
2693 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2695 prop= RNA_def_property(srna, "invert_vertex_group_density", PROP_BOOLEAN, PROP_NONE);
2696 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_DENSITY));
2697 RNA_def_property_ui_text(prop, "Vertex Group Density Negate", "Negate the effect of the density vertex group");
2698 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2700 prop= RNA_def_property(srna, "vertex_group_velocity", PROP_STRING, PROP_NONE);
2701 RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_1", "rna_ParticleVGroup_name_len_1", "rna_ParticleVGroup_name_set_1");
2702 RNA_def_property_ui_text(prop, "Vertex Group Velocity", "Vertex group to control velocity");
2703 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2705 prop= RNA_def_property(srna, "invert_vertex_group_velocity", PROP_BOOLEAN, PROP_NONE);
2706 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_VEL));
2707 RNA_def_property_ui_text(prop, "Vertex Group Velocity Negate", "Negate the effect of the velocity vertex group");
2708 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2710 prop= RNA_def_property(srna, "vertex_group_length", PROP_STRING, PROP_NONE);
2711 RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_2", "rna_ParticleVGroup_name_len_2", "rna_ParticleVGroup_name_set_2");
2712 RNA_def_property_ui_text(prop, "Vertex Group Length", "Vertex group to control length");
2713 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2715 prop= RNA_def_property(srna, "invert_vertex_group_length", PROP_BOOLEAN, PROP_NONE);
2716 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_LENGTH));
2717 RNA_def_property_ui_text(prop, "Vertex Group Length Negate", "Negate the effect of the length vertex group");
2718 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2720 prop= RNA_def_property(srna, "vertex_group_clump", PROP_STRING, PROP_NONE);
2721 RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_3", "rna_ParticleVGroup_name_len_3", "rna_ParticleVGroup_name_set_3");
2722 RNA_def_property_ui_text(prop, "Vertex Group Clump", "Vertex group to control clump");
2723 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2725 prop= RNA_def_property(srna, "invert_vertex_group_clump", PROP_BOOLEAN, PROP_NONE);
2726 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_CLUMP));
2727 RNA_def_property_ui_text(prop, "Vertex Group Clump Negate", "Negate the effect of the clump vertex group");
2728 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2730 prop= RNA_def_property(srna, "vertex_group_kink", PROP_STRING, PROP_NONE);
2731 RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_4", "rna_ParticleVGroup_name_len_4", "rna_ParticleVGroup_name_set_4");
2732 RNA_def_property_ui_text(prop, "Vertex Group Kink", "Vertex group to control kink");
2733 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2735 prop= RNA_def_property(srna, "invert_vertex_group_kink", PROP_BOOLEAN, PROP_NONE);
2736 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_KINK));
2737 RNA_def_property_ui_text(prop, "Vertex Group Kink Negate", "Negate the effect of the kink vertex group");
2738 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2740 prop= RNA_def_property(srna, "vertex_group_roughness_1", PROP_STRING, PROP_NONE);
2741 RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_5", "rna_ParticleVGroup_name_len_5", "rna_ParticleVGroup_name_set_5");
2742 RNA_def_property_ui_text(prop, "Vertex Group Roughness 1", "Vertex group to control roughness 1");
2743 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2745 prop= RNA_def_property(srna, "invert_vertex_group_roughness_1", PROP_BOOLEAN, PROP_NONE);
2746 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGH1));
2747 RNA_def_property_ui_text(prop, "Vertex Group Roughness 1 Negate", "Negate the effect of the roughness 1 vertex group");
2748 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2750 prop= RNA_def_property(srna, "vertex_group_roughness_2", PROP_STRING, PROP_NONE);
2751 RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_6", "rna_ParticleVGroup_name_len_6", "rna_ParticleVGroup_name_set_6");
2752 RNA_def_property_ui_text(prop, "Vertex Group Roughness 2", "Vertex group to control roughness 2");
2753 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2755 prop= RNA_def_property(srna, "invert_vertex_group_roughness_2", PROP_BOOLEAN, PROP_NONE);
2756 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGH2));
2757 RNA_def_property_ui_text(prop, "Vertex Group Roughness 2 Negate", "Negate the effect of the roughness 2 vertex group");
2758 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2760 prop= RNA_def_property(srna, "vertex_group_roughness_end", PROP_STRING, PROP_NONE);
2761 RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_7", "rna_ParticleVGroup_name_len_7", "rna_ParticleVGroup_name_set_7");
2762 RNA_def_property_ui_text(prop, "Vertex Group Roughness End", "Vertex group to control roughness end");
2763 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2765 prop= RNA_def_property(srna, "invert_vertex_group_roughness_end", PROP_BOOLEAN, PROP_NONE);
2766 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGHE));
2767 RNA_def_property_ui_text(prop, "Vertex Group Roughness End Negate", "Negate the effect of the roughness end vertex group");
2768 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
2770 prop= RNA_def_property(srna, "vertex_group_size", PROP_STRING, PROP_NONE);
2771 RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_8", "rna_ParticleVGroup_name_len_8", "rna_ParticleVGroup_name_set_8");
2772 RNA_def_property_ui_text(prop, "Vertex Group Size", "Vertex group to control size");
2773 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2775 prop= RNA_def_property(srna, "invert_vertex_group_size", PROP_BOOLEAN, PROP_NONE);
2776 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_SIZE));
2777 RNA_def_property_ui_text(prop, "Vertex Group Size Negate", "Negate the effect of the size vertex group");
2778 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2780 prop= RNA_def_property(srna, "vertex_group_tangent", PROP_STRING, PROP_NONE);
2781 RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_9", "rna_ParticleVGroup_name_len_9", "rna_ParticleVGroup_name_set_9");
2782 RNA_def_property_ui_text(prop, "Vertex Group Tangent", "Vertex group to control tangent");
2783 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2785 prop= RNA_def_property(srna, "invert_vertex_group_tangent", PROP_BOOLEAN, PROP_NONE);
2786 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_TAN));
2787 RNA_def_property_ui_text(prop, "Vertex Group Tangent Negate", "Negate the effect of the tangent vertex group");
2788 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2790 prop= RNA_def_property(srna, "vertex_group_rotation", PROP_STRING, PROP_NONE);
2791 RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_10", "rna_ParticleVGroup_name_len_10", "rna_ParticleVGroup_name_set_10");
2792 RNA_def_property_ui_text(prop, "Vertex Group Rotation", "Vertex group to control rotation");
2793 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2795 prop= RNA_def_property(srna, "invert_vertex_group_rotation", PROP_BOOLEAN, PROP_NONE);
2796 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROT));
2797 RNA_def_property_ui_text(prop, "Vertex Group Rotation Negate", "Negate the effect of the rotation vertex group");
2798 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2800 prop= RNA_def_property(srna, "vertex_group_field", PROP_STRING, PROP_NONE);
2801 RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_11", "rna_ParticleVGroup_name_len_11", "rna_ParticleVGroup_name_set_11");
2802 RNA_def_property_ui_text(prop, "Vertex Group Field", "Vertex group to control field");
2803 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2805 prop= RNA_def_property(srna, "invert_vertex_group_field", PROP_BOOLEAN, PROP_NONE);
2806 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_EFFECTOR));
2807 RNA_def_property_ui_text(prop, "Vertex Group Field Negate", "Negate the effect of the field vertex group");
2808 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2811 prop= RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
2812 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2813 RNA_def_property_pointer_sdna(prop, NULL, "pointcache");
2814 RNA_def_property_struct_type(prop, "PointCache");
2815 RNA_def_property_ui_text(prop, "Point Cache", "");
2817 prop= RNA_def_property(srna, "has_multiple_caches", PROP_BOOLEAN, PROP_NONE);
2818 RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_multiple_caches_get", NULL);
2819 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2820 RNA_def_property_ui_text(prop, "Multiple Caches", "Particle system has multiple point caches");
2823 prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
2824 RNA_def_property_pointer_sdna(prop, NULL, "parent");
2825 RNA_def_property_flag(prop, PROP_EDITABLE);
2826 RNA_def_property_ui_text(prop, "Parent", "Use this object's coordinate system instead of global coordinate system");
2827 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2829 /* hair or cache editing */
2830 prop= RNA_def_property(srna, "is_editable", PROP_BOOLEAN, PROP_NONE);
2831 RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_editable_get", NULL);
2832 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2833 RNA_def_property_ui_text(prop, "Editable", "Particle system can be edited in particle mode");
2835 prop= RNA_def_property(srna, "is_edited", PROP_BOOLEAN, PROP_NONE);
2836 RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_edited_get", NULL);
2837 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2838 RNA_def_property_ui_text(prop, "Edited", "Particle system has been edited in particle mode");
2841 RNA_def_struct_path_func(srna, "rna_ParticleSystem_path");
2844 void RNA_def_particle(BlenderRNA *brna)
2846 rna_def_particle_target(brna);
2847 rna_def_fluid_settings(brna);
2848 rna_def_particle_hair_key(brna);
2849 rna_def_particle_key(brna);
2851 rna_def_child_particle(brna);
2852 rna_def_particle(brna);
2853 rna_def_particle_dupliweight(brna);
2854 rna_def_particle_system(brna);
2855 rna_def_particle_settings_mtex(brna);
2856 rna_def_particle_settings(brna);