Blender V2.61 - r43446

rna_object_force.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), Thomas Dinges
00019  *
00020  * ***** END GPL LICENSE BLOCK *****
00021  */
00022 
00028 #include <stdlib.h>
00029 
00030 #include "RNA_define.h"
00031 
00032 #include "rna_internal.h"
00033 
00034 #include "DNA_cloth_types.h"
00035 #include "DNA_object_types.h"
00036 #include "DNA_object_force.h"
00037 #include "DNA_particle_types.h"
00038 #include "DNA_scene_types.h"
00039 #include "DNA_smoke_types.h"
00040 
00041 #include "WM_api.h"
00042 #include "WM_types.h"
00043 
00044 static EnumPropertyItem effector_shape_items[] = {
00045     {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
00046     {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""},
00047     {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Surface", ""},
00048     {PFIELD_SHAPE_POINTS, "POINTS", 0, "Every Point", ""},
00049     {0, NULL, 0, NULL, NULL}
00050 };
00051 
00052 #ifdef RNA_RUNTIME
00053 
00054 /* type specific return values only used from functions */
00055 static EnumPropertyItem curve_shape_items[] = {
00056     {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
00057     {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""},
00058     {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Curve", ""},
00059     {0, NULL, 0, NULL, NULL}
00060 };
00061 
00062 static EnumPropertyItem empty_shape_items[] = {
00063     {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
00064     {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""},
00065     {0, NULL, 0, NULL, NULL}
00066 };
00067 
00068 static EnumPropertyItem vortex_shape_items[] = {
00069     {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
00070     {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""},
00071     {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Surface falloff (New)", ""},
00072     {PFIELD_SHAPE_POINTS, "POINTS", 0, "Every Point (New)", ""},
00073     {0, NULL, 0, NULL, NULL}
00074 };
00075 
00076 static EnumPropertyItem curve_vortex_shape_items[] = {
00077     {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
00078     {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""},
00079     {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Curve (New)", ""},
00080     {0, NULL, 0, NULL, NULL}
00081 };
00082 
00083 static EnumPropertyItem empty_vortex_shape_items[] = {
00084     {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
00085     {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""},
00086     {0, NULL, 0, NULL, NULL}
00087 };
00088 
00089 #include "MEM_guardedalloc.h"
00090 
00091 #include "DNA_modifier_types.h"
00092 #include "DNA_texture_types.h"
00093 
00094 #include "BKE_context.h"
00095 #include "BKE_modifier.h"
00096 #include "BKE_pointcache.h"
00097 #include "BKE_depsgraph.h"
00098 
00099 #include "ED_object.h"
00100 
00101 static void rna_Cache_change(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
00102 {
00103     Object *ob = (Object*)ptr->id.data;
00104     PointCache *cache = (PointCache*)ptr->data;
00105     PTCacheID *pid = NULL;
00106     ListBase pidlist;
00107 
00108     if(!ob)
00109         return;
00110 
00111     cache->flag |= PTCACHE_OUTDATED;
00112 
00113     BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
00114 
00115     DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
00116 
00117     for(pid=pidlist.first; pid; pid=pid->next) {
00118         if(pid->cache==cache)
00119             break;
00120     }
00121 
00122     if(pid) {
00123         /* Just make sure this wasn't changed. */
00124         if(pid->type == PTCACHE_TYPE_SMOKE_DOMAIN)
00125             cache->step = 1;
00126         BKE_ptcache_update_info(pid);
00127     }
00128 
00129     BLI_freelistN(&pidlist);
00130 }
00131 
00132 static void rna_Cache_toggle_disk_cache(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
00133 {
00134     Object *ob = (Object*)ptr->id.data;
00135     PointCache *cache = (PointCache*)ptr->data;
00136     PTCacheID *pid = NULL;
00137     ListBase pidlist;
00138 
00139     if(!ob)
00140         return;
00141 
00142     BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
00143 
00144     for(pid=pidlist.first; pid; pid=pid->next) {
00145         if(pid->cache==cache)
00146             break;
00147     }
00148 
00149     /* smoke can only use disk cache */
00150     if(pid && pid->type != PTCACHE_TYPE_SMOKE_DOMAIN)
00151         BKE_ptcache_toggle_disk_cache(pid);
00152     else
00153         cache->flag ^= PTCACHE_DISK_CACHE;
00154 
00155     BLI_freelistN(&pidlist);
00156 }
00157 
00158 static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
00159 {
00160     Object *ob = (Object*)ptr->id.data;
00161     PointCache *cache = (PointCache*)ptr->data;
00162     PTCacheID *pid = NULL, *pid2= NULL;
00163     ListBase pidlist;
00164     int new_name = 1;
00165 
00166     if(!ob)
00167         return;
00168 
00169     /* TODO: check for proper characters */
00170 
00171     BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
00172 
00173     if(cache->flag & PTCACHE_EXTERNAL) {
00174         for(pid=pidlist.first; pid; pid=pid->next) {
00175             if(pid->cache==cache)
00176                 break;
00177         }
00178 
00179         if(!pid)
00180             return;
00181 
00182         BKE_ptcache_load_external(pid);
00183 
00184         DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
00185     }
00186     else {
00187         for(pid=pidlist.first; pid; pid=pid->next) {
00188             if(pid->cache==cache)
00189                 pid2 = pid;
00190             else if(cache->name[0] != '\0' && strcmp(cache->name,pid->cache->name)==0) {
00191                 /*TODO: report "name exists" to user */
00192                 BLI_strncpy(cache->name, cache->prev_name, sizeof(cache->name));
00193                 new_name = 0;
00194             }
00195         }
00196 
00197         if(new_name) {
00198             if(pid2 && cache->flag & PTCACHE_DISK_CACHE) {
00199                 char old_name[80];
00200                 char new_name[80];
00201 
00202                 BLI_strncpy(old_name, cache->prev_name, sizeof(old_name));
00203                 BLI_strncpy(new_name, cache->name, sizeof(new_name));
00204 
00205                 BKE_ptcache_disk_cache_rename(pid2, old_name, new_name);
00206             }
00207 
00208             BLI_strncpy(cache->prev_name, cache->name, sizeof(cache->prev_name));
00209         }
00210     }
00211 
00212     BLI_freelistN(&pidlist);
00213 }
00214 
00215 static void rna_Cache_list_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
00216 {
00217     PointCache *cache= ptr->data;
00218     ListBase lb;
00219 
00220     while(cache->prev)
00221         cache= cache->prev;
00222 
00223     lb.first= cache;
00224     lb.last= NULL; /* not used by listbase_begin */
00225 
00226     rna_iterator_listbase_begin(iter, &lb, NULL);
00227 }
00228 static void rna_Cache_active_point_cache_index_range(PointerRNA *ptr, int *min, int *max)
00229 {
00230     Object *ob = ptr->id.data;
00231     PointCache *cache= ptr->data;
00232     PTCacheID *pid;
00233     ListBase pidlist;
00234 
00235     BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
00236     
00237     *min= 0;
00238     *max= 0;
00239 
00240     for(pid=pidlist.first; pid; pid=pid->next) {
00241         if(pid->cache == cache) {
00242             *max= BLI_countlist(pid->ptcaches)-1;
00243             *max= MAX2(0, *max);
00244             break;
00245         }
00246     }
00247 
00248     BLI_freelistN(&pidlist);
00249 }
00250 
00251 static int rna_Cache_active_point_cache_index_get(PointerRNA *ptr)
00252 {
00253     Object *ob = ptr->id.data;
00254     PointCache *cache= ptr->data;
00255     PTCacheID *pid;
00256     ListBase pidlist;
00257     int num = 0;
00258 
00259     BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
00260     
00261     for(pid=pidlist.first; pid; pid=pid->next) {
00262         if(pid->cache == cache) {
00263             num = BLI_findindex(pid->ptcaches, cache);
00264             break;
00265         }
00266     }
00267 
00268     BLI_freelistN(&pidlist);
00269 
00270     return num;
00271 }
00272 
00273 static void rna_Cache_active_point_cache_index_set(struct PointerRNA *ptr, int value)
00274 {
00275     Object *ob = ptr->id.data;
00276     PointCache *cache= ptr->data;
00277     PTCacheID *pid;
00278     ListBase pidlist;
00279 
00280     BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
00281     
00282     for(pid=pidlist.first; pid; pid=pid->next) {
00283         if(pid->cache == cache) {
00284             *(pid->cache_ptr) = BLI_findlink(pid->ptcaches, value);
00285             break;
00286         }
00287     }
00288 
00289     BLI_freelistN(&pidlist);
00290 }
00291 
00292 static void rna_PointCache_frame_step_range(PointerRNA *ptr, int *min, int *max)
00293 {
00294     Object *ob = ptr->id.data;
00295     PointCache *cache= ptr->data;
00296     PTCacheID *pid;
00297     ListBase pidlist;
00298 
00299     *min= 1;
00300     *max= 20;
00301 
00302     BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
00303     
00304     for(pid=pidlist.first; pid; pid=pid->next) {
00305         if(pid->cache == cache) {
00306             *max= pid->max_step;
00307             break;
00308         }
00309     }
00310 
00311     BLI_freelistN(&pidlist);
00312 }
00313 
00314 static char *rna_CollisionSettings_path(PointerRNA *UNUSED(ptr))
00315 {
00316     /* both methods work ok, but return the shorter path */
00317 #if 0
00318     Object *ob= (Object*)ptr->id.data;
00319     ModifierData *md = (ModifierData *)modifiers_findByType(ob, eModifierType_Collision);
00320 
00321     if(md) {
00322         return BLI_sprintfN("modifiers[\"%s\"].settings", md->name);
00323     }
00324     else {
00325         return BLI_strdup("");
00326     }
00327 #else
00328     /* more reliable */
00329     return BLI_strdup("collision");
00330 #endif
00331 }
00332 
00333 static int rna_SoftBodySettings_use_edges_get(PointerRNA *ptr)
00334 {
00335     Object *data= (Object*)(ptr->id.data);
00336     return (((data->softflag) & OB_SB_EDGES) != 0);
00337 }
00338 
00339 static void rna_SoftBodySettings_use_edges_set(PointerRNA *ptr, int value)
00340 {
00341     Object *data= (Object*)(ptr->id.data);
00342     if(value) data->softflag |= OB_SB_EDGES;
00343     else data->softflag &= ~OB_SB_EDGES;
00344 }
00345 
00346 static int rna_SoftBodySettings_use_goal_get(PointerRNA *ptr)
00347 {
00348     Object *data= (Object*)(ptr->id.data);
00349     return (((data->softflag) & OB_SB_GOAL) != 0);
00350 }
00351 
00352 static void rna_SoftBodySettings_use_goal_set(PointerRNA *ptr, int value)
00353 {
00354     Object *data= (Object*)(ptr->id.data);
00355     if(value) data->softflag |= OB_SB_GOAL;
00356     else data->softflag &= ~OB_SB_GOAL;
00357 }
00358 
00359 static int rna_SoftBodySettings_stiff_quads_get(PointerRNA *ptr)
00360 {
00361     Object *data= (Object*)(ptr->id.data);
00362     return (((data->softflag) & OB_SB_QUADS) != 0);
00363 }
00364 
00365 static void rna_SoftBodySettings_stiff_quads_set(PointerRNA *ptr, int value)
00366 {
00367     Object *data= (Object*)(ptr->id.data);
00368     if(value) data->softflag |= OB_SB_QUADS;
00369     else data->softflag &= ~OB_SB_QUADS;
00370 }
00371 
00372 static int rna_SoftBodySettings_self_collision_get(PointerRNA *ptr)
00373 {
00374     Object *data= (Object*)(ptr->id.data);
00375     return (((data->softflag) & OB_SB_SELF) != 0);
00376 }
00377 
00378 static void rna_SoftBodySettings_self_collision_set(PointerRNA *ptr, int value)
00379 {
00380     Object *data= (Object*)(ptr->id.data);
00381     if(value) data->softflag |= OB_SB_SELF;
00382     else data->softflag &= ~OB_SB_SELF;
00383 }
00384 
00385 static int rna_SoftBodySettings_new_aero_get(PointerRNA *ptr)
00386 {
00387     Object *data= (Object*)(ptr->id.data);
00388     if (data->softflag & OB_SB_AERO_ANGLE)
00389         return 1;
00390     else
00391         return 0;
00392 }
00393 
00394 static void rna_SoftBodySettings_new_aero_set(PointerRNA *ptr, int value)
00395 {
00396     Object *data= (Object*)(ptr->id.data);
00397     if (value == 1)
00398         data->softflag |= OB_SB_AERO_ANGLE;
00399     else    /* value == 0 */
00400         data->softflag &= ~OB_SB_AERO_ANGLE;
00401 }
00402 
00403 static int rna_SoftBodySettings_face_collision_get(PointerRNA *ptr)
00404 {
00405     Object *data= (Object*)(ptr->id.data);
00406     return (((data->softflag) & OB_SB_FACECOLL) != 0);
00407 }
00408 
00409 static void rna_SoftBodySettings_face_collision_set(PointerRNA *ptr, int value)
00410 {
00411     Object *data= (Object*)(ptr->id.data);
00412     if(value) data->softflag |= OB_SB_FACECOLL;
00413     else data->softflag &= ~OB_SB_FACECOLL;
00414 }
00415 
00416 static int rna_SoftBodySettings_edge_collision_get(PointerRNA *ptr)
00417 {
00418     Object *data= (Object*)(ptr->id.data);
00419     return (((data->softflag) & OB_SB_EDGECOLL) != 0);
00420 }
00421 
00422 static void rna_SoftBodySettings_edge_collision_set(PointerRNA *ptr, int value)
00423 {
00424     Object *data= (Object*)(ptr->id.data);
00425     if(value) data->softflag |= OB_SB_EDGECOLL;
00426     else data->softflag &= ~OB_SB_EDGECOLL;
00427 }
00428 
00429 static void rna_SoftBodySettings_goal_vgroup_get(PointerRNA *ptr, char *value)
00430 {
00431     SoftBody *sb= (SoftBody*)ptr->data;
00432     rna_object_vgroup_name_index_get(ptr, value, sb->vertgroup);
00433 }
00434 
00435 static int rna_SoftBodySettings_goal_vgroup_length(PointerRNA *ptr)
00436 {
00437     SoftBody *sb= (SoftBody*)ptr->data;
00438     return rna_object_vgroup_name_index_length(ptr, sb->vertgroup);
00439 }
00440 
00441 static void rna_SoftBodySettings_goal_vgroup_set(PointerRNA *ptr, const char *value)
00442 {
00443     SoftBody *sb= (SoftBody*)ptr->data;
00444     rna_object_vgroup_name_index_set(ptr, value, &sb->vertgroup);
00445 }
00446 
00447 static void rna_SoftBodySettings_mass_vgroup_set(PointerRNA *ptr, const char *value)
00448 {
00449     SoftBody *sb= (SoftBody*)ptr->data;
00450     rna_object_vgroup_name_set(ptr, value, sb->namedVG_Mass, sizeof(sb->namedVG_Mass));
00451 }
00452 
00453 static void rna_SoftBodySettings_spring_vgroup_set(PointerRNA *ptr, const char *value)
00454 {
00455     SoftBody *sb= (SoftBody*)ptr->data;
00456     rna_object_vgroup_name_set(ptr, value, sb->namedVG_Spring_K, sizeof(sb->namedVG_Spring_K));
00457 }
00458 
00459 
00460 static char *rna_SoftBodySettings_path(PointerRNA *ptr)
00461 {
00462     Object *ob= (Object*)ptr->id.data;
00463     ModifierData *md = (ModifierData *)modifiers_findByType(ob, eModifierType_Softbody);
00464     
00465     return BLI_sprintfN("modifiers[\"%s\"].settings", md->name);
00466 }
00467 
00468 static int particle_id_check(PointerRNA *ptr)
00469 {
00470     ID *id= ptr->id.data;
00471 
00472     return (GS(id->name) == ID_PA);
00473 }
00474 
00475 static void rna_FieldSettings_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
00476 {
00477     if(particle_id_check(ptr)) {
00478         ParticleSettings *part = (ParticleSettings*)ptr->id.data;
00479 
00480         if(part->pd->forcefield != PFIELD_TEXTURE && part->pd->tex) {
00481             part->pd->tex->id.us--;
00482             part->pd->tex= NULL;
00483         }
00484 
00485         if(part->pd2->forcefield != PFIELD_TEXTURE && part->pd2->tex) {
00486             part->pd2->tex->id.us--;
00487             part->pd2->tex= NULL;
00488         }
00489 
00490         DAG_id_tag_update(&part->id, OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME|PSYS_RECALC_RESET);
00491         WM_main_add_notifier(NC_OBJECT|ND_DRAW, NULL);
00492 
00493     }
00494     else {
00495         Object *ob = (Object*)ptr->id.data;
00496 
00497         if(ob->pd->forcefield != PFIELD_TEXTURE && ob->pd->tex) {
00498             ob->pd->tex->id.us--;
00499             ob->pd->tex= NULL;
00500         }
00501 
00502         DAG_id_tag_update(&ob->id, OB_RECALC_OB);
00503         WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob);
00504     }
00505 }
00506 
00507 static void rna_FieldSettings_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr)
00508 {
00509     if(!particle_id_check(ptr)) {
00510         Object *ob= (Object*)ptr->id.data;
00511         PartDeflect *pd= ob->pd;
00512         ModifierData *md= modifiers_findByType(ob, eModifierType_Surface);
00513 
00514         /* add/remove modifier as needed */
00515         if(!md) {
00516             if(pd && (pd->shape == PFIELD_SHAPE_SURFACE) && ELEM(pd->forcefield,PFIELD_GUIDE,PFIELD_TEXTURE)==0)
00517                 if(ELEM4(ob->type, OB_MESH, OB_SURF, OB_FONT, OB_CURVE))
00518                     ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Surface);
00519         }
00520         else {
00521             if(!pd || pd->shape != PFIELD_SHAPE_SURFACE)
00522                 ED_object_modifier_remove(NULL, bmain, scene, ob, md);
00523         }
00524 
00525         WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob);
00526     }
00527 }
00528 
00529 static void rna_FieldSettings_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
00530 {
00531     if(particle_id_check(ptr)) {
00532         DAG_id_tag_update((ID*)ptr->id.data, OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME|PSYS_RECALC_RESET);
00533     }
00534     else {
00535         Object *ob= (Object*)ptr->id.data;
00536 
00537         /* do this before scene sort, that one checks for CU_PATH */
00538         /* XXX if(ob->type==OB_CURVE && ob->pd->forcefield==PFIELD_GUIDE) {
00539             Curve *cu= ob->data;
00540             cu->flag |= (CU_PATH|CU_3D);
00541             do_curvebuts(B_CU3D);  // all curves too
00542         }*/
00543 
00544         rna_FieldSettings_shape_update(bmain, scene, ptr);
00545 
00546         DAG_scene_sort(bmain, scene);
00547 
00548         if(ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE)
00549             DAG_id_tag_update(&ob->id, OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME);
00550         else
00551             DAG_id_tag_update(&ob->id, OB_RECALC_OB);
00552 
00553         WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob);
00554     }
00555 }
00556 
00557 static char *rna_FieldSettings_path(PointerRNA *ptr)
00558 {
00559     PartDeflect *pd = (PartDeflect *)ptr->data;
00560     
00561     /* Check through all possible places the settings can be to find the right one */
00562     
00563     if(particle_id_check(ptr)) {
00564         /* particle system force field */
00565         ParticleSettings *part = (ParticleSettings*)ptr->id.data;
00566         
00567         if (part->pd == pd)
00568             return BLI_sprintfN("force_field_1");
00569         else if (part->pd2 == pd)
00570             return BLI_sprintfN("force_field_2");
00571     } else {
00572         /* object force field */
00573         Object *ob= (Object*)ptr->id.data;
00574         
00575         if (ob->pd == pd)
00576             return BLI_sprintfN("field");
00577     }
00578     return NULL;
00579 }
00580 
00581 static void rna_EffectorWeight_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
00582 {
00583     DAG_id_tag_update((ID*)ptr->id.data, OB_RECALC_DATA|PSYS_RECALC_RESET);
00584 
00585     WM_main_add_notifier(NC_OBJECT|ND_DRAW, NULL);
00586 }
00587 
00588 static void rna_EffectorWeight_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
00589 {
00590     DAG_scene_sort(bmain, scene);
00591 
00592     DAG_id_tag_update((ID*)ptr->id.data, OB_RECALC_DATA|PSYS_RECALC_RESET);
00593 
00594     WM_main_add_notifier(NC_OBJECT|ND_DRAW, NULL);
00595 }
00596 
00597 static char *rna_EffectorWeight_path(PointerRNA *ptr)
00598 {
00599     EffectorWeights *ew = (EffectorWeights *)ptr->data;
00600     /* Check through all possible places the settings can be to find the right one */
00601     
00602     if(particle_id_check(ptr)) {
00603         /* particle effector weights */
00604         ParticleSettings *part = (ParticleSettings*)ptr->id.data;
00605         
00606         if (part->effector_weights == ew)
00607             return BLI_sprintfN("effector_weights");
00608     } else {
00609         Object *ob= (Object*)ptr->id.data;
00610         ModifierData *md;
00611         
00612         /* check softbody modifier */
00613         md = (ModifierData *)modifiers_findByType(ob, eModifierType_Softbody);
00614         if (md) {
00615             /* no pointer from modifier data to actual softbody storage, would be good to add */
00616             if (ob->soft->effector_weights == ew)
00617                 return BLI_sprintfN("modifiers[\"%s\"].settings.effector_weights", md->name);
00618         }
00619         
00620         /* check cloth modifier */
00621         md = (ModifierData *)modifiers_findByType(ob, eModifierType_Cloth);
00622         if (md) {
00623             ClothModifierData *cmd = (ClothModifierData *)md;
00624             
00625             if (cmd->sim_parms->effector_weights == ew)
00626                 return BLI_sprintfN("modifiers[\"%s\"].settings.effector_weights", md->name);
00627         }
00628         
00629         /* check smoke modifier */
00630         md = (ModifierData *)modifiers_findByType(ob, eModifierType_Smoke);
00631         if (md) {
00632             SmokeModifierData *smd = (SmokeModifierData *)md;
00633             
00634             if (smd->domain->effector_weights == ew)
00635                 return BLI_sprintfN("modifiers[\"%s\"].settings.effector_weights", md->name);
00636         }
00637 
00638         /* check dynamic paint modifier */
00639         md = (ModifierData *)modifiers_findByType(ob, eModifierType_DynamicPaint);
00640         if (md) {
00641             DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
00642 
00643             if (pmd->canvas) {
00644                 DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
00645 
00646                 for(; surface; surface=surface->next) {
00647                     if (surface->effector_weights == ew)
00648                         return BLI_sprintfN("modifiers[\"%s\"].canvas_settings.canvas_surfaces[\"%s\"].effector_weights",
00649                             md->name, surface->name);
00650                 }
00651             }
00652         }
00653     }
00654     return NULL;
00655 }
00656 
00657 static void rna_CollisionSettings_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
00658 {
00659     Object *ob= (Object*)ptr->id.data;
00660     ModifierData *md= modifiers_findByType(ob, eModifierType_Collision);
00661 
00662     /* add/remove modifier as needed */
00663     if(ob->pd->deflect && !md)
00664         ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Collision);
00665     else if(!ob->pd->deflect && md)
00666         ED_object_modifier_remove(NULL, bmain, scene, ob, md);
00667 
00668     WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob);
00669 }
00670 
00671 static void rna_CollisionSettings_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
00672 {
00673     Object *ob= (Object*)ptr->id.data;
00674 
00675     DAG_id_tag_update(&ob->id, OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME);
00676     WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob);
00677 }
00678 
00679 static void rna_softbody_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
00680 {
00681     Object *ob= (Object*)ptr->id.data;
00682 
00683     DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
00684     WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob);
00685 }
00686 
00687 
00688 static EnumPropertyItem *rna_Effector_shape_itemf(bContext *UNUSED(C), PointerRNA *ptr,
00689                                                   PropertyRNA *UNUSED(prop), int *UNUSED(free))
00690 {
00691     Object *ob= NULL;
00692 
00693     if(particle_id_check(ptr))
00694         return empty_shape_items;
00695     
00696     ob= (Object*)ptr->id.data;
00697     
00698     if(ob->type == OB_CURVE) {
00699         if(ob->pd->forcefield == PFIELD_VORTEX)
00700             return curve_vortex_shape_items;
00701 
00702         return curve_shape_items;
00703     }
00704     else if(ELEM3(ob->type, OB_MESH, OB_SURF, OB_FONT)) {
00705         if(ob->pd->forcefield == PFIELD_VORTEX)
00706             return vortex_shape_items;
00707 
00708         return effector_shape_items;
00709     }
00710     else {
00711         if(ob->pd->forcefield == PFIELD_VORTEX)
00712             return empty_vortex_shape_items;
00713 
00714         return empty_shape_items;
00715     }
00716 }
00717 
00718 #else
00719 
00720 /* ptcache.point_caches */
00721 static void rna_def_ptcache_point_caches(BlenderRNA *brna, PropertyRNA *cprop)
00722 {
00723     StructRNA *srna;
00724     PropertyRNA *prop;
00725 
00726     // FunctionRNA *func;
00727     // PropertyRNA *parm;
00728 
00729     RNA_def_property_srna(cprop, "PointCaches");
00730     srna= RNA_def_struct(brna, "PointCaches", NULL);
00731     RNA_def_struct_sdna(srna, "PointCache");
00732     RNA_def_struct_ui_text(srna, "Point Caches", "Collection of point caches");
00733 
00734     prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
00735     RNA_def_property_int_funcs(prop, "rna_Cache_active_point_cache_index_get", "rna_Cache_active_point_cache_index_set",
00736                                "rna_Cache_active_point_cache_index_range");
00737     RNA_def_property_ui_text(prop, "Active Point Cache Index", "");
00738     RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
00739 }
00740 
00741 static void rna_def_pointcache(BlenderRNA *brna)
00742 {
00743     StructRNA *srna;
00744     PropertyRNA *prop;
00745 
00746     static EnumPropertyItem point_cache_compress_items[] = {
00747         {PTCACHE_COMPRESS_NO, "NO", 0, "No", "No compression"},
00748         {PTCACHE_COMPRESS_LZO, "LIGHT", 0, "Light", "Fast but not so effective compression"},
00749         {PTCACHE_COMPRESS_LZMA, "HEAVY", 0, "Heavy", "Effective but slow compression"},
00750         {0, NULL, 0, NULL, NULL}};
00751 
00752     srna= RNA_def_struct(brna, "PointCache", NULL);
00753     RNA_def_struct_ui_text(srna, "Point Cache", "Point cache for physics simulations");
00754     RNA_def_struct_ui_icon(srna, ICON_PHYSICS);
00755     
00756     prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
00757     RNA_def_property_int_sdna(prop, NULL, "startframe");
00758     RNA_def_property_range(prop, 1, MAXFRAME);
00759     RNA_def_property_ui_text(prop, "Start", "Frame on which the simulation starts");
00760     
00761     prop= RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
00762     RNA_def_property_int_sdna(prop, NULL, "endframe");
00763     RNA_def_property_range(prop, 1, MAXFRAME);
00764     RNA_def_property_ui_text(prop, "End", "Frame on which the simulation stops");
00765 
00766     prop= RNA_def_property(srna, "frame_step", PROP_INT, PROP_NONE);
00767     RNA_def_property_int_sdna(prop, NULL, "step");
00768     RNA_def_property_range(prop, 1, 20);
00769     RNA_def_property_int_funcs(prop, NULL, NULL, "rna_PointCache_frame_step_range");
00770     RNA_def_property_ui_text(prop, "Cache Step", "Number of frames between cached frames");
00771     RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
00772 
00773     prop= RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
00774     RNA_def_property_int_sdna(prop, NULL, "index");
00775     RNA_def_property_range(prop, -1, 100);
00776     RNA_def_property_ui_text(prop, "Cache Index", "Index number of cache files");
00777     RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
00778 
00779     prop= RNA_def_property(srna, "compression", PROP_ENUM, PROP_NONE);
00780     RNA_def_property_enum_items(prop, point_cache_compress_items);
00781     RNA_def_property_ui_text(prop, "Cache Compression", "Compression method to be used");
00782 
00783     /* flags */
00784     prop= RNA_def_property(srna, "is_baked", PROP_BOOLEAN, PROP_NONE);
00785     RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_BAKED);
00786     RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00787 
00788     prop= RNA_def_property(srna, "is_baking", PROP_BOOLEAN, PROP_NONE);
00789     RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_BAKING);
00790     RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00791 
00792     prop= RNA_def_property(srna, "use_disk_cache", PROP_BOOLEAN, PROP_NONE);
00793     RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_DISK_CACHE);
00794     RNA_def_property_ui_text(prop, "Disk Cache", "Save cache files to disk (.blend file must be saved first)");
00795     RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_toggle_disk_cache");
00796 
00797     prop= RNA_def_property(srna, "is_outdated", PROP_BOOLEAN, PROP_NONE);
00798     RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_OUTDATED);
00799     RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00800     RNA_def_property_ui_text(prop, "Cache is outdated", "");
00801 
00802     prop= RNA_def_property(srna, "frames_skipped", PROP_BOOLEAN, PROP_NONE);
00803     RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_FRAMES_SKIPPED);
00804     RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00805 
00806     prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
00807     RNA_def_property_string_sdna(prop, NULL, "name");
00808     RNA_def_property_ui_text(prop, "Name", "Cache name");
00809     RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
00810     RNA_def_struct_name_property(srna, prop);
00811 
00812     prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_DIRPATH);
00813     RNA_def_property_string_sdna(prop, NULL, "path");
00814     RNA_def_property_ui_text(prop, "File Path", "Cache file path");
00815     RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
00816 
00817     prop= RNA_def_property(srna, "use_quick_cache", PROP_BOOLEAN, PROP_NONE);
00818     RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_QUICK_CACHE);
00819     RNA_def_property_ui_text(prop, "Quick Cache", "Update simulation with cache steps");
00820     RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
00821 
00822     prop= RNA_def_property(srna, "info", PROP_STRING, PROP_NONE);
00823     RNA_def_property_string_sdna(prop, NULL, "info");
00824     RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00825     RNA_def_property_ui_text(prop, "Cache Info", "Info on current cache status");
00826 
00827     prop= RNA_def_property(srna, "use_external", PROP_BOOLEAN, PROP_NONE);
00828     RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_EXTERNAL);
00829     RNA_def_property_ui_text(prop, "External", "Read cache from an external location");
00830     RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
00831 
00832     prop= RNA_def_property(srna, "use_library_path", PROP_BOOLEAN, PROP_NONE);
00833     RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PTCACHE_IGNORE_LIBPATH);
00834     RNA_def_property_ui_text(prop, "Library Path", "Use this files path when library linked into another file");
00835     RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
00836 
00837     prop= RNA_def_property(srna, "point_caches", PROP_COLLECTION, PROP_NONE);
00838     RNA_def_property_collection_funcs(prop, "rna_Cache_list_begin", "rna_iterator_listbase_next",
00839                                       "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL);
00840     RNA_def_property_struct_type(prop, "PointCache");
00841     RNA_def_property_ui_text(prop, "Point Cache List", "Point cache list");
00842     rna_def_ptcache_point_caches(brna, prop);
00843 }
00844 
00845 static void rna_def_collision(BlenderRNA *brna)
00846 {
00847     StructRNA *srna;
00848     PropertyRNA *prop;
00849 
00850     srna= RNA_def_struct(brna, "CollisionSettings", NULL);
00851     RNA_def_struct_sdna(srna, "PartDeflect");
00852     RNA_def_struct_path_func(srna, "rna_CollisionSettings_path");
00853     RNA_def_struct_ui_text(srna, "Collision Settings", "Collision settings for object in physics simulation");
00854     
00855     prop= RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
00856     RNA_def_property_boolean_sdna(prop, NULL, "deflect", 1);
00857     RNA_def_property_ui_text(prop, "Enabled", "Enable this objects as a collider for physics systems");
00858     RNA_def_property_update(prop, 0, "rna_CollisionSettings_dependency_update");
00859     
00860     /* Particle Interaction */
00861     
00862     prop= RNA_def_property(srna, "damping_factor", PROP_FLOAT, PROP_NONE);
00863     RNA_def_property_float_sdna(prop, NULL, "pdef_damp");
00864     RNA_def_property_range(prop, 0.0f, 1.0f);
00865     RNA_def_property_ui_text(prop, "Damping Factor", "Amount of damping during particle collision");
00866     RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
00867     
00868     prop= RNA_def_property(srna, "damping_random", PROP_FLOAT, PROP_NONE);
00869     RNA_def_property_float_sdna(prop, NULL, "pdef_rdamp");
00870     RNA_def_property_range(prop, 0.0f, 1.0f);
00871     RNA_def_property_ui_text(prop, "Random Damping", "Random variation of damping");
00872     RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
00873     
00874     prop= RNA_def_property(srna, "friction_factor", PROP_FLOAT, PROP_NONE);
00875     RNA_def_property_float_sdna(prop, NULL, "pdef_frict");
00876     RNA_def_property_range(prop, 0.0f, 1.0f);
00877     RNA_def_property_ui_text(prop, "Friction Factor", "Amount of friction during particle collision");
00878     RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
00879     
00880     prop= RNA_def_property(srna, "friction_random", PROP_FLOAT, PROP_NONE);
00881     RNA_def_property_float_sdna(prop, NULL, "pdef_rfrict");
00882     RNA_def_property_range(prop, 0.0f, 1.0f);
00883     RNA_def_property_ui_text(prop, "Random Friction", "Random variation of friction");
00884     RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
00885         
00886     prop= RNA_def_property(srna, "permeability", PROP_FLOAT, PROP_NONE);
00887     RNA_def_property_float_sdna(prop, NULL, "pdef_perm");
00888     RNA_def_property_range(prop, 0.0f, 1.0f);
00889     RNA_def_property_ui_text(prop, "Permeability", "Chance that the particle will pass through the mesh");
00890     RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
00891     
00892     prop= RNA_def_property(srna, "use_particle_kill", PROP_BOOLEAN, PROP_NONE);
00893     RNA_def_property_boolean_sdna(prop, NULL, "flag", PDEFLE_KILL_PART);
00894     RNA_def_property_ui_text(prop, "Kill Particles", "Kill collided particles");
00895     RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
00896 
00897     prop= RNA_def_property(srna, "stickness", PROP_FLOAT, PROP_NONE);
00898     RNA_def_property_float_sdna(prop, NULL, "pdef_stickness");
00899     RNA_def_property_range(prop, 0.0f, 10.0f);
00900     RNA_def_property_ui_text(prop, "Stickness", "Amount of stickness to surface collision");
00901     RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
00902     
00903     /* Soft Body and Cloth Interaction */
00904     
00905     prop= RNA_def_property(srna, "thickness_inner", PROP_FLOAT, PROP_NONE);
00906     RNA_def_property_float_sdna(prop, NULL, "pdef_sbift");
00907     RNA_def_property_range(prop, 0.001f, 1.0f);
00908     RNA_def_property_ui_text(prop, "Inner Thickness", "Inner face thickness");
00909     RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
00910     
00911     prop= RNA_def_property(srna, "thickness_outer", PROP_FLOAT, PROP_NONE);
00912     RNA_def_property_float_sdna(prop, NULL, "pdef_sboft");
00913     RNA_def_property_range(prop, 0.001f, 1.0f);
00914     RNA_def_property_ui_text(prop, "Outer Thickness", "Outer face thickness");
00915     RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
00916     
00917     prop= RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
00918     RNA_def_property_float_sdna(prop, NULL, "pdef_sbdamp");
00919     RNA_def_property_range(prop, 0.0f, 1.0f);
00920     RNA_def_property_ui_text(prop, "Damping", "Amount of damping during collision");
00921     RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
00922 
00923     prop= RNA_def_property(srna, "absorption", PROP_FLOAT, PROP_FACTOR);
00924     RNA_def_property_range(prop, 0.0f, 1.0f);
00925     RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 2);
00926     RNA_def_property_ui_text(prop, "Absorption",
00927                              "How much of effector force gets lost during collision with this object (in percent)");
00928     RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
00929 }
00930 
00931 static void rna_def_effector_weight(BlenderRNA *brna)
00932 {
00933     StructRNA *srna;
00934     PropertyRNA *prop;
00935 
00936     srna= RNA_def_struct(brna, "EffectorWeights", NULL);
00937     RNA_def_struct_sdna(srna, "EffectorWeights");
00938     RNA_def_struct_path_func(srna, "rna_EffectorWeight_path");
00939     RNA_def_struct_ui_text(srna, "Effector Weights", "Effector weights for physics simulation");
00940     RNA_def_struct_ui_icon(srna, ICON_PHYSICS);
00941 
00942     /* Flags */
00943     prop= RNA_def_property(srna, "apply_to_hair_growing", PROP_BOOLEAN, PROP_NONE);
00944     RNA_def_property_boolean_sdna(prop, NULL, "flag", EFF_WEIGHT_DO_HAIR);
00945     RNA_def_property_ui_text(prop, "Use For Growing Hair", "Use force fields when growing hair");
00946     RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
00947     
00948     /* General */
00949     prop= RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
00950     RNA_def_property_flag(prop, PROP_EDITABLE);
00951     RNA_def_property_ui_text(prop, "Effector Group", "Limit effectors to this Group");
00952     RNA_def_property_update(prop, 0, "rna_EffectorWeight_dependency_update");
00953 
00954     prop= RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_NONE);
00955     RNA_def_property_float_sdna(prop, NULL, "global_gravity");
00956     RNA_def_property_range(prop, -200.0f, 200.0f);
00957     RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
00958     RNA_def_property_ui_text(prop, "Gravity", "Global gravity weight");
00959     RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
00960 
00961     /* Effector weights */
00962     prop= RNA_def_property(srna, "all", PROP_FLOAT, PROP_NONE);
00963     RNA_def_property_float_sdna(prop, NULL, "weight[0]");
00964     RNA_def_property_range(prop, -200.0f, 200.0f);
00965     RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
00966     RNA_def_property_ui_text(prop, "All", "All effector's weight");
00967     RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
00968 
00969     prop= RNA_def_property(srna, "force", PROP_FLOAT, PROP_NONE);
00970     RNA_def_property_float_sdna(prop, NULL, "weight[1]");
00971     RNA_def_property_range(prop, -200.0f, 200.0f);
00972     RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
00973     RNA_def_property_ui_text(prop, "Force", "Force effector weight");
00974     RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
00975 
00976     prop= RNA_def_property(srna, "vortex", PROP_FLOAT, PROP_NONE);
00977     RNA_def_property_float_sdna(prop, NULL, "weight[2]");
00978     RNA_def_property_range(prop, -200.0f, 200.0f);
00979     RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
00980     RNA_def_property_ui_text(prop, "Vortex", "Vortex effector weight");
00981     RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
00982 
00983     prop= RNA_def_property(srna, "magnetic", PROP_FLOAT, PROP_NONE);
00984     RNA_def_property_float_sdna(prop, NULL, "weight[3]");
00985     RNA_def_property_range(prop, -200.0f, 200.0f);
00986     RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
00987     RNA_def_property_ui_text(prop, "Magnetic", "Magnetic effector weight");
00988     RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
00989 
00990     prop= RNA_def_property(srna, "wind", PROP_FLOAT, PROP_NONE);
00991     RNA_def_property_float_sdna(prop, NULL, "weight[4]");
00992     RNA_def_property_range(prop, -200.0f, 200.0f);
00993     RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
00994     RNA_def_property_ui_text(prop, "Wind", "Wind effector weight");
00995     RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
00996 
00997     prop= RNA_def_property(srna, "curve_guide", PROP_FLOAT, PROP_NONE);
00998     RNA_def_property_float_sdna(prop, NULL, "weight[5]");
00999     RNA_def_property_range(prop, -200.0f, 200.0f);
01000     RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
01001     RNA_def_property_ui_text(prop, "Curve Guide", "Curve guide effector weight");
01002     RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
01003 
01004     prop= RNA_def_property(srna, "texture", PROP_FLOAT, PROP_NONE);
01005     RNA_def_property_float_sdna(prop, NULL, "weight[6]");
01006     RNA_def_property_range(prop, -200.0f, 200.0f);
01007     RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
01008     RNA_def_property_ui_text(prop, "Texture", "Texture effector weight");
01009     RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
01010 
01011     prop= RNA_def_property(srna, "harmonic", PROP_FLOAT, PROP_NONE);
01012     RNA_def_property_float_sdna(prop, NULL, "weight[7]");
01013     RNA_def_property_range(prop, -200.0f, 200.0f);
01014     RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
01015     RNA_def_property_ui_text(prop, "Harmonic", "Harmonic effector weight");
01016     RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
01017 
01018     prop= RNA_def_property(srna, "charge", PROP_FLOAT, PROP_NONE);
01019     RNA_def_property_float_sdna(prop, NULL, "weight[8]");
01020     RNA_def_property_range(prop, -200.0f, 200.0f);
01021     RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
01022     RNA_def_property_ui_text(prop, "Charge", "Charge effector weight");
01023     RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
01024 
01025     prop= RNA_def_property(srna, "lennardjones", PROP_FLOAT, PROP_NONE);
01026     RNA_def_property_float_sdna(prop, NULL, "weight[9]");
01027     RNA_def_property_range(prop, -200.0f, 200.0f);
01028     RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
01029     RNA_def_property_ui_text(prop, "Lennard-Jones", "Lennard-Jones effector weight");
01030     RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
01031 
01032     prop= RNA_def_property(srna, "boid", PROP_FLOAT, PROP_NONE);
01033     RNA_def_property_float_sdna(prop, NULL, "weight[10]");
01034     RNA_def_property_range(prop, -200.0f, 200.0f);
01035     RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
01036     RNA_def_property_ui_text(prop, "Boid", "Boid effector weight");
01037     RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
01038 
01039     prop= RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
01040     RNA_def_property_float_sdna(prop, NULL, "weight[11]");
01041     RNA_def_property_range(prop, -200.0f, 200.0f);
01042     RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
01043     RNA_def_property_ui_text(prop, "Turbulence", "Turbulence effector weight");
01044     RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
01045 
01046     prop= RNA_def_property(srna, "drag", PROP_FLOAT, PROP_NONE);
01047     RNA_def_property_float_sdna(prop, NULL, "weight[12]");
01048     RNA_def_property_range(prop, -200.0f, 200.0f);
01049     RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
01050     RNA_def_property_ui_text(prop, "Drag", "Drag effector weight");
01051     RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
01052 }
01053 
01054 static void rna_def_field(BlenderRNA *brna)
01055 {
01056     StructRNA *srna;
01057     PropertyRNA *prop;
01058     
01059     static EnumPropertyItem field_type_items[] = {
01060         {0, "NONE", 0, "None", ""},
01061         {PFIELD_FORCE, "FORCE", ICON_FORCE_FORCE, "Force", "Radial field toward the center of object"},
01062         {PFIELD_WIND, "WIND", ICON_FORCE_WIND, "Wind", "Constant force along the force object's local Z axis"},
01063         {PFIELD_VORTEX, "VORTEX", ICON_FORCE_VORTEX, "Vortex", "Spiraling force that twists the force object's local Z axis"},
01064         {PFIELD_MAGNET, "MAGNET", ICON_FORCE_MAGNETIC, "Magnetic", "Forcefield depends on the speed of the particles"},
01065         {PFIELD_HARMONIC, "HARMONIC", ICON_FORCE_HARMONIC, "Harmonic",
01066                           "The source of this force field is the zero point of a harmonic oscillator"},
01067         {PFIELD_CHARGE, "CHARGE", ICON_FORCE_CHARGE, "Charge",
01068                         "Spherical forcefield based on the charge of particles, only influences other charge force fields"},
01069         {PFIELD_LENNARDJ, "LENNARDJ", ICON_FORCE_LENNARDJONES, "Lennard-Jones",
01070                           "Forcefield based on the Lennard-Jones potential"},
01071         {PFIELD_TEXTURE, "TEXTURE", ICON_FORCE_TEXTURE, "Texture", "Forcefield based on a texture"},
01072         {PFIELD_GUIDE, "GUIDE", ICON_FORCE_CURVE, "Curve Guide", "Create a force along a curve object"},
01073         {PFIELD_BOID, "BOID", ICON_FORCE_BOID, "Boid", ""},
01074         {PFIELD_TURBULENCE, "TURBULENCE", ICON_FORCE_TURBULENCE, "Turbulence", "Create turbulence with a noise field"},
01075         {PFIELD_DRAG, "DRAG", ICON_FORCE_DRAG, "Drag", "Create a force that dampens motion"},
01076         {0, NULL, 0, NULL, NULL}};
01077 
01078     static EnumPropertyItem falloff_items[] = {
01079         {PFIELD_FALL_SPHERE, "SPHERE", 0, "Sphere", ""},
01080         {PFIELD_FALL_TUBE, "TUBE", 0, "Tube", ""},
01081         {PFIELD_FALL_CONE, "CONE", 0, "Cone", ""},
01082         {0, NULL, 0, NULL, NULL}};
01083         
01084     static EnumPropertyItem texture_items[] = {
01085         {PFIELD_TEX_RGB, "RGB", 0, "RGB", ""},
01086         {PFIELD_TEX_GRAD, "GRADIENT", 0, "Gradient", ""},
01087         {PFIELD_TEX_CURL, "CURL", 0, "Curl", ""},
01088         {0, NULL, 0, NULL, NULL}};
01089 
01090     static EnumPropertyItem zdirection_items[] = {
01091         {PFIELD_Z_BOTH, "BOTH", 0, "Both Z", ""},
01092         {PFIELD_Z_POS, "POSITIVE", 0, "+Z", ""},
01093         {PFIELD_Z_NEG, "NEGATIVE", 0, "-Z", ""},
01094         {0, NULL, 0, NULL, NULL}};
01095         
01096     static EnumPropertyItem guide_kink_items[] = {
01097         {0, "NONE", 0, "Nothing", ""},
01098         {1, "CURL", 0, "Curl", ""},
01099         {2, "RADIAL", 0, "Radial", ""},
01100         {3, "WAVE", 0, "Wave", ""},
01101         {4, "BRAID", 0, "Braid", ""},
01102         {5, "ROTATION", 0, "Rotation", ""},
01103         {6, "ROLL", 0, "Roll", ""},
01104         {0, NULL, 0, NULL, NULL}};
01105         
01106     static EnumPropertyItem guide_kink_axis_items[] = {
01107         {0, "X", 0, "X", ""},
01108         {1, "Y", 0, "Y", ""},
01109         {2, "Z", 0, "Z", ""},
01110         {0, NULL, 0, NULL, NULL}};
01111 
01112     srna= RNA_def_struct(brna, "FieldSettings", NULL);
01113     RNA_def_struct_sdna(srna, "PartDeflect");
01114     RNA_def_struct_path_func(srna, "rna_FieldSettings_path");
01115     RNA_def_struct_ui_text(srna, "Field Settings", "Field settings for an object in physics simulation");
01116     RNA_def_struct_ui_icon(srna, ICON_PHYSICS);
01117     
01118     /* Enums */
01119     
01120     prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
01121     RNA_def_property_enum_sdna(prop, NULL, "forcefield");
01122     RNA_def_property_enum_items(prop, field_type_items);
01123     RNA_def_property_ui_text(prop, "Type", "Type of field");
01124     RNA_def_property_update(prop, 0, "rna_FieldSettings_dependency_update");
01125 
01126     prop= RNA_def_property(srna, "shape", PROP_ENUM, PROP_NONE);
01127     RNA_def_property_enum_items(prop, effector_shape_items);
01128     RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Effector_shape_itemf");
01129     RNA_def_property_ui_text(prop, "Shape", "Which direction is used to calculate the effector force");
01130     RNA_def_property_update(prop, 0, "rna_FieldSettings_shape_update");
01131     
01132     prop= RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
01133     RNA_def_property_enum_sdna(prop, NULL, "falloff");
01134     RNA_def_property_enum_items(prop, falloff_items);
01135     RNA_def_property_ui_text(prop, "Fall-Off", "");
01136     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01137     
01138     prop= RNA_def_property(srna, "texture_mode", PROP_ENUM, PROP_NONE);
01139     RNA_def_property_enum_sdna(prop, NULL, "tex_mode");
01140     RNA_def_property_enum_items(prop, texture_items);
01141     RNA_def_property_ui_text(prop, "Texture Mode",
01142                              "How the texture effect is calculated (RGB & Curl need a RGB texture, "
01143                              "else Gradient will be used instead)");
01144     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01145 
01146     prop= RNA_def_property(srna, "z_direction", PROP_ENUM, PROP_NONE);
01147     RNA_def_property_enum_sdna(prop, NULL, "zdir");
01148     RNA_def_property_enum_items(prop, zdirection_items);
01149     RNA_def_property_ui_text(prop, "Z Direction", "Effect in full or only positive/negative Z direction");
01150     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01151     
01152     /* Float */
01153     
01154     prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
01155     RNA_def_property_float_sdna(prop, NULL, "f_strength");
01156     RNA_def_property_range(prop, -1000.0f, 1000.0f);
01157     RNA_def_property_ui_text(prop, "Strength", "Strength of force field");
01158     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01159 
01160     /* different ui range to above */
01161     prop= RNA_def_property(srna, "linear_drag", PROP_FLOAT, PROP_NONE);
01162     RNA_def_property_float_sdna(prop, NULL, "f_strength");
01163     RNA_def_property_range(prop, -2.0f, 2.0f);
01164     RNA_def_property_ui_text(prop, "Linear Drag", "Drag component proportional to velocity");
01165     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01166 
01167     prop= RNA_def_property(srna, "harmonic_damping", PROP_FLOAT, PROP_NONE);
01168     RNA_def_property_float_sdna(prop, NULL, "f_damp");
01169     RNA_def_property_range(prop, 0.0f, 10.0f);
01170     RNA_def_property_ui_text(prop, "Harmonic Damping", "Damping of the harmonic force");
01171     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01172 
01173     /* different ui range to above */
01174     prop= RNA_def_property(srna, "quadratic_drag", PROP_FLOAT, PROP_NONE);
01175     RNA_def_property_float_sdna(prop, NULL, "f_damp");
01176     RNA_def_property_range(prop, -2.0f, 2.0f);
01177     RNA_def_property_ui_text(prop, "Quadratic Drag", "Drag component proportional to the square of velocity");
01178     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01179 
01180     prop= RNA_def_property(srna, "flow", PROP_FLOAT, PROP_NONE);
01181     RNA_def_property_float_sdna(prop, NULL, "f_flow");
01182     RNA_def_property_range(prop, 0.0f, 10.0f);
01183     RNA_def_property_ui_text(prop, "Flow", "Convert effector force into air flow velocity");
01184     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01185 
01186     /* different ui range to above */
01187     prop= RNA_def_property(srna, "inflow", PROP_FLOAT, PROP_NONE);
01188     RNA_def_property_float_sdna(prop, NULL, "f_flow");
01189     RNA_def_property_range(prop, -10.0f, 10.0f);
01190     RNA_def_property_ui_text(prop, "Inflow", "Inwards component of the vortex force");
01191     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01192 
01193     prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
01194     RNA_def_property_float_sdna(prop, NULL, "f_size");
01195     RNA_def_property_range(prop, 0.0f, 10.0f);
01196     RNA_def_property_ui_text(prop, "Size", "Size of the turbulence");
01197     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01198 
01199     prop= RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_NONE);
01200     RNA_def_property_float_sdna(prop, NULL, "f_size");
01201     RNA_def_property_range(prop, 0.0f, 1000.0f);
01202     RNA_def_property_ui_text(prop, "Rest Length", "Rest length of the harmonic force");
01203     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01204     
01205     prop= RNA_def_property(srna, "falloff_power", PROP_FLOAT, PROP_NONE);
01206     RNA_def_property_float_sdna(prop, NULL, "f_power");
01207     RNA_def_property_range(prop, 0.0f, 10.0f);
01208     RNA_def_property_ui_text(prop, "Falloff Power", "Falloff power (real gravitational falloff = 2)");
01209     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01210     
01211     prop= RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_NONE);
01212     RNA_def_property_float_sdna(prop, NULL, "mindist");
01213     RNA_def_property_range(prop, 0.0f, 1000.0f);
01214     RNA_def_property_ui_text(prop, "Minimum Distance", "Minimum distance for the field's fall-off");
01215     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01216     
01217     prop= RNA_def_property(srna, "distance_max", PROP_FLOAT, PROP_NONE);
01218     RNA_def_property_float_sdna(prop, NULL, "maxdist");
01219     RNA_def_property_range(prop, 0.0f, 1000.0f);
01220     RNA_def_property_ui_text(prop, "Maximum Distance", "Maximum distance for the field to work");
01221     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01222     
01223     prop= RNA_def_property(srna, "radial_min", PROP_FLOAT, PROP_NONE);
01224     RNA_def_property_float_sdna(prop, NULL, "minrad");
01225     RNA_def_property_range(prop, 0.0f, 1000.0f);
01226     RNA_def_property_ui_text(prop, "Minimum Radial Distance", "Minimum radial distance for the field's fall-off");
01227     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01228     
01229     prop= RNA_def_property(srna, "radial_max", PROP_FLOAT, PROP_NONE);
01230     RNA_def_property_float_sdna(prop, NULL, "maxrad");
01231     RNA_def_property_range(prop, 0.0f, 1000.0f);
01232     RNA_def_property_ui_text(prop, "Maximum Radial Distance", "Maximum radial distance for the field to work");
01233     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01234     
01235     prop= RNA_def_property(srna, "radial_falloff", PROP_FLOAT, PROP_NONE);
01236     RNA_def_property_float_sdna(prop, NULL, "f_power_r");
01237     RNA_def_property_range(prop, 0.0f, 10.0f);
01238     RNA_def_property_ui_text(prop, "Radial Falloff Power", "Radial falloff power (real gravitational falloff = 2)");
01239     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01240 
01241     prop= RNA_def_property(srna, "texture_nabla", PROP_FLOAT, PROP_NONE);
01242     RNA_def_property_float_sdna(prop, NULL, "tex_nabla");
01243     RNA_def_property_range(prop, 0.0001f, 1.0f);
01244     RNA_def_property_ui_text(prop, "Nabla", "Defines size of derivative offset used for calculating gradient and curl");
01245     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01246     
01247     prop= RNA_def_property(srna, "noise", PROP_FLOAT, PROP_NONE);
01248     RNA_def_property_float_sdna(prop, NULL, "f_noise");
01249     RNA_def_property_range(prop, 0.0f, 10.0f);
01250     RNA_def_property_ui_text(prop, "Noise", "Amount of noise for the force strength");
01251     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01252 
01253     prop= RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED);
01254     RNA_def_property_range(prop, 1, 128);
01255     RNA_def_property_ui_text(prop, "Seed", "Seed of the noise");
01256     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01257 
01258     /* Boolean */
01259     
01260     prop= RNA_def_property(srna, "use_min_distance", PROP_BOOLEAN, PROP_NONE);
01261     RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMIN);
01262     RNA_def_property_ui_text(prop, "Use Min", "Use a minimum distance for the field's fall-off");
01263     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01264     
01265     prop= RNA_def_property(srna, "use_max_distance", PROP_BOOLEAN, PROP_NONE);
01266     RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMAX);
01267     RNA_def_property_ui_text(prop, "Use Max", "Use a maximum distance for the field to work");
01268     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01269     
01270     prop= RNA_def_property(srna, "use_radial_min", PROP_BOOLEAN, PROP_NONE);
01271     RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMINR);
01272     RNA_def_property_ui_text(prop, "Use Min", "Use a minimum radial distance for the field's fall-off");
01273     // "Use a minimum angle for the field's fall-off"
01274     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01275     
01276     prop= RNA_def_property(srna, "use_radial_max", PROP_BOOLEAN, PROP_NONE);
01277     RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMAXR);
01278     RNA_def_property_ui_text(prop, "Use Max", "Use a maximum radial distance for the field to work");
01279     // "Use a maximum angle for the field to work"
01280     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01281 
01282     prop= RNA_def_property(srna, "use_object_coords", PROP_BOOLEAN, PROP_NONE);
01283     RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_OBJECT);
01284     RNA_def_property_ui_text(prop, "Use Coordinates", "Use object/global coordinates for texture");
01285     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01286 
01287     prop= RNA_def_property(srna, "use_global_coords", PROP_BOOLEAN, PROP_NONE);
01288     RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GLOBAL_CO);
01289     RNA_def_property_ui_text(prop, "Use Global Coordinates", "Use effector/global coordinates for turbulence");
01290     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01291     
01292     prop= RNA_def_property(srna, "use_2d_force", PROP_BOOLEAN, PROP_NONE);
01293     RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_2D);
01294     RNA_def_property_ui_text(prop, "2D", "Apply force only in 2d");
01295     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01296     
01297     prop= RNA_def_property(srna, "use_root_coords", PROP_BOOLEAN, PROP_NONE);
01298     RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_ROOTCO);
01299     RNA_def_property_ui_text(prop, "Root Texture Coordinates", "Texture coordinates from root particle locations");
01300     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01301 
01302     prop= RNA_def_property(srna, "apply_to_location", PROP_BOOLEAN, PROP_NONE);
01303     RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_DO_LOCATION);
01304     RNA_def_property_ui_text(prop, "Location", "Effect particles' location");
01305     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01306 
01307     prop= RNA_def_property(srna, "apply_to_rotation", PROP_BOOLEAN, PROP_NONE);
01308     RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_DO_ROTATION);
01309     RNA_def_property_ui_text(prop, "Rotation", "Effect particles' dynamic rotation");
01310     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01311 
01312     prop= RNA_def_property(srna, "use_absorption", PROP_BOOLEAN, PROP_NONE);
01313     RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_VISIBILITY);
01314     RNA_def_property_ui_text(prop, "Absorption", "Force gets absorbed by collision objects");
01315     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01316 
01317     prop= RNA_def_property(srna, "use_multiple_springs", PROP_BOOLEAN, PROP_NONE);
01318     RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_MULTIPLE_SPRINGS);
01319     RNA_def_property_ui_text(prop, "Multiple Springs", "Every point is effected by multiple springs");
01320     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01321     
01322     /* Pointer */
01323     
01324     prop= RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
01325     RNA_def_property_pointer_sdna(prop, NULL, "tex");
01326     RNA_def_property_flag(prop, PROP_EDITABLE);
01327     RNA_def_property_ui_text(prop, "Texture", "Texture to use as force");
01328     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01329     
01330     /********** Curve Guide Field Settings **********/
01331     
01332     prop= RNA_def_property(srna, "guide_minimum", PROP_FLOAT, PROP_NONE);
01333     RNA_def_property_float_sdna(prop, NULL, "f_strength");
01334     RNA_def_property_range(prop, 0.0f, 1000.0f);
01335     RNA_def_property_ui_text(prop, "Minimum Distance", "The distance from which particles are affected fully");
01336     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01337 
01338     prop= RNA_def_property(srna, "guide_free", PROP_FLOAT, PROP_NONE);
01339     RNA_def_property_float_sdna(prop, NULL, "free_end");
01340     RNA_def_property_range(prop, 0.0f, 0.99f);
01341     RNA_def_property_ui_text(prop, "Free", "Guide-free time from particle life's end");
01342     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01343 
01344     prop= RNA_def_property(srna, "use_guide_path_add", PROP_BOOLEAN, PROP_NONE);
01345     RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GUIDE_PATH_ADD);
01346     RNA_def_property_ui_text(prop, "Additive", "Based on distance/falloff it adds a portion of the entire path");
01347     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01348 
01349     prop= RNA_def_property(srna, "use_guide_path_weight", PROP_BOOLEAN, PROP_NONE);
01350     RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GUIDE_PATH_WEIGHT);
01351     RNA_def_property_ui_text(prop, "Weights", "Use curve weights to influence the particle influence along the curve");
01352     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01353     
01354     /* Clump Settings */
01355     
01356     prop= RNA_def_property(srna, "guide_clump_amount", PROP_FLOAT, PROP_NONE);
01357     RNA_def_property_float_sdna(prop, NULL, "clump_fac");
01358     RNA_def_property_range(prop, -1.0f, 1.0f);
01359     RNA_def_property_ui_text(prop, "Amount", "Amount of clumping");
01360     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01361     
01362     prop= RNA_def_property(srna, "guide_clump_shape", PROP_FLOAT, PROP_NONE);
01363     RNA_def_property_float_sdna(prop, NULL, "clump_pow");
01364     RNA_def_property_range(prop, -0.999f, 0.999f);
01365     RNA_def_property_ui_text(prop, "Shape", "Shape of clumping");
01366     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01367     
01368     /* Kink Settings */
01369     
01370     prop= RNA_def_property(srna, "guide_kink_type", PROP_ENUM, PROP_NONE);
01371     RNA_def_property_enum_sdna(prop, NULL, "kink");
01372     RNA_def_property_enum_items(prop, guide_kink_items);
01373     RNA_def_property_ui_text(prop, "Kink", "Type of periodic offset on the curve");
01374     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01375     
01376     prop= RNA_def_property(srna, "guide_kink_axis", PROP_ENUM, PROP_NONE);
01377     RNA_def_property_enum_sdna(prop, NULL, "kink_axis");
01378     RNA_def_property_enum_items(prop, guide_kink_axis_items);
01379     RNA_def_property_ui_text(prop, "Axis", "Which axis to use for offset");
01380     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01381 
01382     prop= RNA_def_property(srna, "guide_kink_frequency", PROP_FLOAT, PROP_NONE);
01383     RNA_def_property_float_sdna(prop, NULL, "kink_freq");
01384     RNA_def_property_range(prop, 0.0f, 10.0f);
01385     RNA_def_property_ui_text(prop, "Frequency", "The frequency of the offset (1/total length)");
01386     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01387     
01388     prop= RNA_def_property(srna, "guide_kink_shape", PROP_FLOAT, PROP_NONE);
01389     RNA_def_property_float_sdna(prop, NULL, "kink_shape");
01390     RNA_def_property_range(prop, -0.999f, 0.999f);
01391     RNA_def_property_ui_text(prop, "Shape", "Adjust the offset to the beginning/end");
01392     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01393     
01394     prop= RNA_def_property(srna, "guide_kink_amplitude", PROP_FLOAT, PROP_NONE);
01395     RNA_def_property_float_sdna(prop, NULL, "kink_amp");
01396     RNA_def_property_range(prop, 0.0f, 10.0f);
01397     RNA_def_property_ui_text(prop, "Amplitude", "The amplitude of the offset");
01398     RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
01399 
01400     /* Variables used for Curve Guide, already wrapped, used for other fields too */
01401     // falloff_power, use_max_distance, maximum_distance
01402 }
01403 
01404 static void rna_def_game_softbody(BlenderRNA *brna)
01405 {
01406     StructRNA *srna;
01407     PropertyRNA *prop;
01408 
01409     srna= RNA_def_struct(brna, "GameSoftBodySettings", NULL);
01410     RNA_def_struct_sdna(srna, "BulletSoftBody");
01411     RNA_def_struct_ui_text(srna, "Game Soft Body Settings", "Soft body simulation settings for an object in the game engine");
01412     
01413     /* Floats */
01414     
01415     prop= RNA_def_property(srna, "linear_stiffness", PROP_FLOAT, PROP_NONE);
01416     RNA_def_property_float_sdna(prop, NULL, "linStiff");
01417     RNA_def_property_range(prop, 0.0f, 1.0f);
01418     RNA_def_property_ui_text(prop, "Linear Stiffness", "Linear stiffness of the soft body links");
01419     
01420     prop= RNA_def_property(srna, "dynamic_friction", PROP_FLOAT, PROP_NONE);
01421     RNA_def_property_float_sdna(prop, NULL, "kDF");
01422     RNA_def_property_range(prop, 0.0f, 1.0f);
01423     RNA_def_property_ui_text(prop, "Friction", "Dynamic Friction");
01424     
01425     prop= RNA_def_property(srna, "shape_threshold", PROP_FLOAT, PROP_NONE);
01426     RNA_def_property_float_sdna(prop, NULL, "kMT");
01427     RNA_def_property_range(prop, 0.0f, 1.0f);
01428     RNA_def_property_ui_text(prop, "Threshold", "Shape matching threshold");
01429     
01430     prop= RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_NONE);
01431     RNA_def_property_float_sdna(prop, NULL, "margin");
01432     RNA_def_property_range(prop, 0.01f, 1.0f);
01433     RNA_def_property_ui_text(prop, "Margin", "Collision margin for soft body. Small value makes the algorithm unstable");
01434     
01435     prop= RNA_def_property(srna, "weld_threshold", PROP_FLOAT, PROP_DISTANCE);
01436     RNA_def_property_float_sdna(prop, NULL, "welding");
01437     RNA_def_property_range(prop, 0.0f, 0.01f);
01438     RNA_def_property_ui_text(prop, "Welding",
01439                              "Welding threshold: distance between nearby vertices to be considered equal "
01440                              "=> set to 0.0 to disable welding test and speed up scene loading "
01441                              "(ok if the mesh has no duplicates)");
01442 
01443     /* Integers */
01444     
01445     prop= RNA_def_property(srna, "location_iterations", PROP_INT, PROP_NONE);
01446     RNA_def_property_int_sdna(prop, NULL, "piterations");
01447     RNA_def_property_range(prop, 0, 10);
01448     RNA_def_property_ui_text(prop, "Position Iterations", "Position solver iterations");
01449     
01450     prop= RNA_def_property(srna, "cluster_iterations", PROP_INT, PROP_NONE);
01451     RNA_def_property_int_sdna(prop, NULL, "numclusteriterations");
01452     RNA_def_property_range(prop, 1, 128);
01453     RNA_def_property_ui_text(prop, "Cluster Iterations", "Number of cluster iterations");
01454     
01455     /* Booleans */
01456     
01457     prop= RNA_def_property(srna, "use_shape_match", PROP_BOOLEAN, PROP_NONE);
01458     RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_BSB_SHAPE_MATCHING);
01459     RNA_def_property_ui_text(prop, "Shape Match", "Enable soft body shape matching goal");
01460     
01461     prop= RNA_def_property(srna, "use_bending_constraints", PROP_BOOLEAN, PROP_NONE);
01462     RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_BSB_BENDING_CONSTRAINTS);
01463     RNA_def_property_ui_text(prop, "Bending Const", "Enable bending constraints");
01464     
01465     prop= RNA_def_property(srna, "use_cluster_rigid_to_softbody", PROP_BOOLEAN, PROP_NONE);
01466     RNA_def_property_boolean_sdna(prop, NULL, "collisionflags", OB_BSB_COL_CL_RS);
01467     RNA_def_property_ui_text(prop, "Rigid to Soft Body", "Enable cluster collision between soft and rigid body");
01468     
01469     prop= RNA_def_property(srna, "use_cluster_soft_to_softbody", PROP_BOOLEAN, PROP_NONE);
01470     RNA_def_property_boolean_sdna(prop, NULL, "collisionflags", OB_BSB_COL_CL_SS);
01471     RNA_def_property_ui_text(prop, "Soft to Soft Body", "Enable cluster collision between soft and soft body");
01472 }
01473 
01474 static void rna_def_softbody(BlenderRNA *brna)
01475 {
01476     StructRNA *srna;
01477     PropertyRNA *prop;
01478     const int matrix_dimsize[]= {3, 3};
01479 
01480     
01481     static EnumPropertyItem collision_type_items[] = {
01482         {SBC_MODE_MANUAL, "MANUAL", 0, "Manual", "Manual adjust"},
01483         {SBC_MODE_AVG, "AVERAGE", 0, "Average", "Average Spring length * Ball Size"},
01484         {SBC_MODE_MIN, "MINIMAL", 0, "Minimal", "Minimal Spring length * Ball Size"},
01485         {SBC_MODE_MAX, "MAXIMAL", 0, "Maximal", "Maximal Spring length * Ball Size"},
01486         {SBC_MODE_AVGMINMAX, "MINMAX", 0, "AvMinMax", "(Min+Max)/2 * Ball Size"},
01487         {0, NULL, 0, NULL, NULL}};
01488     
01489     static EnumPropertyItem aerodynamics_type[] = {
01490         {0, "SIMPLE", 0, "Simple", "Edges receive a drag force from surrounding media"},
01491         {1, "LIFT_FORCE", 0, "Lift Force", "Edges receive a lift force when passing through surrounding media"},
01492         {0, NULL, 0, NULL, NULL}};
01493 
01494     srna= RNA_def_struct(brna, "SoftBodySettings", NULL);
01495     RNA_def_struct_sdna(srna, "SoftBody");
01496     RNA_def_struct_path_func(srna, "rna_SoftBodySettings_path");
01497     RNA_def_struct_ui_text(srna, "Soft Body Settings", "Soft body simulation settings for an object");
01498     
01499     /* General Settings */
01500     
01501     prop= RNA_def_property(srna, "friction", PROP_FLOAT, PROP_NONE);
01502     RNA_def_property_float_sdna(prop, NULL, "mediafrict");
01503     RNA_def_property_range(prop, 0.0f, 50.0f);
01504     RNA_def_property_ui_text(prop, "Friction", "General media friction for point movements");
01505     RNA_def_property_update(prop, 0, "rna_softbody_update");
01506     
01507     prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
01508     RNA_def_property_float_sdna(prop, NULL, "nodemass");
01509     RNA_def_property_range(prop, 0.0f, 50000.0f);
01510     RNA_def_property_ui_text(prop, "Mass", "General Mass value");
01511     RNA_def_property_update(prop, 0, "rna_softbody_update");
01512     
01513     prop= RNA_def_property(srna, "vertex_group_mass", PROP_STRING, PROP_NONE);
01514     RNA_def_property_string_sdna(prop, NULL, "namedVG_Mass");
01515     RNA_def_property_ui_text(prop, "Mass Vertex Group", "Control point mass values");
01516     RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SoftBodySettings_mass_vgroup_set");
01517     RNA_def_property_update(prop, 0, "rna_softbody_update");
01518     
01519     /* no longer used */
01520     prop= RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
01521     RNA_def_property_float_sdna(prop, NULL, "grav");
01522     RNA_def_property_range(prop, -10.0f, 10.0f);
01523     RNA_def_property_ui_text(prop, "Gravitation", "Apply gravitation to point movement");
01524     RNA_def_property_update(prop, 0, "rna_softbody_update");
01525     
01526     prop= RNA_def_property(srna, "speed", PROP_FLOAT, PROP_NONE);
01527     RNA_def_property_float_sdna(prop, NULL, "physics_speed");
01528     RNA_def_property_range(prop, 0.01f, 100.0f);
01529     RNA_def_property_ui_text(prop, "Speed", "Tweak timing for physics to control frequency and speed");
01530     RNA_def_property_update(prop, 0, "rna_softbody_update");
01531     
01532     /* Goal */
01533     
01534     prop= RNA_def_property(srna, "vertex_group_goal", PROP_STRING, PROP_NONE);
01535     RNA_def_property_string_sdna(prop, NULL, "vertgroup");
01536     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* not impossible .. but not supported yet */
01537     RNA_def_property_string_funcs(prop, "rna_SoftBodySettings_goal_vgroup_get", "rna_SoftBodySettings_goal_vgroup_length",
01538                                   "rna_SoftBodySettings_goal_vgroup_set");
01539     RNA_def_property_ui_text(prop, "Goal Vertex Group", "Control point weight values");
01540     
01541     prop= RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_NONE);
01542     RNA_def_property_float_sdna(prop, NULL, "mingoal");
01543     RNA_def_property_range(prop, 0.0f, 1.0f);
01544     RNA_def_property_ui_text(prop, "Goal Minimum", "Goal minimum, vertex weights are scaled to match this range");
01545     RNA_def_property_update(prop, 0, "rna_softbody_update");
01546 
01547     prop= RNA_def_property(srna, "goal_max", PROP_FLOAT, PROP_NONE);
01548     RNA_def_property_float_sdna(prop, NULL, "maxgoal");
01549     RNA_def_property_range(prop, 0.0f, 1.0f);
01550     RNA_def_property_ui_text(prop, "Goal Maximum", "Goal maximum, vertex weights are scaled to match this range");
01551     RNA_def_property_update(prop, 0, "rna_softbody_update");
01552 
01553     prop= RNA_def_property(srna, "goal_default", PROP_FLOAT, PROP_NONE);
01554     RNA_def_property_float_sdna(prop, NULL, "defgoal");
01555     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01556     RNA_def_property_range(prop, 0.0f, 1.0f);
01557     RNA_def_property_ui_text(prop, "Goal Default", "Default Goal (vertex target position) value, when no Vertex Group used");
01558     RNA_def_property_update(prop, 0, "rna_softbody_update");
01559     
01560     prop= RNA_def_property(srna, "goal_spring", PROP_FLOAT, PROP_NONE);
01561     RNA_def_property_float_sdna(prop, NULL, "goalspring");
01562     RNA_def_property_range(prop, 0.0f, 0.999f);
01563     RNA_def_property_ui_text(prop, "Goal Stiffness", "Goal (vertex target position) spring stiffness");
01564     RNA_def_property_update(prop, 0, "rna_softbody_update");
01565     
01566     prop= RNA_def_property(srna, "goal_friction", PROP_FLOAT, PROP_NONE);
01567     RNA_def_property_float_sdna(prop, NULL, "goalfrict");
01568     RNA_def_property_range(prop, 0.0f, 50.0f);
01569     RNA_def_property_ui_text(prop, "Goal Damping", "Goal (vertex target position) friction");
01570     RNA_def_property_update(prop, 0, "rna_softbody_update");
01571     
01572     /* Edge Spring Settings */
01573     
01574     prop= RNA_def_property(srna, "pull", PROP_FLOAT, PROP_NONE);
01575     RNA_def_property_float_sdna(prop, NULL, "inspring");
01576     RNA_def_property_range(prop, 0.0f, 0.999f);
01577     RNA_def_property_ui_text(prop, "Pull", "Edge spring stiffness when longer than rest length");
01578     RNA_def_property_update(prop, 0, "rna_softbody_update");
01579     
01580     prop= RNA_def_property(srna, "push", PROP_FLOAT, PROP_NONE);
01581     RNA_def_property_float_sdna(prop, NULL, "inpush");
01582     RNA_def_property_range(prop, 0.0f, 0.999f);
01583     RNA_def_property_ui_text(prop, "Push", "Edge spring stiffness when shorter than rest length");
01584     RNA_def_property_update(prop, 0, "rna_softbody_update");
01585     
01586     prop= RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
01587     RNA_def_property_float_sdna(prop, NULL, "infrict");
01588     RNA_def_property_range(prop, 0.0f, 50.0f);
01589     RNA_def_property_ui_text(prop, "Damp", "Edge spring friction");
01590     RNA_def_property_update(prop, 0, "rna_softbody_update");
01591     
01592     prop= RNA_def_property(srna, "spring_length", PROP_INT, PROP_NONE);
01593     RNA_def_property_int_sdna(prop, NULL, "springpreload");
01594     RNA_def_property_range(prop, 0.0f, 200.0f);
01595     RNA_def_property_ui_text(prop, "SL", "Alter spring length to shrink/blow up (unit %) 0 to disable");
01596     RNA_def_property_update(prop, 0, "rna_softbody_update");
01597     
01598     prop= RNA_def_property(srna, "aero", PROP_INT, PROP_NONE);
01599     RNA_def_property_int_sdna(prop, NULL, "aeroedge");
01600     RNA_def_property_range(prop, 0.0f, 30000.0f);
01601     RNA_def_property_ui_text(prop, "Aero", "Make edges 'sail'");
01602     RNA_def_property_update(prop, 0, "rna_softbody_update");
01603     
01604     prop= RNA_def_property(srna, "plastic", PROP_INT, PROP_NONE);
01605     RNA_def_property_int_sdna(prop, NULL, "plastic");
01606     RNA_def_property_range(prop, 0.0f, 100.0f);
01607     RNA_def_property_ui_text(prop, "Plastic", "Permanent deform");
01608     RNA_def_property_update(prop, 0, "rna_softbody_update");
01609     
01610     prop= RNA_def_property(srna, "bend", PROP_FLOAT, PROP_NONE);
01611     RNA_def_property_float_sdna(prop, NULL, "secondspring");
01612     RNA_def_property_range(prop, 0.0f, 10.0f);
01613     RNA_def_property_ui_text(prop, "Bending", "Bending Stiffness");
01614     RNA_def_property_update(prop, 0, "rna_softbody_update");
01615     
01616     prop= RNA_def_property(srna, "shear", PROP_FLOAT, PROP_NONE);
01617     RNA_def_property_float_sdna(prop, NULL, "shearstiff");
01618     RNA_def_property_range(prop, 0.0f, 1.0f);
01619     RNA_def_property_ui_text(prop, "Shear", "Shear Stiffness");
01620     
01621     prop= RNA_def_property(srna, "vertex_group_spring", PROP_STRING, PROP_NONE);
01622     RNA_def_property_string_sdna(prop, NULL, "namedVG_Spring_K");
01623     RNA_def_property_ui_text(prop, "Spring Vertex Group", "Control point spring strength values");
01624     RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SoftBodySettings_spring_vgroup_set");
01625     RNA_def_property_update(prop, 0, "rna_softbody_update");
01626     
01627     /* Collision */
01628     
01629     prop= RNA_def_property(srna, "collision_type", PROP_ENUM, PROP_NONE);
01630     RNA_def_property_enum_sdna(prop, NULL, "sbc_mode");
01631     RNA_def_property_enum_items(prop, collision_type_items);
01632     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01633     RNA_def_property_ui_text(prop, "Collision Type", "Choose Collision Type");
01634     RNA_def_property_update(prop, 0, "rna_softbody_update");
01635     
01636     prop= RNA_def_property(srna, "ball_size", PROP_FLOAT, PROP_NONE);
01637     RNA_def_property_float_sdna(prop, NULL, "colball");
01638     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* code is not ready for that yet */
01639     RNA_def_property_range(prop, -10.0f, 10.0f);
01640     RNA_def_property_ui_text(prop, "Ball Size", "Absolute ball size or factor if not manual adjusted");
01641     RNA_def_property_update(prop, 0, "rna_softbody_update");
01642     
01643     prop= RNA_def_property(srna, "ball_stiff", PROP_FLOAT, PROP_NONE);
01644     RNA_def_property_float_sdna(prop, NULL, "ballstiff");
01645     RNA_def_property_range(prop, 0.001f, 100.0f);
01646     RNA_def_property_ui_text(prop, "Ball Size", "Ball inflating pressure");
01647     RNA_def_property_update(prop, 0, "rna_softbody_update");
01648     
01649     prop= RNA_def_property(srna, "ball_damp", PROP_FLOAT, PROP_NONE);
01650     RNA_def_property_float_sdna(prop, NULL, "balldamp");
01651     RNA_def_property_range(prop, 0.001f, 1.0f);
01652     RNA_def_property_ui_text(prop, "Ball Size", "Blending to inelastic collision");
01653     RNA_def_property_update(prop, 0, "rna_softbody_update");
01654     
01655     /* Solver */
01656     
01657     prop= RNA_def_property(srna, "error_threshold", PROP_FLOAT, PROP_NONE);
01658     RNA_def_property_float_sdna(prop, NULL, "rklimit");
01659     RNA_def_property_range(prop, 0.001f, 10.0f);
01660     RNA_def_property_ui_text(prop, "Error Limit",
01661                              "The Runge-Kutta ODE solver error limit, low value gives more precision, high values speed");
01662     RNA_def_property_update(prop, 0, "rna_softbody_update");
01663     
01664     prop= RNA_def_property(srna, "step_min", PROP_INT, PROP_NONE);
01665     RNA_def_property_int_sdna(prop, NULL, "minloops");
01666     RNA_def_property_range(prop, 0, 30000);
01667     RNA_def_property_ui_text(prop, "Min Step", "Minimal # solver steps/frame");
01668     RNA_def_property_update(prop, 0, "rna_softbody_update");
01669     
01670     prop= RNA_def_property(srna, "step_max", PROP_INT, PROP_NONE);
01671     RNA_def_property_int_sdna(prop, NULL, "maxloops");
01672     RNA_def_property_range(prop, 0, 30000);
01673     RNA_def_property_ui_text(prop, "Max Step", "Maximal # solver steps/frame");
01674     RNA_def_property_update(prop, 0, "rna_softbody_update");
01675     
01676     prop= RNA_def_property(srna, "choke", PROP_INT, PROP_NONE);
01677     RNA_def_property_int_sdna(prop, NULL, "choke");
01678     RNA_def_property_range(prop, 0, 100);
01679     RNA_def_property_ui_text(prop, "Choke", "'Viscosity' inside collision target");
01680     RNA_def_property_update(prop, 0, "rna_softbody_update");
01681     
01682     prop= RNA_def_property(srna, "fuzzy", PROP_INT, PROP_NONE);
01683     RNA_def_property_int_sdna(prop, NULL, "fuzzyness");
01684     RNA_def_property_range(prop, 1, 100);
01685     RNA_def_property_ui_text(prop, "Fuzzy",
01686                              "Fuzziness while on collision, high values make collision handling faster but less stable");
01687     RNA_def_property_update(prop, 0, "rna_softbody_update");
01688     
01689     prop= RNA_def_property(srna, "use_auto_step", PROP_BOOLEAN, PROP_NONE);
01690     RNA_def_property_boolean_sdna(prop, NULL, "solverflags", SBSO_OLDERR);
01691     RNA_def_property_ui_text(prop, "V", "Use velocities for automagic step sizes");
01692     RNA_def_property_update(prop, 0, "rna_softbody_update");
01693     
01694     prop= RNA_def_property(srna, "use_diagnose", PROP_BOOLEAN, PROP_NONE);
01695     RNA_def_property_boolean_sdna(prop, NULL, "solverflags", SBSO_MONITOR);
01696     RNA_def_property_ui_text(prop, "Print Performance to Console", "Turn on SB diagnose console prints");
01697     
01698     prop= RNA_def_property(srna, "use_estimate_matrix", PROP_BOOLEAN, PROP_NONE);
01699     RNA_def_property_boolean_sdna(prop, NULL, "solverflags", SBSO_ESTIMATEIPO);
01700     RNA_def_property_ui_text(prop, "Estimate matrix", "Estimate matrix... split to COM, ROT, SCALE");
01701 
01702 
01703     /***********************************************************************************/
01704     /* these are not exactly settings, but reading calculated results*/
01705     /* but i did not want to start a new property struct */
01706     /* so rather rename this from SoftBodySettings to SoftBody */
01707     /* translation */
01708     prop= RNA_def_property(srna, "location_mass_center", PROP_FLOAT, PROP_TRANSLATION);
01709     RNA_def_property_float_sdna(prop, NULL, "lcom");
01710     RNA_def_property_ui_text(prop, "Center of mass", "Location of Center of mass");
01711 
01712     /* matrix */
01713     prop= RNA_def_property(srna, "rotation_estimate", PROP_FLOAT, PROP_MATRIX);
01714     RNA_def_property_float_sdna(prop, NULL, "lrot");
01715     RNA_def_property_multi_array(prop, 2, matrix_dimsize);
01716     RNA_def_property_ui_text(prop, "Rot Matrix", "Estimated rotation matrix");
01717 
01718     prop= RNA_def_property(srna, "scale_estimate", PROP_FLOAT, PROP_MATRIX);
01719     RNA_def_property_float_sdna(prop, NULL, "lscale");
01720     RNA_def_property_multi_array(prop, 2, matrix_dimsize);
01721     RNA_def_property_ui_text(prop, "Scale Matrix", "Estimated scale matrix");
01722     /***********************************************************************************/
01723 
01724 
01725     /* Flags */
01726     
01727     prop= RNA_def_property(srna, "use_goal", PROP_BOOLEAN, PROP_NONE);
01728     RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_use_goal_get", "rna_SoftBodySettings_use_goal_set");
01729     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01730     RNA_def_property_ui_text(prop, "Use Goal", "Define forces for vertices to stick to animated position");
01731     RNA_def_property_update(prop, 0, "rna_softbody_update");
01732     
01733     prop= RNA_def_property(srna, "use_edges", PROP_BOOLEAN, PROP_NONE);
01734     RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_use_edges_get", "rna_SoftBodySettings_use_edges_set");
01735     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01736     RNA_def_property_ui_text(prop, "Use Edges", "Use Edges as springs");
01737     RNA_def_property_update(prop, 0, "rna_softbody_update");
01738     
01739     prop= RNA_def_property(srna, "use_stiff_quads", PROP_BOOLEAN, PROP_NONE);
01740     RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_stiff_quads_get", "rna_SoftBodySettings_stiff_quads_set");
01741     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01742     RNA_def_property_ui_text(prop, "Stiff Quads", "Add diagonal springs on 4-gons");
01743     RNA_def_property_update(prop, 0, "rna_softbody_update");
01744     
01745     prop= RNA_def_property(srna, "use_edge_collision", PROP_BOOLEAN, PROP_NONE);
01746     RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_edge_collision_get", "rna_SoftBodySettings_edge_collision_set");
01747     RNA_def_property_ui_text(prop, "Edge Collision", "Edges collide too");
01748     RNA_def_property_update(prop, 0, "rna_softbody_update");
01749     
01750     prop= RNA_def_property(srna, "use_face_collision", PROP_BOOLEAN, PROP_NONE);
01751     RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_face_collision_get", "rna_SoftBodySettings_face_collision_set");
01752     RNA_def_property_ui_text(prop, "Face Collision", "Faces collide too, can be very slow");
01753     RNA_def_property_update(prop, 0, "rna_softbody_update");
01754     
01755     prop= RNA_def_property(srna, "aerodynamics_type", PROP_ENUM, PROP_NONE);
01756     RNA_def_property_enum_items(prop, aerodynamics_type);
01757     RNA_def_property_enum_funcs(prop, "rna_SoftBodySettings_new_aero_get", "rna_SoftBodySettings_new_aero_set", NULL);
01758     RNA_def_property_ui_text(prop, "Aerodynamics Type", "Method of calculating aerodynamic interaction");
01759     RNA_def_property_update(prop, 0, "rna_softbody_update");
01760     
01761     prop= RNA_def_property(srna, "use_self_collision", PROP_BOOLEAN, PROP_NONE);
01762     RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_self_collision_get", "rna_SoftBodySettings_self_collision_set");
01763     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01764     RNA_def_property_ui_text(prop, "Self Collision", "Enable naive vertex ball self collision");
01765     RNA_def_property_update(prop, 0, "rna_softbody_update");
01766 
01767     prop= RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
01768     RNA_def_property_pointer_sdna(prop, NULL, "effector_weights");
01769     RNA_def_property_struct_type(prop, "EffectorWeights");
01770     RNA_def_property_clear_flag(prop, PROP_EDITABLE);
01771     RNA_def_property_ui_text(prop, "Effector Weights", "");
01772 }
01773 
01774 void RNA_def_object_force(BlenderRNA *brna)
01775 {
01776     rna_def_pointcache(brna);
01777     rna_def_collision(brna);
01778     rna_def_effector_weight(brna);
01779     rna_def_field(brna);
01780     rna_def_game_softbody(brna);
01781     rna_def_softbody(brna);
01782 }
01783 
01784 #endif