Blender V2.61 - r43446
|
00001 /* 00002 * ***** BEGIN GPL LICENSE BLOCK ***** 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 * 00018 * Contributor(s): Blender Foundation (2008) 00019 * 00020 * ***** END GPL LICENSE BLOCK ***** 00021 */ 00022 00028 #include <stdlib.h> 00029 #include <limits.h> 00030 00031 #include "RNA_define.h" 00032 00033 #include "rna_internal.h" 00034 00035 #include "BKE_cloth.h" 00036 #include "BKE_modifier.h" 00037 00038 #include "DNA_cloth_types.h" 00039 #include "DNA_object_types.h" 00040 #include "DNA_scene_types.h" 00041 00042 #include "WM_api.h" 00043 #include "WM_types.h" 00044 00045 #ifdef RNA_RUNTIME 00046 00047 #include "BKE_context.h" 00048 #include "BKE_depsgraph.h" 00049 00050 static void rna_cloth_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) 00051 { 00052 Object *ob= (Object*)ptr->id.data; 00053 00054 DAG_id_tag_update(&ob->id, OB_RECALC_DATA); 00055 WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob); 00056 } 00057 00058 static void rna_cloth_pinning_changed(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) 00059 { 00060 Object *ob= (Object*)ptr->id.data; 00061 // ClothSimSettings *settings = (ClothSimSettings*)ptr->data; 00062 ClothModifierData *clmd = (ClothModifierData*)modifiers_findByType(ob, eModifierType_Cloth); 00063 00064 cloth_free_modifier(clmd); 00065 00066 DAG_id_tag_update(&ob->id, OB_RECALC_DATA); 00067 WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob); 00068 } 00069 00070 static void rna_cloth_reset(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) 00071 { 00072 Object *ob= (Object*)ptr->id.data; 00073 ClothSimSettings *settings = (ClothSimSettings*)ptr->data; 00074 00075 settings->reset = 1; 00076 00077 DAG_id_tag_update(&ob->id, OB_RECALC_DATA); 00078 WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob); 00079 } 00080 00081 00082 static void rna_ClothSettings_max_bend_set(struct PointerRNA *ptr, float value) 00083 { 00084 ClothSimSettings *settings = (ClothSimSettings*)ptr->data; 00085 00086 /* check for clipping */ 00087 if(value < settings->bending) 00088 value = settings->bending; 00089 00090 settings->max_bend = value; 00091 } 00092 00093 static void rna_ClothSettings_max_struct_set(struct PointerRNA *ptr, float value) 00094 { 00095 ClothSimSettings *settings = (ClothSimSettings*)ptr->data; 00096 00097 /* check for clipping */ 00098 if(value < settings->structural) 00099 value = settings->structural; 00100 00101 settings->max_struct = value; 00102 } 00103 00104 static void rna_ClothSettings_mass_vgroup_get(PointerRNA *ptr, char *value) 00105 { 00106 ClothSimSettings *sim= (ClothSimSettings*)ptr->data; 00107 rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_mass); 00108 } 00109 00110 static int rna_ClothSettings_mass_vgroup_length(PointerRNA *ptr) 00111 { 00112 ClothSimSettings *sim= (ClothSimSettings*)ptr->data; 00113 return rna_object_vgroup_name_index_length(ptr, sim->vgroup_mass); 00114 } 00115 00116 static void rna_ClothSettings_mass_vgroup_set(PointerRNA *ptr, const char *value) 00117 { 00118 ClothSimSettings *sim= (ClothSimSettings*)ptr->data; 00119 rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_mass); 00120 } 00121 00122 static void rna_ClothSettings_struct_vgroup_get(PointerRNA *ptr, char *value) 00123 { 00124 ClothSimSettings *sim= (ClothSimSettings*)ptr->data; 00125 rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_struct); 00126 } 00127 00128 static int rna_ClothSettings_struct_vgroup_length(PointerRNA *ptr) 00129 { 00130 ClothSimSettings *sim= (ClothSimSettings*)ptr->data; 00131 return rna_object_vgroup_name_index_length(ptr, sim->vgroup_struct); 00132 } 00133 00134 static void rna_ClothSettings_struct_vgroup_set(PointerRNA *ptr, const char *value) 00135 { 00136 ClothSimSettings *sim= (ClothSimSettings*)ptr->data; 00137 rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_struct); 00138 } 00139 00140 static void rna_ClothSettings_bend_vgroup_get(PointerRNA *ptr, char *value) 00141 { 00142 ClothSimSettings *sim= (ClothSimSettings*)ptr->data; 00143 rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_bend); 00144 } 00145 00146 static int rna_ClothSettings_bend_vgroup_length(PointerRNA *ptr) 00147 { 00148 ClothSimSettings *sim= (ClothSimSettings*)ptr->data; 00149 return rna_object_vgroup_name_index_length(ptr, sim->vgroup_bend); 00150 } 00151 00152 static void rna_ClothSettings_bend_vgroup_set(PointerRNA *ptr, const char *value) 00153 { 00154 ClothSimSettings *sim= (ClothSimSettings*)ptr->data; 00155 rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_bend); 00156 } 00157 00158 static PointerRNA rna_ClothSettings_rest_shape_key_get(PointerRNA *ptr) 00159 { 00160 Object *ob= (Object*)ptr->id.data; 00161 ClothSimSettings *sim= (ClothSimSettings*)ptr->data; 00162 00163 return rna_object_shapekey_index_get(ob->data, sim->shapekey_rest); 00164 } 00165 00166 static void rna_ClothSettings_rest_shape_key_set(PointerRNA *ptr, PointerRNA value) 00167 { 00168 Object *ob= (Object*)ptr->id.data; 00169 ClothSimSettings *sim= (ClothSimSettings*)ptr->data; 00170 00171 sim->shapekey_rest= rna_object_shapekey_index_set(ob->data, value, sim->shapekey_rest); 00172 } 00173 00174 static void rna_ClothSettings_gravity_get(PointerRNA *ptr, float *values) 00175 { 00176 ClothSimSettings *sim= (ClothSimSettings*)ptr->data; 00177 00178 values[0]= sim->gravity[0]; 00179 values[1]= sim->gravity[1]; 00180 values[2]= sim->gravity[2]; 00181 } 00182 00183 static void rna_ClothSettings_gravity_set(PointerRNA *ptr, const float *values) 00184 { 00185 ClothSimSettings *sim= (ClothSimSettings*)ptr->data; 00186 00187 sim->gravity[0]= values[0]; 00188 sim->gravity[1]= values[1]; 00189 sim->gravity[2]= values[2]; 00190 } 00191 00192 static char *rna_ClothSettings_path(PointerRNA *ptr) 00193 { 00194 Object *ob= (Object*)ptr->id.data; 00195 ModifierData *md= modifiers_findByType(ob, eModifierType_Cloth); 00196 00197 return md ? BLI_sprintfN("modifiers[\"%s\"].settings", md->name) : NULL; 00198 } 00199 00200 static char *rna_ClothCollisionSettings_path(PointerRNA *ptr) 00201 { 00202 Object *ob= (Object*)ptr->id.data; 00203 ModifierData *md= modifiers_findByType(ob, eModifierType_Cloth); 00204 00205 return md ? BLI_sprintfN("modifiers[\"%s\"].collision_settings", md->name) : NULL; 00206 } 00207 00208 #else 00209 00210 static void rna_def_cloth_sim_settings(BlenderRNA *brna) 00211 { 00212 StructRNA *srna; 00213 PropertyRNA *prop; 00214 00215 srna = RNA_def_struct(brna, "ClothSettings", NULL); 00216 RNA_def_struct_ui_text(srna, "Cloth Settings", "Cloth simulation settings for an object"); 00217 RNA_def_struct_sdna(srna, "ClothSimSettings"); 00218 RNA_def_struct_path_func(srna, "rna_ClothSettings_path"); 00219 00220 /* goal */ 00221 00222 prop= RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_NONE); 00223 RNA_def_property_float_sdna(prop, NULL, "mingoal"); 00224 RNA_def_property_range(prop, 0.0f, 1.0f); 00225 RNA_def_property_ui_text(prop, "Goal Minimum", "Goal minimum, vertex group weights are scaled to match this range"); 00226 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00227 00228 prop= RNA_def_property(srna, "goal_max", PROP_FLOAT, PROP_NONE); 00229 RNA_def_property_float_sdna(prop, NULL, "maxgoal"); 00230 RNA_def_property_range(prop, 0.0f, 1.0f); 00231 RNA_def_property_ui_text(prop, "Goal Maximum", "Goal maximum, vertex group weights are scaled to match this range"); 00232 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00233 00234 prop= RNA_def_property(srna, "goal_default", PROP_FLOAT, PROP_NONE); 00235 RNA_def_property_float_sdna(prop, NULL, "defgoal"); 00236 RNA_def_property_range(prop, 0.0f, 1.0f); 00237 RNA_def_property_ui_text(prop, "Goal Default", "Default Goal (vertex target position) value, when no Vertex Group used"); 00238 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00239 00240 prop= RNA_def_property(srna, "goal_spring", PROP_FLOAT, PROP_NONE); 00241 RNA_def_property_float_sdna(prop, NULL, "goalspring"); 00242 RNA_def_property_range(prop, 0.0f, 0.999f); 00243 RNA_def_property_ui_text(prop, "Goal Stiffness", "Goal (vertex target position) spring stiffness"); 00244 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00245 00246 prop= RNA_def_property(srna, "goal_friction", PROP_FLOAT, PROP_NONE); 00247 RNA_def_property_float_sdna(prop, NULL, "goalfrict"); 00248 RNA_def_property_range(prop, 0.0f, 50.0f); 00249 RNA_def_property_ui_text(prop, "Goal Damping", "Goal (vertex target position) friction"); 00250 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00251 00252 prop= RNA_def_property(srna, "internal_friction", PROP_FLOAT, PROP_NONE); 00253 RNA_def_property_float_sdna(prop, NULL, "velocity_smooth"); 00254 RNA_def_property_range(prop, 0.0f, 1.0f); 00255 RNA_def_property_ui_text(prop, "Internal Friction", ""); 00256 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00257 00258 prop= RNA_def_property(srna, "collider_friction", PROP_FLOAT, PROP_NONE); 00259 RNA_def_property_float_sdna(prop, NULL, "collider_friction"); 00260 RNA_def_property_range(prop, 0.0f, 1.0f); 00261 RNA_def_property_ui_text(prop, "Collider Friction", ""); 00262 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00263 00264 /* mass */ 00265 00266 prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE); 00267 RNA_def_property_range(prop, 0.0f, 10.0f); 00268 RNA_def_property_ui_text(prop, "Mass", "Mass of cloth material"); 00269 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00270 00271 prop= RNA_def_property(srna, "vertex_group_mass", PROP_STRING, PROP_NONE); 00272 RNA_def_property_string_funcs(prop, "rna_ClothSettings_mass_vgroup_get", "rna_ClothSettings_mass_vgroup_length", 00273 "rna_ClothSettings_mass_vgroup_set"); 00274 RNA_def_property_ui_text(prop, "Mass Vertex Group", "Vertex Group for pinning of vertices"); 00275 RNA_def_property_update(prop, 0, "rna_cloth_pinning_changed"); 00276 00277 prop= RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION); 00278 RNA_def_property_array(prop, 3); 00279 RNA_def_property_range(prop, -100.0, 100.0); 00280 RNA_def_property_float_funcs(prop, "rna_ClothSettings_gravity_get", "rna_ClothSettings_gravity_set", NULL); 00281 RNA_def_property_ui_text(prop, "Gravity", "Gravity or external force vector"); 00282 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00283 00284 /* various */ 00285 00286 prop= RNA_def_property(srna, "air_damping", PROP_FLOAT, PROP_NONE); 00287 RNA_def_property_float_sdna(prop, NULL, "Cvi"); 00288 RNA_def_property_range(prop, 0.0f, 10.0f); 00289 RNA_def_property_ui_text(prop, "Air Damping", "Air has normally some thickness which slows falling things down"); 00290 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00291 00292 prop= RNA_def_property(srna, "use_pin_cloth", PROP_BOOLEAN, PROP_NONE); 00293 RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_GOAL); 00294 RNA_def_property_ui_text(prop, "Pin Cloth", "Enable pinning of cloth vertices to other objects/positions"); 00295 RNA_def_property_update(prop, 0, "rna_cloth_pinning_changed"); 00296 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); 00297 00298 prop= RNA_def_property(srna, "pin_stiffness", PROP_FLOAT, PROP_NONE); 00299 RNA_def_property_float_sdna(prop, NULL, "goalspring"); 00300 RNA_def_property_range(prop, 0.0f, 50.0); 00301 RNA_def_property_ui_text(prop, "Pin Stiffness", "Pin (vertex target position) spring stiffness"); 00302 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00303 00304 prop= RNA_def_property(srna, "quality", PROP_INT, PROP_NONE); 00305 RNA_def_property_int_sdna(prop, NULL, "stepsPerFrame"); 00306 RNA_def_property_range(prop, 4, 80); 00307 RNA_def_property_ui_text(prop, "Quality", 00308 "Quality of the simulation in steps per frame (higher is better quality but slower)"); 00309 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00310 00311 /* springs */ 00312 00313 prop= RNA_def_property(srna, "use_stiffness_scale", PROP_BOOLEAN, PROP_NONE); 00314 RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_SCALING); 00315 RNA_def_property_ui_text(prop, "Stiffness Scaling", 00316 "If enabled, stiffness can be scaled along a weight painted vertex group"); 00317 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00318 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); 00319 00320 prop= RNA_def_property(srna, "spring_damping", PROP_FLOAT, PROP_NONE); 00321 RNA_def_property_float_sdna(prop, NULL, "Cdis"); 00322 RNA_def_property_range(prop, 0.0f, 50.0f); 00323 RNA_def_property_ui_text(prop, "Spring Damping", "Damping of cloth velocity (higher = more smooth, less jiggling)"); 00324 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00325 00326 prop= RNA_def_property(srna, "structural_stiffness", PROP_FLOAT, PROP_NONE); 00327 RNA_def_property_float_sdna(prop, NULL, "structural"); 00328 RNA_def_property_range(prop, 0.0f, 10000.0f); 00329 RNA_def_property_ui_text(prop, "Structural Stiffness", "Overall stiffness of structure"); 00330 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00331 00332 prop= RNA_def_property(srna, "structural_stiffness_max", PROP_FLOAT, PROP_NONE); 00333 RNA_def_property_float_sdna(prop, NULL, "max_struct"); 00334 RNA_def_property_range(prop, 0.0f, 10000.0f); 00335 RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_max_struct_set", NULL); 00336 RNA_def_property_ui_text(prop, "Structural Stiffness Maximum", "Maximum structural stiffness value"); 00337 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00338 00339 prop= RNA_def_property(srna, "vertex_group_structural_stiffness", PROP_STRING, PROP_NONE); 00340 RNA_def_property_string_funcs(prop, "rna_ClothSettings_struct_vgroup_get", "rna_ClothSettings_struct_vgroup_length", 00341 "rna_ClothSettings_struct_vgroup_set"); 00342 RNA_def_property_ui_text(prop, "Structural Stiffness Vertex Group", 00343 "Vertex group for fine control over structural stiffness"); 00344 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00345 00346 prop= RNA_def_property(srna, "bending_stiffness", PROP_FLOAT, PROP_NONE); 00347 RNA_def_property_float_sdna(prop, NULL, "bending"); 00348 RNA_def_property_range(prop, 0.0f, 10000.0f); 00349 RNA_def_property_ui_text(prop, "Bending Stiffness", "Wrinkle coefficient (higher = less smaller but more big wrinkles)"); 00350 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00351 00352 prop= RNA_def_property(srna, "bending_stiffness_max", PROP_FLOAT, PROP_NONE); 00353 RNA_def_property_float_sdna(prop, NULL, "max_bend"); 00354 RNA_def_property_range(prop, 0.0f, 10000.0f); 00355 RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_max_bend_set", NULL); 00356 RNA_def_property_ui_text(prop, "Bending Stiffness Maximum", "Maximum bending stiffness value"); 00357 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00358 00359 prop= RNA_def_property(srna, "vertex_group_bending", PROP_STRING, PROP_NONE); 00360 RNA_def_property_string_funcs(prop, "rna_ClothSettings_bend_vgroup_get", "rna_ClothSettings_bend_vgroup_length", 00361 "rna_ClothSettings_bend_vgroup_set"); 00362 RNA_def_property_ui_text(prop, "Bending Stiffness Vertex Group", "Vertex group for fine control over bending stiffness"); 00363 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00364 00365 prop= RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE); 00366 RNA_def_property_struct_type(prop, "EffectorWeights"); 00367 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 00368 RNA_def_property_ui_text(prop, "Effector Weights", ""); 00369 00370 prop= RNA_def_property(srna, "pre_roll", PROP_INT, PROP_NONE); 00371 RNA_def_property_int_sdna(prop, NULL, "preroll"); 00372 RNA_def_property_range(prop, 0, 200); 00373 RNA_def_property_ui_text(prop, "Pre Roll", "Simulation starts on this frame"); 00374 RNA_def_property_update(prop, 0, "rna_cloth_reset"); 00375 00376 prop= RNA_def_property(srna, "rest_shape_key", PROP_POINTER, PROP_NONE); 00377 RNA_def_property_flag(prop, PROP_EDITABLE); 00378 RNA_def_property_struct_type(prop, "ShapeKey"); 00379 RNA_def_property_pointer_funcs(prop, "rna_ClothSettings_rest_shape_key_get", 00380 "rna_ClothSettings_rest_shape_key_set", NULL, NULL); 00381 RNA_def_property_ui_text(prop, "Rest Shape Key", "Shape key to use the rest spring lengths from"); 00382 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00383 00384 /* unused */ 00385 00386 /* unused still 00387 prop= RNA_def_property(srna, "shear_stiffness", PROP_FLOAT, PROP_NONE); 00388 RNA_def_property_float_sdna(prop, NULL, "shear"); 00389 RNA_def_property_range(prop, 0.0f, 1000.0f); 00390 RNA_def_property_ui_text(prop, "Shear Stiffness", "Shear spring stiffness"); */ 00391 00392 /* unused still 00393 prop= RNA_def_property(srna, "shear_stiffness_max", PROP_FLOAT, PROP_NONE); 00394 RNA_def_property_float_sdna(prop, NULL, "max_shear"); 00395 RNA_def_property_range(prop, 0.0f, upperLimitf); 00396 RNA_def_property_ui_text(prop, "Shear Stiffness Maximum", "Maximum shear scaling value"); */ 00397 00398 /* unused still 00399 prop= RNA_def_property(srna, "effector_force_scale", PROP_FLOAT, PROP_NONE); 00400 RNA_def_property_float_sdna(prop, NULL, "eff_force_scale"); 00401 RNA_def_property_range(prop, 0.0f, 100.0f); 00402 RNA_def_property_ui_text(prop, "Effector Force Scale", ""); */ 00403 00404 /* unused still 00405 prop= RNA_def_property(srna, "effector_wind_scale", PROP_FLOAT, PROP_NONE); 00406 RNA_def_property_float_sdna(prop, NULL, "eff_wind_scale"); 00407 RNA_def_property_range(prop, 0.0f, 100.0f); 00408 RNA_def_property_ui_text(prop, "Effector Wind Scale", ""); */ 00409 00410 /* unused still 00411 prop= RNA_def_property(srna, "tearing", PROP_BOOLEAN, PROP_NONE); 00412 RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_TEARING); 00413 RNA_def_property_ui_text(prop, "Tearing", "");*/ 00414 00415 /* unused still 00416 prop= RNA_def_property(srna, "max_spring_extensions", PROP_INT, PROP_NONE); 00417 RNA_def_property_int_sdna(prop, NULL, "maxspringlen"); 00418 RNA_def_property_range(prop, 1.0, 1000.0); 00419 RNA_def_property_ui_text(prop, "Maximum Spring Extension", "Maximum extension before spring gets cut"); */ 00420 } 00421 00422 static void rna_def_cloth_collision_settings(BlenderRNA *brna) 00423 { 00424 StructRNA *srna; 00425 PropertyRNA *prop; 00426 00427 srna = RNA_def_struct(brna, "ClothCollisionSettings", NULL); 00428 RNA_def_struct_ui_text(srna, "Cloth Collision Settings", 00429 "Cloth simulation settings for self collision and collision with other objects"); 00430 RNA_def_struct_sdna(srna, "ClothCollSettings"); 00431 RNA_def_struct_path_func(srna, "rna_ClothCollisionSettings_path"); 00432 00433 /* general collision */ 00434 00435 prop= RNA_def_property(srna, "use_collision", PROP_BOOLEAN, PROP_NONE); 00436 RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_COLLSETTINGS_FLAG_ENABLED); 00437 RNA_def_property_ui_text(prop, "Enable Collision", "Enable collisions with other objects"); 00438 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00439 00440 prop= RNA_def_property(srna, "repel_force", PROP_FLOAT, PROP_NONE); 00441 RNA_def_property_float_sdna(prop, NULL, "repel_force"); 00442 RNA_def_property_range(prop, 0.0f, 20.0f); 00443 RNA_def_property_float_default(prop, 1.0f); 00444 RNA_def_property_ui_text(prop, "Repulsion Force", "Repulsion force to apply on cloth when close to colliding"); 00445 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00446 00447 prop= RNA_def_property(srna, "distance_repel", PROP_FLOAT, PROP_NONE); 00448 RNA_def_property_float_sdna(prop, NULL, "distance_repel"); 00449 RNA_def_property_range(prop, 0.001f, 10.0f); 00450 RNA_def_property_float_default(prop, 0.005f); 00451 RNA_def_property_ui_text(prop, "Repulsion Distance", 00452 "Maximum distance to apply repulsion force, must be greater than minimum distance"); 00453 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00454 00455 prop= RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_NONE); 00456 RNA_def_property_float_sdna(prop, NULL, "epsilon"); 00457 RNA_def_property_range(prop, 0.001f, 1.0f); 00458 RNA_def_property_ui_text(prop, "Minimum Distance", 00459 "Minimum distance between collision objects before collision response takes in"); 00460 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00461 00462 prop= RNA_def_property(srna, "friction", PROP_FLOAT, PROP_NONE); 00463 RNA_def_property_range(prop, 0.0f, 80.0f); 00464 RNA_def_property_ui_text(prop, "Friction", "Friction force if a collision happened (higher = less movement)"); 00465 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00466 00467 prop= RNA_def_property(srna, "collision_quality", PROP_INT, PROP_NONE); 00468 RNA_def_property_int_sdna(prop, NULL, "loop_count"); 00469 RNA_def_property_range(prop, 1, 20); 00470 RNA_def_property_ui_text(prop, "Collision Quality", 00471 "How many collision iterations should be done. (higher is better quality but slower)"); 00472 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00473 00474 /* self collision */ 00475 00476 prop= RNA_def_property(srna, "use_self_collision", PROP_BOOLEAN, PROP_NONE); 00477 RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_COLLSETTINGS_FLAG_SELF); 00478 RNA_def_property_ui_text(prop, "Enable Self Collision", "Enable self collisions"); 00479 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00480 00481 prop= RNA_def_property(srna, "self_distance_min", PROP_FLOAT, PROP_NONE); 00482 RNA_def_property_float_sdna(prop, NULL, "selfepsilon"); 00483 RNA_def_property_range(prop, 0.5f, 1.0f); 00484 RNA_def_property_ui_text(prop, "Self Minimum Distance", "0.5 means no distance at all, 1.0 is maximum distance"); 00485 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00486 00487 prop= RNA_def_property(srna, "self_friction", PROP_FLOAT, PROP_NONE); 00488 RNA_def_property_range(prop, 0.0f, 80.0f); 00489 RNA_def_property_ui_text(prop, "Self Friction", "Friction/damping with self contact"); 00490 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00491 00492 prop= RNA_def_property(srna, "self_collision_quality", PROP_INT, PROP_NONE); 00493 RNA_def_property_int_sdna(prop, NULL, "self_loop_count"); 00494 RNA_def_property_range(prop, 1, 10); 00495 RNA_def_property_ui_text(prop, "Self Collision Quality", 00496 "How many self collision iterations should be done (higher is better quality but slower)"); 00497 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00498 00499 prop= RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE); 00500 RNA_def_property_flag(prop, PROP_EDITABLE); 00501 RNA_def_property_ui_text(prop, "Collision Group", "Limit colliders to this Group"); 00502 RNA_def_property_update(prop, 0, "rna_cloth_update"); 00503 } 00504 00505 void RNA_def_cloth(BlenderRNA *brna) 00506 { 00507 rna_def_cloth_sim_settings(brna); 00508 rna_def_cloth_collision_settings(brna); 00509 } 00510 00511 #endif 00512