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