Blender V2.61 - r43446

rna_particle.c

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