Blender  V2.59
rna_particle.c
Go to the documentation of this file.
00001 /*
00002  * $Id: rna_particle.c 37760 2011-06-23 18:59:47Z lukastoenne $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * Contributor(s): Blender Foundation (2008).
00021  *
00022  * ***** END GPL LICENSE BLOCK *****
00023  */
00024 
00030 #include <stdio.h>
00031 #include <stdlib.h>
00032 
00033 #include "limits.h"
00034 
00035 #include "RNA_define.h"
00036 
00037 #include "rna_internal.h"
00038 
00039 #include "DNA_material_types.h"
00040 #include "DNA_meshdata_types.h"
00041 #include "DNA_modifier_types.h"
00042 #include "DNA_cloth_types.h"
00043 #include "DNA_particle_types.h"
00044 #include "DNA_object_force.h"
00045 #include "DNA_object_types.h"
00046 #include "DNA_scene_types.h"
00047 #include "DNA_boid_types.h"
00048 #include "DNA_texture_types.h"
00049 
00050 #include "WM_types.h"
00051 #include "WM_api.h"
00052 
00053 EnumPropertyItem part_from_items[] = {
00054         {PART_FROM_VERT, "VERT", 0, "Verts", ""},
00055         {PART_FROM_FACE, "FACE", 0, "Faces", ""},
00056         {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
00057         {0, NULL, 0, NULL, NULL}
00058 };
00059 
00060 EnumPropertyItem part_reactor_from_items[] = {
00061         {PART_FROM_VERT, "VERT", 0, "Verts", ""},
00062         {PART_FROM_FACE, "FACE", 0, "Faces", ""},
00063         {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
00064         {0, NULL, 0, NULL, NULL}
00065 };
00066 
00067 EnumPropertyItem part_dist_items[] = {
00068         {PART_DISTR_JIT, "JIT", 0, "Jittered", ""},
00069         {PART_DISTR_RAND, "RAND", 0, "Random", ""},
00070         {PART_DISTR_GRID, "GRID", 0, "Grid", ""},
00071         {0, NULL, 0, NULL, NULL}
00072 };
00073 
00074 EnumPropertyItem part_hair_dist_items[] = {
00075         {PART_DISTR_JIT, "JIT", 0, "Jittered", ""},
00076         {PART_DISTR_RAND, "RAND", 0, "Random", ""},
00077         {0, NULL, 0, NULL, NULL}
00078 };
00079 
00080 EnumPropertyItem part_draw_as_items[] = {
00081         {PART_DRAW_NOT, "NONE", 0, "None", ""},
00082         {PART_DRAW_REND, "RENDER", 0, "Rendered", ""},
00083         {PART_DRAW_DOT, "DOT", 0, "Point", ""},
00084         {PART_DRAW_CIRC, "CIRC", 0, "Circle", ""},
00085         {PART_DRAW_CROSS, "CROSS", 0, "Cross", ""},
00086         {PART_DRAW_AXIS, "AXIS", 0, "Axis", ""},
00087         {0, NULL, 0, NULL, NULL}
00088 };
00089 
00090 EnumPropertyItem part_hair_draw_as_items[] = {
00091         {PART_DRAW_NOT, "NONE", 0, "None", ""},
00092         {PART_DRAW_REND, "RENDER", 0, "Rendered", ""},
00093         {PART_DRAW_PATH, "PATH", 0, "Path", ""},
00094         {0, NULL, 0, NULL, NULL}
00095 };
00096 
00097 EnumPropertyItem part_ren_as_items[] = {
00098         {PART_DRAW_NOT, "NONE", 0, "None", ""},
00099         {PART_DRAW_HALO, "HALO", 0, "Halo", ""},
00100         {PART_DRAW_LINE, "LINE", 0, "Line", ""},
00101         {PART_DRAW_PATH, "PATH", 0, "Path", ""},
00102         {PART_DRAW_OB, "OBJECT", 0, "Object", ""},
00103         {PART_DRAW_GR, "GROUP", 0, "Group", ""},
00104         {PART_DRAW_BB, "BILLBOARD", 0, "Billboard", ""},
00105         {0, NULL, 0, NULL, NULL}
00106 };
00107 
00108 EnumPropertyItem part_hair_ren_as_items[] = {
00109         {PART_DRAW_NOT, "NONE", 0, "None", ""},
00110         {PART_DRAW_PATH, "PATH", 0, "Path", ""},
00111         {PART_DRAW_OB, "OBJECT", 0, "Object", ""},
00112         {PART_DRAW_GR, "GROUP", 0, "Group", ""},
00113         {0, NULL, 0, NULL, NULL}
00114 };
00115 
00116 #ifdef RNA_RUNTIME
00117 
00118 #include "BLI_math.h"
00119 #include "BLI_listbase.h"
00120 
00121 #include "BKE_context.h"
00122 #include "BKE_cloth.h"
00123 #include "BKE_deform.h"
00124 #include "BKE_depsgraph.h"
00125 #include "BKE_DerivedMesh.h"
00126 #include "BKE_cdderivedmesh.h"
00127 #include "BKE_effect.h"
00128 #include "BKE_modifier.h"
00129 #include "BKE_particle.h"
00130 #include "BKE_pointcache.h"
00131 #include "BKE_texture.h"
00132 
00133 /* use for object space hair get/set */
00134 static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, ParticleSystemModifierData **psmd_pt, ParticleData **pa_pt)
00135 {
00136         HairKey *hkey= (HairKey *)ptr->data;
00137         Object *ob = (Object *)ptr->id.data;
00138         ModifierData *md;
00139         ParticleSystemModifierData *psmd=NULL;
00140         ParticleSystem *psys;
00141         ParticleData *pa;
00142         int i;
00143 
00144         *psmd_pt= NULL;
00145         *pa_pt= NULL;
00146 
00147         /* weak, what about multiple particle systems? */
00148         for (md = ob->modifiers.first; md; md=md->next) {
00149                 if (md->type == eModifierType_ParticleSystem)
00150                         psmd= (ParticleSystemModifierData*) md;
00151         }
00152 
00153         if (!psmd || !psmd->dm || !psmd->psys) {
00154                 return;
00155         }
00156 
00157         psys= psmd->psys;
00158 
00159         /* not a very efficient way of getting hair key location data,
00160          * but it's the best we've got at the present */
00161 
00162         /* find the particle that corresponds with this HairKey */
00163         for(i=0, pa=psys->particles; i<psys->totpart; i++, pa++) {
00164 
00165                 /* hairkeys are stored sequentially in memory, so we can find if
00166                  * it's the same particle by comparing pointers, without having
00167                  * to iterate over them all */
00168                 if ((hkey >= pa->hair) && (hkey < pa->hair + pa->totkey))
00169                         break;
00170         }
00171 
00172         *psmd_pt= psmd;
00173         *pa_pt= pa;
00174 }
00175 
00176 static void rna_ParticleHairKey_location_object_get(PointerRNA *ptr, float *values)
00177 {
00178         HairKey *hkey= (HairKey *)ptr->data;
00179         Object *ob = (Object *)ptr->id.data;
00180         ParticleSystemModifierData *psmd;
00181         ParticleData *pa;
00182 
00183         rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
00184 
00185         if(pa) {
00186                 DerivedMesh *hairdm = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_dm : NULL;
00187 
00188                 if(hairdm) {
00189                         MVert *mvert = CDDM_get_vert(hairdm, pa->hair_index + (hkey - pa->hair));
00190                         copy_v3_v3(values, mvert->co);
00191                 }
00192                 else {
00193                         float hairmat[4][4];
00194                         psys_mat_hair_to_object(ob, psmd->dm, psmd->psys->part->from, pa, hairmat);
00195                         copy_v3_v3(values, hkey->co);
00196                         mul_m4_v3(hairmat, values);
00197                 }
00198         }
00199         else {
00200                 zero_v3(values);
00201         }
00202 }
00203 
00204 static void rna_ParticleHairKey_location_object_set(PointerRNA *ptr, const float *values)
00205 {
00206         HairKey *hkey= (HairKey *)ptr->data;
00207         Object *ob = (Object *)ptr->id.data;
00208         ParticleSystemModifierData *psmd;
00209         ParticleData *pa;
00210 
00211         rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
00212 
00213         if(pa) {
00214                 DerivedMesh *hairdm = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_dm : NULL;
00215 
00216                 if(hairdm) {
00217                         MVert *mvert = CDDM_get_vert(hairdm, pa->hair_index + (hkey - pa->hair));
00218                         copy_v3_v3(mvert->co, values);
00219                 }
00220                 else {
00221                         float hairmat[4][4];
00222                         float imat[4][4];
00223 
00224                         psys_mat_hair_to_object(ob, psmd->dm, psmd->psys->part->from, pa, hairmat);
00225                         invert_m4_m4(imat, hairmat);
00226                         copy_v3_v3(hkey->co, values);
00227                         mul_m4_v3(imat, hkey->co);
00228                 }
00229         }
00230         else {
00231                 zero_v3(hkey->co);
00232         }
00233 }
00234 
00235 /* property update functions */
00236 static void particle_recalc(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr, short flag)
00237 {
00238         if(ptr->type==&RNA_ParticleSystem) {
00239                 ParticleSystem *psys = (ParticleSystem*)ptr->data;
00240                 
00241                 psys->recalc = flag;
00242 
00243                 DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
00244         }
00245         else
00246                 DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA|flag);
00247 
00248         WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL);
00249 }
00250 static void rna_Particle_redo(Main *bmain, Scene *scene, PointerRNA *ptr)
00251 {
00252         particle_recalc(bmain, scene, ptr, PSYS_RECALC_REDO);
00253 }
00254 
00255 static void rna_Particle_redo_dependency(Main *bmain, Scene *scene, PointerRNA *ptr)
00256 {
00257         DAG_scene_sort(bmain, scene);
00258         rna_Particle_redo(bmain, scene, ptr);
00259 }
00260 
00261 static void rna_Particle_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
00262 {
00263         particle_recalc(bmain, scene, ptr, PSYS_RECALC_RESET);
00264 }
00265 
00266 static void rna_Particle_change_type(Main *bmain, Scene *scene, PointerRNA *ptr)
00267 {
00268         particle_recalc(bmain, scene, ptr, PSYS_RECALC_RESET|PSYS_RECALC_TYPE);
00269 }
00270 
00271 static void rna_Particle_change_physics(Main *bmain, Scene *scene, PointerRNA *ptr)
00272 {
00273         particle_recalc(bmain, scene, ptr, PSYS_RECALC_RESET|PSYS_RECALC_PHYS);
00274 }
00275 
00276 static void rna_Particle_redo_child(Main *bmain, Scene *scene, PointerRNA *ptr)
00277 {
00278         particle_recalc(bmain, scene, ptr, PSYS_RECALC_CHILD);
00279 }
00280 
00281 static ParticleSystem *rna_particle_system_for_target(Object *ob, ParticleTarget *target)
00282 {
00283         ParticleSystem *psys;
00284         ParticleTarget *pt;
00285 
00286         for(psys=ob->particlesystem.first; psys; psys=psys->next)
00287                 for(pt=psys->targets.first; pt; pt=pt->next)
00288                         if(pt == target)
00289                                 return psys;
00290         
00291         return NULL;
00292 }
00293 
00294 static void rna_Particle_target_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
00295 {
00296         if(ptr->type==&RNA_ParticleTarget) {
00297                 Object *ob = (Object*)ptr->id.data;
00298                 ParticleTarget *pt = (ParticleTarget*)ptr->data;
00299                 ParticleSystem *kpsys=NULL, *psys=rna_particle_system_for_target(ob, pt);
00300 
00301                 if(pt->ob==ob || pt->ob==NULL) {
00302                         kpsys = BLI_findlink(&ob->particlesystem, pt->psys-1);
00303 
00304                         if(kpsys)
00305                                 pt->flag |= PTARGET_VALID;
00306                         else
00307                                 pt->flag &= ~PTARGET_VALID;
00308                 }
00309                 else {
00310                         if(pt->ob)
00311                                 kpsys = BLI_findlink(&pt->ob->particlesystem, pt->psys-1);
00312 
00313                         if(kpsys)
00314                                 pt->flag |= PTARGET_VALID;
00315                         else
00316                                 pt->flag &= ~PTARGET_VALID;
00317                 }
00318                 
00319                 psys->recalc = PSYS_RECALC_RESET;
00320 
00321                 DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
00322                 DAG_scene_sort(bmain, scene);
00323         }
00324 
00325         WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL);
00326 }
00327 
00328 static void rna_Particle_target_redo(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
00329 {
00330         if(ptr->type==&RNA_ParticleTarget) {
00331                 Object *ob = (Object*)ptr->id.data;
00332                 ParticleTarget *pt = (ParticleTarget*)ptr->data;
00333                 ParticleSystem *psys = rna_particle_system_for_target(ob, pt);
00334                 
00335                 psys->recalc = PSYS_RECALC_REDO;
00336 
00337                 DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
00338                 WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL);
00339         }
00340 }
00341 
00342 static void rna_Particle_hair_dynamics(Main *bmain, Scene *scene, PointerRNA *ptr)
00343 {
00344         Object *ob = (Object*)ptr->id.data;
00345         ParticleSystem *psys = (ParticleSystem*)ptr->data;
00346         
00347         if(psys && !psys->clmd) {
00348                 psys->clmd = (ClothModifierData*)modifier_new(eModifierType_Cloth);
00349                 psys->clmd->sim_parms->goalspring = 0.0f;
00350                 psys->clmd->sim_parms->flags |= CLOTH_SIMSETTINGS_FLAG_GOAL|CLOTH_SIMSETTINGS_FLAG_NO_SPRING_COMPRESS;
00351                 psys->clmd->coll_parms->flags &= ~CLOTH_COLLSETTINGS_FLAG_SELF;
00352                 rna_Particle_redo(bmain, scene, ptr);
00353         }
00354         else
00355                 WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL);
00356 
00357         DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
00358 }
00359 static PointerRNA rna_particle_settings_get(PointerRNA *ptr)
00360 {
00361         ParticleSystem *psys= (ParticleSystem*)ptr->data;
00362         ParticleSettings *part = psys->part;
00363 
00364         return rna_pointer_inherit_refine(ptr, &RNA_ParticleSettings, part);
00365 }
00366 
00367 static void rna_particle_settings_set(PointerRNA *ptr, PointerRNA value)
00368 {
00369         ParticleSystem *psys= (ParticleSystem*)ptr->data;
00370         int old_type = 0;
00371 
00372 
00373         if(psys->part) {
00374                 old_type = psys->part->type;
00375                 psys->part->id.us--;
00376         }
00377 
00378         psys->part = (ParticleSettings *)value.data;
00379 
00380         if(psys->part) {
00381                 psys->part->id.us++;
00382                 psys_check_boid_data(psys);
00383                 if(old_type != psys->part->type)
00384                         psys->recalc |= PSYS_RECALC_TYPE;
00385         }
00386 }
00387 static void rna_Particle_abspathtime_update(Main *bmain, Scene *scene, PointerRNA *ptr)
00388 {
00389         ParticleSettings *settings = (ParticleSettings*)ptr->data;
00390         float delta = settings->end + settings->lifetime - settings->sta;
00391         if(settings->draw & PART_ABS_PATH_TIME) {
00392                 settings->path_start = settings->sta + settings->path_start * delta;
00393                 settings->path_end = settings->sta + settings->path_end * delta;
00394         }
00395         else {
00396                 settings->path_start = (settings->path_start - settings->sta)/delta;
00397                 settings->path_end = (settings->path_end - settings->sta)/delta;
00398         }
00399         rna_Particle_redo(bmain, scene, ptr);
00400 }
00401 static void rna_PartSettings_start_set(struct PointerRNA *ptr, float value)
00402 {
00403         ParticleSettings *settings = (ParticleSettings*)ptr->data;
00404 
00405         /* check for clipping */
00406         if(value > settings->end)
00407                 value = settings->end;
00408 
00409         //if(settings->type==PART_REACTOR && value < 1.0)
00410         //      value = 1.0;
00411         //else 
00412         if (value < MINAFRAMEF)
00413                 value = MINAFRAMEF;
00414 
00415         settings->sta = value;
00416 }
00417 
00418 static void rna_PartSettings_end_set(struct PointerRNA *ptr, float value)
00419 {
00420         ParticleSettings *settings = (ParticleSettings*)ptr->data;
00421 
00422         /* check for clipping */
00423         if(value < settings->sta)
00424                 value = settings->sta;
00425 
00426         settings->end = value;
00427 }
00428 
00429 static void rna_PartSetings_timestep_set(struct PointerRNA *ptr, float value)
00430 {
00431         ParticleSettings *settings = (ParticleSettings*)ptr->data;
00432 
00433         settings->timetweak = value/0.04f;
00434 }
00435 
00436 static float rna_PartSettings_timestep_get(struct PointerRNA *ptr)
00437 {
00438         ParticleSettings *settings = (ParticleSettings*)ptr->data;
00439 
00440         return settings->timetweak * 0.04f;
00441 }
00442 
00443 static void rna_PartSetting_hairlength_set(struct PointerRNA *ptr, float value)
00444 {
00445         ParticleSettings *settings = (ParticleSettings*)ptr->data;
00446         settings->normfac = value / 4.f;
00447 }
00448 
00449 static float rna_PartSetting_hairlength_get(struct PointerRNA *ptr)
00450 {
00451         ParticleSettings *settings = (ParticleSettings*)ptr->data;
00452         return settings->normfac * 4.f;
00453 }
00454 
00455 static void rna_PartSetting_linelentail_set(struct PointerRNA *ptr, float value)
00456 {
00457         ParticleSettings *settings = (ParticleSettings*)ptr->data;
00458         settings->draw_line[0] = value;
00459 }
00460 
00461 static float rna_PartSetting_linelentail_get(struct PointerRNA *ptr)
00462 {
00463         ParticleSettings *settings = (ParticleSettings*)ptr->data;
00464         return settings->draw_line[0];
00465 }
00466 static void rna_PartSetting_pathstartend_range(PointerRNA *ptr, float *min, float *max)
00467 {
00468         ParticleSettings *settings = (ParticleSettings*)ptr->data;
00469 
00470         if(settings->type==PART_HAIR) {
00471                 *min = 0.0f;
00472                 *max = (settings->draw & PART_ABS_PATH_TIME) ? 100.0f : 1.0f;
00473         }
00474         else {
00475                 *min = (settings->draw & PART_ABS_PATH_TIME) ? settings->sta : 0.0f;
00476                 *max= (settings->draw & PART_ABS_PATH_TIME) ? MAXFRAMEF : 1.0f;
00477         }
00478 }
00479 static void rna_PartSetting_linelenhead_set(struct PointerRNA *ptr, float value)
00480 {
00481         ParticleSettings *settings = (ParticleSettings*)ptr->data;
00482         settings->draw_line[1] = value;
00483 }
00484 
00485 static float rna_PartSetting_linelenhead_get(struct PointerRNA *ptr)
00486 {
00487         ParticleSettings *settings = (ParticleSettings*)ptr->data;
00488         return settings->draw_line[1];
00489 }
00490 
00491 
00492 static int rna_PartSettings_is_fluid_get(PointerRNA *ptr)
00493 {
00494         ParticleSettings *part= (ParticleSettings*)ptr->data;
00495 
00496         return part->type == PART_FLUID;
00497 }
00498 
00499 static PointerRNA rna_ParticleSystem_active_particle_target_get(PointerRNA *ptr)
00500 {
00501         ParticleSystem *psys= (ParticleSystem*)ptr->data;
00502         ParticleTarget *pt = psys->targets.first;
00503 
00504         for(; pt; pt=pt->next) {
00505                 if(pt->flag & PTARGET_CURRENT)
00506                         return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, pt);
00507         }
00508         return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, NULL);
00509 }
00510 static void rna_ParticleSystem_active_particle_target_index_range(PointerRNA *ptr, int *min, int *max)
00511 {
00512         ParticleSystem *psys= (ParticleSystem*)ptr->data;
00513         *min= 0;
00514         *max= BLI_countlist(&psys->targets)-1;
00515         *max= MAX2(0, *max);
00516 }
00517 
00518 static int rna_ParticleSystem_active_particle_target_index_get(PointerRNA *ptr)
00519 {
00520         ParticleSystem *psys= (ParticleSystem*)ptr->data;
00521         ParticleTarget *pt = psys->targets.first;
00522         int i=0;
00523 
00524         for(; pt; pt=pt->next, i++)
00525                 if(pt->flag & PTARGET_CURRENT)
00526                         return i;
00527 
00528         return 0;
00529 }
00530 
00531 static void rna_ParticleSystem_active_particle_target_index_set(struct PointerRNA *ptr, int value)
00532 {
00533         ParticleSystem *psys= (ParticleSystem*)ptr->data;
00534         ParticleTarget *pt = psys->targets.first;
00535         int i=0;
00536 
00537         for(; pt; pt=pt->next, i++) {
00538                 if(i==value)
00539                         pt->flag |= PTARGET_CURRENT;
00540                 else
00541                         pt->flag &= ~PTARGET_CURRENT;
00542         }
00543 }
00544 static int rna_ParticleTarget_name_length(PointerRNA *ptr)
00545 {
00546         ParticleTarget *pt= ptr->data;
00547 
00548         if(pt->flag & PTARGET_VALID) {
00549                 ParticleSystem *psys = NULL;
00550 
00551                 if(pt->ob)
00552                         psys = BLI_findlink(&pt->ob->particlesystem, pt->psys-1);
00553                 else {
00554                         Object *ob = (Object*) ptr->id.data;
00555                         psys = BLI_findlink(&ob->particlesystem, pt->psys-1);
00556                 }
00557                 
00558                 if(psys) {
00559                         if(pt->ob)
00560                                 return strlen(pt->ob->id.name+2) + 2 + strlen(psys->name);
00561                         else
00562                                 return strlen(psys->name);
00563                 }
00564                 else
00565                         return 15;
00566         }
00567         else
00568                 return 15;
00569 }
00570 
00571 static void rna_ParticleTarget_name_get(PointerRNA *ptr, char *str)
00572 {
00573         ParticleTarget *pt= ptr->data;
00574 
00575         if(pt->flag & PTARGET_VALID) {
00576                 ParticleSystem *psys = NULL;
00577 
00578                 if(pt->ob)
00579                         psys = BLI_findlink(&pt->ob->particlesystem, pt->psys-1);
00580                 else {
00581                         Object *ob = (Object*) ptr->id.data;
00582                         psys = BLI_findlink(&ob->particlesystem, pt->psys-1);
00583                 }
00584                 
00585                 if(psys) {
00586                         if(pt->ob)
00587                                 sprintf(str, "%s: %s", pt->ob->id.name+2, psys->name);
00588                         else
00589                                 strcpy(str, psys->name);
00590                 }
00591                 else
00592                         strcpy(str, "Invalid target!");
00593         }
00594         else
00595                 strcpy(str, "Invalid target!");
00596 }
00597 
00598 static int particle_id_check(PointerRNA *ptr)
00599 {
00600         ID *id= ptr->id.data;
00601 
00602         return (GS(id->name) == ID_PA);
00603 }
00604 
00605 static char *rna_SPHFluidSettings_path(PointerRNA *ptr)
00606 {
00607         SPHFluidSettings *fluid = (SPHFluidSettings *)ptr->data;
00608         
00609         if(particle_id_check(ptr)) {
00610                 ParticleSettings *part = (ParticleSettings*)ptr->id.data;
00611                 
00612                 if (part->fluid == fluid)
00613                         return BLI_sprintfN("fluid");
00614         }
00615         return NULL;
00616 }
00617 
00618 static int rna_ParticleSystem_multiple_caches_get(PointerRNA *ptr)
00619 {
00620         ParticleSystem *psys= (ParticleSystem*)ptr->data;
00621 
00622         return (psys->ptcaches.first != psys->ptcaches.last);
00623 }
00624 static int rna_ParticleSystem_editable_get(PointerRNA *ptr)
00625 {
00626         ParticleSystem *psys= (ParticleSystem*)ptr->data;
00627 
00628         return psys_check_edited(psys);
00629 }
00630 static int rna_ParticleSystem_edited_get(PointerRNA *ptr)
00631 {
00632         ParticleSystem *psys= (ParticleSystem*)ptr->data;
00633 
00634         if(psys->part && psys->part->type==PART_HAIR)
00635                 return (psys->flag & PSYS_EDITED || (psys->edit && psys->edit->edited));
00636         else
00637                 return (psys->pointcache->edit && psys->pointcache->edit->edited);
00638 }
00639 static PointerRNA rna_ParticleDupliWeight_active_get(PointerRNA *ptr)
00640 {
00641         ParticleSettings *part= (ParticleSettings*)ptr->id.data;
00642         ParticleDupliWeight *dw = part->dupliweights.first;
00643 
00644         for(; dw; dw=dw->next) {
00645                 if(dw->flag & PART_DUPLIW_CURRENT)
00646                         return rna_pointer_inherit_refine(ptr, &RNA_ParticleDupliWeight, dw);
00647         }
00648         return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, NULL);
00649 }
00650 static void rna_ParticleDupliWeight_active_index_range(PointerRNA *ptr, int *min, int *max)
00651 {
00652         ParticleSettings *part= (ParticleSettings*)ptr->id.data;
00653         *min= 0;
00654         *max= BLI_countlist(&part->dupliweights)-1;
00655         *max= MAX2(0, *max);
00656 }
00657 
00658 static int rna_ParticleDupliWeight_active_index_get(PointerRNA *ptr)
00659 {
00660         ParticleSettings *part= (ParticleSettings*)ptr->id.data;
00661         ParticleDupliWeight *dw = part->dupliweights.first;
00662         int i=0;
00663 
00664         for(; dw; dw=dw->next, i++)
00665                 if(dw->flag & PART_DUPLIW_CURRENT)
00666                         return i;
00667 
00668         return 0;
00669 }
00670 
00671 static void rna_ParticleDupliWeight_active_index_set(struct PointerRNA *ptr, int value)
00672 {
00673         ParticleSettings *part= (ParticleSettings*)ptr->id.data;
00674         ParticleDupliWeight *dw = part->dupliweights.first;
00675         int i=0;
00676 
00677         for(; dw; dw=dw->next, i++) {
00678                 if(i==value)
00679                         dw->flag |= PART_DUPLIW_CURRENT;
00680                 else
00681                         dw->flag &= ~PART_DUPLIW_CURRENT;
00682         }
00683 }
00684 
00685 static int rna_ParticleDupliWeight_name_length(PointerRNA *ptr)
00686 {
00687         ParticleDupliWeight *dw= ptr->data;
00688 
00689         if(dw->ob)
00690                 return strlen(dw->ob->id.name+2) + 7;
00691         else
00692                 return 9 + 7;
00693 }
00694 
00695 static void rna_ParticleDupliWeight_name_get(PointerRNA *ptr, char *str)
00696 {
00697         ParticleDupliWeight *dw= ptr->data;
00698 
00699         if(dw->ob)
00700                 sprintf(str, "%s: %i", dw->ob->id.name+2, dw->count);
00701         else
00702                 strcpy(str, "No object");
00703 }
00704 
00705 static EnumPropertyItem *rna_Particle_from_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *UNUSED(free))
00706 {
00707         //if(part->type==PART_REACTOR)
00708         //      return part_reactor_from_items;
00709         //else
00710                 return part_from_items;
00711 }
00712 
00713 static EnumPropertyItem *rna_Particle_dist_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
00714 {
00715         ParticleSettings *part = ptr->id.data;
00716 
00717         if(part->type==PART_HAIR)
00718                 return part_hair_dist_items;
00719         else
00720                 return part_dist_items;
00721 }
00722 
00723 static EnumPropertyItem *rna_Particle_draw_as_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
00724 {
00725         ParticleSettings *part = ptr->id.data;
00726 
00727         if(part->type==PART_HAIR)
00728                 return part_hair_draw_as_items;
00729         else
00730                 return part_draw_as_items;
00731 }
00732 
00733 static EnumPropertyItem *rna_Particle_ren_as_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
00734 {
00735         ParticleSettings *part = ptr->id.data;
00736 
00737         if(part->type==PART_HAIR)
00738                 return part_hair_ren_as_items;
00739         else
00740                 return part_ren_as_items;
00741 }
00742 
00743 static PointerRNA rna_Particle_field1_get(PointerRNA *ptr)
00744 {
00745         ParticleSettings *part= (ParticleSettings*)ptr->id.data;
00746 
00747         /* weak */
00748         if(!part->pd)
00749                 part->pd= object_add_collision_fields(0);
00750         
00751         return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd);
00752 }
00753 
00754 static PointerRNA rna_Particle_field2_get(PointerRNA *ptr)
00755 {
00756         ParticleSettings *part= (ParticleSettings*)ptr->id.data;
00757 
00758         /* weak */
00759         if(!part->pd2)
00760                 part->pd2= object_add_collision_fields(0);
00761         
00762         return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd2);
00763 }
00764 
00765 static void psys_vg_name_get__internal(PointerRNA *ptr, char *value, int index)
00766 {
00767         Object *ob= ptr->id.data;
00768         ParticleSystem *psys= (ParticleSystem*)ptr->data;
00769 
00770         if(psys->vgroup[index] > 0) {
00771                 bDeformGroup *defGroup= BLI_findlink(&ob->defbase, psys->vgroup[index]-1);
00772 
00773                 if(defGroup) {
00774                         strcpy(value, defGroup->name);
00775                         return;
00776                 }
00777         }
00778 
00779         value[0]= '\0';
00780 }
00781 static int psys_vg_name_len__internal(PointerRNA *ptr, int index)
00782 {
00783         Object *ob= ptr->id.data;
00784         ParticleSystem *psys= (ParticleSystem*)ptr->data;
00785 
00786         if(psys->vgroup[index] > 0) {
00787                 bDeformGroup *defGroup= BLI_findlink(&ob->defbase, psys->vgroup[index]-1);
00788 
00789                 if(defGroup) {
00790                         return strlen(defGroup->name);
00791                 }
00792         }
00793         return 0;
00794 }
00795 static void psys_vg_name_set__internal(PointerRNA *ptr, const char *value, int index)
00796 {
00797         Object *ob= ptr->id.data;
00798         ParticleSystem *psys= (ParticleSystem*)ptr->data;
00799 
00800         if(value[0]=='\0') {
00801                 psys->vgroup[index]= 0;
00802         }
00803         else {
00804                 int vgroup_num = defgroup_name_index(ob, (char*)value);
00805 
00806                 if(vgroup_num == -1)
00807                         return;
00808 
00809                 psys->vgroup[index]= vgroup_num + 1;
00810         }
00811 }
00812 
00813 static char *rna_ParticleSystem_path(PointerRNA *ptr)
00814 {
00815         ParticleSystem *psys= (ParticleSystem*)ptr->data;
00816         return BLI_sprintfN("particle_systems[\"%s\"]", psys->name);
00817 }
00818 
00819 static void rna_ParticleSettings_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
00820 {
00821         ParticleSettings *part= (ParticleSettings*)ptr->data;
00822         rna_iterator_array_begin(iter, (void*)part->mtex, sizeof(MTex*), MAX_MTEX, 0, NULL);
00823 }
00824 
00825 static PointerRNA rna_ParticleSettings_active_texture_get(PointerRNA *ptr)
00826 {
00827         ParticleSettings *part= (ParticleSettings*)ptr->data;
00828         Tex *tex;
00829 
00830         tex= give_current_particle_texture(part);
00831         return rna_pointer_inherit_refine(ptr, &RNA_Texture, tex);
00832 }
00833 
00834 static void rna_ParticleSettings_active_texture_set(PointerRNA *ptr, PointerRNA value)
00835 {
00836         ParticleSettings *part= (ParticleSettings*)ptr->data;
00837 
00838         set_current_particle_texture(part, value.data);
00839 }
00840 
00841 /* irritating string functions for each index :/ */
00842 static void rna_ParticleVGroup_name_get_0(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 0); }
00843 static void rna_ParticleVGroup_name_get_1(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 1); }
00844 static void rna_ParticleVGroup_name_get_2(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 2); }
00845 static void rna_ParticleVGroup_name_get_3(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 3); }
00846 static void rna_ParticleVGroup_name_get_4(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 4); }
00847 static void rna_ParticleVGroup_name_get_5(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 5); }
00848 static void rna_ParticleVGroup_name_get_6(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 6); }
00849 static void rna_ParticleVGroup_name_get_7(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 7); }
00850 static void rna_ParticleVGroup_name_get_8(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 8); }
00851 static void rna_ParticleVGroup_name_get_9(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 9); }
00852 static void rna_ParticleVGroup_name_get_10(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 10); }
00853 static void rna_ParticleVGroup_name_get_11(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 11); }
00854 
00855 static int rna_ParticleVGroup_name_len_0(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 0); }
00856 static int rna_ParticleVGroup_name_len_1(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 1); }
00857 static int rna_ParticleVGroup_name_len_2(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 2); }
00858 static int rna_ParticleVGroup_name_len_3(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 3); }
00859 static int rna_ParticleVGroup_name_len_4(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 4); }
00860 static int rna_ParticleVGroup_name_len_5(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 5); }
00861 static int rna_ParticleVGroup_name_len_6(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 6); }
00862 static int rna_ParticleVGroup_name_len_7(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 7); }
00863 static int rna_ParticleVGroup_name_len_8(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 8); }
00864 static int rna_ParticleVGroup_name_len_9(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 9); }
00865 static int rna_ParticleVGroup_name_len_10(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 10); }
00866 static int rna_ParticleVGroup_name_len_11(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 11); }
00867 
00868 static void rna_ParticleVGroup_name_set_0(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 0); }
00869 static void rna_ParticleVGroup_name_set_1(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 1); }
00870 static void rna_ParticleVGroup_name_set_2(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 2); }
00871 static void rna_ParticleVGroup_name_set_3(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 3); }
00872 static void rna_ParticleVGroup_name_set_4(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 4); }
00873 static void rna_ParticleVGroup_name_set_5(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 5); }
00874 static void rna_ParticleVGroup_name_set_6(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 6); }
00875 static void rna_ParticleVGroup_name_set_7(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 7); }
00876 static void rna_ParticleVGroup_name_set_8(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 8); }
00877 static void rna_ParticleVGroup_name_set_9(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 9); }
00878 static void rna_ParticleVGroup_name_set_10(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 10); }
00879 static void rna_ParticleVGroup_name_set_11(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 11); }
00880 
00881 
00882 #else
00883 
00884 static void rna_def_particle_hair_key(BlenderRNA *brna)
00885 {
00886         StructRNA *srna;
00887         PropertyRNA *prop;
00888 
00889         srna = RNA_def_struct(brna, "ParticleHairKey", NULL);
00890         RNA_def_struct_sdna(srna, "HairKey");
00891         RNA_def_struct_ui_text(srna, "Particle Hair Key", "Particle key for hair particle system");
00892 
00893         prop= RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
00894         RNA_def_property_ui_text(prop, "Time", "Relative time of key over hair length");
00895 
00896         prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_UNSIGNED);
00897         RNA_def_property_range(prop, 0.0, 1.0);
00898         RNA_def_property_ui_text(prop, "Weight", "Weight for cloth simulation");
00899 
00900         prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
00901         RNA_def_property_array(prop, 3);
00902         RNA_def_property_ui_text(prop, "Location (Object Space)", "Location of the hair key in object space");
00903         RNA_def_property_float_funcs(prop, "rna_ParticleHairKey_location_object_get", "rna_ParticleHairKey_location_object_set", NULL);
00904         
00905         prop= RNA_def_property(srna, "co_hair_space", PROP_FLOAT, PROP_TRANSLATION);
00906         RNA_def_property_float_sdna(prop, NULL, "co");
00907         RNA_def_property_ui_text(prop, "Location", "Location of the hair key in its internal coordinate system, relative to the emitting face");
00908 }
00909 
00910 static void rna_def_particle_key(BlenderRNA *brna)
00911 {
00912         StructRNA *srna;
00913         PropertyRNA *prop;
00914 
00915         srna = RNA_def_struct(brna, "ParticleKey", NULL);
00916         RNA_def_struct_ui_text(srna, "Particle Key", "Key location for a particle over time");
00917 
00918         prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
00919         RNA_def_property_float_sdna(prop, NULL, "co");
00920         RNA_def_property_ui_text(prop, "Location", "Key location");
00921 
00922         prop= RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
00923         RNA_def_property_float_sdna(prop, NULL, "vel");
00924         RNA_def_property_ui_text(prop, "Velocity", "Key velocity");
00925 
00926         prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
00927         RNA_def_property_float_sdna(prop, NULL, "rot");
00928         RNA_def_property_ui_text(prop, "Rotation", "Key rotation quaternion");
00929 
00930         prop= RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
00931         RNA_def_property_float_sdna(prop, NULL, "ave");
00932         RNA_def_property_ui_text(prop, "Angular Velocity", "Key angular velocity");
00933 
00934         prop= RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
00935         RNA_def_property_ui_text(prop, "Time", "Time of key over the simulation");
00936 }
00937 
00938 static void rna_def_child_particle(BlenderRNA *brna)
00939 {
00940         StructRNA *srna;
00941         //PropertyRNA *prop;
00942 
00943         srna = RNA_def_struct(brna, "ChildParticle", NULL);
00944         RNA_def_struct_ui_text(srna, "Child Particle", "Child particle interpolated from simulated or edited particles");
00945 
00946 //      int num, parent;        /* num is face index on the final derived mesh */
00947 
00948 //      int pa[4];                      /* nearest particles to the child, used for the interpolation */
00949 //      float w[4];                     /* interpolation weights for the above particles */
00950 //      float fuv[4], foffset; /* face vertex weights and offset */
00951 //      float rand[3];
00952 }
00953 
00954 static void rna_def_particle(BlenderRNA *brna)
00955 {
00956         StructRNA *srna;
00957         PropertyRNA *prop;
00958 
00959         static EnumPropertyItem alive_items[] = {
00960                 //{PARS_KILLED, "KILLED", 0, "Killed", ""},
00961                 {PARS_DEAD, "DEAD", 0, "Dead", ""},
00962                 {PARS_UNBORN, "UNBORN", 0, "Unborn", ""},
00963                 {PARS_ALIVE, "ALIVE", 0, "Alive", ""},
00964                 {PARS_DYING, "DYING", 0, "Dying", ""},
00965                 {0, NULL, 0, NULL, NULL}
00966         };
00967 
00968         srna = RNA_def_struct(brna, "Particle", NULL);
00969         RNA_def_struct_sdna(srna, "ParticleData");
00970         RNA_def_struct_ui_text(srna, "Particle", "Particle in a particle system");
00971 
00972         /* Particle State & Previous State */
00973         prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
00974         RNA_def_property_float_sdna(prop, NULL, "state.co");
00975         RNA_def_property_ui_text(prop, "Particle Location", "");
00976 
00977         prop= RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
00978         RNA_def_property_float_sdna(prop, NULL, "state.vel");
00979         RNA_def_property_ui_text(prop, "Particle Velocity", "");
00980 
00981         prop= RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
00982         RNA_def_property_float_sdna(prop, NULL, "state.ave");
00983         RNA_def_property_ui_text(prop, "Angular Velocity", "");
00984 
00985         prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
00986         RNA_def_property_float_sdna(prop, NULL, "state.rot");
00987         RNA_def_property_ui_text(prop, "Rotation", "");
00988 
00989         prop= RNA_def_property(srna, "prev_location", PROP_FLOAT, PROP_TRANSLATION);
00990         RNA_def_property_float_sdna(prop, NULL, "prev_state.co");
00991         RNA_def_property_ui_text(prop, "Previous Particle Location", "");
00992 
00993         prop= RNA_def_property(srna, "prev_velocity", PROP_FLOAT, PROP_VELOCITY);
00994         RNA_def_property_float_sdna(prop, NULL, "prev_state.vel");
00995         RNA_def_property_ui_text(prop, "Previous Particle Velocity", "");
00996 
00997         prop= RNA_def_property(srna, "prev_angular_velocity", PROP_FLOAT, PROP_VELOCITY);
00998         RNA_def_property_float_sdna(prop, NULL, "prev_state.ave");
00999         RNA_def_property_ui_text(prop, "Previous Angular Velocity", "");
01000 
01001         prop= RNA_def_property(srna, "prev_rotation", PROP_FLOAT, PROP_QUATERNION);
01002         RNA_def_property_float_sdna(prop, NULL, "prev_state.rot");
01003         RNA_def_property_ui_text(prop, "Previous Rotation", "");
01004 
01005         /* Hair & Keyed Keys */
01006 
01007         prop= RNA_def_property(srna, "hair_keys", PROP_COLLECTION, PROP_NONE);
01008         RNA_def_property_collection_sdna(prop, NULL, "hair", "totkey");
01009         RNA_def_property_struct_type(prop, "ParticleHairKey");
01010         RNA_def_property_ui_text(prop, "Hair", "");
01011 
01012         prop= RNA_def_property(srna, "particle_keys", PROP_COLLECTION, PROP_NONE);
01013         RNA_def_property_collection_sdna(prop, NULL, "keys", "totkey");
01014         RNA_def_property_struct_type(prop, "ParticleKey");
01015         RNA_def_property_ui_text(prop, "Keyed States", "");
01016 //
01017 //      float fuv[4], foffset;  /* coordinates on face/edge number "num" and depth along*/
01018 //                                                      /* face normal for volume emission                                              */
01019 
01020         prop= RNA_def_property(srna, "birth_time", PROP_FLOAT, PROP_TIME);
01021         RNA_def_property_float_sdna(prop, NULL, "time");
01022 //      RNA_def_property_range(prop, lowerLimitf, upperLimitf);
01023         RNA_def_property_ui_text(prop, "Birth Time", "");
01024 
01025         prop= RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
01026 //      RNA_def_property_range(prop, lowerLimitf, upperLimitf);
01027         RNA_def_property_ui_text(prop, "Lifetime", "");
01028 
01029         prop= RNA_def_property(srna, "die_time", PROP_FLOAT, PROP_TIME);
01030         RNA_def_property_float_sdna(prop, NULL, "dietime");
01031 //      RNA_def_property_range(prop, lowerLimitf, upperLimitf);
01032         RNA_def_property_ui_text(prop, "Die Time", "");
01033 
01034         prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
01035 //      RNA_def_property_range(prop, lowerLimitf, upperLimitf);
01036         RNA_def_property_ui_text(prop, "Size", "");
01037 
01038 //
01039 //      int num;                                /* index to vert/edge/face */
01040 //      int num_dmcache;                /* index to derived mesh data (face) to avoid slow lookups */
01041 //      int pad;
01042 //
01043 //      int totkey;
01044 
01045         /* flag */
01046         prop= RNA_def_property(srna, "is_exist", PROP_BOOLEAN, PROP_NONE);
01047         RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PARS_UNEXIST);
01048         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
01049         RNA_def_property_ui_text(prop, "Exists", "");
01050 
01051         prop= RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE);
01052         RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PARS_NO_DISP);
01053         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
01054         RNA_def_property_ui_text(prop, "Visible", "");
01055 
01056         prop= RNA_def_property(srna, "alive_state", PROP_ENUM, PROP_NONE);
01057         RNA_def_property_enum_sdna(prop, NULL, "alive");
01058         RNA_def_property_enum_items(prop, alive_items);
01059         RNA_def_property_ui_text(prop, "Alive State", "");
01060 
01061 //      short rt2;
01062 }
01063 
01064 static void rna_def_particle_dupliweight(BlenderRNA *brna)
01065 {
01066         StructRNA *srna;
01067         PropertyRNA *prop;
01068 
01069         srna = RNA_def_struct(brna, "ParticleDupliWeight", NULL);
01070         RNA_def_struct_ui_text(srna, "Particle Dupliobject Weight", "Weight of a particle dupliobject in a group");
01071         RNA_def_struct_sdna(srna, "ParticleDupliWeight");
01072 
01073         prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
01074         RNA_def_property_string_funcs(prop, "rna_ParticleDupliWeight_name_get", "rna_ParticleDupliWeight_name_length", NULL);
01075         RNA_def_property_ui_text(prop, "Name", "Particle dupliobject name");
01076         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
01077         RNA_def_struct_name_property(srna, prop);
01078 
01079         prop= RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
01080         RNA_def_property_range(prop, 0, SHRT_MAX);
01081         RNA_def_property_ui_text(prop, "Count", "The number of times this object is repeated with respect to other objects");
01082         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01083 }
01084 
01085 static void rna_def_fluid_settings(BlenderRNA *brna)
01086 {
01087         StructRNA *srna;
01088         PropertyRNA *prop;
01089         
01090         srna = RNA_def_struct(brna, "SPHFluidSettings", NULL);
01091         RNA_def_struct_path_func(srna, "rna_SPHFluidSettings_path");
01092         RNA_def_struct_ui_text(srna, "SPH Fluid Settings", "Settings for particle fluids physics");
01093         
01094         /* Fluid settings */
01095         prop= RNA_def_property(srna, "spring_force", PROP_FLOAT, PROP_NONE);
01096         RNA_def_property_float_sdna(prop, NULL, "spring_k");
01097         RNA_def_property_range(prop, 0.0f, 100.0f);
01098         RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
01099         RNA_def_property_ui_text(prop, "Spring Force", "Spring force");
01100         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01101 
01102         prop= RNA_def_property(srna, "fluid_radius", PROP_FLOAT, PROP_NONE);
01103         RNA_def_property_float_sdna(prop, NULL, "radius");
01104         RNA_def_property_range(prop, 0.0f, 20.0f);
01105         RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
01106         RNA_def_property_ui_text(prop, "Interaction Radius", "Fluid interaction radius");
01107         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01108 
01109         prop= RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_NONE);
01110         RNA_def_property_range(prop, 0.0f, 2.0f);
01111         RNA_def_property_ui_text(prop, "Rest Length", "Spring rest length (factor of particle radius)");
01112         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01113 
01114         prop= RNA_def_property(srna, "use_viscoelastic_springs", PROP_BOOLEAN, PROP_NONE);
01115         RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_VISCOELASTIC_SPRINGS);
01116         RNA_def_property_ui_text(prop, "Viscoelastic Springs", "Use viscoelastic springs instead of Hooke's springs");
01117         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01118 
01119         prop= RNA_def_property(srna, "use_initial_rest_length", PROP_BOOLEAN, PROP_NONE);
01120         RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_CURRENT_REST_LENGTH);
01121         RNA_def_property_ui_text(prop, "Initial Rest Length", "Use the initial length as spring rest length instead of 2 * particle size");
01122         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01123 
01124         prop= RNA_def_property(srna, "plasticity", PROP_FLOAT, PROP_NONE);
01125         RNA_def_property_float_sdna(prop, NULL, "plasticity_constant");
01126         RNA_def_property_range(prop, 0.0f, 100.0f);
01127         RNA_def_property_ui_text(prop, "Plasticity", "How much the spring rest length can change after the elastic limit is crossed");
01128         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01129 
01130         prop= RNA_def_property(srna, "yield_ratio", PROP_FLOAT, PROP_NONE);
01131         RNA_def_property_float_sdna(prop, NULL, "yield_ratio");
01132         RNA_def_property_range(prop, 0.0f, 1.0f);
01133         RNA_def_property_ui_text(prop, "Elastic Limit", "How much the spring has to be stretched/compressed in order to change it's rest length");
01134         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01135 
01136         prop= RNA_def_property(srna, "spring_frames", PROP_INT, PROP_NONE);
01137         RNA_def_property_range(prop, 0.0f, 100.0f);
01138         RNA_def_property_ui_text(prop, "Spring Frames", "Create springs for this number of frames since particles birth (0 is always)");
01139         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01140 
01141         /* Viscosity */
01142         prop= RNA_def_property(srna, "linear_viscosity", PROP_FLOAT, PROP_NONE);
01143         RNA_def_property_float_sdna(prop, NULL, "viscosity_omega");
01144         RNA_def_property_range(prop, 0.0f, 100.0f);
01145         RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
01146         RNA_def_property_ui_text(prop, "Viscosity", "Linear viscosity");
01147         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01148 
01149         prop= RNA_def_property(srna, "stiff_viscosity", PROP_FLOAT, PROP_NONE);
01150         RNA_def_property_float_sdna(prop, NULL, "viscosity_beta");
01151         RNA_def_property_range(prop, 0.0f, 100.0f);
01152         RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
01153         RNA_def_property_ui_text(prop, "Stiff viscosity", "Creates viscosity for expanding fluid)");
01154         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01155 
01156         /* Double density relaxation */
01157         prop= RNA_def_property(srna, "stiffness", PROP_FLOAT, PROP_NONE);
01158         RNA_def_property_float_sdna(prop, NULL, "stiffness_k");
01159         RNA_def_property_range(prop, 0.0f, 100.0f);
01160         RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
01161         RNA_def_property_ui_text(prop, "Stiffness", "How incompressible the fluid is");
01162         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01163 
01164         prop= RNA_def_property(srna, "repulsion", PROP_FLOAT, PROP_NONE);
01165         RNA_def_property_float_sdna(prop, NULL, "stiffness_knear");
01166         RNA_def_property_range(prop, 0.0f, 100.0f);
01167         RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
01168         RNA_def_property_ui_text(prop, "Repulsion Factor", "How strongly the fluid tries to keep from clustering (factor of stiffness)");
01169         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01170 
01171         prop= RNA_def_property(srna, "rest_density", PROP_FLOAT, PROP_NONE);
01172         RNA_def_property_float_sdna(prop, NULL, "rest_density");
01173         RNA_def_property_range(prop, 0.0f, 100.0f);
01174         RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
01175         RNA_def_property_ui_text(prop, "Rest Density", "Fluid rest density");
01176         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01177 
01178         /* Buoyancy */
01179         prop= RNA_def_property(srna, "buoyancy", PROP_FLOAT, PROP_NONE);
01180         RNA_def_property_float_sdna(prop, NULL, "buoyancy");
01181         RNA_def_property_range(prop, 0.0f, 10.0f);
01182         RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3);
01183         RNA_def_property_ui_text(prop, "Buoyancy", "Artificial buoyancy force in negative gravity direction based on pressure differences inside the fluid");
01184         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01185 
01186         /* Factor flags */
01187 
01188         prop= RNA_def_property(srna, "factor_repulsion", PROP_BOOLEAN, PROP_NONE);
01189         RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_REPULSION);
01190         RNA_def_property_ui_text(prop, "Factor Repulsion", "Repulsion is a factor of stiffness");
01191         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01192 
01193         prop= RNA_def_property(srna, "factor_density", PROP_BOOLEAN, PROP_NONE);
01194         RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_DENSITY);
01195         RNA_def_property_ui_text(prop, "Factor Density", "Density is calculated as a factor of default density (depends on particle size)");
01196         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01197 
01198         prop= RNA_def_property(srna, "factor_radius", PROP_BOOLEAN, PROP_NONE);
01199         RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_RADIUS);
01200         RNA_def_property_ui_text(prop, "Factor Radius", "Interaction radius is a factor of 4 * particle size");
01201         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01202 
01203         prop= RNA_def_property(srna, "factor_stiff_viscosity", PROP_BOOLEAN, PROP_NONE);
01204         RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_VISCOSITY);
01205         RNA_def_property_ui_text(prop, "Factor Stiff Viscosity", "Stiff viscosity is a factor of normal viscosity");
01206         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01207 
01208         prop= RNA_def_property(srna, "factor_rest_length", PROP_BOOLEAN, PROP_NONE);
01209         RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_REST_LENGTH);
01210         RNA_def_property_ui_text(prop, "Factor Rest Length", "Spring rest length is a factor of 2 * particle size");
01211         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01212 }
01213 
01214 static void rna_def_particle_settings_mtex(BlenderRNA *brna)
01215 {
01216         StructRNA *srna;
01217         PropertyRNA *prop;
01218 
01219         static EnumPropertyItem texco_items[] = {
01220                 {TEXCO_GLOB, "GLOBAL", 0, "Global", "Uses global coordinates for the texture coordinates"},
01221                 {TEXCO_OBJECT, "OBJECT", 0, "Object", "Uses linked object's coordinates for texture coordinates"},
01222                 {TEXCO_UV, "UV", 0, "UV", "Uses UV coordinates for texture coordinates"},
01223                 {TEXCO_ORCO, "ORCO", 0, "Generated", "Uses the original undeformed coordinates of the object"},
01224                 {TEXCO_STRAND, "STRAND", 0, "Strand / Particle", "Uses normalized strand texture coordinate (1D) or particle age (X) and trail position (Y)"},
01225                 {0, NULL, 0, NULL, NULL}};
01226 
01227         static EnumPropertyItem prop_mapping_items[] = {
01228                 {MTEX_FLAT, "FLAT", 0, "Flat", "Maps X and Y coordinates directly"},
01229                 {MTEX_CUBE, "CUBE", 0, "Cube", "Maps using the normal vector"},
01230                 {MTEX_TUBE, "TUBE", 0, "Tube", "Maps with Z as central axis"},
01231                 {MTEX_SPHERE, "SPHERE", 0, "Sphere", "Maps with Z as central axis"},
01232                 {0, NULL, 0, NULL, NULL}};
01233                 
01234         static EnumPropertyItem prop_x_mapping_items[] = {
01235                 {0, "NONE", 0, "None", ""},
01236                 {1, "X", 0, "X", ""},
01237                 {2, "Y", 0, "Y", ""},
01238                 {3, "Z", 0, "Z", ""},
01239                 {0, NULL, 0, NULL, NULL}};
01240                 
01241         static EnumPropertyItem prop_y_mapping_items[] = {
01242                 {0, "NONE", 0, "None", ""},
01243                 {1, "X", 0, "X", ""},
01244                 {2, "Y", 0, "Y", ""},
01245                 {3, "Z", 0, "Z", ""},
01246                 {0, NULL, 0, NULL, NULL}};
01247                 
01248         static EnumPropertyItem prop_z_mapping_items[] = {
01249                 {0, "NONE", 0, "None", ""},
01250                 {1, "X", 0, "X", ""},
01251                 {2, "Y", 0, "Y", ""},
01252                 {3, "Z", 0, "Z", ""},
01253                 {0, NULL, 0, NULL, NULL}};
01254 
01255         srna= RNA_def_struct(brna, "ParticleSettingsTextureSlot", "TextureSlot");
01256         RNA_def_struct_sdna(srna, "MTex");
01257         RNA_def_struct_ui_text(srna, "Particle Settings Texture Slot", "Texture slot for textures in a Particle Settings datablock");
01258 
01259         prop= RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
01260         RNA_def_property_enum_sdna(prop, NULL, "texco");
01261         RNA_def_property_enum_items(prop, texco_items);
01262         RNA_def_property_ui_text(prop, "Texture Coordinates", "Texture coordinates used to map the texture onto the background");
01263         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01264 
01265         prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
01266         RNA_def_property_pointer_sdna(prop, NULL, "object");
01267         RNA_def_property_struct_type(prop, "Object");
01268         RNA_def_property_flag(prop, PROP_EDITABLE);
01269         RNA_def_property_ui_text(prop, "Object", "Object to use for mapping with Object texture coordinates");
01270         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01271 
01272         prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
01273         RNA_def_property_string_sdna(prop, NULL, "uvname");
01274         RNA_def_property_ui_text(prop, "UV Layer", "UV layer to use for mapping with UV texture coordinates");
01275         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01276 
01277         prop= RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE);
01278         RNA_def_property_enum_sdna(prop, NULL, "projx");
01279         RNA_def_property_enum_items(prop, prop_x_mapping_items);
01280         RNA_def_property_ui_text(prop, "X Mapping", "");
01281         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01282         
01283         prop= RNA_def_property(srna, "mapping_y", PROP_ENUM, PROP_NONE);
01284         RNA_def_property_enum_sdna(prop, NULL, "projy");
01285         RNA_def_property_enum_items(prop, prop_y_mapping_items);
01286         RNA_def_property_ui_text(prop, "Y Mapping", "");
01287         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01288         
01289         prop= RNA_def_property(srna, "mapping_z", PROP_ENUM, PROP_NONE);
01290         RNA_def_property_enum_sdna(prop, NULL, "projz");
01291         RNA_def_property_enum_items(prop, prop_z_mapping_items);
01292         RNA_def_property_ui_text(prop, "Z Mapping", "");
01293         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01294         
01295         prop= RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
01296         RNA_def_property_enum_items(prop, prop_mapping_items);
01297         RNA_def_property_ui_text(prop, "Mapping", "");
01298         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01299 
01300         /* map to */
01301         prop= RNA_def_property(srna, "use_map_time", PROP_BOOLEAN, PROP_NONE);
01302         RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_TIME);
01303         RNA_def_property_ui_text(prop, "Emission Time", "Affect the emission time of the particles");
01304         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01305 
01306         prop= RNA_def_property(srna, "use_map_life", PROP_BOOLEAN, PROP_NONE);
01307         RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_LIFE);
01308         RNA_def_property_ui_text(prop, "Life Time", "Affect the life time of the particles");
01309         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01310 
01311         prop= RNA_def_property(srna, "use_map_density", PROP_BOOLEAN, PROP_NONE);
01312         RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_DENS);
01313         RNA_def_property_ui_text(prop, "Density", "Affect the density of the particles");
01314         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01315 
01316         prop= RNA_def_property(srna, "use_map_size", PROP_BOOLEAN, PROP_NONE);
01317         RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_SIZE);
01318         RNA_def_property_ui_text(prop, "Size", "Affect the particle size");
01319         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01320 
01321         prop= RNA_def_property(srna, "use_map_velocity", PROP_BOOLEAN, PROP_NONE);
01322         RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_IVEL);
01323         RNA_def_property_ui_text(prop, "Initial Velocity", "Affect the particle initial velocity");
01324         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01325 
01326         prop= RNA_def_property(srna, "use_map_field", PROP_BOOLEAN, PROP_NONE);
01327         RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_FIELD);
01328         RNA_def_property_ui_text(prop, "Force Field", "Affect the particle force fields");
01329         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01330 
01331         prop= RNA_def_property(srna, "use_map_gravity", PROP_BOOLEAN, PROP_NONE);
01332         RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_GRAVITY);
01333         RNA_def_property_ui_text(prop, "Gravity", "Affect the particle gravity");
01334         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01335 
01336         prop= RNA_def_property(srna, "use_map_damp", PROP_BOOLEAN, PROP_NONE);
01337         RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_DAMP);
01338         RNA_def_property_ui_text(prop, "Damp", "Affect the particle velocity damping");
01339         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
01340 
01341         prop= RNA_def_property(srna, "use_map_clump", PROP_BOOLEAN, PROP_NONE);
01342         RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_CLUMP);
01343         RNA_def_property_ui_text(prop, "Clump", "Affect the child clumping");
01344         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01345 
01346         prop= RNA_def_property(srna, "use_map_kink", PROP_BOOLEAN, PROP_NONE);
01347         RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_KINK);
01348         RNA_def_property_ui_text(prop, "Kink", "Affect the child kink");
01349         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
01350 
01351         prop= RNA_def_property(srna, "use_map_rough", PROP_BOOLEAN, PROP_NONE);
01352         RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_ROUGH);
01353         RNA_def_property_ui_text(prop, "Rough", "Affect the child rough");
01354         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
01355 
01356         prop= RNA_def_property(srna, "use_map_length", PROP_BOOLEAN, PROP_NONE);
01357         RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_LENGTH);
01358         RNA_def_property_ui_text(prop, "Length", "Affect the child hair length");
01359         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
01360 
01361 
01362         /* influence factors */
01363         prop= RNA_def_property(srna, "time_factor", PROP_FLOAT, PROP_NONE);
01364         RNA_def_property_float_sdna(prop, NULL, "timefac");
01365         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
01366         RNA_def_property_ui_text(prop, "Emission Time Factor", "Amount texture affects particle emission time");
01367         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01368 
01369         prop= RNA_def_property(srna, "life_factor", PROP_FLOAT, PROP_NONE);
01370         RNA_def_property_float_sdna(prop, NULL, "lifefac");
01371         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
01372         RNA_def_property_ui_text(prop, "Life Time Factor", "Amount texture affects particle life time");
01373         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01374 
01375         prop= RNA_def_property(srna, "density_factor", PROP_FLOAT, PROP_NONE);
01376         RNA_def_property_float_sdna(prop, NULL, "padensfac");
01377         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
01378         RNA_def_property_ui_text(prop, "Density Factor", "Amount texture affects particle density");
01379         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01380 
01381         prop= RNA_def_property(srna, "size_factor", PROP_FLOAT, PROP_NONE);
01382         RNA_def_property_float_sdna(prop, NULL, "sizefac");
01383         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
01384         RNA_def_property_ui_text(prop, "Size Factor", "Amount texture affects physical particle size");
01385         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01386 
01387         prop= RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE);
01388         RNA_def_property_float_sdna(prop, NULL, "ivelfac");
01389         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
01390         RNA_def_property_ui_text(prop, "Velocity Factor", "Amount texture affects particle initial velocity");
01391         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01392 
01393 
01394         prop= RNA_def_property(srna, "field_factor", PROP_FLOAT, PROP_NONE);
01395         RNA_def_property_float_sdna(prop, NULL, "fieldfac");
01396         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
01397         RNA_def_property_ui_text(prop, "Field Factor", "Amount texture affects particle force fields");
01398         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01399 
01400         prop= RNA_def_property(srna, "gravity_factor", PROP_FLOAT, PROP_NONE);
01401         RNA_def_property_float_sdna(prop, NULL, "gravityfac");
01402         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
01403         RNA_def_property_ui_text(prop, "Gravity Factor", "Amount texture affects particle gravity");
01404         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01405 
01406         prop= RNA_def_property(srna, "damp_factor", PROP_FLOAT, PROP_NONE);
01407         RNA_def_property_float_sdna(prop, NULL, "dampfac");
01408         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
01409         RNA_def_property_ui_text(prop, "Damp Factor", "Amount texture affects particle damping");
01410         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01411 
01412 
01413         prop= RNA_def_property(srna, "length_factor", PROP_FLOAT, PROP_NONE);
01414         RNA_def_property_float_sdna(prop, NULL, "lengthfac");
01415         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
01416         RNA_def_property_ui_text(prop, "Length Factor", "Amount texture affects child hair length");
01417         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
01418 
01419         prop= RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
01420         RNA_def_property_float_sdna(prop, NULL, "clumpfac");
01421         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
01422         RNA_def_property_ui_text(prop, "Clump Factor", "Amount texture affects child clump");
01423         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
01424 
01425         prop= RNA_def_property(srna, "kink_factor", PROP_FLOAT, PROP_NONE);
01426         RNA_def_property_float_sdna(prop, NULL, "kinkfac");
01427         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
01428         RNA_def_property_ui_text(prop, "Kink Factor", "Amount texture affects child kink");
01429         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
01430 
01431         prop= RNA_def_property(srna, "rough_factor", PROP_FLOAT, PROP_NONE);
01432         RNA_def_property_float_sdna(prop, NULL, "roughfac");
01433         RNA_def_property_ui_range(prop, 0, 1, 10, 3);
01434         RNA_def_property_ui_text(prop, "Rough Factor", "Amount texture affects child roughness");
01435         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
01436 }
01437 
01438 static void rna_def_particle_settings(BlenderRNA *brna)
01439 {
01440         StructRNA *srna;
01441         PropertyRNA *prop;
01442 
01443         static EnumPropertyItem type_items[] = {
01444                 {PART_EMITTER, "EMITTER", 0, "Emitter", ""},
01445                 //{PART_REACTOR, "REACTOR", 0, "Reactor", ""},
01446                 {PART_HAIR, "HAIR", 0, "Hair", ""},
01447                 {0, NULL, 0, NULL, NULL}
01448         };
01449 
01450         static EnumPropertyItem phys_type_items[] = {
01451                 {PART_PHYS_NO, "NO", 0, "No", ""},
01452                 {PART_PHYS_NEWTON, "NEWTON", 0, "Newtonian", ""},
01453                 {PART_PHYS_KEYED, "KEYED", 0, "Keyed", ""},
01454                 {PART_PHYS_BOIDS, "BOIDS", 0, "Boids", ""},
01455                 {PART_PHYS_FLUID, "FLUID", 0, "Fluid", ""},
01456                 {0, NULL, 0, NULL, NULL}
01457         };
01458 
01459         static EnumPropertyItem rot_mode_items[] = {
01460                 {0, "NONE", 0, "None", ""},
01461                 {PART_ROT_NOR, "NOR", 0, "Normal", ""},
01462                 {PART_ROT_VEL, "VEL", 0, "Velocity", ""},
01463                 {PART_ROT_GLOB_X, "GLOB_X", 0, "Global X", ""},
01464                 {PART_ROT_GLOB_Y, "GLOB_Y", 0, "Global Y", ""},
01465                 {PART_ROT_GLOB_Z, "GLOB_Z", 0, "Global Z", ""},
01466                 {PART_ROT_OB_X, "OB_X", 0, "Object X", ""},
01467                 {PART_ROT_OB_Y, "OB_Y", 0, "Object Y", ""},
01468                 {PART_ROT_OB_Z, "OB_Z", 0, "Object Z", ""},
01469                 {0, NULL, 0, NULL, NULL}
01470         };
01471 
01472         static EnumPropertyItem ave_mode_items[] = {
01473                 {0, "NONE", 0, "None", ""},
01474                 {PART_AVE_SPIN, "SPIN", 0, "Spin", ""},
01475                 {PART_AVE_RAND, "RAND", 0, "Random", ""} ,
01476                 {0, NULL, 0, NULL, NULL}
01477         };
01478 
01479         static EnumPropertyItem react_event_items[] = {
01480                 {PART_EVENT_DEATH, "DEATH", 0, "Death", ""},
01481                 {PART_EVENT_COLLIDE, "COLLIDE", 0, "Collision", ""},
01482                 {PART_EVENT_NEAR, "NEAR", 0, "Near", ""},
01483                 {0, NULL, 0, NULL, NULL}
01484         };
01485 
01486         static EnumPropertyItem child_type_items[] = {
01487                 {0, "NONE", 0, "None", ""},
01488                 {PART_CHILD_PARTICLES, "SIMPLE", 0, "Simple", ""},
01489                 {PART_CHILD_FACES, "INTERPOLATED", 0, "Interpolated", ""},
01490                 {0, NULL, 0, NULL, NULL}
01491         };
01492 
01493         //TODO: names, tooltips
01494 #if 0
01495         static EnumPropertyItem rot_from_items[] = {
01496                 {PART_ROT_KEYS, "KEYS", 0, "keys", ""},
01497                 {PART_ROT_ZINCR, "ZINCR", 0, "zincr", ""},
01498                 {PART_ROT_IINCR, "IINCR", 0, "iincr", ""},
01499                 {0, NULL, 0, NULL, NULL}
01500         };
01501 #endif
01502         static EnumPropertyItem integrator_type_items[] = {
01503                 {PART_INT_EULER, "EULER", 0, "Euler", ""},
01504                 {PART_INT_VERLET, "VERLET", 0, "Verlet", ""},
01505                 {PART_INT_MIDPOINT, "MIDPOINT", 0, "Midpoint", ""},
01506                 {PART_INT_RK4, "RK4", 0, "RK4", ""},
01507                 {0, NULL, 0, NULL, NULL}
01508         };
01509 
01510         static EnumPropertyItem kink_type_items[] = {
01511                 {PART_KINK_NO, "NO", 0, "Nothing", ""},
01512                 {PART_KINK_CURL, "CURL", 0, "Curl", ""},
01513                 {PART_KINK_RADIAL, "RADIAL", 0, "Radial", ""},
01514                 {PART_KINK_WAVE, "WAVE", 0, "Wave", ""},
01515                 {PART_KINK_BRAID, "BRAID", 0, "Braid", ""},
01516                 {0, NULL, 0, NULL, NULL}
01517         };
01518 
01519         static EnumPropertyItem kink_axis_items[] = {
01520                 {0, "X", 0, "X", ""},
01521                 {1, "Y", 0, "Y", ""},
01522                 {2, "Z", 0, "Z", ""},
01523                 {0, NULL, 0, NULL, NULL}
01524         };
01525 
01526         static EnumPropertyItem bb_align_items[] = {
01527                 {PART_BB_X, "X", 0, "X", ""},
01528                 {PART_BB_Y, "Y", 0, "Y", ""},
01529                 {PART_BB_Z, "Z", 0, "Z", ""},
01530                 {PART_BB_VIEW, "VIEW", 0, "View", ""},
01531                 {PART_BB_VEL, "VEL", 0, "Velocity", ""},
01532                 {0, NULL, 0, NULL, NULL}
01533         };
01534 
01535         static EnumPropertyItem bb_anim_items[] = {
01536                 {PART_BB_ANIM_NONE, "NONE", 0, "None", ""},
01537                 {PART_BB_ANIM_AGE, "AGE", 0, "Age", ""},
01538                 {PART_BB_ANIM_FRAME, "FRAME", 0, "Frame", ""},
01539                 {PART_BB_ANIM_ANGLE, "ANGLE", 0, "Angle", ""},
01540                 {0, NULL, 0, NULL, NULL}
01541         };
01542 
01543         static EnumPropertyItem bb_split_offset_items[] = {
01544                 {PART_BB_OFF_NONE, "NONE", 0, "None", ""},
01545                 {PART_BB_OFF_LINEAR, "LINEAR", 0, "Linear", ""},
01546                 {PART_BB_OFF_RANDOM, "RANDOM", 0, "Random", ""},
01547                 {0, NULL, 0, NULL, NULL}
01548         };
01549 
01550         static EnumPropertyItem draw_col_items[] = {
01551                 {PART_DRAW_COL_NONE, "NONE", 0, "None", ""},
01552                 {PART_DRAW_COL_MAT, "MATERIAL", 0, "Material", ""},
01553                 {PART_DRAW_COL_VEL, "VELOCITY", 0, "Velocity", ""},
01554                 {PART_DRAW_COL_ACC, "ACCELERATION", 0, "Acceleration", ""},
01555                 {0, NULL, 0, NULL, NULL}
01556         };
01557 
01558         srna= RNA_def_struct(brna, "ParticleSettings", "ID");
01559         RNA_def_struct_ui_text(srna, "Particle Settings", "Particle settings, reusable by multiple particle systems");
01560         RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
01561 
01562         rna_def_mtex_common(brna, srna, "rna_ParticleSettings_mtex_begin", "rna_ParticleSettings_active_texture_get",
01563                 "rna_ParticleSettings_active_texture_set", NULL, "ParticleSettingsTextureSlot", "ParticleSettingsTextureSlots", "rna_Particle_reset");
01564 
01565         /* fluid particle type can't be checked from the type value in rna as it's not shown in the menu */
01566         prop= RNA_def_property(srna, "is_fluid", PROP_BOOLEAN, PROP_NONE);
01567         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
01568         RNA_def_property_boolean_funcs(prop, "rna_PartSettings_is_fluid_get", NULL);
01569         RNA_def_property_ui_text(prop, "Fluid", "Particles were created by a fluid simulation");
01570 
01571         /* flag */
01572         prop= RNA_def_property(srna, "use_react_start_end", PROP_BOOLEAN, PROP_NONE);
01573         RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_STA_END);
01574         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01575         RNA_def_property_ui_text(prop, "Start/End", "Give birth to unreacted particles eventually");
01576         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01577 
01578         prop= RNA_def_property(srna, "use_react_multiple", PROP_BOOLEAN, PROP_NONE);
01579         RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_MULTIPLE);
01580         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01581         RNA_def_property_ui_text(prop, "Multi React", "React multiple times");
01582         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01583 
01584         prop= RNA_def_property(srna, "regrow_hair", PROP_BOOLEAN, PROP_NONE);
01585         RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_REGROW);
01586         RNA_def_property_ui_text(prop, "Regrow", "Regrow hair for each frame");
01587         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01588 
01589         prop= RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
01590         RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_UNBORN);
01591         RNA_def_property_ui_text(prop, "Unborn", "Show particles before they are emitted");
01592         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01593 
01594         prop= RNA_def_property(srna, "use_dead", PROP_BOOLEAN, PROP_NONE);
01595         RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_DIED);
01596         RNA_def_property_ui_text(prop, "Died", "Show particles after they have died");
01597         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01598 
01599         prop= RNA_def_property(srna, "use_emit_random", PROP_BOOLEAN, PROP_NONE);
01600         RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_TRAND);
01601         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01602         RNA_def_property_ui_text(prop, "Random", "Emit in random order of elements");
01603         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01604 
01605         prop= RNA_def_property(srna, "use_even_distribution", PROP_BOOLEAN, PROP_NONE);
01606         RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_EDISTR);
01607         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01608         RNA_def_property_ui_text(prop, "Even Distribution", "Use even distribution from faces based on face areas or edge lengths");
01609         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01610  
01611         prop= RNA_def_property(srna, "use_die_on_collision", PROP_BOOLEAN, PROP_NONE);
01612         RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_DIE_ON_COL);
01613         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01614         RNA_def_property_ui_text(prop, "Die on hit", "Particles die when they collide with a deflector object");
01615         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01616 
01617         prop= RNA_def_property(srna, "use_size_deflect", PROP_BOOLEAN, PROP_NONE);
01618         RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SIZE_DEFL);
01619         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01620         RNA_def_property_ui_text(prop, "Size Deflect", "Use particle's size in deflection");
01621         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01622 
01623         prop= RNA_def_property(srna, "use_dynamic_rotation", PROP_BOOLEAN, PROP_NONE);
01624         RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ROT_DYN);
01625         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01626         RNA_def_property_ui_text(prop, "Dynamic", "Sets rotation to dynamic/constant");
01627         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01628 
01629         prop= RNA_def_property(srna, "use_multiply_size_mass", PROP_BOOLEAN, PROP_NONE);
01630         RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SIZEMASS);
01631         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01632         RNA_def_property_ui_text(prop, "Mass from Size", "Multiply mass by particle size");
01633         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01634 
01635         prop= RNA_def_property(srna, "use_advanced_hair", PROP_BOOLEAN, PROP_NONE);
01636         RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PART_HIDE_ADVANCED_HAIR);
01637         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01638         RNA_def_property_ui_text(prop, "Advanced", "Use full physics calculations for growing hair");
01639         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01640 
01641         prop= RNA_def_property(srna, "lock_boids_to_surface", PROP_BOOLEAN, PROP_NONE);
01642         RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_BOIDS_2D);
01643         RNA_def_property_ui_text(prop, "Boids 2D", "Constrain boids to a surface");
01644         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01645 
01646         prop= RNA_def_property(srna, "use_hair_bspline", PROP_BOOLEAN, PROP_NONE);
01647         RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_BSPLINE);
01648         RNA_def_property_ui_text(prop, "B-Spline", "Interpolate hair using B-Splines");
01649         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01650 
01651         prop= RNA_def_property(srna, "invert_grid", PROP_BOOLEAN, PROP_NONE);
01652         RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GRID_INVERT);
01653         RNA_def_property_ui_text(prop, "Invert Grid", "Invert what is considered object and what is not");
01654         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01655 
01656         prop= RNA_def_property(srna, "hexagonal_grid", PROP_BOOLEAN, PROP_NONE);
01657         RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GRID_HEXAGONAL);
01658         RNA_def_property_ui_text(prop, "Hexagonal Grid", "Create the grid in a hexagonal pattern");
01659         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01660 
01661         prop= RNA_def_property(srna, "apply_effector_to_children", PROP_BOOLEAN, PROP_NONE);
01662         RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_EFFECT);
01663         RNA_def_property_ui_text(prop, "Effect Children", "Apply effectors to children");
01664         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01665 
01666         prop= RNA_def_property(srna, "create_long_hair_children", PROP_BOOLEAN, PROP_NONE);
01667         RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_LONG_HAIR);
01668         RNA_def_property_ui_text(prop, "Long Hair", "Calculate children that suit long hair well");
01669         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
01670 
01671         prop= RNA_def_property(srna, "apply_guide_to_children", PROP_BOOLEAN, PROP_NONE);
01672         RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_GUIDE);
01673         RNA_def_property_ui_text(prop, "apply_guide_to_children", "");
01674         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01675 
01676         prop= RNA_def_property(srna, "use_self_effect", PROP_BOOLEAN, PROP_NONE);
01677         RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SELF_EFFECT);
01678         RNA_def_property_ui_text(prop, "Self Effect", "Particle effectors effect themselves");
01679         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01680 
01681 
01682         prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
01683         RNA_def_property_enum_items(prop, type_items);
01684         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01685         RNA_def_property_ui_text(prop, "Type", "Particle Type");
01686         RNA_def_property_update(prop, 0, "rna_Particle_change_type");
01687 
01688         prop= RNA_def_property(srna, "emit_from", PROP_ENUM, PROP_NONE);
01689         RNA_def_property_enum_sdna(prop, NULL, "from");
01690         RNA_def_property_enum_items(prop, part_reactor_from_items);
01691         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01692         RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_from_itemf");
01693         RNA_def_property_ui_text(prop, "Emit From", "Where to emit particles from");
01694         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01695 
01696         prop= RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
01697         RNA_def_property_enum_sdna(prop, NULL, "distr");
01698         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01699         RNA_def_property_enum_items(prop, part_dist_items);
01700         RNA_def_property_enum_items(prop, part_draw_as_items);
01701         RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_dist_itemf");
01702         RNA_def_property_ui_text(prop, "Distribution", "How to distribute particles on selected element");
01703         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01704 
01705         /* physics modes */
01706         prop= RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
01707         RNA_def_property_enum_sdna(prop, NULL, "phystype");
01708         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01709         RNA_def_property_enum_items(prop, phys_type_items);
01710         RNA_def_property_ui_text(prop, "Physics Type", "Particle physics type");
01711         RNA_def_property_update(prop, 0, "rna_Particle_change_physics");
01712 
01713         prop= RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
01714         RNA_def_property_enum_sdna(prop, NULL, "rotmode");
01715         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01716         RNA_def_property_enum_items(prop, rot_mode_items);
01717         RNA_def_property_ui_text(prop, "Rotation", "Particles initial rotation");
01718         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01719 
01720         prop= RNA_def_property(srna, "angular_velocity_mode", PROP_ENUM, PROP_NONE);
01721         RNA_def_property_enum_sdna(prop, NULL, "avemode");
01722         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01723         RNA_def_property_enum_items(prop, ave_mode_items);
01724         RNA_def_property_ui_text(prop, "Angular Velocity Mode", "Particle angular velocity mode");
01725         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01726 
01727         prop= RNA_def_property(srna, "react_event", PROP_ENUM, PROP_NONE);
01728         RNA_def_property_enum_sdna(prop, NULL, "reactevent");
01729         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01730         RNA_def_property_enum_items(prop, react_event_items);
01731         RNA_def_property_ui_text(prop, "React On", "The event of target particles to react on");
01732         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01733 
01734         /*draw flag*/
01735         prop= RNA_def_property(srna, "show_velocity", PROP_BOOLEAN, PROP_NONE);
01736         RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL);
01737         RNA_def_property_ui_text(prop, "Velocity", "Show particle velocity");
01738         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01739 
01740         prop= RNA_def_property(srna, "show_size", PROP_BOOLEAN, PROP_NONE);
01741         RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_SIZE);
01742         RNA_def_property_ui_text(prop, "Size", "Show particle size");
01743         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01744 
01745         prop= RNA_def_property(srna, "use_render_emitter", PROP_BOOLEAN, PROP_NONE);
01746         RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_EMITTER);
01747         RNA_def_property_ui_text(prop, "Emitter", "Render emitter Object also");
01748         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01749 
01750         prop= RNA_def_property(srna, "show_health", PROP_BOOLEAN, PROP_NONE);
01751         RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_HEALTH);
01752         RNA_def_property_ui_text(prop, "Health", "Draw boid health");
01753         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01754 
01755         prop= RNA_def_property(srna, "use_absolute_path_time", PROP_BOOLEAN, PROP_NONE);
01756         RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_ABS_PATH_TIME);
01757         RNA_def_property_ui_text(prop, "Absolute Path Time", "Path timing is in absolute frames");
01758         RNA_def_property_update(prop, 0, "rna_Particle_abspathtime_update");
01759 
01760         prop= RNA_def_property(srna, "use_parent_particles", PROP_BOOLEAN, PROP_NONE);
01761         RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_PARENT);
01762         RNA_def_property_ui_text(prop, "Parents", "Render parent particles");
01763         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01764 
01765         prop= RNA_def_property(srna, "show_number", PROP_BOOLEAN, PROP_NONE);
01766         RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_NUM);
01767         RNA_def_property_ui_text(prop, "Number", "Show particle number");
01768         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01769 
01770         prop= RNA_def_property(srna, "use_group_pick_random", PROP_BOOLEAN, PROP_NONE);
01771         RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_RAND_GR);
01772         RNA_def_property_ui_text(prop, "Pick Random", "Pick objects from group randomly");
01773         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01774 
01775         prop= RNA_def_property(srna, "use_group_count", PROP_BOOLEAN, PROP_NONE);
01776         RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_COUNT_GR);
01777         RNA_def_property_ui_text(prop, "Use Count", "Use object multiple times in the same group");
01778         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01779 
01780         prop= RNA_def_property(srna, "use_global_dupli", PROP_BOOLEAN, PROP_NONE);
01781         RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_GLOBAL_OB);
01782         RNA_def_property_ui_text(prop, "Use Global", "Use object's global coordinates for duplication");
01783         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01784 
01785         prop= RNA_def_property(srna, "use_render_adaptive", PROP_BOOLEAN, PROP_NONE);
01786         RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_ADAPT);
01787         RNA_def_property_ui_text(prop, "Adaptive render", "Draw steps of the particle path");
01788         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01789 
01790         prop= RNA_def_property(srna, "use_velocity_length", PROP_BOOLEAN, PROP_NONE);
01791         RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL_LENGTH);
01792         RNA_def_property_ui_text(prop, "Speed", "Multiply line length by particle speed");
01793         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01794 
01795         prop= RNA_def_property(srna, "use_whole_group", PROP_BOOLEAN, PROP_NONE);
01796         RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_WHOLE_GR);
01797         RNA_def_property_ui_text(prop, "Whole Group", "Use whole group at once");
01798         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01799 
01800         prop= RNA_def_property(srna, "use_strand_primitive", PROP_BOOLEAN, PROP_NONE);
01801         RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_STRAND);
01802         RNA_def_property_ui_text(prop, "Strand render", "Use the strand primitive for rendering");
01803         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01804 
01805         prop= RNA_def_property(srna, "draw_method", PROP_ENUM, PROP_NONE);
01806         RNA_def_property_enum_sdna(prop, NULL, "draw_as");
01807         RNA_def_property_enum_items(prop, part_draw_as_items);
01808         RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_draw_as_itemf");
01809         RNA_def_property_ui_text(prop, "Particle Drawing", "How particles are drawn in viewport");
01810         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01811 
01812         prop= RNA_def_property(srna, "render_type", PROP_ENUM, PROP_NONE);
01813         RNA_def_property_enum_sdna(prop, NULL, "ren_as");
01814         RNA_def_property_enum_items(prop, part_ren_as_items);
01815         RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_ren_as_itemf");
01816         RNA_def_property_ui_text(prop, "Particle Rendering", "How particles are rendered");
01817         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01818 
01819         prop= RNA_def_property(srna, "draw_color", PROP_ENUM, PROP_NONE);
01820         RNA_def_property_enum_sdna(prop, NULL, "draw_col");
01821         RNA_def_property_enum_items(prop, draw_col_items);
01822         RNA_def_property_ui_text(prop, "Draw Color", "Draw additional particle data as a color");
01823         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01824 
01825         prop= RNA_def_property(srna, "draw_size", PROP_INT, PROP_NONE);
01826         RNA_def_property_range(prop, 0, 1000);
01827         RNA_def_property_ui_range(prop, 0, 100, 1, 0);
01828         RNA_def_property_ui_text(prop, "Draw Size", "Size of particles on viewport in pixels (0=default)");
01829         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01830 
01831         prop= RNA_def_property(srna, "child_type", PROP_ENUM, PROP_NONE);
01832         RNA_def_property_enum_sdna(prop, NULL, "childtype");
01833         RNA_def_property_enum_items(prop, child_type_items);
01834         RNA_def_property_ui_text(prop, "Children From", "Create child particles");
01835         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
01836 
01837         prop= RNA_def_property(srna, "draw_step", PROP_INT, PROP_NONE);
01838         RNA_def_property_range(prop, 0, 10);
01839         RNA_def_property_ui_range(prop, 0, 7, 1, 0);
01840         RNA_def_property_ui_text(prop, "Steps", "How many steps paths are drawn with (power of 2)");
01841         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01842 
01843         prop= RNA_def_property(srna, "render_step", PROP_INT, PROP_NONE);
01844         RNA_def_property_int_sdna(prop, NULL, "ren_step");
01845         RNA_def_property_range(prop, 0, 20);
01846         RNA_def_property_ui_range(prop, 0, 9, 1, 0);
01847         RNA_def_property_ui_text(prop, "Render", "How many steps paths are rendered with (power of 2)");
01848 
01849         prop= RNA_def_property(srna, "hair_step", PROP_INT, PROP_NONE);
01850         RNA_def_property_range(prop, 2, 50);
01851         RNA_def_property_ui_text(prop, "Segments", "Number of hair segments");
01852         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01853 
01854 
01855         //TODO: not found in UI, readonly?
01856         prop= RNA_def_property(srna, "keys_step", PROP_INT, PROP_NONE);
01857         RNA_def_property_range(prop, 0, SHRT_MAX);//TODO:min,max
01858         RNA_def_property_ui_text(prop, "Keys Step", "");
01859 
01860         /* adaptive path rendering */
01861         prop= RNA_def_property(srna, "adaptive_angle", PROP_INT, PROP_NONE);
01862         RNA_def_property_int_sdna(prop, NULL, "adapt_angle");
01863         RNA_def_property_range(prop, 0, 45);
01864         RNA_def_property_ui_text(prop, "Degrees", "How many degrees path has to curve to make another render segment");
01865 
01866         prop= RNA_def_property(srna, "adaptive_pixel", PROP_INT, PROP_NONE);
01867         RNA_def_property_int_sdna(prop, NULL, "adapt_pix");
01868         RNA_def_property_range(prop, 0, 50);
01869         RNA_def_property_ui_text(prop, "Pixel", "How many pixels path has to cover to make another render segment");
01870 
01871         prop= RNA_def_property(srna, "draw_percentage", PROP_INT, PROP_NONE);
01872         RNA_def_property_int_sdna(prop, NULL, "disp");
01873         RNA_def_property_range(prop, 0, 100);
01874         RNA_def_property_ui_text(prop, "Display", "Percentage of particles to display in 3D view");
01875         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01876 
01877         prop= RNA_def_property(srna, "material", PROP_INT, PROP_NONE);
01878         RNA_def_property_int_sdna(prop, NULL, "omat");
01879         RNA_def_property_range(prop, 1, 32767);
01880         RNA_def_property_ui_text(prop, "Material", "Specify material used for the particles");
01881         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01882 
01883 
01884         // not used anywhere, why is this in DNA???
01885 #if 0
01886         prop= RNA_def_property(srna, "rotate_from", PROP_ENUM, PROP_NONE);
01887         RNA_def_property_enum_sdna(prop, NULL, "rotfrom");
01888         RNA_def_property_enum_items(prop, rot_from_items);
01889         RNA_def_property_ui_text(prop, "Rotate From", "");
01890 #endif
01891 
01892         prop= RNA_def_property(srna, "integrator", PROP_ENUM, PROP_NONE);
01893         RNA_def_property_enum_items(prop, integrator_type_items);
01894         RNA_def_property_ui_text(prop, "Integration", "Algorithm used to calculate physics. Fastest to most stable/accurate: Midpoint, Euler, Verlet, RK4 (Old)");
01895         RNA_def_property_update(prop, 0, "rna_Particle_reset");
01896 
01897         prop= RNA_def_property(srna, "kink", PROP_ENUM, PROP_NONE);
01898         RNA_def_property_enum_items(prop, kink_type_items);
01899         RNA_def_property_ui_text(prop, "Kink", "Type of periodic offset on the path");
01900         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
01901 
01902         prop= RNA_def_property(srna, "kink_axis", PROP_ENUM, PROP_NONE);
01903         RNA_def_property_enum_items(prop, kink_axis_items);
01904         RNA_def_property_ui_text(prop, "Axis", "Which axis to use for offset");
01905         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
01906 
01907         /* billboards */
01908         prop= RNA_def_property(srna, "lock_billboard", PROP_BOOLEAN, PROP_NONE);
01909         RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_BB_LOCK);
01910         RNA_def_property_ui_text(prop, "Lock Billboard", "Lock the billboards align axis");
01911         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01912 
01913         prop= RNA_def_property(srna, "billboard_align", PROP_ENUM, PROP_NONE);
01914         RNA_def_property_enum_sdna(prop, NULL, "bb_align");
01915         RNA_def_property_enum_items(prop, bb_align_items);
01916         RNA_def_property_ui_text(prop, "Align to", "In respect to what the billboards are aligned");
01917         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01918 
01919         prop= RNA_def_property(srna, "billboard_uv_split", PROP_INT, PROP_NONE);
01920         RNA_def_property_int_sdna(prop, NULL, "bb_uv_split");
01921         RNA_def_property_range(prop, 1, 100);
01922         RNA_def_property_ui_range(prop, 1, 10, 1, 0);
01923         RNA_def_property_ui_text(prop, "UV Split", "Amount of rows/columns to split UV coordinates for billboards");
01924 
01925         prop= RNA_def_property(srna, "billboard_animation", PROP_ENUM, PROP_NONE);
01926         RNA_def_property_enum_sdna(prop, NULL, "bb_anim");
01927         RNA_def_property_enum_items(prop, bb_anim_items);
01928         RNA_def_property_ui_text(prop, "Animate", "How to animate billboard textures");
01929 
01930         prop= RNA_def_property(srna, "billboard_offset_split", PROP_ENUM, PROP_NONE);
01931         RNA_def_property_enum_sdna(prop, NULL, "bb_split_offset");
01932         RNA_def_property_enum_items(prop, bb_split_offset_items);
01933         RNA_def_property_ui_text(prop, "Offset", "How to offset billboard textures");
01934 
01935         prop= RNA_def_property(srna, "billboard_tilt", PROP_FLOAT, PROP_NONE);
01936         RNA_def_property_float_sdna(prop, NULL, "bb_tilt");
01937         RNA_def_property_range(prop, -1.0f, 1.0f);
01938         RNA_def_property_ui_text(prop, "Tilt", "Tilt of the billboards");
01939         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01940 
01941         prop= RNA_def_property(srna, "color_maximum", PROP_FLOAT, PROP_NONE);
01942         RNA_def_property_float_sdna(prop, NULL, "color_vec_max");
01943         RNA_def_property_range(prop, 0.01f, 100.0f);
01944         RNA_def_property_ui_text(prop, "Color Maximum", "Maximum length of the particle color vector");
01945         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01946 
01947         prop= RNA_def_property(srna, "billboard_tilt_random", PROP_FLOAT, PROP_NONE);
01948         RNA_def_property_float_sdna(prop, NULL, "bb_rand_tilt");
01949         RNA_def_property_range(prop, 0.0f, 1.0f);
01950         RNA_def_property_ui_text(prop, "Random Tilt", "Random tilt of the billboards");
01951         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01952 
01953         prop= RNA_def_property(srna, "billboard_offset", PROP_FLOAT, PROP_TRANSLATION);
01954         RNA_def_property_float_sdna(prop, NULL, "bb_offset");
01955         RNA_def_property_array(prop, 2);
01956         RNA_def_property_range(prop, -100.0f, 100.0f);
01957         RNA_def_property_ui_range(prop, -1.0, 1.0, 0.1, 3);
01958         RNA_def_property_ui_text(prop, "Billboard Offset", "");
01959         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01960 
01961         prop= RNA_def_property(srna, "billboard_size", PROP_FLOAT, PROP_FACTOR);
01962         RNA_def_property_float_sdna(prop, NULL, "bb_size");
01963         RNA_def_property_array(prop, 2);
01964         RNA_def_property_range(prop, 0.001f, 10.0f);
01965         RNA_def_property_ui_text(prop, "Billboard Scale", "Scale billboards relative to particle size");
01966         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01967 
01968         prop= RNA_def_property(srna, "billboard_velocity_head", PROP_FLOAT, PROP_FACTOR);
01969         RNA_def_property_float_sdna(prop, NULL, "bb_vel_head");
01970         RNA_def_property_range(prop, 0.0f, 10.0f);
01971         RNA_def_property_ui_text(prop, "Billboard Velocity Head", "Scale billboards by velocity");
01972         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01973 
01974         prop= RNA_def_property(srna, "billboard_velocity_tail", PROP_FLOAT, PROP_FACTOR);
01975         RNA_def_property_float_sdna(prop, NULL, "bb_vel_tail");
01976         RNA_def_property_range(prop, 0.0f, 10.0f);
01977         RNA_def_property_ui_text(prop, "Billboard Velocity Tail", "Scale billboards by velocity");
01978         RNA_def_property_update(prop, 0, "rna_Particle_redo");
01979 
01980         /* simplification */
01981         prop= RNA_def_property(srna, "use_simplify", PROP_BOOLEAN, PROP_NONE);
01982         RNA_def_property_boolean_sdna(prop, NULL, "simplify_flag", PART_SIMPLIFY_ENABLE);
01983         RNA_def_property_ui_text(prop, "Child Simplification", "Remove child strands as the object becomes smaller on the screen");
01984 
01985         prop= RNA_def_property(srna, "use_simplify_viewport", PROP_BOOLEAN, PROP_NONE);
01986         RNA_def_property_boolean_sdna(prop, NULL, "simplify_flag", PART_SIMPLIFY_VIEWPORT);
01987         RNA_def_property_ui_text(prop, "Viewport", "");
01988 
01989         prop= RNA_def_property(srna, "simplify_refsize", PROP_INT, PROP_UNSIGNED);
01990         RNA_def_property_int_sdna(prop, NULL, "simplify_refsize");
01991         RNA_def_property_range(prop, 1, 32768);
01992         RNA_def_property_ui_text(prop, "Reference Size", "Reference size in pixels, after which simplification begins");
01993 
01994         prop= RNA_def_property(srna, "simplify_rate", PROP_FLOAT, PROP_NONE);
01995         RNA_def_property_range(prop, 0.0f, 1.0f);
01996         RNA_def_property_ui_text(prop, "Rate", "Speed of simplification");
01997 
01998         prop= RNA_def_property(srna, "simplify_transition", PROP_FLOAT, PROP_NONE);
01999         RNA_def_property_range(prop, 0.0f, 1.0f);
02000         RNA_def_property_ui_text(prop, "Transition", "Transition period for fading out strands");
02001 
02002         prop= RNA_def_property(srna, "simplify_viewport", PROP_FLOAT, PROP_NONE);
02003         RNA_def_property_range(prop, 0.0f, 0.999f);
02004         RNA_def_property_ui_text(prop, "Rate", "Speed of Simplification");
02005 
02006         /* general values */
02007         prop= RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
02008         RNA_def_property_float_sdna(prop, NULL, "sta");//optional if prop names are the same
02009         RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
02010         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
02011         RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_start_set", NULL);
02012         RNA_def_property_ui_text(prop, "Start", "Frame # to start emitting particles");
02013         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02014 
02015         prop= RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
02016         RNA_def_property_float_sdna(prop, NULL, "end");
02017         RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
02018 
02019         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
02020         RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_end_set", NULL);
02021         RNA_def_property_ui_text(prop, "End", "Frame # to stop emitting particles");
02022         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02023 
02024         prop= RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
02025         RNA_def_property_range(prop, 1.0f, MAXFRAMEF);
02026         RNA_def_property_ui_text(prop, "Lifetime", "Specify the life span of the particles");
02027         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02028 
02029         prop= RNA_def_property(srna, "lifetime_random", PROP_FLOAT, PROP_NONE);
02030         RNA_def_property_float_sdna(prop, NULL, "randlife");
02031         RNA_def_property_range(prop, 0.0f, 1.0f);
02032         RNA_def_property_ui_text(prop, "Random", "Give the particle life a random variation");
02033         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02034 
02035         prop= RNA_def_property(srna, "time_tweak", PROP_FLOAT, PROP_NONE);
02036         RNA_def_property_float_sdna(prop, NULL, "timetweak");
02037         RNA_def_property_range(prop, 0.0f, 100.0f);
02038         RNA_def_property_ui_range(prop, 0, 10, 1, 3);
02039         RNA_def_property_ui_text(prop, "Tweak", "A multiplier for physics timestep (1.0 means one frame = 1/25 seconds)");
02040         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02041 
02042         prop= RNA_def_property(srna, "timestep", PROP_FLOAT, PROP_NONE);
02043         RNA_def_property_float_funcs(prop, "rna_PartSettings_timestep_get", "rna_PartSetings_timestep_set", NULL);
02044         RNA_def_property_range(prop, 0.0001, 100.0);
02045         RNA_def_property_ui_range(prop, 0.01, 10, 1, 3);
02046         RNA_def_property_ui_text(prop, "Timestep", "The simulation timestep per frame (in seconds)");
02047         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02048         
02049         prop= RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE);
02050         RNA_def_property_range(prop, 0, 1000);  
02051         RNA_def_property_ui_text(prop, "Subframes", "Subframes to simulate for improved stability and finer granularity simulations");
02052         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02053 
02054         prop= RNA_def_property(srna, "jitter_factor", PROP_FLOAT, PROP_NONE);
02055         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
02056         RNA_def_property_float_sdna(prop, NULL, "jitfac");
02057         RNA_def_property_range(prop, 0.0f, 2.0f);
02058         RNA_def_property_ui_text(prop, "Amount", "Amount of jitter applied to the sampling");
02059         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02060 
02061         prop= RNA_def_property(srna, "effect_hair", PROP_FLOAT, PROP_NONE);
02062         RNA_def_property_float_sdna(prop, NULL, "eff_hair");
02063         RNA_def_property_range(prop, 0.0f, 1.0f);
02064         RNA_def_property_ui_text(prop, "Stiffness", "Hair stiffness for effectors");
02065         RNA_def_property_update(prop, 0, "rna_Particle_redo");
02066 
02067         prop= RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
02068         RNA_def_property_int_sdna(prop, NULL, "totpart");
02069         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
02070         /* This limit is for those freaks who have the machine power to handle it. */
02071         /* 10M particles take around 2.2 Gb of memory / disk space in saved file and */
02072         /* each cached frame takes around 0.5 Gb of memory / disk space depending on cache mode. */
02073         RNA_def_property_range(prop, 0, 10000000);
02074         RNA_def_property_ui_range(prop, 0, 100000, 1, 0);
02075         RNA_def_property_ui_text(prop, "Amount", "Total number of particles");
02076         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02077 
02078         prop= RNA_def_property(srna, "userjit", PROP_INT, PROP_UNSIGNED);//TODO: can we get a better name for userjit?
02079         RNA_def_property_int_sdna(prop, NULL, "userjit");
02080         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
02081         RNA_def_property_range(prop, 0, 1000);
02082         RNA_def_property_ui_text(prop, "P/F", "Emission locations / face (0 = automatic)");
02083         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02084 
02085         prop= RNA_def_property(srna, "grid_resolution", PROP_INT, PROP_UNSIGNED);
02086         RNA_def_property_int_sdna(prop, NULL, "grid_res");
02087         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
02088         RNA_def_property_range(prop, 1, 250); /* ~15M particles in a cube (ouch!), but could be very usable in a plane */
02089         RNA_def_property_ui_range(prop, 1, 50, 1, 0); /* ~100k particles in a cube */
02090         RNA_def_property_ui_text(prop, "Resolution", "The resolution of the particle grid");
02091         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02092 
02093         prop= RNA_def_property(srna, "grid_random", PROP_FLOAT, PROP_NONE);
02094         RNA_def_property_float_sdna(prop, NULL, "grid_rand");
02095         RNA_def_property_range(prop, 0.0f, 1.0f);
02096         RNA_def_property_ui_text(prop, "Grid Randomness", "Add random offset to the grid locations");
02097         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02098 
02099         prop= RNA_def_property(srna, "effector_amount", PROP_INT, PROP_UNSIGNED);
02100         /* in theory PROP_ANIMATABLE perhaps should be cleared, but animating this can give some interesting results! */
02101         RNA_def_property_range(prop, 0, 10000); /* 10000 effectors will bel SLOW, but who knows */
02102         RNA_def_property_ui_range(prop, 0, 100, 1, 0);
02103         RNA_def_property_ui_text(prop, "Effector Amount", "How many particles are effectors (0 is all particles)");
02104         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02105 
02106         /* initial velocity factors */
02107         prop= RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_NONE);
02108         RNA_def_property_float_sdna(prop, NULL, "normfac");//optional if prop names are the same
02109         RNA_def_property_range(prop, -1000.0f, 1000.0f);
02110         RNA_def_property_ui_range(prop, 0, 100, 1, 3);
02111         RNA_def_property_ui_text(prop, "Normal", "Let the surface normal give the particle a starting speed");
02112         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02113 
02114         prop= RNA_def_property(srna, "object_factor", PROP_FLOAT, PROP_NONE);
02115         RNA_def_property_float_sdna(prop, NULL, "obfac");
02116         RNA_def_property_range(prop, -200.0f, 200.0f);
02117         RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
02118         RNA_def_property_ui_text(prop, "Object", "Let the object give the particle a starting speed");
02119         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02120 
02121         prop= RNA_def_property(srna, "factor_random", PROP_FLOAT, PROP_NONE);
02122         RNA_def_property_float_sdna(prop, NULL, "randfac");//optional if prop names are the same
02123         RNA_def_property_range(prop, 0.0f, 200.0f);
02124         RNA_def_property_ui_range(prop, 0, 100, 1, 3);
02125         RNA_def_property_ui_text(prop, "Random", "Give the starting speed a random variation");
02126         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02127 
02128         prop= RNA_def_property(srna, "particle_factor", PROP_FLOAT, PROP_NONE);
02129         RNA_def_property_float_sdna(prop, NULL, "partfac");
02130         RNA_def_property_range(prop, -200.0f, 200.0f);
02131         RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
02132         RNA_def_property_ui_text(prop, "Particle", "Let the target particle give the particle a starting speed");
02133         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02134 
02135         prop= RNA_def_property(srna, "tangent_factor", PROP_FLOAT, PROP_NONE);
02136         RNA_def_property_float_sdna(prop, NULL, "tanfac");
02137         RNA_def_property_range(prop, -1000.0f, 1000.0f);
02138         RNA_def_property_ui_range(prop, -100, 100, 1, 2);
02139         RNA_def_property_ui_text(prop, "Tangent", "Let the surface tangent give the particle a starting speed");
02140         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02141 
02142         prop= RNA_def_property(srna, "tangent_phase", PROP_FLOAT, PROP_NONE);
02143         RNA_def_property_float_sdna(prop, NULL, "tanphase");
02144         RNA_def_property_range(prop, -1.0f, 1.0f);
02145         RNA_def_property_ui_text(prop, "Rot", "Rotate the surface tangent");
02146         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02147 
02148         prop= RNA_def_property(srna, "reactor_factor", PROP_FLOAT, PROP_NONE);
02149         RNA_def_property_float_sdna(prop, NULL, "reactfac");
02150         RNA_def_property_range(prop, -10.0f, 10.0f);
02151         RNA_def_property_ui_text(prop, "Reactor", "Let the vector away from the target particles location give the particle a starting speed");
02152         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02153 
02154         prop= RNA_def_property(srna, "object_align_factor", PROP_FLOAT, PROP_VELOCITY);
02155         RNA_def_property_float_sdna(prop, NULL, "ob_vel");
02156         RNA_def_property_array(prop, 3);
02157         RNA_def_property_range(prop, -200.0f, 200.0f);
02158         RNA_def_property_ui_range(prop, -100, 100, 1, 3);
02159         RNA_def_property_ui_text(prop, "Object Aligned", "Let the emitter object orientation give the particle a starting speed");
02160         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02161 
02162         prop= RNA_def_property(srna, "angular_velocity_factor", PROP_FLOAT, PROP_NONE);
02163         RNA_def_property_float_sdna(prop, NULL, "avefac");
02164         RNA_def_property_range(prop, -200.0f, 200.0f);
02165         RNA_def_property_ui_range(prop, -100, 100, 10, 3);
02166         RNA_def_property_ui_text(prop, "Angular Velocity", "Angular velocity amount");
02167         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02168 
02169         prop= RNA_def_property(srna, "phase_factor", PROP_FLOAT, PROP_NONE);
02170         RNA_def_property_float_sdna(prop, NULL, "phasefac");
02171         RNA_def_property_range(prop, -1.0f, 1.0f);
02172         RNA_def_property_ui_text(prop, "Phase", "Initial rotation phase");
02173         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02174 
02175         prop= RNA_def_property(srna, "rotation_factor_random", PROP_FLOAT, PROP_NONE);
02176         RNA_def_property_float_sdna(prop, NULL, "randrotfac");
02177         RNA_def_property_range(prop, 0.0f, 1.0f);
02178         RNA_def_property_ui_text(prop, "Random Rotation", "Randomize rotation");
02179         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02180 
02181         prop= RNA_def_property(srna, "phase_factor_random", PROP_FLOAT, PROP_NONE);
02182         RNA_def_property_float_sdna(prop, NULL, "randphasefac");
02183         RNA_def_property_range(prop, 0.0f, 1.0f);
02184         RNA_def_property_ui_text(prop, "Random Phase", "Randomize rotation phase");
02185         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02186 
02187         prop= RNA_def_property(srna, "hair_length", PROP_FLOAT, PROP_NONE);
02188         RNA_def_property_float_funcs(prop, "rna_PartSetting_hairlength_get", "rna_PartSetting_hairlength_set", NULL);
02189         RNA_def_property_range(prop, 0.0f, 1000.0f);
02190         RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
02191         RNA_def_property_ui_text(prop, "Hair Length", "Length of the hair");
02192         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02193 
02194         /* physical properties */
02195         prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
02196         RNA_def_property_range(prop, 0.001f, 100000.0f);
02197         RNA_def_property_ui_range(prop, 0.01, 100, 1, 3);
02198         RNA_def_property_ui_text(prop, "Mass", "Specify the mass of the particles");
02199         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02200 
02201         prop= RNA_def_property(srna, "particle_size", PROP_FLOAT, PROP_NONE);
02202         RNA_def_property_float_sdna(prop, NULL, "size");
02203         RNA_def_property_range(prop, 0.001f, 100000.0f);
02204         RNA_def_property_ui_range(prop, 0.01, 100, 1, 3);
02205         RNA_def_property_ui_text(prop, "Size", "The size of the particles");
02206         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02207 
02208         prop= RNA_def_property(srna, "size_random", PROP_FLOAT, PROP_NONE);
02209         RNA_def_property_float_sdna(prop, NULL, "randsize");
02210         RNA_def_property_range(prop, 0.0f, 1.0f);
02211         RNA_def_property_ui_text(prop, "Random Size", "Give the particle size a random variation");
02212         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02213 
02214 
02215         /* global physical properties */
02216         prop= RNA_def_property(srna, "drag_factor", PROP_FLOAT, PROP_NONE);
02217         RNA_def_property_float_sdna(prop, NULL, "dragfac");
02218         RNA_def_property_range(prop, 0.0f, 1.0f);
02219         RNA_def_property_ui_text(prop, "Drag", "Specify the amount of air-drag");
02220         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02221 
02222         prop= RNA_def_property(srna, "brownian_factor", PROP_FLOAT, PROP_NONE);
02223         RNA_def_property_float_sdna(prop, NULL, "brownfac");
02224         RNA_def_property_range(prop, 0.0f, 200.0f);
02225         RNA_def_property_ui_range(prop, 0, 20, 1, 3);
02226         RNA_def_property_ui_text(prop, "Brownian", "Specify the amount of Brownian motion");
02227         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02228 
02229         prop= RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
02230         RNA_def_property_float_sdna(prop, NULL, "dampfac");
02231         RNA_def_property_range(prop, 0.0f, 1.0f);
02232         RNA_def_property_ui_text(prop, "Damp", "Specify the amount of damping");
02233         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02234 
02235         /* random length */
02236         prop= RNA_def_property(srna, "length_random", PROP_FLOAT, PROP_NONE);
02237         RNA_def_property_float_sdna(prop, NULL, "randlength");
02238         RNA_def_property_range(prop, 0.0f, 1.0f);
02239         RNA_def_property_ui_text(prop, "Random Length", "Give path length a random variation");
02240         RNA_def_property_update(prop, 0, "rna_Particle_redo");
02241 
02242         /* children */
02243         prop= RNA_def_property(srna, "child_nbr", PROP_INT, PROP_NONE);
02244         RNA_def_property_int_sdna(prop, NULL, "child_nbr");//optional if prop names are the same
02245         RNA_def_property_range(prop, 0, 100000);
02246         RNA_def_property_ui_range(prop, 0, 1000, 1, 0);
02247         RNA_def_property_ui_text(prop, "Children Per Parent", "Amount of children/parent");
02248         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02249 
02250         prop= RNA_def_property(srna, "rendered_child_count", PROP_INT, PROP_NONE);
02251         RNA_def_property_int_sdna(prop, NULL, "ren_child_nbr");
02252         RNA_def_property_range(prop, 0, 100000);
02253         RNA_def_property_ui_range(prop, 0, 10000, 1, 0);
02254         RNA_def_property_ui_text(prop, "Rendered Children", "Amount of children/parent for rendering");
02255 
02256         prop= RNA_def_property(srna, "virtual_parents", PROP_FLOAT, PROP_NONE);
02257         RNA_def_property_float_sdna(prop, NULL, "parents");
02258         RNA_def_property_range(prop, 0.0f, 1.0f);
02259         RNA_def_property_ui_text(prop, "Virtual Parents", "Relative amount of virtual parents");
02260         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02261 
02262         prop= RNA_def_property(srna, "child_size", PROP_FLOAT, PROP_NONE);
02263         RNA_def_property_float_sdna(prop, NULL, "childsize");
02264         RNA_def_property_range(prop, 0.001f, 100000.0f);
02265         RNA_def_property_ui_range(prop, 0.01f, 100.0f, 0.1, 3);
02266         RNA_def_property_ui_text(prop, "Child Size", "A multiplier for the child particle size");
02267         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02268 
02269         prop= RNA_def_property(srna, "child_size_random", PROP_FLOAT, PROP_NONE);
02270         RNA_def_property_float_sdna(prop, NULL, "childrandsize");
02271         RNA_def_property_range(prop, 0.0f, 1.0f);
02272         RNA_def_property_ui_text(prop, "Random Child Size", "Random variation to the size of the child particles");
02273         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02274 
02275         prop= RNA_def_property(srna, "child_radius", PROP_FLOAT, PROP_NONE);
02276         RNA_def_property_float_sdna(prop, NULL, "childrad");
02277         RNA_def_property_range(prop, 0.0f, 10.0f);
02278         RNA_def_property_ui_text(prop, "Child Radius", "Radius of children around parent");
02279         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02280 
02281         prop= RNA_def_property(srna, "child_roundness", PROP_FLOAT, PROP_NONE);
02282         RNA_def_property_float_sdna(prop, NULL, "childflat");
02283         RNA_def_property_range(prop, 0.0f, 1.0f);
02284         RNA_def_property_ui_text(prop, "Child Roundness", "Roundness of children around parent");
02285         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02286 
02287         /* clumping */
02288         prop= RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
02289         RNA_def_property_float_sdna(prop, NULL, "clumpfac");
02290         RNA_def_property_range(prop, -1.0f, 1.0f);
02291         RNA_def_property_ui_text(prop, "Clump", "Amount of clumping");
02292         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02293 
02294         prop= RNA_def_property(srna, "clump_shape", PROP_FLOAT, PROP_NONE);
02295         RNA_def_property_float_sdna(prop, NULL, "clumppow");
02296         RNA_def_property_range(prop, -0.999f, 0.999f);
02297         RNA_def_property_ui_text(prop, "Shape", "Shape of clumping");
02298         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02299 
02300 
02301         /* kink */
02302         prop= RNA_def_property(srna, "kink_amplitude", PROP_FLOAT, PROP_NONE);
02303         RNA_def_property_float_sdna(prop, NULL, "kink_amp");
02304         RNA_def_property_range(prop, -100000.0f, 100000.0f);
02305         RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
02306         RNA_def_property_ui_text(prop, "Amplitude", "The amplitude of the offset");
02307         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02308 
02309         prop= RNA_def_property(srna, "kink_amplitude_clump", PROP_FLOAT, PROP_NONE);
02310         RNA_def_property_float_sdna(prop, NULL, "kink_amp_clump");
02311         RNA_def_property_range(prop, 0.0f, 1.0f);
02312         RNA_def_property_ui_text(prop, "Amplitude Clump", "How much clump effects kink amplitude");
02313         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02314 
02315         prop= RNA_def_property(srna, "kink_frequency", PROP_FLOAT, PROP_NONE);
02316         RNA_def_property_float_sdna(prop, NULL, "kink_freq");
02317         RNA_def_property_range(prop, -100000.0f, 100000.0f);
02318         RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
02319         RNA_def_property_ui_text(prop, "Frequency", "The frequency of the offset (1/total length)");
02320         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02321 
02322         prop= RNA_def_property(srna, "kink_shape", PROP_FLOAT, PROP_NONE);
02323         RNA_def_property_range(prop, -0.999f, 0.999f);
02324         RNA_def_property_ui_text(prop, "Shape", "Adjust the offset to the beginning/end");
02325         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02326 
02327         prop= RNA_def_property(srna, "kink_flat", PROP_FLOAT, PROP_NONE);
02328         RNA_def_property_range(prop, 0.0f, 1.0f);
02329         RNA_def_property_ui_text(prop, "Flatness", "How flat the hairs are");
02330         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02331 
02332         /* rough */
02333         prop= RNA_def_property(srna, "roughness_1", PROP_FLOAT, PROP_NONE);
02334         RNA_def_property_float_sdna(prop, NULL, "rough1");
02335         RNA_def_property_range(prop, 0.0f, 100000.0f);
02336         RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
02337         RNA_def_property_ui_text(prop, "Rough1", "Amount of location dependent rough");
02338         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02339 
02340         prop= RNA_def_property(srna, "roughness_1_size", PROP_FLOAT, PROP_NONE);
02341         RNA_def_property_float_sdna(prop, NULL, "rough1_size");
02342         RNA_def_property_range(prop, 0.01f, 100000.0f);
02343         RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3);
02344         RNA_def_property_ui_text(prop, "Size1", "Size of location dependent rough");
02345         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02346 
02347         prop= RNA_def_property(srna, "roughness_2", PROP_FLOAT, PROP_NONE);
02348         RNA_def_property_float_sdna(prop, NULL, "rough2");
02349         RNA_def_property_range(prop, 0.0f, 100000.0f);
02350         RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
02351         RNA_def_property_ui_text(prop, "Rough2", "Amount of random rough");
02352         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02353 
02354         prop= RNA_def_property(srna, "roughness_2_size", PROP_FLOAT, PROP_NONE);
02355         RNA_def_property_float_sdna(prop, NULL, "rough2_size");
02356         RNA_def_property_range(prop, 0.01f, 100000.0f);
02357         RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3);
02358         RNA_def_property_ui_text(prop, "Size2", "Size of random rough");
02359         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02360 
02361         prop= RNA_def_property(srna, "roughness_2_threshold", PROP_FLOAT, PROP_NONE);
02362         RNA_def_property_float_sdna(prop, NULL, "rough2_thres");
02363         RNA_def_property_range(prop, 0.0f, 1.0f);
02364         RNA_def_property_ui_text(prop, "Threshold", "Amount of particles left untouched by random rough");
02365         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02366 
02367         prop= RNA_def_property(srna, "roughness_endpoint", PROP_FLOAT, PROP_NONE);
02368         RNA_def_property_float_sdna(prop, NULL, "rough_end");
02369         RNA_def_property_range(prop, 0.0f, 100000.0f);
02370         RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
02371         RNA_def_property_ui_text(prop, "Rough Endpoint", "Amount of end point rough");
02372         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02373 
02374         prop= RNA_def_property(srna, "roughness_end_shape", PROP_FLOAT, PROP_NONE);
02375         RNA_def_property_float_sdna(prop, NULL, "rough_end_shape");
02376         RNA_def_property_range(prop, 0.0f, 10.0f);
02377         RNA_def_property_ui_text(prop, "Shape", "Shape of end point rough");
02378         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02379 
02380         prop= RNA_def_property(srna, "child_length", PROP_FLOAT, PROP_NONE);
02381         RNA_def_property_float_sdna(prop, NULL, "clength");
02382         RNA_def_property_range(prop, 0.0f, 1.0f);
02383         RNA_def_property_ui_text(prop, "Length", "Length of child paths");
02384         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02385 
02386         prop= RNA_def_property(srna, "child_length_threshold", PROP_FLOAT, PROP_NONE);
02387         RNA_def_property_float_sdna(prop, NULL, "clength_thres");
02388         RNA_def_property_range(prop, 0.0f, 1.0f);
02389         RNA_def_property_ui_text(prop, "Threshold", "Amount of particles left untouched by child path length");
02390         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02391 
02392         /* parting */
02393         prop= RNA_def_property(srna, "child_parting_factor", PROP_FLOAT, PROP_NONE);
02394         RNA_def_property_float_sdna(prop, NULL, "parting_fac");
02395         RNA_def_property_range(prop, 0.0f, 1.0f);
02396         RNA_def_property_ui_text(prop, "Parting Factor", "Create parting in the children based on parent strands");
02397         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02398 
02399         prop= RNA_def_property(srna, "child_parting_min", PROP_FLOAT, PROP_NONE);
02400         RNA_def_property_float_sdna(prop, NULL, "parting_min");
02401         RNA_def_property_range(prop, 0.0f, 180.0f);
02402         RNA_def_property_ui_text(prop, "Parting Minimum", "Minimum root to tip angle (tip distance/root distance for long hair)");
02403         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02404 
02405         prop= RNA_def_property(srna, "child_parting_max", PROP_FLOAT, PROP_NONE);
02406         RNA_def_property_float_sdna(prop, NULL, "parting_max");
02407         RNA_def_property_range(prop, 0.0f, 180.0f);
02408         RNA_def_property_ui_text(prop, "Parting Maximum", "Maximum root to tip angle (tip distance/root distance for long hair)");
02409         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02410 
02411         /* branching */
02412         prop= RNA_def_property(srna, "branch_threshold", PROP_FLOAT, PROP_NONE);
02413         RNA_def_property_float_sdna(prop, NULL, "branch_thres");
02414         RNA_def_property_range(prop, 0.0f, 1.0f);
02415         RNA_def_property_ui_text(prop, "Threshold", "Threshold of branching");
02416         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02417 
02418         /* drawing stuff */
02419         prop= RNA_def_property(srna, "line_length_tail", PROP_FLOAT, PROP_NONE);
02420         RNA_def_property_float_funcs(prop, "rna_PartSetting_linelentail_get", "rna_PartSetting_linelentail_set", NULL);
02421         RNA_def_property_range(prop, 0.0f, 100000.0f);
02422         RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
02423         RNA_def_property_ui_text(prop, "Back", "Length of the line's tail");
02424         RNA_def_property_update(prop, 0, "rna_Particle_redo");
02425 
02426         prop= RNA_def_property(srna, "line_length_head", PROP_FLOAT, PROP_NONE);
02427         RNA_def_property_float_funcs(prop, "rna_PartSetting_linelenhead_get", "rna_PartSetting_linelenhead_set", NULL);
02428         RNA_def_property_range(prop, 0.0f, 100000.0f);
02429         RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
02430         RNA_def_property_ui_text(prop, "Head", "Length of the line's head");
02431         RNA_def_property_update(prop, 0, "rna_Particle_redo");
02432 
02433         prop= RNA_def_property(srna, "path_start", PROP_FLOAT, PROP_NONE);
02434         RNA_def_property_float_sdna(prop, NULL, "path_start");
02435         RNA_def_property_float_funcs(prop, NULL, NULL, "rna_PartSetting_pathstartend_range");
02436         RNA_def_property_ui_text(prop, "Path Start", "Starting time of drawn path");
02437         RNA_def_property_update(prop, 0, "rna_Particle_redo");
02438 
02439         prop= RNA_def_property(srna, "path_end", PROP_FLOAT, PROP_NONE);
02440         RNA_def_property_float_sdna(prop, NULL, "path_end");
02441         RNA_def_property_float_funcs(prop, NULL, NULL, "rna_PartSetting_pathstartend_range");
02442         RNA_def_property_ui_text(prop, "Path End", "End time of drawn path");
02443         RNA_def_property_update(prop, 0, "rna_Particle_redo");
02444 
02445         prop= RNA_def_property(srna, "trail_count", PROP_INT, PROP_NONE);
02446         RNA_def_property_int_sdna(prop, NULL, "trail_count");
02447         RNA_def_property_range(prop, 1, 100000);
02448         RNA_def_property_ui_range(prop, 1, 100, 1, 0);
02449         RNA_def_property_ui_text(prop, "Trail Count", "Number of trail particles");
02450         RNA_def_property_update(prop, 0, "rna_Particle_redo");
02451 
02452         /* keyed particles */
02453         prop= RNA_def_property(srna, "keyed_loops", PROP_INT, PROP_NONE);
02454         RNA_def_property_int_sdna(prop, NULL, "keyed_loops");
02455         RNA_def_property_range(prop, 1.0f, 10000.0f);
02456         RNA_def_property_ui_range(prop, 1.0f, 100.0f, 0.1, 3);
02457         RNA_def_property_ui_text(prop, "Loop count", "Number of times the keys are looped");
02458         RNA_def_property_update(prop, 0, "rna_Particle_redo");
02459         
02460         /* draw objects & groups */
02461         prop= RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE);
02462         RNA_def_property_pointer_sdna(prop, NULL, "dup_group");
02463         RNA_def_property_struct_type(prop, "Group");
02464         RNA_def_property_flag(prop, PROP_EDITABLE);
02465         RNA_def_property_ui_text(prop, "Dupli Group", "Show Objects in this Group in place of particles");
02466         RNA_def_property_update(prop, 0, "rna_Particle_redo");
02467 
02468         prop= RNA_def_property(srna, "dupli_weights", PROP_COLLECTION, PROP_NONE);
02469         RNA_def_property_collection_sdna(prop, NULL, "dupliweights", NULL);
02470         RNA_def_property_struct_type(prop, "ParticleDupliWeight");
02471         RNA_def_property_ui_text(prop, "Dupli Group Weights", "Weights for all of the objects in the dupli group");
02472 
02473         prop= RNA_def_property(srna, "active_dupliweight", PROP_POINTER, PROP_NONE);
02474         RNA_def_property_struct_type(prop, "ParticleDupliWeight");
02475         RNA_def_property_pointer_funcs(prop, "rna_ParticleDupliWeight_active_get", NULL, NULL, NULL);
02476         RNA_def_property_ui_text(prop, "Active Dupli Object", "");
02477 
02478         prop= RNA_def_property(srna, "active_dupliweight_index", PROP_INT, PROP_UNSIGNED);
02479         RNA_def_property_int_funcs(prop, "rna_ParticleDupliWeight_active_index_get", "rna_ParticleDupliWeight_active_index_set", "rna_ParticleDupliWeight_active_index_range");
02480         RNA_def_property_ui_text(prop, "Active Dupli Object Index", "");
02481 
02482         prop= RNA_def_property(srna, "dupli_object", PROP_POINTER, PROP_NONE);
02483         RNA_def_property_pointer_sdna(prop, NULL, "dup_ob");
02484         RNA_def_property_struct_type(prop, "Object");
02485         RNA_def_property_flag(prop, PROP_EDITABLE);
02486         RNA_def_property_ui_text(prop, "Dupli Object", "Show this Object in place of particles");
02487         RNA_def_property_update(prop, 0, "rna_Particle_redo_dependency");
02488 
02489         prop= RNA_def_property(srna, "billboard_object", PROP_POINTER, PROP_NONE);
02490         RNA_def_property_pointer_sdna(prop, NULL, "bb_ob");
02491         RNA_def_property_struct_type(prop, "Object");
02492         RNA_def_property_flag(prop, PROP_EDITABLE);
02493         RNA_def_property_ui_text(prop, "Billboard Object", "Billboards face this object (default is active camera)");
02494         RNA_def_property_update(prop, 0, "rna_Particle_redo");
02495 
02496         /* boids */
02497         prop= RNA_def_property(srna, "boids", PROP_POINTER, PROP_NONE);
02498         RNA_def_property_struct_type(prop, "BoidSettings");
02499         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
02500         RNA_def_property_ui_text(prop, "Boid Settings", "");
02501         
02502         /* Fluid particles */
02503         prop= RNA_def_property(srna, "fluid", PROP_POINTER, PROP_NONE);
02504         RNA_def_property_struct_type(prop, "SPHFluidSettings");
02505         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
02506         RNA_def_property_ui_text(prop, "SPH Fluid Settings", ""); 
02507 
02508         /* Effector weights */
02509         prop= RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
02510         RNA_def_property_struct_type(prop, "EffectorWeights");
02511         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
02512         RNA_def_property_ui_text(prop, "Effector Weights", "");
02513         
02514         /* animation here? */
02515         rna_def_animdata_common(srna);
02516 
02517         prop= RNA_def_property(srna, "force_field_1", PROP_POINTER, PROP_NONE);
02518         RNA_def_property_pointer_sdna(prop, NULL, "pd");
02519         RNA_def_property_struct_type(prop, "FieldSettings");
02520         RNA_def_property_pointer_funcs(prop, "rna_Particle_field1_get", NULL, NULL, NULL);
02521         RNA_def_property_ui_text(prop, "Force Field 1", "");
02522 
02523         prop= RNA_def_property(srna, "force_field_2", PROP_POINTER, PROP_NONE);
02524         RNA_def_property_pointer_sdna(prop, NULL, "pd2");
02525         RNA_def_property_struct_type(prop, "FieldSettings");
02526         RNA_def_property_pointer_funcs(prop, "rna_Particle_field2_get", NULL, NULL, NULL);
02527         RNA_def_property_ui_text(prop, "Force Field 2", "");
02528 }
02529 
02530 static void rna_def_particle_target(BlenderRNA *brna)
02531 {
02532         StructRNA *srna;
02533         PropertyRNA *prop;
02534 
02535         static EnumPropertyItem mode_items[] = {
02536                 {PTARGET_MODE_FRIEND, "FRIEND", 0, "Friend", ""},
02537                 {PTARGET_MODE_NEUTRAL, "NEUTRAL", 0, "Neutral", ""},
02538                 {PTARGET_MODE_ENEMY, "ENEMY", 0, "Enemy", ""},
02539                 {0, NULL, 0, NULL, NULL}
02540         };
02541 
02542 
02543         srna = RNA_def_struct(brna, "ParticleTarget", NULL);
02544         RNA_def_struct_ui_text(srna, "Particle Target", "Target particle system");
02545 
02546         prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
02547         RNA_def_property_string_funcs(prop, "rna_ParticleTarget_name_get", "rna_ParticleTarget_name_length", NULL);
02548         RNA_def_property_ui_text(prop, "Name", "Particle target name");
02549         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
02550         RNA_def_struct_name_property(srna, prop);
02551 
02552         prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
02553         RNA_def_property_pointer_sdna(prop, NULL, "ob");
02554         RNA_def_property_flag(prop, PROP_EDITABLE);
02555         RNA_def_property_ui_text(prop, "Target Object", "The object that has the target particle system (empty if same object)");
02556         RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
02557 
02558         prop= RNA_def_property(srna, "system", PROP_INT, PROP_UNSIGNED);
02559         RNA_def_property_int_sdna(prop, NULL, "psys");
02560         RNA_def_property_range(prop, 1, INT_MAX);
02561         RNA_def_property_ui_text(prop, "Target Particle System", "The index of particle system on the target object");
02562         RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
02563 
02564         prop= RNA_def_property(srna, "time", PROP_FLOAT, PROP_TIME);
02565         RNA_def_property_float_sdna(prop, NULL, "time");
02566         RNA_def_property_range(prop, 0.0, 30000.0f); //TODO: replace 30000 with MAXFRAMEF when available in 2.5
02567         RNA_def_property_ui_text(prop, "Time", "");
02568         RNA_def_property_update(prop, 0, "rna_Particle_target_redo");
02569 
02570         prop= RNA_def_property(srna, "duration", PROP_FLOAT, PROP_NONE);
02571         RNA_def_property_float_sdna(prop, NULL, "duration");
02572         RNA_def_property_range(prop, 0.0, 30000.0f); //TODO: replace 30000 with MAXFRAMEF when available in 2.5
02573         RNA_def_property_ui_text(prop, "Duration", "");
02574         RNA_def_property_update(prop, 0, "rna_Particle_target_redo");
02575 
02576         prop= RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
02577         RNA_def_property_boolean_sdna(prop, NULL, "flag", PTARGET_VALID);
02578         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
02579         RNA_def_property_ui_text(prop, "Valid", "Keyed particles target is valid");
02580 
02581         prop= RNA_def_property(srna, "alliance", PROP_ENUM, PROP_NONE);
02582         RNA_def_property_enum_sdna(prop, NULL, "mode");
02583         RNA_def_property_enum_items(prop, mode_items);
02584         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
02585         RNA_def_property_ui_text(prop, "Mode", "");
02586         RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
02587 
02588 }
02589 static void rna_def_particle_system(BlenderRNA *brna)
02590 {
02591         StructRNA *srna;
02592         PropertyRNA *prop;
02593 
02594         srna= RNA_def_struct(brna, "ParticleSystem", NULL);
02595         RNA_def_struct_ui_text(srna, "Particle System", "Particle system in an object");
02596         RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
02597 
02598         prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
02599         RNA_def_property_ui_text(prop, "Name", "Particle system name");
02600         RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER|NA_RENAME, NULL);
02601         RNA_def_struct_name_property(srna, prop);
02602 
02603         /* access to particle settings is redirected through functions */
02604         /* to allow proper id-buttons functionality */
02605         prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
02606         //RNA_def_property_pointer_sdna(prop, NULL, "part");
02607         RNA_def_property_struct_type(prop, "ParticleSettings");
02608         RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_NULL);
02609         RNA_def_property_pointer_funcs(prop, "rna_particle_settings_get", "rna_particle_settings_set", NULL, NULL);
02610         RNA_def_property_ui_text(prop, "Settings", "Particle system settings");
02611         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02612 
02613         prop= RNA_def_property(srna, "particles", PROP_COLLECTION, PROP_NONE);
02614         RNA_def_property_collection_sdna(prop, NULL, "particles", "totpart");
02615         RNA_def_property_struct_type(prop, "Particle");
02616         RNA_def_property_ui_text(prop, "Particles", "Particles generated by the particle system");
02617 
02618         prop= RNA_def_property(srna, "child_particles", PROP_COLLECTION, PROP_NONE);
02619         RNA_def_property_collection_sdna(prop, NULL, "child", "totchild");
02620         RNA_def_property_struct_type(prop, "ChildParticle");
02621         RNA_def_property_ui_text(prop, "Child Particles", "Child particles generated by the particle system");
02622 
02623         prop= RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED);
02624         RNA_def_property_ui_text(prop, "Seed", "Offset in the random number table, to get a different randomized result");
02625         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02626 
02627         prop= RNA_def_property(srna, "child_seed", PROP_INT, PROP_UNSIGNED);
02628         RNA_def_property_ui_text(prop, "Child Seed", "Offset in the random number table for child particles, to get a different randomized result");
02629         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02630 
02631         /* hair */
02632         prop= RNA_def_property(srna, "is_global_hair", PROP_BOOLEAN, PROP_NONE);
02633         RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_GLOBAL_HAIR);
02634         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
02635         RNA_def_property_ui_text(prop, "Global Hair", "Hair keys are in global coordinate space");
02636 
02637         prop= RNA_def_property(srna, "use_hair_dynamics", PROP_BOOLEAN, PROP_NONE);
02638         RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_HAIR_DYNAMICS);
02639         RNA_def_property_ui_text(prop, "Hair Dynamics", "Enable hair dynamics using cloth simulation");
02640         RNA_def_property_update(prop, 0, "rna_Particle_hair_dynamics");
02641 
02642         prop= RNA_def_property(srna, "cloth", PROP_POINTER, PROP_NONE);
02643         RNA_def_property_pointer_sdna(prop, NULL, "clmd");
02644         RNA_def_property_struct_type(prop, "ClothModifier");
02645         RNA_def_property_flag(prop, PROP_NEVER_NULL);
02646         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
02647         RNA_def_property_ui_text(prop, "Cloth", "Cloth dynamics for hair");
02648 
02649         /* reactor */
02650         prop= RNA_def_property(srna, "reactor_target_object", PROP_POINTER, PROP_NONE);
02651         RNA_def_property_pointer_sdna(prop, NULL, "target_ob");
02652         RNA_def_property_flag(prop, PROP_EDITABLE);
02653         RNA_def_property_ui_text(prop, "Reactor Target Object", "For reactor systems, the object that has the target particle system (empty if same object)");
02654         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02655 
02656         prop= RNA_def_property(srna, "reactor_target_particle_system", PROP_INT, PROP_UNSIGNED);
02657         RNA_def_property_int_sdna(prop, NULL, "target_psys");
02658         RNA_def_property_range(prop, 1, SHRT_MAX);
02659         RNA_def_property_ui_text(prop, "Reactor Target Particle System", "For reactor systems, index of particle system on the target object");
02660         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02661 
02662         /* keyed */
02663         prop= RNA_def_property(srna, "use_keyed_timing", PROP_BOOLEAN, PROP_NONE);
02664         RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_KEYED_TIMING);
02665         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
02666         RNA_def_property_ui_text(prop, "Keyed timing", "Use key times");
02667         RNA_def_property_update(prop, 0, "rna_Particle_redo");
02668 
02669         prop= RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
02670         RNA_def_property_struct_type(prop, "ParticleTarget");
02671         RNA_def_property_ui_text(prop, "Targets", "Target particle systems");
02672 
02673         prop= RNA_def_property(srna, "active_particle_target", PROP_POINTER, PROP_NONE);
02674         RNA_def_property_struct_type(prop, "ParticleTarget");
02675         RNA_def_property_pointer_funcs(prop, "rna_ParticleSystem_active_particle_target_get", NULL, NULL, NULL);
02676         RNA_def_property_ui_text(prop, "Active Particle Target", "");
02677 
02678         prop= RNA_def_property(srna, "active_particle_target_index", PROP_INT, PROP_UNSIGNED);
02679         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");
02680         RNA_def_property_ui_text(prop, "Active Particle Target Index", "");
02681 
02682 
02683         /* billboard */
02684         prop= RNA_def_property(srna, "billboard_normal_uv", PROP_STRING, PROP_NONE);
02685         RNA_def_property_string_sdna(prop, NULL, "bb_uvname[0]");
02686         RNA_def_property_string_maxlength(prop, 32);
02687         RNA_def_property_ui_text(prop, "Billboard Normal UV", "UV Layer to control billboard normals");
02688 
02689         prop= RNA_def_property(srna, "billboard_time_index_uv", PROP_STRING, PROP_NONE);
02690         RNA_def_property_string_sdna(prop, NULL, "bb_uvname[1]");
02691         RNA_def_property_string_maxlength(prop, 32);
02692         RNA_def_property_ui_text(prop, "Billboard Time Index UV", "UV Layer to control billboard time index (X-Y)");
02693 
02694         prop= RNA_def_property(srna, "billboard_split_uv", PROP_STRING, PROP_NONE);
02695         RNA_def_property_string_sdna(prop, NULL, "bb_uvname[2]");
02696         RNA_def_property_string_maxlength(prop, 32);
02697         RNA_def_property_ui_text(prop, "Billboard Split UV", "UV Layer to control billboard splitting");
02698 
02699         /* vertex groups */
02700 
02701         /* note, internally store as ints, access as strings */
02702 #if 0 // int access. works ok but isnt useful for the UI
02703         prop= RNA_def_property(srna, "vertex_group_density", PROP_INT, PROP_NONE);
02704         RNA_def_property_int_sdna(prop, NULL, "vgroup[0]");
02705         RNA_def_property_ui_text(prop, "Vertex Group Density", "Vertex group to control density");
02706         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02707 #endif
02708 
02709         prop= RNA_def_property(srna, "vertex_group_density", PROP_STRING, PROP_NONE);
02710         RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_0", "rna_ParticleVGroup_name_len_0", "rna_ParticleVGroup_name_set_0");
02711         RNA_def_property_ui_text(prop, "Vertex Group Density", "Vertex group to control density");
02712         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02713 
02714         prop= RNA_def_property(srna, "invert_vertex_group_density", PROP_BOOLEAN, PROP_NONE);
02715         RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_DENSITY));
02716         RNA_def_property_ui_text(prop, "Vertex Group Density Negate", "Negate the effect of the density vertex group");
02717         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02718 
02719         prop= RNA_def_property(srna, "vertex_group_velocity", PROP_STRING, PROP_NONE);
02720         RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_1", "rna_ParticleVGroup_name_len_1", "rna_ParticleVGroup_name_set_1");
02721         RNA_def_property_ui_text(prop, "Vertex Group Velocity", "Vertex group to control velocity");
02722         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02723 
02724         prop= RNA_def_property(srna, "invert_vertex_group_velocity", PROP_BOOLEAN, PROP_NONE);
02725         RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_VEL));
02726         RNA_def_property_ui_text(prop, "Vertex Group Velocity Negate", "Negate the effect of the velocity vertex group");
02727         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02728 
02729         prop= RNA_def_property(srna, "vertex_group_length", PROP_STRING, PROP_NONE);
02730         RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_2", "rna_ParticleVGroup_name_len_2", "rna_ParticleVGroup_name_set_2");
02731         RNA_def_property_ui_text(prop, "Vertex Group Length", "Vertex group to control length");
02732         RNA_def_property_update(prop, 0, "rna_Particle_redo");
02733 
02734         prop= RNA_def_property(srna, "invert_vertex_group_length", PROP_BOOLEAN, PROP_NONE);
02735         RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_LENGTH));
02736         RNA_def_property_ui_text(prop, "Vertex Group Length Negate", "Negate the effect of the length vertex group");
02737         RNA_def_property_update(prop, 0, "rna_Particle_redo");
02738 
02739         prop= RNA_def_property(srna, "vertex_group_clump", PROP_STRING, PROP_NONE);
02740         RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_3", "rna_ParticleVGroup_name_len_3", "rna_ParticleVGroup_name_set_3");
02741         RNA_def_property_ui_text(prop, "Vertex Group Clump", "Vertex group to control clump");
02742         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02743 
02744         prop= RNA_def_property(srna, "invert_vertex_group_clump", PROP_BOOLEAN, PROP_NONE);
02745         RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_CLUMP));
02746         RNA_def_property_ui_text(prop, "Vertex Group Clump Negate", "Negate the effect of the clump vertex group");
02747         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02748 
02749         prop= RNA_def_property(srna, "vertex_group_kink", PROP_STRING, PROP_NONE);
02750         RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_4", "rna_ParticleVGroup_name_len_4", "rna_ParticleVGroup_name_set_4");
02751         RNA_def_property_ui_text(prop, "Vertex Group Kink", "Vertex group to control kink");
02752         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02753 
02754         prop= RNA_def_property(srna, "invert_vertex_group_kink", PROP_BOOLEAN, PROP_NONE);
02755         RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_KINK));
02756         RNA_def_property_ui_text(prop, "Vertex Group Kink Negate", "Negate the effect of the kink vertex group");
02757         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02758 
02759         prop= RNA_def_property(srna, "vertex_group_roughness_1", PROP_STRING, PROP_NONE);
02760         RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_5", "rna_ParticleVGroup_name_len_5", "rna_ParticleVGroup_name_set_5");
02761         RNA_def_property_ui_text(prop, "Vertex Group Roughness 1", "Vertex group to control roughness 1");
02762         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02763 
02764         prop= RNA_def_property(srna, "invert_vertex_group_roughness_1", PROP_BOOLEAN, PROP_NONE);
02765         RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGH1));
02766         RNA_def_property_ui_text(prop, "Vertex Group Roughness 1 Negate", "Negate the effect of the roughness 1 vertex group");
02767         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02768 
02769         prop= RNA_def_property(srna, "vertex_group_roughness_2", PROP_STRING, PROP_NONE);
02770         RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_6", "rna_ParticleVGroup_name_len_6", "rna_ParticleVGroup_name_set_6");
02771         RNA_def_property_ui_text(prop, "Vertex Group Roughness 2", "Vertex group to control roughness 2");
02772         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02773 
02774         prop= RNA_def_property(srna, "invert_vertex_group_roughness_2", PROP_BOOLEAN, PROP_NONE);
02775         RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGH2));
02776         RNA_def_property_ui_text(prop, "Vertex Group Roughness 2 Negate", "Negate the effect of the roughness 2 vertex group");
02777         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02778 
02779         prop= RNA_def_property(srna, "vertex_group_roughness_end", PROP_STRING, PROP_NONE);
02780         RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_7", "rna_ParticleVGroup_name_len_7", "rna_ParticleVGroup_name_set_7");
02781         RNA_def_property_ui_text(prop, "Vertex Group Roughness End", "Vertex group to control roughness end");
02782         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02783 
02784         prop= RNA_def_property(srna, "invert_vertex_group_roughness_end", PROP_BOOLEAN, PROP_NONE);
02785         RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGHE));
02786         RNA_def_property_ui_text(prop, "Vertex Group Roughness End Negate", "Negate the effect of the roughness end vertex group");
02787         RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
02788 
02789         prop= RNA_def_property(srna, "vertex_group_size", PROP_STRING, PROP_NONE);
02790         RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_8", "rna_ParticleVGroup_name_len_8", "rna_ParticleVGroup_name_set_8");
02791         RNA_def_property_ui_text(prop, "Vertex Group Size", "Vertex group to control size");
02792         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02793 
02794         prop= RNA_def_property(srna, "invert_vertex_group_size", PROP_BOOLEAN, PROP_NONE);
02795         RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_SIZE));
02796         RNA_def_property_ui_text(prop, "Vertex Group Size Negate", "Negate the effect of the size vertex group");
02797         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02798 
02799         prop= RNA_def_property(srna, "vertex_group_tangent", PROP_STRING, PROP_NONE);
02800         RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_9", "rna_ParticleVGroup_name_len_9", "rna_ParticleVGroup_name_set_9");
02801         RNA_def_property_ui_text(prop, "Vertex Group Tangent", "Vertex group to control tangent");
02802         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02803 
02804         prop= RNA_def_property(srna, "invert_vertex_group_tangent", PROP_BOOLEAN, PROP_NONE);
02805         RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_TAN));
02806         RNA_def_property_ui_text(prop, "Vertex Group Tangent Negate", "Negate the effect of the tangent vertex group");
02807         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02808 
02809         prop= RNA_def_property(srna, "vertex_group_rotation", PROP_STRING, PROP_NONE);
02810         RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_10", "rna_ParticleVGroup_name_len_10", "rna_ParticleVGroup_name_set_10");
02811         RNA_def_property_ui_text(prop, "Vertex Group Rotation", "Vertex group to control rotation");
02812         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02813 
02814         prop= RNA_def_property(srna, "invert_vertex_group_rotation", PROP_BOOLEAN, PROP_NONE);
02815         RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROT));
02816         RNA_def_property_ui_text(prop, "Vertex Group Rotation Negate", "Negate the effect of the rotation vertex group");
02817         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02818 
02819         prop= RNA_def_property(srna, "vertex_group_field", PROP_STRING, PROP_NONE);
02820         RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_11", "rna_ParticleVGroup_name_len_11", "rna_ParticleVGroup_name_set_11");
02821         RNA_def_property_ui_text(prop, "Vertex Group Field", "Vertex group to control field");
02822         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02823 
02824         prop= RNA_def_property(srna, "invert_vertex_group_field", PROP_BOOLEAN, PROP_NONE);
02825         RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_EFFECTOR));
02826         RNA_def_property_ui_text(prop, "Vertex Group Field Negate", "Negate the effect of the field vertex group");
02827         RNA_def_property_update(prop, 0, "rna_Particle_reset");
02828 
02829         /* pointcache */
02830         prop= RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
02831         RNA_def_property_flag(prop, PROP_NEVER_NULL);
02832         RNA_def_property_pointer_sdna(prop, NULL, "pointcache");
02833         RNA_def_property_struct_type(prop, "PointCache");
02834         RNA_def_property_ui_text(prop, "Point Cache", "");
02835 
02836         prop= RNA_def_property(srna, "has_multiple_caches", PROP_BOOLEAN, PROP_NONE);
02837         RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_multiple_caches_get", NULL);
02838         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
02839         RNA_def_property_ui_text(prop, "Multiple Caches", "Particle system has multiple point caches");
02840 
02841         /* offset ob */
02842         prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
02843         RNA_def_property_pointer_sdna(prop, NULL, "parent");
02844         RNA_def_property_flag(prop, PROP_EDITABLE);
02845         RNA_def_property_ui_text(prop, "Parent", "Use this object's coordinate system instead of global coordinate system");
02846         RNA_def_property_update(prop, 0, "rna_Particle_redo");
02847 
02848         /* hair or cache editing */
02849         prop= RNA_def_property(srna, "is_editable", PROP_BOOLEAN, PROP_NONE);
02850         RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_editable_get", NULL);
02851         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
02852         RNA_def_property_ui_text(prop, "Editable", "Particle system can be edited in particle mode");
02853 
02854         prop= RNA_def_property(srna, "is_edited", PROP_BOOLEAN, PROP_NONE);
02855         RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_edited_get", NULL);
02856         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
02857         RNA_def_property_ui_text(prop, "Edited", "Particle system has been edited in particle mode");
02858 
02859 
02860         RNA_def_struct_path_func(srna, "rna_ParticleSystem_path");
02861 }
02862 
02863 void RNA_def_particle(BlenderRNA *brna)
02864 {
02865         rna_def_particle_target(brna);
02866         rna_def_fluid_settings(brna);
02867         rna_def_particle_hair_key(brna);
02868         rna_def_particle_key(brna);
02869         
02870         rna_def_child_particle(brna);
02871         rna_def_particle(brna);
02872         rna_def_particle_dupliweight(brna);
02873         rna_def_particle_system(brna);
02874         rna_def_particle_settings_mtex(brna);
02875         rna_def_particle_settings(brna);        
02876 }
02877 
02878 #endif
02879