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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * Contributor(s): Blender Foundation (2008).
22 * ***** END GPL LICENSE BLOCK *****
30 #include "RNA_define.h"
31 #include "RNA_types.h"
32 #include "RNA_access.h"
34 #include "rna_internal.h"
36 #include "DNA_modifier_types.h"
37 #include "DNA_particle_types.h"
38 #include "DNA_object_force.h"
39 #include "DNA_object_types.h"
40 #include "DNA_scene_types.h"
41 #include "DNA_boid_types.h"
46 EnumPropertyItem part_from_items[] = {
47 {PART_FROM_VERT, "VERT", 0, "Verts", ""},
48 {PART_FROM_FACE, "FACE", 0, "Faces", ""},
49 {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
50 {0, NULL, 0, NULL, NULL}
53 EnumPropertyItem part_reactor_from_items[] = {
54 {PART_FROM_VERT, "VERT", 0, "Verts", ""},
55 {PART_FROM_FACE, "FACE", 0, "Faces", ""},
56 {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
57 {PART_FROM_PARTICLE, "PARTICLE", 0, "Particle", ""},
58 {0, NULL, 0, NULL, NULL}
61 EnumPropertyItem part_draw_as_items[] = {
62 {PART_DRAW_NOT, "NONE", 0, "None", ""},
63 {PART_DRAW_REND, "RENDER", 0, "Rendered", ""},
64 {PART_DRAW_DOT, "DOT", 0, "Point", ""},
65 {PART_DRAW_CIRC, "CIRC", 0, "Circle", ""},
66 {PART_DRAW_CROSS, "CROSS", 0, "Cross", ""},
67 {PART_DRAW_AXIS, "AXIS", 0, "Axis", ""},
68 {0, NULL, 0, NULL, NULL}
71 EnumPropertyItem part_hair_draw_as_items[] = {
72 {PART_DRAW_NOT, "NONE", 0, "None", ""},
73 {PART_DRAW_REND, "RENDER", 0, "Rendered", ""},
74 {PART_DRAW_PATH, "PATH", 0, "Path", ""},
75 {0, NULL, 0, NULL, NULL}
78 EnumPropertyItem part_ren_as_items[] = {
79 {PART_DRAW_NOT, "NONE", 0, "None", ""},
80 {PART_DRAW_HALO, "HALO", 0, "Halo", ""},
81 {PART_DRAW_LINE, "LINE", 0, "Line", ""},
82 {PART_DRAW_PATH, "PATH", 0, "Path", ""},
83 {PART_DRAW_OB, "OBJECT", 0, "Object", ""},
84 {PART_DRAW_GR, "GROUP", 0, "Group", ""},
85 {PART_DRAW_BB, "BILLBOARD", 0, "Billboard", ""},
86 {0, NULL, 0, NULL, NULL}
89 EnumPropertyItem part_hair_ren_as_items[] = {
90 {PART_DRAW_NOT, "NONE", 0, "None", ""},
91 {PART_DRAW_PATH, "PATH", 0, "Path", ""},
92 {PART_DRAW_OB, "OBJECT", 0, "Object", ""},
93 {PART_DRAW_GR, "GROUP", 0, "Group", ""},
94 {0, NULL, 0, NULL, NULL}
99 #include "BKE_context.h"
100 #include "BKE_cloth.h"
101 #include "BKE_depsgraph.h"
102 #include "BKE_effect.h"
103 #include "BKE_modifier.h"
104 #include "BKE_particle.h"
105 #include "BKE_pointcache.h"
107 #include "BLI_arithb.h"
108 #include "BLI_listbase.h"
110 /* property update functions */
111 static void particle_recalc(bContext *C, PointerRNA *ptr, short flag)
113 if(ptr->type==&RNA_ParticleSystem) {
114 ParticleSystem *psys = (ParticleSystem*)ptr->data;
118 DAG_id_flush_update(ptr->id.data, OB_RECALC_DATA);
121 DAG_id_flush_update(ptr->id.data, OB_RECALC_DATA|flag);
123 WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, NULL);
125 static void rna_Particle_redo(bContext *C, PointerRNA *ptr)
127 particle_recalc(C, ptr, PSYS_RECALC_REDO);
130 static void rna_Particle_redo_dependency(bContext *C, PointerRNA *ptr)
132 DAG_scene_sort(CTX_data_scene(C));
133 rna_Particle_redo(C, ptr);
136 static void rna_Particle_reset(bContext *C, PointerRNA *ptr)
138 particle_recalc(C, ptr, PSYS_RECALC_RESET);
141 static void rna_Particle_change_type(bContext *C, PointerRNA *ptr)
143 particle_recalc(C, ptr, PSYS_RECALC_RESET|PSYS_RECALC_TYPE);
146 static void rna_Particle_change_physics(bContext *C, PointerRNA *ptr)
148 particle_recalc(C, ptr, PSYS_RECALC_RESET|PSYS_RECALC_PHYS);
151 static void rna_Particle_redo_child(bContext *C, PointerRNA *ptr)
153 particle_recalc(C, ptr, PSYS_RECALC_CHILD);
156 static void rna_Particle_target_reset(bContext *C, PointerRNA *ptr)
158 Scene *scene = CTX_data_scene(C);
160 if(ptr->type==&RNA_ParticleTarget) {
161 ParticleTarget *pt = (ParticleTarget*)ptr->data;
162 Object *ob = (Object*)ptr->id.data;
163 ParticleSystem *kpsys=NULL, *psys=psys_get_current(ob);
165 if(pt->ob==ob || pt->ob==NULL) {
166 kpsys = BLI_findlink(&ob->particlesystem, pt->psys-1);
169 pt->flag |= PTARGET_VALID;
171 pt->flag &= ~PTARGET_VALID;
175 kpsys = BLI_findlink(&pt->ob->particlesystem, pt->psys-1);
178 pt->flag |= PTARGET_VALID;
180 pt->flag &= ~PTARGET_VALID;
183 psys->recalc = PSYS_RECALC_RESET;
185 DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
186 DAG_scene_sort(scene);
189 WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, NULL);
192 static void rna_Particle_target_redo(bContext *C, PointerRNA *ptr)
194 if(ptr->type==&RNA_ParticleTarget) {
195 Object *ob = (Object*)ptr->id.data;
196 ParticleSystem *psys = psys_get_current(ob);
198 psys->recalc = PSYS_RECALC_REDO;
200 DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
201 WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, NULL);
205 static void rna_Particle_hair_dynamics(bContext *C, PointerRNA *ptr)
207 /* Scene *scene = CTX_data_scene(C); */
208 ParticleSystem *psys = (ParticleSystem*)ptr->data;
210 if(psys && !psys->clmd) {
211 psys->clmd = (ClothModifierData*)modifier_new(eModifierType_Cloth);
212 psys->clmd->sim_parms->goalspring = 0.0f;
213 psys->clmd->sim_parms->flags |= CLOTH_SIMSETTINGS_FLAG_GOAL|CLOTH_SIMSETTINGS_FLAG_NO_SPRING_COMPRESS;
214 psys->clmd->coll_parms->flags &= ~CLOTH_COLLSETTINGS_FLAG_SELF;
215 rna_Particle_redo(C, ptr);
218 WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, NULL);
220 static PointerRNA rna_particle_settings_get(PointerRNA *ptr)
222 Object *ob= (Object*)ptr->id.data;
223 ParticleSettings *part = psys_get_current(ob)->part;
225 return rna_pointer_inherit_refine(ptr, &RNA_ParticleSettings, part);
228 static void rna_particle_settings_set(PointerRNA *ptr, PointerRNA value)
230 Object *ob= (Object*)ptr->id.data;
231 ParticleSystem *psys = psys_get_current(ob);
236 psys->part = (ParticleSettings *)value.data;
240 psys_check_boid_data(psys);
243 static void rna_Particle_abspathtime_update(bContext *C, PointerRNA *ptr)
245 ParticleSettings *settings = (ParticleSettings*)ptr->data;
246 float delta = settings->end + settings->lifetime - settings->sta;
247 if(settings->draw & PART_ABS_PATH_TIME) {
248 settings->path_start = settings->sta + settings->path_start * delta;
249 settings->path_end = settings->sta + settings->path_end * delta;
252 settings->path_start = (settings->path_start - settings->sta)/delta;
253 settings->path_end = (settings->path_end - settings->sta)/delta;
255 rna_Particle_redo(C, ptr);
257 static void rna_PartSettings_start_set(struct PointerRNA *ptr, float value)
259 ParticleSettings *settings = (ParticleSettings*)ptr->data;
261 /* check for clipping */
262 if(value > settings->end)
263 value = settings->end;
265 //if(settings->type==PART_REACTOR && value < 1.0)
268 if (value < MINAFRAMEF)
271 settings->sta = value;
274 static void rna_PartSettings_end_set(struct PointerRNA *ptr, float value)
276 ParticleSettings *settings = (ParticleSettings*)ptr->data;
278 /* check for clipping */
279 if(value < settings->sta)
280 value = settings->sta;
282 settings->end = value;
285 static void rna_PartSetting_linelentail_set(struct PointerRNA *ptr, float value)
287 ParticleSettings *settings = (ParticleSettings*)ptr->data;
288 settings->draw_line[0] = value;
291 static float rna_PartSetting_linelentail_get(struct PointerRNA *ptr)
293 ParticleSettings *settings = (ParticleSettings*)ptr->data;
294 return settings->draw_line[0];
296 static void rna_PartSetting_pathstartend_range(PointerRNA *ptr, float *min, float *max)
298 ParticleSettings *settings = (ParticleSettings*)ptr->data;
300 if(settings->type==PART_HAIR) {
302 *max = (settings->draw & PART_ABS_PATH_TIME) ? 100.0f : 1.0;
305 *min = (settings->draw & PART_ABS_PATH_TIME) ? settings->sta : 0.0f;
306 *max= (settings->draw & PART_ABS_PATH_TIME) ? MAXFRAMEF : 1.0f;
309 static void rna_PartSetting_linelenhead_set(struct PointerRNA *ptr, float value)
311 ParticleSettings *settings = (ParticleSettings*)ptr->data;
312 settings->draw_line[1] = value;
315 static float rna_PartSetting_linelenhead_get(struct PointerRNA *ptr)
317 ParticleSettings *settings = (ParticleSettings*)ptr->data;
318 return settings->draw_line[1];
321 static PointerRNA rna_ParticleSystem_active_particle_target_get(PointerRNA *ptr)
323 ParticleSystem *psys= (ParticleSystem*)ptr->data;
324 ParticleTarget *pt = psys->targets.first;
326 for(; pt; pt=pt->next) {
327 if(pt->flag & PTARGET_CURRENT)
328 return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, pt);
330 return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, NULL);
332 static void rna_ParticleSystem_active_particle_target_index_range(PointerRNA *ptr, int *min, int *max)
334 ParticleSystem *psys= (ParticleSystem*)ptr->data;
336 *max= BLI_countlist(&psys->targets)-1;
340 static int rna_ParticleSystem_active_particle_target_index_get(PointerRNA *ptr)
342 ParticleSystem *psys= (ParticleSystem*)ptr->data;
343 ParticleTarget *pt = psys->targets.first;
346 for(; pt; pt=pt->next, i++)
347 if(pt->flag & PTARGET_CURRENT)
353 static void rna_ParticleSystem_active_particle_target_index_set(struct PointerRNA *ptr, int value)
355 ParticleSystem *psys= (ParticleSystem*)ptr->data;
356 ParticleTarget *pt = psys->targets.first;
359 for(; pt; pt=pt->next, i++) {
361 pt->flag |= PTARGET_CURRENT;
363 pt->flag &= ~PTARGET_CURRENT;
366 static int rna_ParticleTarget_name_length(PointerRNA *ptr)
368 ParticleTarget *pt= ptr->data;
370 if(pt->flag & PTARGET_VALID) {
371 ParticleSystem *psys = NULL;
374 psys = BLI_findlink(&pt->ob->particlesystem, pt->psys-1);
376 Object *ob = (Object*) ptr->id.data;
377 psys = BLI_findlink(&ob->particlesystem, pt->psys-1);
382 return strlen(pt->ob->id.name+2) + 2 + strlen(psys->name);
384 return strlen(psys->name);
393 static void rna_ParticleTarget_name_get(PointerRNA *ptr, char *str)
395 ParticleTarget *pt= ptr->data;
397 if(pt->flag & PTARGET_VALID) {
398 ParticleSystem *psys = NULL;
401 psys = BLI_findlink(&pt->ob->particlesystem, pt->psys-1);
403 Object *ob = (Object*) ptr->id.data;
404 psys = BLI_findlink(&ob->particlesystem, pt->psys-1);
409 sprintf(str, "%s: %s", pt->ob->id.name+2, psys->name);
411 strcpy(str, psys->name);
414 strcpy(str, "Invalid target!");
417 strcpy(str, "Invalid target!");
419 static int rna_ParticleSystem_multiple_caches_get(PointerRNA *ptr)
421 ParticleSystem *psys= (ParticleSystem*)ptr->data;
423 return (psys->ptcaches.first != psys->ptcaches.last);
425 static int rna_ParticleSystem_editable_get(PointerRNA *ptr)
427 ParticleSystem *psys= (ParticleSystem*)ptr->data;
429 return psys_check_edited(psys);
431 static int rna_ParticleSystem_edited_get(PointerRNA *ptr)
433 ParticleSystem *psys= (ParticleSystem*)ptr->data;
435 if(psys->part && psys->part->type==PART_HAIR)
436 return (psys->flag & PSYS_EDITED || (psys->edit && psys->edit->edited));
438 return (psys->pointcache->edit && psys->pointcache->edit->edited);
440 static PointerRNA rna_ParticleDupliWeight_active_get(PointerRNA *ptr)
442 ParticleSettings *part= (ParticleSettings*)ptr->id.data;
443 ParticleDupliWeight *dw = part->dupliweights.first;
445 for(; dw; dw=dw->next) {
446 if(dw->flag & PART_DUPLIW_CURRENT)
447 return rna_pointer_inherit_refine(ptr, &RNA_ParticleDupliWeight, dw);
449 return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, NULL);
451 static void rna_ParticleDupliWeight_active_index_range(PointerRNA *ptr, int *min, int *max)
453 ParticleSettings *part= (ParticleSettings*)ptr->id.data;
455 *max= BLI_countlist(&part->dupliweights)-1;
459 static int rna_ParticleDupliWeight_active_index_get(PointerRNA *ptr)
461 ParticleSettings *part= (ParticleSettings*)ptr->id.data;
462 ParticleDupliWeight *dw = part->dupliweights.first;
465 for(; dw; dw=dw->next, i++)
466 if(dw->flag & PART_DUPLIW_CURRENT)
472 static void rna_ParticleDupliWeight_active_index_set(struct PointerRNA *ptr, int value)
474 ParticleSettings *part= (ParticleSettings*)ptr->id.data;
475 ParticleDupliWeight *dw = part->dupliweights.first;
478 for(; dw; dw=dw->next, i++) {
480 dw->flag |= PART_DUPLIW_CURRENT;
482 dw->flag &= ~PART_DUPLIW_CURRENT;
486 static int rna_ParticleDupliWeight_name_length(PointerRNA *ptr)
488 ParticleDupliWeight *dw= ptr->data;
491 return strlen(dw->ob->id.name+2) + 7;
496 static void rna_ParticleDupliWeight_name_get(PointerRNA *ptr, char *str)
498 ParticleDupliWeight *dw= ptr->data;
501 sprintf(str, "%s: %i", dw->ob->id.name+2, dw->count);
503 strcpy(str, "No object");
506 static EnumPropertyItem *rna_Particle_from_itemf(bContext *C, PointerRNA *ptr, int *free)
508 //if(part->type==PART_REACTOR)
509 // return part_reactor_from_items;
511 return part_from_items;
514 static EnumPropertyItem *rna_Particle_draw_as_itemf(bContext *C, PointerRNA *ptr, int *free)
516 ParticleSettings *part = ptr->id.data;
518 if(part->type==PART_HAIR)
519 return part_hair_draw_as_items;
521 return part_draw_as_items;
524 static EnumPropertyItem *rna_Particle_ren_as_itemf(bContext *C, PointerRNA *ptr, int *free)
526 ParticleSettings *part = ptr->id.data;
528 if(part->type==PART_HAIR)
529 return part_hair_ren_as_items;
531 return part_ren_as_items;
534 static PointerRNA rna_Particle_field1_get(PointerRNA *ptr)
536 ParticleSettings *part= (ParticleSettings*)ptr->id.data;
540 part->pd= object_add_collision_fields(0);
542 return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd);
545 static PointerRNA rna_Particle_field2_get(PointerRNA *ptr)
547 ParticleSettings *part= (ParticleSettings*)ptr->id.data;
551 part->pd2= object_add_collision_fields(0);
553 return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd2);
559 static void rna_def_particle_hair_key(BlenderRNA *brna)
564 srna = RNA_def_struct(brna, "ParticleHairKey", NULL);
565 RNA_def_struct_sdna(srna, "HairKey");
566 RNA_def_struct_ui_text(srna, "Particle Hair Key", "Particle key for hair particle system.");
568 prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
569 RNA_def_property_float_sdna(prop, NULL, "co");
570 RNA_def_property_ui_text(prop, "Location", "Key location.");
572 prop= RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
573 RNA_def_property_ui_text(prop, "Time", "Relative time of key over hair length.");
575 prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_UNSIGNED);
576 RNA_def_property_ui_text(prop, "Weight", "Weight for softbody simulation.");
579 static void rna_def_particle_key(BlenderRNA *brna)
584 srna = RNA_def_struct(brna, "ParticleKey", NULL);
585 RNA_def_struct_ui_text(srna, "Particle Key", "Key location for a particle over time.");
587 prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
588 RNA_def_property_float_sdna(prop, NULL, "co");
589 RNA_def_property_ui_text(prop, "Location", "Key location.");
591 prop= RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
592 RNA_def_property_float_sdna(prop, NULL, "vel");
593 RNA_def_property_ui_text(prop, "Velocity", "Key velocity");
595 prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
596 RNA_def_property_float_sdna(prop, NULL, "rot");
597 RNA_def_property_ui_text(prop, "Rotation", "Key rotation quaterion.");
599 prop= RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
600 RNA_def_property_float_sdna(prop, NULL, "ave");
601 RNA_def_property_ui_text(prop, "Angular Velocity", "Key angular velocity.");
603 prop= RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
604 RNA_def_property_ui_text(prop, "Time", "Time of key over the simulation.");
607 static void rna_def_child_particle(BlenderRNA *brna)
612 srna = RNA_def_struct(brna, "ChildParticle", NULL);
613 RNA_def_struct_ui_text(srna, "Child Particle", "Child particle interpolated from simulated or edited particles.");
615 // int num, parent; /* num is face index on the final derived mesh */
617 // int pa[4]; /* nearest particles to the child, used for the interpolation */
618 // float w[4]; /* interpolation weights for the above particles */
619 // float fuv[4], foffset; /* face vertex weights and offset */
623 static void rna_def_particle(BlenderRNA *brna)
628 static EnumPropertyItem alive_items[] = {
629 //{PARS_KILLED, "KILLED", 0, "Killed", ""},
630 {PARS_DEAD, "DEAD", 0, "Dead", ""},
631 {PARS_UNBORN, "UNBORN", 0, "Unborn", ""},
632 {PARS_ALIVE, "ALIVE", 0, "Alive", ""},
633 {PARS_DYING, "DYING", 0, "Dying", ""},
634 {0, NULL, 0, NULL, NULL}
637 srna = RNA_def_struct(brna, "Particle", NULL);
638 RNA_def_struct_sdna(srna, "ParticleData");
639 RNA_def_struct_ui_text(srna, "Particle", "Particle in a particle system.");
641 /* Particle State & Previous State */
642 prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
643 RNA_def_property_float_sdna(prop, NULL, "state.co");
644 RNA_def_property_ui_text(prop, "Particle Location", "");
646 prop= RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
647 RNA_def_property_float_sdna(prop, NULL, "state.vel");
648 RNA_def_property_ui_text(prop, "Particle Velocity", "");
650 prop= RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
651 RNA_def_property_float_sdna(prop, NULL, "state.ave");
652 RNA_def_property_ui_text(prop, "Angular Velocity", "");
654 prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
655 RNA_def_property_float_sdna(prop, NULL, "state.rot");
656 RNA_def_property_ui_text(prop, "Rotation", "");
658 prop= RNA_def_property(srna, "prev_location", PROP_FLOAT, PROP_TRANSLATION);
659 RNA_def_property_float_sdna(prop, NULL, "prev_state.co");
660 RNA_def_property_ui_text(prop, "Previous Particle Location", "");
662 prop= RNA_def_property(srna, "prev_velocity", PROP_FLOAT, PROP_VELOCITY);
663 RNA_def_property_float_sdna(prop, NULL, "prev_state.vel");
664 RNA_def_property_ui_text(prop, "Previous Particle Velocity", "");
666 prop= RNA_def_property(srna, "prev_angular_velocity", PROP_FLOAT, PROP_VELOCITY);
667 RNA_def_property_float_sdna(prop, NULL, "prev_state.ave");
668 RNA_def_property_ui_text(prop, "Previous Angular Velocity", "");
670 prop= RNA_def_property(srna, "prev_rotation", PROP_FLOAT, PROP_QUATERNION);
671 RNA_def_property_float_sdna(prop, NULL, "prev_state.rot");
672 RNA_def_property_ui_text(prop, "Previous Rotation", "");
674 /* Hair & Keyed Keys */
676 prop= RNA_def_property(srna, "hair", PROP_COLLECTION, PROP_NONE);
677 RNA_def_property_collection_sdna(prop, NULL, "hair", "totkey");
678 RNA_def_property_struct_type(prop, "ParticleHairKey");
679 RNA_def_property_ui_text(prop, "Hair", "");
681 prop= RNA_def_property(srna, "keys", PROP_COLLECTION, PROP_NONE);
682 RNA_def_property_collection_sdna(prop, NULL, "keys", "totkey");
683 RNA_def_property_struct_type(prop, "ParticleKey");
684 RNA_def_property_ui_text(prop, "Keyed States", "");
686 // float fuv[4], foffset; /* coordinates on face/edge number "num" and depth along*/
687 // /* face normal for volume emission */
689 prop= RNA_def_property(srna, "birthtime", PROP_FLOAT, PROP_TIME);
690 RNA_def_property_float_sdna(prop, NULL, "time");
691 // RNA_def_property_range(prop, lowerLimitf, upperLimitf);
692 RNA_def_property_ui_text(prop, "Birth Time", "");
694 prop= RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
695 // RNA_def_property_range(prop, lowerLimitf, upperLimitf);
696 RNA_def_property_ui_text(prop, "Lifetime", "");
698 prop= RNA_def_property(srna, "die_time", PROP_FLOAT, PROP_TIME);
699 RNA_def_property_float_sdna(prop, NULL, "dietime");
700 // RNA_def_property_range(prop, lowerLimitf, upperLimitf);
701 RNA_def_property_ui_text(prop, "Die Time", "");
703 prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
704 // RNA_def_property_range(prop, lowerLimitf, upperLimitf);
705 RNA_def_property_ui_text(prop, "Size", "");
708 // int num; /* index to vert/edge/face */
709 // int num_dmcache; /* index to derived mesh data (face) to avoid slow lookups */
715 prop= RNA_def_property(srna, "unexist", PROP_BOOLEAN, PROP_NONE);
716 RNA_def_property_boolean_sdna(prop, NULL, "flag", PARS_UNEXIST);
717 RNA_def_property_ui_text(prop, "unexist", "");
719 prop= RNA_def_property(srna, "no_disp", PROP_BOOLEAN, PROP_NONE);
720 RNA_def_property_boolean_sdna(prop, NULL, "flag", PARS_NO_DISP);
721 RNA_def_property_ui_text(prop, "no_disp", "");
723 prop= RNA_def_property(srna, "rekey", PROP_BOOLEAN, PROP_NONE);
724 RNA_def_property_boolean_sdna(prop, NULL, "flag", PARS_REKEY);
725 RNA_def_property_ui_text(prop, "rekey", "");
727 prop= RNA_def_property(srna, "alive_state", PROP_ENUM, PROP_NONE);
728 RNA_def_property_enum_sdna(prop, NULL, "alive");
729 RNA_def_property_enum_items(prop, alive_items);
730 RNA_def_property_ui_text(prop, "Alive State", "");
732 prop= RNA_def_property(srna, "loop", PROP_INT, PROP_NONE);
733 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
735 RNA_def_property_ui_text(prop, "Loop", "How may times the particle life has looped");
740 static void rna_def_particle_dupliweight(BlenderRNA *brna)
745 srna = RNA_def_struct(brna, "ParticleDupliWeight", NULL);
746 RNA_def_struct_ui_text(srna, "Particle Dupliobject Weight", "Weight of a particle dupliobject in a group.");
747 RNA_def_struct_sdna(srna, "ParticleDupliWeight");
749 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
750 RNA_def_property_string_funcs(prop, "rna_ParticleDupliWeight_name_get", "rna_ParticleDupliWeight_name_length", NULL);
751 RNA_def_property_ui_text(prop, "Name", "Particle dupliobject name.");
752 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
753 RNA_def_struct_name_property(srna, prop);
755 prop= RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
756 RNA_def_property_range(prop, 0, INT_MAX);
757 RNA_def_property_ui_text(prop, "Count", "The number of times this object is repeated with respect to other objects.");
758 RNA_def_property_update(prop, 0, "rna_Particle_redo");
761 static void rna_def_particle_settings(BlenderRNA *brna)
766 static EnumPropertyItem type_items[] = {
767 {PART_EMITTER, "EMITTER", 0, "Emitter", ""},
768 //{PART_REACTOR, "REACTOR", 0, "Reactor", ""},
769 {PART_HAIR, "HAIR", 0, "Hair", ""},
770 {0, NULL, 0, NULL, NULL}
773 static EnumPropertyItem dist_items[] = {
774 {PART_DISTR_JIT, "JIT", 0, "Jittered", ""},
775 {PART_DISTR_RAND, "RAND", 0, "Random", ""},
776 {PART_DISTR_GRID, "GRID", 0, "Grid", ""},
777 {0, NULL, 0, NULL, NULL}
780 static EnumPropertyItem phys_type_items[] = {
781 {PART_PHYS_NO, "NO", 0, "No", ""},
782 {PART_PHYS_NEWTON, "NEWTON", 0, "Newtonian", ""},
783 {PART_PHYS_KEYED, "KEYED", 0, "Keyed", ""},
784 {PART_PHYS_BOIDS, "BOIDS", 0, "Boids", ""},
785 {0, NULL, 0, NULL, NULL}
788 static EnumPropertyItem rot_mode_items[] = {
789 {0, "NONE", 0, "None", ""},
790 {PART_ROT_NOR, "NOR", 0, "Normal", ""},
791 {PART_ROT_VEL, "VEL", 0, "Velocity", ""},
792 {PART_ROT_GLOB_X, "GLOB_X", 0, "Global X", ""},
793 {PART_ROT_GLOB_Y, "GLOB_Y", 0, "Global Y", ""},
794 {PART_ROT_GLOB_Z, "GLOB_Z", 0, "Global Z", ""},
795 {PART_ROT_OB_X, "OB_X", 0, "Object X", ""},
796 {PART_ROT_OB_Y, "OB_Y", 0, "Object Y", ""},
797 {PART_ROT_OB_Z, "OB_Z", 0, "Object Z", ""},
798 {0, NULL, 0, NULL, NULL}
801 static EnumPropertyItem ave_mode_items[] = {
802 {0, "NONE", 0, "None", ""},
803 {PART_AVE_SPIN, "SPIN", 0, "Spin", ""},
804 {PART_AVE_RAND, "RAND", 0, "Random", ""} ,
805 {0, NULL, 0, NULL, NULL}
808 static EnumPropertyItem react_event_items[] = {
809 {PART_EVENT_DEATH, "DEATH", 0, "Death", ""},
810 {PART_EVENT_COLLIDE, "COLLIDE", 0, "Collision", ""},
811 {PART_EVENT_NEAR, "NEAR", 0, "Near", ""},
812 {0, NULL, 0, NULL, NULL}
815 static EnumPropertyItem child_type_items[] = {
816 {0, "NONE", 0, "None", ""},
817 {PART_CHILD_PARTICLES, "PARTICLES", 0, "Particles", ""},
818 {PART_CHILD_FACES, "FACES", 0, "Faces", ""},
819 {0, NULL, 0, NULL, NULL}
822 //TODO: names, tooltips
823 static EnumPropertyItem rot_from_items[] = {
824 {PART_ROT_KEYS, "KEYS", 0, "keys", ""},
825 {PART_ROT_ZINCR, "ZINCR", 0, "zincr", ""},
826 {PART_ROT_IINCR, "IINCR", 0, "iincr", ""},
827 {0, NULL, 0, NULL, NULL}
830 static EnumPropertyItem integrator_type_items[] = {
831 {PART_INT_EULER, "EULER", 0, "Euler", ""},
832 {PART_INT_MIDPOINT, "MIDPOINT", 0, "Midpoint", ""},
833 {PART_INT_RK4, "RK4", 0, "RK4", ""},
834 {0, NULL, 0, NULL, NULL}
837 static EnumPropertyItem kink_type_items[] = {
838 {PART_KINK_NO, "NO", 0, "Nothing", ""},
839 {PART_KINK_CURL, "CURL", 0, "Curl", ""},
840 {PART_KINK_RADIAL, "RADIAL", 0, "Radial", ""},
841 {PART_KINK_WAVE, "WAVE", 0, "Wave", ""},
842 {PART_KINK_BRAID, "BRAID", 0, "Braid", ""},
843 {0, NULL, 0, NULL, NULL}
846 static EnumPropertyItem kink_axis_items[] = {
847 {0, "X", 0, "X", ""},
848 {1, "Y", 0, "Y", ""},
849 {2, "Z", 0, "Z", ""},
850 {0, NULL, 0, NULL, NULL}
853 static EnumPropertyItem bb_align_items[] = {
854 {PART_BB_X, "X", 0, "X", ""},
855 {PART_BB_Y, "Y", 0, "Y", ""},
856 {PART_BB_Z, "Z", 0, "Z", ""},
857 {PART_BB_VIEW, "VIEW", 0, "View", ""},
858 {PART_BB_VEL, "VEL", 0, "Velocity", ""},
859 {0, NULL, 0, NULL, NULL}
862 static EnumPropertyItem bb_anim_items[] = {
863 {PART_BB_ANIM_NONE, "NONE", 0, "None", ""},
864 {PART_BB_ANIM_TIME, "TIME", 0, "Time", ""},
865 {PART_BB_ANIM_ANGLE, "ANGLE", 0, "Angle", ""},
866 //{PART_BB_ANIM_OFF_TIME, "OFF_TIME", 0, "off_time", ""},
867 //{PART_BB_ANIM_OFF_ANGLE, "OFF_ANGLE", 0, "off_angle", ""},
868 {0, NULL, 0, NULL, NULL}
871 static EnumPropertyItem bb_split_offset_items[] = {
872 {PART_BB_OFF_NONE, "NONE", 0, "None", ""},
873 {PART_BB_OFF_LINEAR, "LINEAR", 0, "Linear", ""},
874 {PART_BB_OFF_RANDOM, "RANDOM", 0, "Random", ""},
875 {0, NULL, 0, NULL, NULL}
878 srna= RNA_def_struct(brna, "ParticleSettings", "ID");
879 RNA_def_struct_ui_text(srna, "Particle Settings", "Particle settings, reusable by multiple particle systems.");
880 RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
883 prop= RNA_def_property(srna, "react_start_end", PROP_BOOLEAN, PROP_NONE);
884 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_STA_END);
885 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
886 RNA_def_property_ui_text(prop, "Start/End", "Give birth to unreacted particles eventually.");
887 RNA_def_property_update(prop, 0, "rna_Particle_reset");
889 prop= RNA_def_property(srna, "react_multiple", PROP_BOOLEAN, PROP_NONE);
890 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_MULTIPLE);
891 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
892 RNA_def_property_ui_text(prop, "Multi React", "React multiple times.");
893 RNA_def_property_update(prop, 0, "rna_Particle_reset");
895 prop= RNA_def_property(srna, "loop", PROP_BOOLEAN, PROP_NONE);
896 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_LOOP);
897 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
898 RNA_def_property_ui_text(prop, "Loop", "Loop particle lives.");
899 RNA_def_property_update(prop, 0, "rna_Particle_reset");
901 /* TODO: used somewhere? */
902 prop= RNA_def_property(srna, "hair_geometry", PROP_BOOLEAN, PROP_NONE);
903 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_GEOMETRY);
904 RNA_def_property_ui_text(prop, "Hair Geometry", "");//TODO: tooltip
906 prop= RNA_def_property(srna, "unborn", PROP_BOOLEAN, PROP_NONE);
907 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_UNBORN);
908 RNA_def_property_ui_text(prop, "Unborn", "Show particles before they are emitted.");
909 RNA_def_property_update(prop, 0, "rna_Particle_redo");
911 prop= RNA_def_property(srna, "died", PROP_BOOLEAN, PROP_NONE);
912 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_DIED);
913 RNA_def_property_ui_text(prop, "Died", "Show particles after they have died");
914 RNA_def_property_update(prop, 0, "rna_Particle_redo");
916 prop= RNA_def_property(srna, "trand", PROP_BOOLEAN, PROP_NONE);
917 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_TRAND);
918 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
919 RNA_def_property_ui_text(prop, "Random", "Emit in random order of elements");
920 RNA_def_property_update(prop, 0, "rna_Particle_reset");
922 prop= RNA_def_property(srna, "even_distribution", PROP_BOOLEAN, PROP_NONE);
923 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_EDISTR);
924 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
925 RNA_def_property_ui_text(prop, "Even Distribution", "Use even distribution from faces based on face areas or edge lengths.");
926 RNA_def_property_update(prop, 0, "rna_Particle_reset");
928 prop= RNA_def_property(srna, "die_on_collision", PROP_BOOLEAN, PROP_NONE);
929 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_DIE_ON_COL);
930 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
931 RNA_def_property_ui_text(prop, "Die on hit", "Particles die when they collide with a deflector object.");
932 RNA_def_property_update(prop, 0, "rna_Particle_reset");
934 prop= RNA_def_property(srna, "size_deflect", PROP_BOOLEAN, PROP_NONE);
935 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SIZE_DEFL);
936 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
937 RNA_def_property_ui_text(prop, "Size Deflect", "Use particle's size in deflection.");
938 RNA_def_property_update(prop, 0, "rna_Particle_reset");
940 prop= RNA_def_property(srna, "rotation_dynamic", PROP_BOOLEAN, PROP_NONE);
941 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ROT_DYN);
942 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
943 RNA_def_property_ui_text(prop, "Dynamic", "Sets rotation to dynamic/constant");
944 RNA_def_property_update(prop, 0, "rna_Particle_reset");
946 prop= RNA_def_property(srna, "sizemass", PROP_BOOLEAN, PROP_NONE);
947 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SIZEMASS);
948 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
949 RNA_def_property_ui_text(prop, "Mass from Size", "Multiply mass with particle size.");
950 RNA_def_property_update(prop, 0, "rna_Particle_reset");
952 prop= RNA_def_property(srna, "boids_2d", PROP_BOOLEAN, PROP_NONE);
953 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_BOIDS_2D);
954 RNA_def_property_ui_text(prop, "Boids 2D", "Constrain boids to a surface");
955 RNA_def_property_update(prop, 0, "rna_Particle_reset");
957 prop= RNA_def_property(srna, "branching", PROP_BOOLEAN, PROP_NONE);
958 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_BRANCHING);
959 RNA_def_property_ui_text(prop, "Branching", "Branch child paths from each other.");
960 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
962 prop= RNA_def_property(srna, "animate_branching", PROP_BOOLEAN, PROP_NONE);
963 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ANIM_BRANCHING);
964 RNA_def_property_ui_text(prop, "Animated", "Animate branching");
965 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
967 prop= RNA_def_property(srna, "symmetric_branching", PROP_BOOLEAN, PROP_NONE);
968 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SYMM_BRANCHING);
969 RNA_def_property_ui_text(prop, "Symmetric", "Start and end points are the same.");
970 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
972 prop= RNA_def_property(srna, "hair_bspline", PROP_BOOLEAN, PROP_NONE);
973 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_BSPLINE);
974 RNA_def_property_ui_text(prop, "B-Spline", "Interpolate hair using B-Splines.");
975 RNA_def_property_update(prop, 0, "rna_Particle_redo");
977 prop= RNA_def_property(srna, "grid_invert", PROP_BOOLEAN, PROP_NONE);
978 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GRID_INVERT);
979 RNA_def_property_ui_text(prop, "Invert", "Invert what is considered object and what is not.");
980 RNA_def_property_update(prop, 0, "rna_Particle_reset");
982 prop= RNA_def_property(srna, "child_effector", PROP_BOOLEAN, PROP_NONE);
983 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_EFFECT);
984 RNA_def_property_ui_text(prop, "Children", "Apply effectors to children.");
985 RNA_def_property_update(prop, 0, "rna_Particle_redo");
987 //prop= RNA_def_property(srna, "child_seams", PROP_BOOLEAN, PROP_NONE);
988 //RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_SEAMS);
989 //RNA_def_property_ui_text(prop, "Use seams", "Use seams to determine parents");
990 //RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
992 /* TODO: used somewhere? */
993 prop= RNA_def_property(srna, "child_render", PROP_BOOLEAN, PROP_NONE);
994 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_RENDER);
995 RNA_def_property_ui_text(prop, "child_render", "");
997 prop= RNA_def_property(srna, "child_guide", PROP_BOOLEAN, PROP_NONE);
998 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_GUIDE);
999 RNA_def_property_ui_text(prop, "child_guide", "");
1000 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1002 prop= RNA_def_property(srna, "self_effect", PROP_BOOLEAN, PROP_NONE);
1003 RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SELF_EFFECT);
1004 RNA_def_property_ui_text(prop, "Self Effect", "Particle effectors effect themselves.");
1005 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1008 prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
1009 RNA_def_property_enum_items(prop, type_items);
1010 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
1011 RNA_def_property_ui_text(prop, "Type", "");
1012 RNA_def_property_update(prop, 0, "rna_Particle_change_type");
1014 prop= RNA_def_property(srna, "emit_from", PROP_ENUM, PROP_NONE);
1015 RNA_def_property_enum_sdna(prop, NULL, "from");
1016 RNA_def_property_enum_items(prop, part_reactor_from_items);
1017 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
1018 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_from_itemf");
1019 RNA_def_property_ui_text(prop, "Emit From", "Where to emit particles from");
1020 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1022 prop= RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
1023 RNA_def_property_enum_sdna(prop, NULL, "distr");
1024 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
1025 RNA_def_property_enum_items(prop, dist_items);
1026 RNA_def_property_ui_text(prop, "Distribution", "How to distribute particles on selected element");
1027 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1030 prop= RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
1031 RNA_def_property_enum_sdna(prop, NULL, "phystype");
1032 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
1033 RNA_def_property_enum_items(prop, phys_type_items);
1034 RNA_def_property_ui_text(prop, "Physics Type", "Particle physics type");
1035 RNA_def_property_update(prop, 0, "rna_Particle_change_physics");
1037 prop= RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
1038 RNA_def_property_enum_sdna(prop, NULL, "rotmode");
1039 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
1040 RNA_def_property_enum_items(prop, rot_mode_items);
1041 RNA_def_property_ui_text(prop, "Rotation", "Particles initial rotation");
1042 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1044 prop= RNA_def_property(srna, "angular_velocity_mode", PROP_ENUM, PROP_NONE);
1045 RNA_def_property_enum_sdna(prop, NULL, "avemode");
1046 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
1047 RNA_def_property_enum_items(prop, ave_mode_items);
1048 RNA_def_property_ui_text(prop, "Angular Velocity Mode", "Particle angular velocity mode.");
1049 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1051 prop= RNA_def_property(srna, "react_event", PROP_ENUM, PROP_NONE);
1052 RNA_def_property_enum_sdna(prop, NULL, "reactevent");
1053 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
1054 RNA_def_property_enum_items(prop, react_event_items);
1055 RNA_def_property_ui_text(prop, "React On", "The event of target particles to react on.");
1056 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1059 prop= RNA_def_property(srna, "velocity", PROP_BOOLEAN, PROP_NONE);
1060 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL);
1061 RNA_def_property_ui_text(prop, "Velocity", "Show particle velocity");
1062 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1064 prop= RNA_def_property(srna, "show_size", PROP_BOOLEAN, PROP_NONE);
1065 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_SIZE);
1066 RNA_def_property_ui_text(prop, "Size", "Show particle size");
1067 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1069 prop= RNA_def_property(srna, "emitter", PROP_BOOLEAN, PROP_NONE);
1070 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_EMITTER);
1071 RNA_def_property_ui_text(prop, "Emitter", "Render emitter Object also.");
1072 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1074 prop= RNA_def_property(srna, "draw_health", PROP_BOOLEAN, PROP_NONE);
1075 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_HEALTH);
1076 RNA_def_property_ui_text(prop, "Health", "Draw boid health");
1077 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1079 prop= RNA_def_property(srna, "abs_path_time", PROP_BOOLEAN, PROP_NONE);
1080 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_ABS_PATH_TIME);
1081 RNA_def_property_ui_text(prop, "Absolute Path Time", "Path timing is in absolute frames");
1082 RNA_def_property_update(prop, 0, "rna_Particle_abspathtime_update");
1084 prop= RNA_def_property(srna, "billboard_lock", PROP_BOOLEAN, PROP_NONE);
1085 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_BB_LOCK);
1086 RNA_def_property_ui_text(prop, "Lock Billboard", "Lock the billboards align axis");
1087 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1089 prop= RNA_def_property(srna, "parent", PROP_BOOLEAN, PROP_NONE);
1090 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_PARENT);
1091 RNA_def_property_ui_text(prop, "Parents", "Render parent particles.");
1092 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1094 prop= RNA_def_property(srna, "num", PROP_BOOLEAN, PROP_NONE);
1095 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_NUM);
1096 RNA_def_property_ui_text(prop, "Number", "Show particle number");
1097 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1099 prop= RNA_def_property(srna, "rand_group", PROP_BOOLEAN, PROP_NONE);
1100 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_RAND_GR);
1101 RNA_def_property_ui_text(prop, "Pick Random", "Pick objects from group randomly");
1102 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1104 prop= RNA_def_property(srna, "use_group_count", PROP_BOOLEAN, PROP_NONE);
1105 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_COUNT_GR);
1106 RNA_def_property_ui_text(prop, "Use Count", "Use object multiple times in the same group");
1107 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1109 prop= RNA_def_property(srna, "use_global_dupli", PROP_BOOLEAN, PROP_NONE);
1110 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_GLOBAL_OB);
1111 RNA_def_property_ui_text(prop, "Use Global", "Use object's global coordinates for duplication.");
1112 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1114 prop= RNA_def_property(srna, "render_adaptive", PROP_BOOLEAN, PROP_NONE);
1115 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_ADAPT);
1116 RNA_def_property_ui_text(prop, "Adaptive render", "Draw steps of the particle path");
1117 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1119 prop= RNA_def_property(srna, "velocity_length", PROP_BOOLEAN, PROP_NONE);
1120 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL_LENGTH);
1121 RNA_def_property_ui_text(prop, "Speed", "Multiply line length by particle speed");
1122 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1124 prop= RNA_def_property(srna, "material_color", PROP_BOOLEAN, PROP_NONE);
1125 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_MAT_COL);
1126 RNA_def_property_ui_text(prop, "Material Color", "Draw particles using material's diffuse color.");
1127 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1129 prop= RNA_def_property(srna, "whole_group", PROP_BOOLEAN, PROP_NONE);
1130 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_WHOLE_GR);
1131 RNA_def_property_ui_text(prop, "Whole Group", "Use whole group at once.");
1132 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1134 prop= RNA_def_property(srna, "render_strand", PROP_BOOLEAN, PROP_NONE);
1135 RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_STRAND);
1136 RNA_def_property_ui_text(prop, "Strand render", "Use the strand primitive for rendering");
1137 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1139 prop= RNA_def_property(srna, "draw_as", PROP_ENUM, PROP_NONE);
1140 RNA_def_property_enum_sdna(prop, NULL, "draw_as");
1141 RNA_def_property_enum_items(prop, part_draw_as_items);
1142 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_draw_as_itemf");
1143 RNA_def_property_ui_text(prop, "Particle Drawing", "How particles are drawn in viewport");
1144 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1146 prop= RNA_def_property(srna, "ren_as", PROP_ENUM, PROP_NONE);
1147 RNA_def_property_enum_sdna(prop, NULL, "ren_as");
1148 RNA_def_property_enum_items(prop, part_ren_as_items);
1149 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_ren_as_itemf");
1150 RNA_def_property_ui_text(prop, "Particle Rendering", "How particles are rendered");
1151 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1153 prop= RNA_def_property(srna, "draw_size", PROP_INT, PROP_NONE);
1154 RNA_def_property_range(prop, 0, 10);
1155 RNA_def_property_ui_text(prop, "Draw Size", "Size of particles on viewport in pixels (0=default)");
1156 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1158 prop= RNA_def_property(srna, "child_type", PROP_ENUM, PROP_NONE);
1159 RNA_def_property_enum_sdna(prop, NULL, "childtype");
1160 RNA_def_property_enum_items(prop, child_type_items);
1161 RNA_def_property_ui_text(prop, "Children From", "Create child particles");
1162 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1164 prop= RNA_def_property(srna, "draw_step", PROP_INT, PROP_NONE);
1165 RNA_def_property_range(prop, 0, 7);
1166 RNA_def_property_ui_range(prop, 0, 10, 1, 0);
1167 RNA_def_property_ui_text(prop, "Steps", "How many steps paths are drawn with (power of 2)");
1168 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1170 prop= RNA_def_property(srna, "render_step", PROP_INT, PROP_NONE);
1171 RNA_def_property_int_sdna(prop, NULL, "ren_step");
1172 RNA_def_property_range(prop, 0, 9);
1173 RNA_def_property_ui_range(prop, 0, 20, 1, 0);
1174 RNA_def_property_ui_text(prop, "Render", "How many steps paths are rendered with (power of 2)");
1176 prop= RNA_def_property(srna, "hair_step", PROP_INT, PROP_NONE);
1177 RNA_def_property_range(prop, 2, 50);
1178 RNA_def_property_ui_text(prop, "Segments", "Number of hair segments");
1179 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1182 //TODO: not found in UI, readonly?
1183 prop= RNA_def_property(srna, "keys_step", PROP_INT, PROP_NONE);
1184 RNA_def_property_range(prop, 0, INT_MAX);//TODO:min,max
1185 RNA_def_property_ui_text(prop, "Keys Step", "");
1187 /* adaptive path rendering */
1188 prop= RNA_def_property(srna, "adaptive_angle", PROP_INT, PROP_NONE);
1189 RNA_def_property_int_sdna(prop, NULL, "adapt_angle");
1190 RNA_def_property_range(prop, 0, 45);
1191 RNA_def_property_ui_text(prop, "Degrees", "How many degrees path has to curve to make another render segment");
1193 prop= RNA_def_property(srna, "adaptive_pix", PROP_INT, PROP_NONE);
1194 RNA_def_property_int_sdna(prop, NULL, "adapt_pix");
1195 RNA_def_property_range(prop, 0, 50);
1196 RNA_def_property_ui_text(prop, "Pixel", "How many pixels path has to cover to make another render segment");
1198 prop= RNA_def_property(srna, "display", PROP_INT, PROP_NONE);
1199 RNA_def_property_int_sdna(prop, NULL, "disp");
1200 RNA_def_property_range(prop, 0, 100);
1201 RNA_def_property_ui_text(prop, "Display", "Percentage of particles to display in 3d view");
1202 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1204 prop= RNA_def_property(srna, "material", PROP_INT, PROP_NONE);
1205 RNA_def_property_int_sdna(prop, NULL, "omat");
1206 RNA_def_property_range(prop, 1, 16);
1207 RNA_def_property_ui_text(prop, "Material", "Specify material used for the particles");
1208 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1211 //TODO: is this read only/internal?
1212 prop= RNA_def_property(srna, "rotate_from", PROP_ENUM, PROP_NONE);
1213 RNA_def_property_enum_sdna(prop, NULL, "rotfrom");
1214 RNA_def_property_enum_items(prop, rot_from_items);
1215 RNA_def_property_ui_text(prop, "Rotate From", "");
1217 prop= RNA_def_property(srna, "integrator", PROP_ENUM, PROP_NONE);
1218 RNA_def_property_enum_items(prop, integrator_type_items);
1219 RNA_def_property_ui_text(prop, "Integration", "Select physics integrator type");
1220 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1222 prop= RNA_def_property(srna, "kink", PROP_ENUM, PROP_NONE);
1223 RNA_def_property_enum_items(prop, kink_type_items);
1224 RNA_def_property_ui_text(prop, "Kink", "Type of periodic offset on the path");
1225 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1227 prop= RNA_def_property(srna, "kink_axis", PROP_ENUM, PROP_NONE);
1228 RNA_def_property_enum_items(prop, kink_axis_items);
1229 RNA_def_property_ui_text(prop, "Axis", "Which axis to use for offset");
1230 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1233 prop= RNA_def_property(srna, "billboard_align", PROP_ENUM, PROP_NONE);
1234 RNA_def_property_enum_sdna(prop, NULL, "bb_align");
1235 RNA_def_property_enum_items(prop, bb_align_items);
1236 RNA_def_property_ui_text(prop, "Align to", "In respect to what the billboards are aligned");
1237 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1239 prop= RNA_def_property(srna, "billboard_uv_split", PROP_INT, PROP_NONE);
1240 RNA_def_property_int_sdna(prop, NULL, "bb_uv_split");
1241 RNA_def_property_range(prop, 1, 100);
1242 RNA_def_property_ui_range(prop, 1, 10, 1, 0);
1243 RNA_def_property_ui_text(prop, "UV Split", "Amount of rows/columns to split uv coordinates for billboards");
1245 prop= RNA_def_property(srna, "billboard_animation", PROP_ENUM, PROP_NONE);
1246 RNA_def_property_enum_sdna(prop, NULL, "bb_anim");
1247 RNA_def_property_enum_items(prop, bb_anim_items);
1248 RNA_def_property_ui_text(prop, "Animate", "How to animate billboard textures.");
1250 prop= RNA_def_property(srna, "billboard_split_offset", PROP_ENUM, PROP_NONE);
1251 RNA_def_property_enum_sdna(prop, NULL, "bb_split_offset");
1252 RNA_def_property_enum_items(prop, bb_split_offset_items);
1253 RNA_def_property_ui_text(prop, "Offset", "How to offset billboard textures");
1255 prop= RNA_def_property(srna, "billboard_tilt", PROP_FLOAT, PROP_NONE);
1256 RNA_def_property_float_sdna(prop, NULL, "bb_tilt");
1257 RNA_def_property_range(prop, -1.0f, 1.0f);
1258 RNA_def_property_ui_text(prop, "Tilt", "Tilt of the billboards");
1259 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1261 prop= RNA_def_property(srna, "billboard_random_tilt", PROP_FLOAT, PROP_NONE);
1262 RNA_def_property_float_sdna(prop, NULL, "bb_rand_tilt");
1263 RNA_def_property_range(prop, 0.0f, 1.0f);
1264 RNA_def_property_ui_text(prop, "Random Tilt", "Random tilt of the billboards");
1265 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1267 prop= RNA_def_property(srna, "billboard_offset", PROP_FLOAT, PROP_TRANSLATION);
1268 RNA_def_property_float_sdna(prop, NULL, "bb_offset");
1269 RNA_def_property_array(prop, 2);
1270 RNA_def_property_range(prop, -100.0f, 100.0f);
1271 RNA_def_property_ui_range(prop, -1.0, 1.0, 0.1, 3);
1272 RNA_def_property_ui_text(prop, "Billboard Offset", "");
1273 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1275 /* simplification */
1276 prop= RNA_def_property(srna, "enable_simplify", PROP_BOOLEAN, PROP_NONE);
1277 RNA_def_property_boolean_sdna(prop, NULL, "simplify_flag", PART_SIMPLIFY_ENABLE);
1278 RNA_def_property_ui_text(prop, "Child Simplification", "Remove child strands as the object becomes smaller on the screen.");
1280 prop= RNA_def_property(srna, "viewport", PROP_BOOLEAN, PROP_NONE);
1281 RNA_def_property_boolean_sdna(prop, NULL, "simplify_flag", PART_SIMPLIFY_VIEWPORT);
1282 RNA_def_property_ui_text(prop, "Viewport", "");
1284 prop= RNA_def_property(srna, "simplify_refsize", PROP_INT, PROP_UNSIGNED);
1285 RNA_def_property_int_sdna(prop, NULL, "simplify_refsize");
1286 RNA_def_property_range(prop, 1, 32768);
1287 RNA_def_property_ui_text(prop, "Reference Size", "Reference size size in pixels, after which simplification begins.");
1289 prop= RNA_def_property(srna, "simplify_rate", PROP_FLOAT, PROP_NONE);
1290 RNA_def_property_range(prop, 0.0f, 1.0f);
1291 RNA_def_property_ui_text(prop, "Rate", "Speed of simplification");
1293 prop= RNA_def_property(srna, "simplify_transition", PROP_FLOAT, PROP_NONE);
1294 RNA_def_property_range(prop, 0.0f, 1.0f);
1295 RNA_def_property_ui_text(prop, "Transition", "Transition period for fading out strands.");
1297 prop= RNA_def_property(srna, "simplify_viewport", PROP_FLOAT, PROP_NONE);
1298 RNA_def_property_range(prop, 0.0f, 0.999f);
1299 RNA_def_property_ui_text(prop, "Rate", "Speed of Simplification");
1301 /* general values */
1302 prop= RNA_def_property(srna, "start", PROP_FLOAT, PROP_NONE);
1303 RNA_def_property_float_sdna(prop, NULL, "sta");//optional if prop names are the same
1304 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
1305 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
1306 RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_start_set", NULL);
1307 RNA_def_property_ui_text(prop, "Start", "Frame # to start emitting particles.");
1308 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1310 prop= RNA_def_property(srna, "end", PROP_FLOAT, PROP_NONE);
1311 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
1313 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
1314 RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_end_set", NULL);
1315 RNA_def_property_ui_text(prop, "End", "Frame # to stop emitting particles.");
1316 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1318 prop= RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
1319 RNA_def_property_range(prop, 1.0f, MAXFRAMEF);
1320 RNA_def_property_ui_text(prop, "Lifetime", "Specify the life span of the particles");
1321 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1323 prop= RNA_def_property(srna, "random_lifetime", PROP_FLOAT, PROP_NONE);
1324 RNA_def_property_float_sdna(prop, NULL, "randlife");
1325 RNA_def_property_range(prop, 0.0f, 1.0f);
1326 RNA_def_property_ui_text(prop, "Random", "Give the particle life a random variation.");
1327 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1329 prop= RNA_def_property(srna, "time_tweak", PROP_FLOAT, PROP_NONE);
1330 RNA_def_property_float_sdna(prop, NULL, "timetweak");
1331 RNA_def_property_range(prop, 0.0f, 10.0f);
1332 RNA_def_property_ui_text(prop, "Tweak", "A multiplier for physics timestep (1.0 means one frame = 1/25 seconds)");
1333 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1335 prop= RNA_def_property(srna, "jitter_factor", PROP_FLOAT, PROP_NONE);
1336 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
1337 RNA_def_property_float_sdna(prop, NULL, "jitfac");
1338 RNA_def_property_range(prop, 0.0f, 2.0f);
1339 RNA_def_property_ui_text(prop, "Amount", "Amount of jitter applied to the sampling.");
1340 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1342 prop= RNA_def_property(srna, "effect_hair", PROP_FLOAT, PROP_NONE);
1343 RNA_def_property_float_sdna(prop, NULL, "eff_hair");
1344 RNA_def_property_range(prop, 0.0f, 1.0f);
1345 RNA_def_property_ui_text(prop, "Stiffnes", "Hair stiffness for effectors");
1346 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1348 prop= RNA_def_property(srna, "amount", PROP_INT, PROP_UNSIGNED);
1349 RNA_def_property_int_sdna(prop, NULL, "totpart");
1350 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
1351 /* This limit is for those freaks who have the machine power to handle it. */
1352 /* 10M particles take around 2.2 Gb of memory / disk space in saved file and */
1353 /* each cached frame takes around 0.5 Gb of memory / disk space depending on cache mode. */
1354 RNA_def_property_range(prop, 0, 10000000);
1355 RNA_def_property_ui_range(prop, 0, 100000, 1, 0);
1356 RNA_def_property_ui_text(prop, "Amount", "Total number of particles.");
1357 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1359 prop= RNA_def_property(srna, "userjit", PROP_INT, PROP_UNSIGNED);//TODO: can we get a better name for userjit?
1360 RNA_def_property_int_sdna(prop, NULL, "userjit");
1361 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
1362 RNA_def_property_range(prop, 0, 1000);
1363 RNA_def_property_ui_text(prop, "P/F", "Emission locations / face (0 = automatic).");
1364 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1366 prop= RNA_def_property(srna, "grid_resolution", PROP_INT, PROP_UNSIGNED);
1367 RNA_def_property_int_sdna(prop, NULL, "grid_res");
1368 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
1369 RNA_def_property_range(prop, 1, 46); /* ~100k particles in a cube */
1370 RNA_def_property_ui_range(prop, 1, 215, 1, 0); /* ~10M particles in a cube */
1371 RNA_def_property_ui_text(prop, "Resolution", "The resolution of the particle grid.");
1372 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1374 /* initial velocity factors */
1375 prop= RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_NONE);
1376 RNA_def_property_float_sdna(prop, NULL, "normfac");//optional if prop names are the same
1377 RNA_def_property_range(prop, -200.0f, 200.0f);
1378 RNA_def_property_ui_text(prop, "Normal", "Let the surface normal give the particle a starting speed.");
1379 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1381 prop= RNA_def_property(srna, "object_factor", PROP_FLOAT, PROP_NONE);
1382 RNA_def_property_float_sdna(prop, NULL, "obfac");
1383 RNA_def_property_range(prop, -200.0f, 200.0f);
1384 RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
1385 RNA_def_property_ui_text(prop, "Object", "Let the object give the particle a starting speed");
1386 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1388 prop= RNA_def_property(srna, "random_factor", PROP_FLOAT, PROP_NONE);
1389 RNA_def_property_float_sdna(prop, NULL, "randfac");//optional if prop names are the same
1390 RNA_def_property_range(prop, 0.0f, 200.0f);
1391 RNA_def_property_ui_text(prop, "Random", "Give the starting speed a random variation.");
1392 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1394 prop= RNA_def_property(srna, "particle_factor", PROP_FLOAT, PROP_NONE);
1395 RNA_def_property_float_sdna(prop, NULL, "partfac");
1396 RNA_def_property_range(prop, -200.0f, 200.0f);
1397 RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
1398 RNA_def_property_ui_text(prop, "Particle", "Let the target particle give the particle a starting speed.");
1399 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1401 prop= RNA_def_property(srna, "tangent_factor", PROP_FLOAT, PROP_NONE);
1402 RNA_def_property_float_sdna(prop, NULL, "tanfac");
1403 RNA_def_property_range(prop, -200.0f, 200.0f);
1404 RNA_def_property_ui_text(prop, "Tangent", "Let the surface tangent give the particle a starting speed.");
1405 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1407 prop= RNA_def_property(srna, "tangent_phase", PROP_FLOAT, PROP_NONE);
1408 RNA_def_property_float_sdna(prop, NULL, "tanphase");
1409 RNA_def_property_range(prop, -1.0f, 1.0f);
1410 RNA_def_property_ui_text(prop, "Rot", "Rotate the surface tangent.");
1411 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1413 prop= RNA_def_property(srna, "reactor_factor", PROP_FLOAT, PROP_NONE);
1414 RNA_def_property_float_sdna(prop, NULL, "reactfac");
1415 RNA_def_property_range(prop, -10.0f, 10.0f);
1416 RNA_def_property_ui_text(prop, "Reactor", "Let the vector away from the target particles location give the particle a starting speed.");
1417 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1419 prop= RNA_def_property(srna, "object_aligned_factor", PROP_FLOAT, PROP_VELOCITY);
1420 RNA_def_property_float_sdna(prop, NULL, "ob_vel");
1421 RNA_def_property_array(prop, 3);
1422 RNA_def_property_range(prop, -200.0f, 200.0f);
1423 RNA_def_property_ui_text(prop, "Object Aligned", "Let the emitter object orientation give the particle a starting speed");
1424 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1426 prop= RNA_def_property(srna, "angular_velocity_factor", PROP_FLOAT, PROP_NONE);
1427 RNA_def_property_float_sdna(prop, NULL, "avefac");
1428 RNA_def_property_range(prop, -200.0f, 200.0f);
1429 RNA_def_property_ui_text(prop, "Angular Velocity", "Angular velocity amount");
1430 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1432 prop= RNA_def_property(srna, "phase_factor", PROP_FLOAT, PROP_NONE);
1433 RNA_def_property_float_sdna(prop, NULL, "phasefac");
1434 RNA_def_property_range(prop, -1.0f, 1.0f);
1435 RNA_def_property_ui_text(prop, "Phase", "Initial rotation phase");
1436 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1438 prop= RNA_def_property(srna, "random_rotation_factor", PROP_FLOAT, PROP_NONE);
1439 RNA_def_property_float_sdna(prop, NULL, "randrotfac");
1440 RNA_def_property_range(prop, 0.0f, 1.0f);
1441 RNA_def_property_ui_text(prop, "Random Rotation", "Randomize rotation");
1442 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1444 prop= RNA_def_property(srna, "random_phase_factor", PROP_FLOAT, PROP_NONE);
1445 RNA_def_property_float_sdna(prop, NULL, "randphasefac");
1446 RNA_def_property_range(prop, 0.0f, 1.0f);
1447 RNA_def_property_ui_text(prop, "Random Phase", "Randomize rotation phase");
1448 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1450 /* physical properties */
1451 prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
1452 RNA_def_property_range(prop, 0.001f, 100000.0f);
1453 RNA_def_property_ui_range(prop, 0.01f, 100.0f, 0.1, 3);
1454 RNA_def_property_ui_text(prop, "Mass", "Specify the mass of the particles");
1455 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1457 prop= RNA_def_property(srna, "particle_size", PROP_FLOAT, PROP_NONE);
1458 RNA_def_property_float_sdna(prop, NULL, "size");
1459 RNA_def_property_range(prop, 0.001f, 100000.0f);
1460 RNA_def_property_ui_range(prop, 0.01f, 100.0f, 0.1, 3);
1461 RNA_def_property_ui_text(prop, "Size", "The size of the particles");
1462 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1464 prop= RNA_def_property(srna, "random_size", PROP_FLOAT, PROP_NONE);
1465 RNA_def_property_float_sdna(prop, NULL, "randsize");
1466 RNA_def_property_range(prop, 0.0f, 1.0f);
1467 RNA_def_property_ui_text(prop, "Random Size", "Give the particle size a random variation");
1468 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1470 prop= RNA_def_property(srna, "reaction_shape", PROP_FLOAT, PROP_NONE);
1471 RNA_def_property_float_sdna(prop, NULL, "reactshape");
1472 RNA_def_property_range(prop, 0.0f, 10.0f);
1473 RNA_def_property_ui_text(prop, "Shape", "Power of reaction strength dependence on distance to target.");
1474 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1477 /* global physical properties */
1478 prop= RNA_def_property(srna, "drag_factor", PROP_FLOAT, PROP_NONE);
1479 RNA_def_property_float_sdna(prop, NULL, "dragfac");
1480 RNA_def_property_range(prop, 0.0f, 1.0f);
1481 RNA_def_property_ui_text(prop, "Drag", "Specify the amount of air-drag.");
1482 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1484 prop= RNA_def_property(srna, "brownian_factor", PROP_FLOAT, PROP_NONE);
1485 RNA_def_property_float_sdna(prop, NULL, "brownfac");
1486 RNA_def_property_range(prop, 0.0f, 200.0f);
1487 RNA_def_property_ui_text(prop, "Brownian", "Specify the amount of brownian motion");
1488 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1490 prop= RNA_def_property(srna, "damp_factor", PROP_FLOAT, PROP_NONE);
1491 RNA_def_property_float_sdna(prop, NULL, "dampfac");
1492 RNA_def_property_range(prop, 0.0f, 1.0f);
1493 RNA_def_property_ui_text(prop, "Damp", "Specify the amount of damping");
1494 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1497 prop= RNA_def_property(srna, "random_length", PROP_FLOAT, PROP_NONE);
1498 RNA_def_property_float_sdna(prop, NULL, "randlength");
1499 RNA_def_property_range(prop, 0.0f, 1.0f);
1500 RNA_def_property_ui_text(prop, "Random Length", "Give path length a random variation.");
1501 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1504 prop= RNA_def_property(srna, "child_nbr", PROP_INT, PROP_NONE);
1505 RNA_def_property_int_sdna(prop, NULL, "child_nbr");//optional if prop names are the same
1506 RNA_def_property_range(prop, 0, 100000);
1507 RNA_def_property_ui_range(prop, 0, 1000, 1, 0);
1508 RNA_def_property_ui_text(prop, "Children Per Parent", "Amount of children/parent");
1509 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1511 prop= RNA_def_property(srna, "rendered_child_nbr", PROP_INT, PROP_NONE);
1512 RNA_def_property_int_sdna(prop, NULL, "ren_child_nbr");
1513 RNA_def_property_range(prop, 0, 100000);
1514 RNA_def_property_ui_range(prop, 0, 10000, 1, 0);
1515 RNA_def_property_ui_text(prop, "Rendered Children", "Amount of children/parent for rendering.");
1517 prop= RNA_def_property(srna, "virtual_parents", PROP_FLOAT, PROP_NONE);
1518 RNA_def_property_float_sdna(prop, NULL, "parents");
1519 RNA_def_property_range(prop, 0.0f, 1.0f);
1520 RNA_def_property_ui_text(prop, "Virtual Parents", "Relative amount of virtual parents.");
1521 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1523 prop= RNA_def_property(srna, "child_size", PROP_FLOAT, PROP_NONE);
1524 RNA_def_property_float_sdna(prop, NULL, "childsize");
1525 RNA_def_property_range(prop, 0.001f, 100000.0f);
1526 RNA_def_property_ui_range(prop, 0.01f, 100.0f, 0.1, 3);
1527 RNA_def_property_ui_text(prop, "Child Size", "A multiplier for the child particle size.");
1528 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1530 prop= RNA_def_property(srna, "child_random_size", PROP_FLOAT, PROP_NONE);
1531 RNA_def_property_float_sdna(prop, NULL, "childrandsize");
1532 RNA_def_property_range(prop, 0.0f, 1.0f);
1533 RNA_def_property_ui_text(prop, "Random Child Size", "Random variation to the size of the child particles.");
1534 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1536 prop= RNA_def_property(srna, "child_radius", PROP_FLOAT, PROP_NONE);
1537 RNA_def_property_float_sdna(prop, NULL, "childrad");
1538 RNA_def_property_range(prop, 0.0f, 10.0f);
1539 RNA_def_property_ui_text(prop, "Child Radius", "Radius of children around parent.");
1540 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1542 prop= RNA_def_property(srna, "child_roundness", PROP_FLOAT, PROP_NONE);
1543 RNA_def_property_float_sdna(prop, NULL, "childflat");
1544 RNA_def_property_range(prop, 0.0f, 1.0f);
1545 RNA_def_property_ui_text(prop, "Child Roundness", "Roundness of children around parent.");
1546 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1549 prop= RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
1550 RNA_def_property_float_sdna(prop, NULL, "clumpfac");
1551 RNA_def_property_range(prop, -1.0f, 1.0f);
1552 RNA_def_property_ui_text(prop, "Clump", "Amount of clumping");
1553 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1555 prop= RNA_def_property(srna, "clumppow", PROP_FLOAT, PROP_NONE);
1556 RNA_def_property_float_sdna(prop, NULL, "clumppow");
1557 RNA_def_property_range(prop, -0.999f, 0.999f);
1558 RNA_def_property_ui_text(prop, "Shape", "Shape of clumping");
1559 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1563 prop= RNA_def_property(srna, "kink_amplitude", PROP_FLOAT, PROP_NONE);
1564 RNA_def_property_float_sdna(prop, NULL, "kink_amp");
1565 RNA_def_property_range(prop, -100000.0f, 100000.0f);
1566 RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
1567 RNA_def_property_ui_text(prop, "Amplitude", "The amplitude of the offset.");
1568 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1570 prop= RNA_def_property(srna, "kink_frequency", PROP_FLOAT, PROP_NONE);
1571 RNA_def_property_float_sdna(prop, NULL, "kink_freq");
1572 RNA_def_property_range(prop, -100000.0f, 100000.0f);
1573 RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
1574 RNA_def_property_ui_text(prop, "Frequency", "The frequency of the offset (1/total length)");
1575 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1577 prop= RNA_def_property(srna, "kink_shape", PROP_FLOAT, PROP_NONE);
1578 RNA_def_property_range(prop, -0.999f, 0.999f);
1579 RNA_def_property_ui_text(prop, "Shape", "Adjust the offset to the beginning/end");
1580 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1584 prop= RNA_def_property(srna, "rough1", PROP_FLOAT, PROP_NONE);
1585 RNA_def_property_range(prop, 0.0f, 100000.0f);
1586 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
1587 RNA_def_property_ui_text(prop, "Rough1", "Amount of location dependent rough.");
1588 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1590 prop= RNA_def_property(srna, "rough1_size", PROP_FLOAT, PROP_NONE);
1591 RNA_def_property_range(prop, 0.01f, 100000.0f);
1592 RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3);
1593 RNA_def_property_ui_text(prop, "Size1", "Size of location dependent rough.");
1594 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1596 prop= RNA_def_property(srna, "rough2", PROP_FLOAT, PROP_NONE);
1597 RNA_def_property_float_sdna(prop, NULL, "rough2");
1598 RNA_def_property_range(prop, 0.0f, 100000.0f);
1599 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
1600 RNA_def_property_ui_text(prop, "Rough2", "Amount of random rough.");
1601 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1603 prop= RNA_def_property(srna, "rough2_size", PROP_FLOAT, PROP_NONE);
1604 RNA_def_property_float_sdna(prop, NULL, "rough2_size");
1605 RNA_def_property_range(prop, 0.01f, 100000.0f);
1606 RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3);
1607 RNA_def_property_ui_text(prop, "Size2", "Size of random rough.");
1608 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1610 prop= RNA_def_property(srna, "rough2_thres", PROP_FLOAT, PROP_NONE);
1611 RNA_def_property_float_sdna(prop, NULL, "rough2_thres");
1612 RNA_def_property_range(prop, 0.0f, 1.0f);
1613 RNA_def_property_ui_text(prop, "Threshold", "Amount of particles left untouched by random rough.");
1614 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1616 prop= RNA_def_property(srna, "rough_endpoint", PROP_FLOAT, PROP_NONE);
1617 RNA_def_property_float_sdna(prop, NULL, "rough_end");
1618 RNA_def_property_range(prop, 0.0f, 100000.0f);
1619 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
1620 RNA_def_property_ui_text(prop, "Rough Endpoint", "Amount of end point rough.");
1621 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1623 prop= RNA_def_property(srna, "rough_end_shape", PROP_FLOAT, PROP_NONE);
1624 RNA_def_property_range(prop, 0.0f, 10.0f);
1625 RNA_def_property_ui_text(prop, "Shape", "Shape of end point rough");
1626 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1628 prop= RNA_def_property(srna, "child_length", PROP_FLOAT, PROP_NONE);
1629 RNA_def_property_float_sdna(prop, NULL, "clength");
1630 RNA_def_property_range(prop, 0.0f, 1.0f);
1631 RNA_def_property_ui_text(prop, "Length", "Length of child paths");
1632 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1634 prop= RNA_def_property(srna, "child_length_thres", PROP_FLOAT, PROP_NONE);
1635 RNA_def_property_float_sdna(prop, NULL, "clength_thres");
1636 RNA_def_property_range(prop, 0.0f, 1.0f);
1637 RNA_def_property_ui_text(prop, "Threshold", "Amount of particles left untouched by child path length.");
1638 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1641 prop= RNA_def_property(srna, "branch_threshold", PROP_FLOAT, PROP_NONE);
1642 RNA_def_property_float_sdna(prop, NULL, "branch_thres");
1643 RNA_def_property_range(prop, 0.0f, 1.0f);
1644 RNA_def_property_ui_text(prop, "Threshold", "Threshold of branching.");
1645 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1648 prop= RNA_def_property(srna, "line_length_tail", PROP_FLOAT, PROP_NONE);
1649 RNA_def_property_float_funcs(prop, "rna_PartSetting_linelentail_get", "rna_PartSetting_linelentail_set", NULL);
1650 RNA_def_property_range(prop, 0.0f, 100000.0f);
1651 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
1652 RNA_def_property_ui_text(prop, "Back", "Length of the line's tail");
1653 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1655 prop= RNA_def_property(srna, "line_length_head", PROP_FLOAT, PROP_NONE);
1656 RNA_def_property_float_funcs(prop, "rna_PartSetting_linelenhead_get", "rna_PartSetting_linelenhead_set", NULL);
1657 RNA_def_property_range(prop, 0.0f, 100000.0f);
1658 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
1659 RNA_def_property_ui_text(prop, "Head", "Length of the line's head");
1660 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1662 prop= RNA_def_property(srna, "path_start", PROP_FLOAT, PROP_NONE);
1663 RNA_def_property_float_sdna(prop, NULL, "path_start");
1664 RNA_def_property_float_funcs(prop, NULL, NULL, "rna_PartSetting_pathstartend_range");
1665 RNA_def_property_ui_text(prop, "Path Start", "Starting time of drawn path.");
1666 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1668 prop= RNA_def_property(srna, "path_end", PROP_FLOAT, PROP_NONE);
1669 RNA_def_property_float_sdna(prop, NULL, "path_end");
1670 RNA_def_property_float_funcs(prop, NULL, NULL, "rna_PartSetting_pathstartend_range");
1671 RNA_def_property_ui_text(prop, "Path End", "End time of drawn path.");
1672 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1674 prop= RNA_def_property(srna, "trail_count", PROP_INT, PROP_NONE);
1675 RNA_def_property_int_sdna(prop, NULL, "trail_count");
1676 RNA_def_property_range(prop, 1, 100000);
1677 RNA_def_property_ui_range(prop, 1, 100, 1, 0);
1678 RNA_def_property_ui_text(prop, "Trail Count", "Number of trail particles.");
1679 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1681 /* keyed particles */
1682 prop= RNA_def_property(srna, "keyed_loops", PROP_INT, PROP_NONE);
1683 RNA_def_property_int_sdna(prop, NULL, "keyed_loops");
1684 RNA_def_property_range(prop, 1.0f, 10000.0f);
1685 RNA_def_property_ui_range(prop, 1.0f, 100.0f, 0.1, 3);
1686 RNA_def_property_ui_text(prop, "Loop count", "Number of times the keys are looped.");
1687 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1690 prop= RNA_def_property(srna, "boids", PROP_POINTER, PROP_NONE);
1691 RNA_def_property_struct_type(prop, "BoidSettings");
1692 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1693 RNA_def_property_ui_text(prop, "Boid Settings", "");
1695 /* draw objects & groups */
1697 prop= RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE);
1698 RNA_def_property_pointer_sdna(prop, NULL, "dup_group");
1699 RNA_def_property_struct_type(prop, "Group");
1700 RNA_def_property_flag(prop, PROP_EDITABLE);
1701 RNA_def_property_ui_text(prop, "Dupli Group", "Show Objects in this Group in place of particles");
1702 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1704 prop= RNA_def_property(srna, "dupliweights", PROP_COLLECTION, PROP_NONE);
1705 RNA_def_property_struct_type(prop, "ParticleDupliWeight");
1706 RNA_def_property_ui_text(prop, "Dupli Group Weights", "Weights for all of the objects in the dupli group.");
1708 prop= RNA_def_property(srna, "active_dupliweight", PROP_POINTER, PROP_NONE);
1709 RNA_def_property_struct_type(prop, "ParticleDupliWeight");
1710 RNA_def_property_pointer_funcs(prop, "rna_ParticleDupliWeight_active_get", NULL, NULL);
1711 RNA_def_property_ui_text(prop, "Active Dupli Object", "");
1713 prop= RNA_def_property(srna, "active_dupliweight_index", PROP_INT, PROP_UNSIGNED);
1714 RNA_def_property_int_funcs(prop, "rna_ParticleDupliWeight_active_index_get", "rna_ParticleDupliWeight_active_index_set", "rna_ParticleDupliWeight_active_index_range");
1715 RNA_def_property_ui_text(prop, "Active Dupli Object Index", "");
1717 prop= RNA_def_property(srna, "dupli_object", PROP_POINTER, PROP_NONE);
1718 RNA_def_property_pointer_sdna(prop, NULL, "dup_ob");
1719 RNA_def_property_struct_type(prop, "Object");
1720 RNA_def_property_flag(prop, PROP_EDITABLE);
1721 RNA_def_property_ui_text(prop, "Dupli Object", "Show this Object in place of particles.");
1722 RNA_def_property_update(prop, 0, "rna_Particle_redo_dependency");
1724 prop= RNA_def_property(srna, "billboard_object", PROP_POINTER, PROP_NONE);
1725 RNA_def_property_pointer_sdna(prop, NULL, "bb_ob");
1726 RNA_def_property_struct_type(prop, "Object");
1727 RNA_def_property_flag(prop, PROP_EDITABLE);
1728 RNA_def_property_ui_text(prop, "Billboard Object", "Billboards face this object (default is active camera)");
1729 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1731 prop= RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
1732 RNA_def_property_struct_type(prop, "EffectorWeights");
1733 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1734 RNA_def_property_ui_text(prop, "Effector Weights", "");
1736 /* animation here? */
1737 rna_def_animdata_common(srna);
1739 prop= RNA_def_property(srna, "force_field_1", PROP_POINTER, PROP_NONE);
1740 RNA_def_property_pointer_sdna(prop, NULL, "pd");
1741 RNA_def_property_struct_type(prop, "FieldSettings");
1742 RNA_def_property_pointer_funcs(prop, "rna_Particle_field1_get", NULL, NULL);
1743 RNA_def_property_ui_text(prop, "Force Field 1", "");
1745 prop= RNA_def_property(srna, "force_field_2", PROP_POINTER, PROP_NONE);
1746 RNA_def_property_pointer_sdna(prop, NULL, "pd2");
1747 RNA_def_property_struct_type(prop, "FieldSettings");
1748 RNA_def_property_pointer_funcs(prop, "rna_Particle_field2_get", NULL, NULL);
1749 RNA_def_property_ui_text(prop, "Force Field 2", "");
1752 static void rna_def_particle_target(BlenderRNA *brna)
1757 static EnumPropertyItem mode_items[] = {
1758 {PTARGET_MODE_FRIEND, "FRIEND", 0, "Friend", ""},
1759 {PTARGET_MODE_NEUTRAL, "NEUTRAL", 0, "Neutral", ""},
1760 {PTARGET_MODE_ENEMY, "ENEMY", 0, "Enemy", ""},
1761 {0, NULL, 0, NULL, NULL}
1765 srna = RNA_def_struct(brna, "ParticleTarget", NULL);
1766 RNA_def_struct_ui_text(srna, "Particle Target", "Target particle system.");
1768 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1769 RNA_def_property_string_funcs(prop, "rna_ParticleTarget_name_get", "rna_ParticleTarget_name_length", NULL);
1770 RNA_def_property_ui_text(prop, "Name", "Particle target name.");
1771 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1772 RNA_def_struct_name_property(srna, prop);
1774 prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1775 RNA_def_property_pointer_sdna(prop, NULL, "ob");
1776 RNA_def_property_flag(prop, PROP_EDITABLE);
1777 RNA_def_property_ui_text(prop, "Target Object", "The object that has the target particle system (empty if same object).");
1778 RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
1780 prop= RNA_def_property(srna, "system", PROP_INT, PROP_UNSIGNED);
1781 RNA_def_property_int_sdna(prop, NULL, "psys");
1782 RNA_def_property_range(prop, 1, INT_MAX);
1783 RNA_def_property_ui_text(prop, "Target Particle System", "The index of particle system on the target object.");
1784 RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
1786 prop= RNA_def_property(srna, "time", PROP_FLOAT, PROP_TIME);
1787 RNA_def_property_float_sdna(prop, NULL, "time");
1788 RNA_def_property_range(prop, 0.0, 30000.0f); //TODO: replace 30000 with MAXFRAMEF when available in 2.5
1789 RNA_def_property_ui_text(prop, "Time", "");
1790 RNA_def_property_update(prop, 0, "rna_Particle_target_redo");
1792 prop= RNA_def_property(srna, "duration", PROP_FLOAT, PROP_NONE);
1793 RNA_def_property_float_sdna(prop, NULL, "duration");
1794 RNA_def_property_range(prop, 0.0, 30000.0f); //TODO: replace 30000 with MAXFRAMEF when available in 2.5
1795 RNA_def_property_ui_text(prop, "Duration", "");
1796 RNA_def_property_update(prop, 0, "rna_Particle_target_redo");
1798 prop= RNA_def_property(srna, "valid", PROP_BOOLEAN, PROP_NONE);
1799 RNA_def_property_boolean_sdna(prop, NULL, "flag", PTARGET_VALID);
1800 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
1801 RNA_def_property_ui_text(prop, "Valid", "Keyed particles target is valid.");
1803 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1804 RNA_def_property_enum_items(prop, mode_items);
1805 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
1806 RNA_def_property_ui_text(prop, "Mode", "");
1807 RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
1810 static void rna_def_particle_system(BlenderRNA *brna)
1815 srna= RNA_def_struct(brna, "ParticleSystem", NULL);
1816 RNA_def_struct_ui_text(srna, "Particle System", "Particle system in an object.");
1817 RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
1819 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1820 RNA_def_property_ui_text(prop, "Name", "Particle system name.");
1821 RNA_def_struct_name_property(srna, prop);
1823 /* access to particle settings is redirected through functions */
1824 /* to allow proper id-buttons functionality */
1825 prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
1826 //RNA_def_property_pointer_sdna(prop, NULL, "part");
1827 RNA_def_property_struct_type(prop, "ParticleSettings");
1828 RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_NULL);
1829 RNA_def_property_pointer_funcs(prop, "rna_particle_settings_get", "rna_particle_settings_set", NULL);
1830 RNA_def_property_ui_text(prop, "Settings", "Particle system settings.");
1831 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1833 prop= RNA_def_property(srna, "particles", PROP_COLLECTION, PROP_NONE);
1834 RNA_def_property_collection_sdna(prop, NULL, "particles", "totpart");
1835 RNA_def_property_struct_type(prop, "Particle");
1836 RNA_def_property_ui_text(prop, "Particles", "Particles generated by the particle system.");
1838 prop= RNA_def_property(srna, "child_particles", PROP_COLLECTION, PROP_NONE);
1839 RNA_def_property_collection_sdna(prop, NULL, "child", "totchild");
1840 RNA_def_property_struct_type(prop, "ChildParticle");
1841 RNA_def_property_ui_text(prop, "Child Particles", "Child particles generated by the particle system.");
1843 prop= RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED);
1844 RNA_def_property_ui_text(prop, "Seed", "Offset in the random number table, to get a different randomized result.");
1845 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1848 prop= RNA_def_property(srna, "global_hair", PROP_BOOLEAN, PROP_NONE);
1849 RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_GLOBAL_HAIR);
1850 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1851 RNA_def_property_ui_text(prop, "Global Hair", "Hair keys are in global coordinate space");
1853 prop= RNA_def_property(srna, "hair_dynamics", PROP_BOOLEAN, PROP_NONE);
1854 RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_HAIR_DYNAMICS);
1855 RNA_def_property_ui_text(prop, "Hair Dynamics", "Enable hair dynamics using cloth simulation.");
1856 RNA_def_property_update(prop, 0, "rna_Particle_hair_dynamics");
1858 prop= RNA_def_property(srna, "cloth", PROP_POINTER, PROP_NONE);
1859 RNA_def_property_pointer_sdna(prop, NULL, "clmd");
1860 RNA_def_property_struct_type(prop, "ClothModifier");
1861 RNA_def_property_flag(prop, PROP_NEVER_NULL);
1862 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1863 RNA_def_property_ui_text(prop, "Cloth", "Cloth dynamics for hair");
1866 prop= RNA_def_property(srna, "reactor_target_object", PROP_POINTER, PROP_NONE);
1867 RNA_def_property_pointer_sdna(prop, NULL, "target_ob");
1868 RNA_def_property_flag(prop, PROP_EDITABLE);
1869 RNA_def_property_ui_text(prop, "Reactor Target Object", "For reactor systems, the object that has the target particle system (empty if same object).");
1870 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1872 prop= RNA_def_property(srna, "reactor_target_particle_system", PROP_INT, PROP_UNSIGNED);
1873 RNA_def_property_int_sdna(prop, NULL, "target_psys");
1874 RNA_def_property_range(prop, 1, INT_MAX);
1875 RNA_def_property_ui_text(prop, "Reactor Target Particle System", "For reactor systems, index of particle system on the target object.");
1876 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1879 prop= RNA_def_property(srna, "keyed_timing", PROP_BOOLEAN, PROP_NONE);
1880 RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_KEYED_TIMING);
1881 RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
1882 RNA_def_property_ui_text(prop, "Keyed timing", "Use key times");
1883 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1885 prop= RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
1886 RNA_def_property_struct_type(prop, "ParticleTarget");
1887 RNA_def_property_ui_text(prop, "Targets", "Target particle systems.");
1889 prop= RNA_def_property(srna, "active_particle_target", PROP_POINTER, PROP_NONE);
1890 RNA_def_property_struct_type(prop, "ParticleTarget");
1891 RNA_def_property_pointer_funcs(prop, "rna_ParticleSystem_active_particle_target_get", NULL, NULL);
1892 RNA_def_property_ui_text(prop, "Active Particle Target", "");
1894 prop= RNA_def_property(srna, "active_particle_target_index", PROP_INT, PROP_UNSIGNED);
1895 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");
1896 RNA_def_property_ui_text(prop, "Active Particle Target Index", "");
1900 prop= RNA_def_property(srna, "billboard_normal_uv", PROP_STRING, PROP_NONE);
1901 RNA_def_property_string_sdna(prop, NULL, "bb_uvname[0]");
1902 RNA_def_property_string_maxlength(prop, 32);
1903 RNA_def_property_ui_text(prop, "Billboard Normal UV", "UV Layer to control billboard normals.");
1905 prop= RNA_def_property(srna, "billboard_time_index_uv", PROP_STRING, PROP_NONE);
1906 RNA_def_property_string_sdna(prop, NULL, "bb_uvname[1]");
1907 RNA_def_property_string_maxlength(prop, 32);
1908 RNA_def_property_ui_text(prop, "Billboard Time Index UV", "UV Layer to control billboard time index (X-Y).");
1910 prop= RNA_def_property(srna, "billboard_split_uv", PROP_STRING, PROP_NONE);
1911 RNA_def_property_string_sdna(prop, NULL, "bb_uvname[2]");
1912 RNA_def_property_string_maxlength(prop, 32);
1913 RNA_def_property_ui_text(prop, "Billboard Split UV", "UV Layer to control billboard splitting.");
1916 prop= RNA_def_property(srna, "vertex_group_density", PROP_INT, PROP_NONE);
1917 RNA_def_property_int_sdna(prop, NULL, "vgroup[0]");
1918 RNA_def_property_ui_text(prop, "Vertex Group Density", "Vertex group to control density.");
1919 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1921 prop= RNA_def_property(srna, "vertex_group_density_negate", PROP_BOOLEAN, PROP_NONE);
1922 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_DENSITY));
1923 RNA_def_property_ui_text(prop, "Vertex Group Density Negate", "Negate the effect of the density vertex group.");
1924 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1926 prop= RNA_def_property(srna, "vertex_group_velocity", PROP_INT, PROP_NONE);
1927 RNA_def_property_int_sdna(prop, NULL, "vgroup[1]");
1928 RNA_def_property_ui_text(prop, "Vertex Group Velocity", "Vertex group to control velocity.");
1929 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1931 prop= RNA_def_property(srna, "vertex_group_velocity_negate", PROP_BOOLEAN, PROP_NONE);
1932 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_VEL));
1933 RNA_def_property_ui_text(prop, "Vertex Group Velocity Negate", "Negate the effect of the velocity vertex group.");
1934 RNA_def_property_update(prop, 0, "rna_Particle_reset");
1936 prop= RNA_def_property(srna, "vertex_group_length", PROP_INT, PROP_NONE);
1937 RNA_def_property_int_sdna(prop, NULL, "vgroup[2]");
1938 RNA_def_property_ui_text(prop, "Vertex Group Length", "Vertex group to control length.");
1939 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1941 prop= RNA_def_property(srna, "vertex_group_length_negate", PROP_BOOLEAN, PROP_NONE);
1942 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_LENGTH));
1943 RNA_def_property_ui_text(prop, "Vertex Group Length Negate", "Negate the effect of the length vertex group.");
1944 RNA_def_property_update(prop, 0, "rna_Particle_redo");
1946 prop= RNA_def_property(srna, "vertex_group_clump", PROP_INT, PROP_NONE);
1947 RNA_def_property_int_sdna(prop, NULL, "vgroup[3]");
1948 RNA_def_property_ui_text(prop, "Vertex Group Clump", "Vertex group to control clump.");
1949 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1951 prop= RNA_def_property(srna, "vertex_group_clump_negate", PROP_BOOLEAN, PROP_NONE);
1952 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_CLUMP));
1953 RNA_def_property_ui_text(prop, "Vertex Group Clump Negate", "Negate the effect of the clump vertex group.");
1954 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1956 prop= RNA_def_property(srna, "vertex_group_kink", PROP_INT, PROP_NONE);
1957 RNA_def_property_int_sdna(prop, NULL, "vgroup[4]");
1958 RNA_def_property_ui_text(prop, "Vertex Group Kink", "Vertex group to control kink.");
1959 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1961 prop= RNA_def_property(srna, "vertex_group_kink_negate", PROP_BOOLEAN, PROP_NONE);
1962 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_KINK));
1963 RNA_def_property_ui_text(prop, "Vertex Group Kink Negate", "Negate the effect of the kink vertex group.");
1964 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1966 prop= RNA_def_property(srna, "vertex_group_roughness1", PROP_INT, PROP_NONE);
1967 RNA_def_property_int_sdna(prop, NULL, "vgroup[5]");
1968 RNA_def_property_ui_text(prop, "Vertex Group Roughness 1", "Vertex group to control roughness 1.");
1969 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1971 prop= RNA_def_property(srna, "vertex_group_roughness1_negate", PROP_BOOLEAN, PROP_NONE);
1972 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGH1));
1973 RNA_def_property_ui_text(prop, "Vertex Group Roughness 1 Negate", "Negate the effect of the roughness 1 vertex group.");
1974 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1976 prop= RNA_def_property(srna, "vertex_group_roughness2", PROP_INT, PROP_NONE);
1977 RNA_def_property_int_sdna(prop, NULL, "vgroup[6]");
1978 RNA_def_property_ui_text(prop, "Vertex Group Roughness 2", "Vertex group to control roughness 2.");
1979 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1981 prop= RNA_def_property(srna, "vertex_group_roughness2_negate", PROP_BOOLEAN, PROP_NONE);
1982 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGH2));
1983 RNA_def_property_ui_text(prop, "Vertex Group Roughness 2 Negate", "Negate the effect of the roughness 2 vertex group.");
1984 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1986 prop= RNA_def_property(srna, "vertex_group_roughness_end", PROP_INT, PROP_NONE);
1987 RNA_def_property_int_sdna(prop, NULL, "vgroup[7]");
1988 RNA_def_property_ui_text(prop, "Vertex Group Roughness End", "Vertex group to control roughness end.");
1989 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1991 prop= RNA_def_property(srna, "vertex_group_roughness_end_negate", PROP_BOOLEAN, PROP_NONE);
1992 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGHE));
1993 RNA_def_property_ui_text(prop, "Vertex Group Roughness End Negate", "Negate the effect of the roughness end vertex group.");
1994 RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
1996 prop= RNA_def_property(srna, "vertex_group_size", PROP_INT, PROP_NONE);
1997 RNA_def_property_int_sdna(prop, NULL, "vgroup[8]");
1998 RNA_def_property_ui_text(prop, "Vertex Group Size", "Vertex group to control size.");
1999 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2001 prop= RNA_def_property(srna, "vertex_group_size_negate", PROP_BOOLEAN, PROP_NONE);
2002 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_SIZE));
2003 RNA_def_property_ui_text(prop, "Vertex Group Size Negate", "Negate the effect of the size vertex group.");
2004 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2006 prop= RNA_def_property(srna, "vertex_group_tangent", PROP_INT, PROP_NONE);
2007 RNA_def_property_int_sdna(prop, NULL, "vgroup[9]");
2008 RNA_def_property_ui_text(prop, "Vertex Group Tangent", "Vertex group to control tangent.");
2009 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2011 prop= RNA_def_property(srna, "vertex_group_tangent_negate", PROP_BOOLEAN, PROP_NONE);
2012 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_TAN));
2013 RNA_def_property_ui_text(prop, "Vertex Group Tangent Negate", "Negate the effect of the tangent vertex group.");
2014 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2016 prop= RNA_def_property(srna, "vertex_group_rotation", PROP_INT, PROP_NONE);
2017 RNA_def_property_int_sdna(prop, NULL, "vgroup[10]");
2018 RNA_def_property_ui_text(prop, "Vertex Group Rotation", "Vertex group to control rotation.");
2019 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2021 prop= RNA_def_property(srna, "vertex_group_rotation_negate", PROP_BOOLEAN, PROP_NONE);
2022 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROT));
2023 RNA_def_property_ui_text(prop, "Vertex Group Rotation Negate", "Negate the effect of the rotation vertex group.");
2024 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2026 prop= RNA_def_property(srna, "vertex_group_field", PROP_INT, PROP_NONE);
2027 RNA_def_property_int_sdna(prop, NULL, "vgroup[11]");
2028 RNA_def_property_ui_text(prop, "Vertex Group Field", "Vertex group to control field.");
2029 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2031 prop= RNA_def_property(srna, "vertex_group_field_negate", PROP_BOOLEAN, PROP_NONE);
2032 RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_EFFECTOR));
2033 RNA_def_property_ui_text(prop, "Vertex Group Field Negate", "Negate the effect of the field vertex group.");
2034 RNA_def_property_update(prop, 0, "rna_Particle_reset");
2037 prop= RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
2038 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2039 RNA_def_property_pointer_sdna(prop, NULL, "pointcache");
2040 RNA_def_property_struct_type(prop, "PointCache");
2041 RNA_def_property_ui_text(prop, "Point Cache", "");
2043 prop= RNA_def_property(srna, "multiple_caches", PROP_BOOLEAN, PROP_NONE);
2044 RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_multiple_caches_get", NULL);
2045 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2046 RNA_def_property_ui_text(prop, "Multiple Caches", "Particle system has multiple point caches");
2049 prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
2050 RNA_def_property_pointer_sdna(prop, NULL, "parent");
2051 RNA_def_property_flag(prop, PROP_EDITABLE);
2052 RNA_def_property_ui_text(prop, "Parent", "Use this object's coordinate system instead of global coordinate system.");
2053 RNA_def_property_update(prop, 0, "rna_Particle_redo");
2055 /* hair or cache editing */
2056 prop= RNA_def_property(srna, "editable", PROP_BOOLEAN, PROP_NONE);
2057 RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_editable_get", NULL);
2058 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2059 RNA_def_property_ui_text(prop, "Editable", "Particle system can be edited in particle mode");
2061 prop= RNA_def_property(srna, "edited", PROP_BOOLEAN, PROP_NONE);
2062 RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_edited_get", NULL);
2063 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2064 RNA_def_property_ui_text(prop, "Edited", "Particle system has been edited in particle mode");
2067 void RNA_def_particle(BlenderRNA *brna)
2069 rna_def_particle_target(brna);
2071 rna_def_particle_hair_key(brna);
2072 rna_def_particle_key(brna);
2074 rna_def_child_particle(brna);
2075 rna_def_particle(brna);
2076 rna_def_particle_dupliweight(brna);
2077 rna_def_particle_system(brna);
2078 rna_def_particle_settings(brna);