diff options
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 35 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object_force.c | 81 |
2 files changed, 108 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 3721c7d4ccb..3e320ca0b8c 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -33,6 +33,7 @@ #include "DNA_customdata_types.h" #include "DNA_material_types.h" #include "DNA_mesh_types.h" +#include "DNA_object_force.h" #include "DNA_object_types.h" #include "DNA_property_types.h" #include "DNA_scene_types.h" @@ -1119,6 +1120,40 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_POSEMODE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Pose Mode", "Object with armature data is in pose mode."); + + /* Softbody Flags */ + + prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "softflag", OB_SB_ENABLE); + RNA_def_property_ui_text(prop, "Enable Softbody", "Sets object to become soft body"); + + prop= RNA_def_property(srna, "use_goal", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "softflag", OB_SB_GOAL); + RNA_def_property_ui_text(prop, "Use Goal", "Define forces for vertices to stick to animated position"); + + prop= RNA_def_property(srna, "use_edges", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "softflag", OB_SB_EDGES); + RNA_def_property_ui_text(prop, "Use Edges", "Use Edges as springs"); + + prop= RNA_def_property(srna, "stiff_quads", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "softflag", OB_SB_QUADS); + RNA_def_property_ui_text(prop, "Stiff Quads", "Adds diagonal springs on 4-gons"); + + prop= RNA_def_property(srna, "edge_collision", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "softflag", OB_SB_EDGECOLL); + RNA_def_property_ui_text(prop, "Edge Collision", "Edge collide too"); + + prop= RNA_def_property(srna, "face_collision", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "softflag", OB_SB_FACECOLL); + RNA_def_property_ui_text(prop, "Face Collision", "Faces collide too SLOOOOOW warning"); + + prop= RNA_def_property(srna, "new_aero", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "softflag", OB_SB_AERO_ANGLE); + RNA_def_property_ui_text(prop, "N", "New aero(uses angle and length)"); + + prop= RNA_def_property(srna, "selfcollision", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "softflag", OB_SB_SELF); + RNA_def_property_ui_text(prop, "Self Collision", "Enable naive vertex ball self collision"); // XXX this stuff should be moved to AnimData... /* diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index f9a93a0a5a2..01901596155 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -412,6 +412,14 @@ static void rna_def_softbody(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; + + static EnumPropertyItem collision_type_items[] = { + {SBC_MODE_MANUAL, "MANUAL", 0, "Manual", "Manual adjust"}, + {SBC_MODE_AVG, "AVERAGE", 0, "Average", "Average Spring lenght * Ball Size"}, + {SBC_MODE_MIN, "MINIMAL", 0, "Minimal", "Minimal Spring lenght * Ball Size"}, + {SBC_MODE_MAX, "MAXIMAL", 0, "Maximal", "Maximal Spring lenght * Ball Size"}, + {SBC_MODE_AVGMINMAX, "MINMAX", 0, "AvMinMax", "(Min+Max)/2 * Ball Size"}, + {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "SoftBodySettings", NULL); RNA_def_struct_sdna(srna, "SoftBody"); @@ -474,43 +482,100 @@ static void rna_def_softbody(BlenderRNA *brna) prop= RNA_def_property(srna, "pull", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "inspring"); - RNA_def_property_range(prop, 0.0f, 0.999f); + RNA_def_property_range(prop, 0.0f, 0.999f); RNA_def_property_ui_text(prop, "Pull", "Edge spring stiffness when longer than rest length"); prop= RNA_def_property(srna, "push", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "inpush"); - RNA_def_property_range(prop, 0.0f, 0.999f); + RNA_def_property_range(prop, 0.0f, 0.999f); RNA_def_property_ui_text(prop, "Push", "Edge spring stiffness when shorter than rest length"); prop= RNA_def_property(srna, "damp", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "infrict"); - RNA_def_property_range(prop, 0.0f, 50.0f); + RNA_def_property_range(prop, 0.0f, 50.0f); RNA_def_property_ui_text(prop, "Damp", "Edge spring friction"); prop= RNA_def_property(srna, "spring_lenght", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "springpreload"); - RNA_def_property_range(prop, 0.0f, 200.0f); + RNA_def_property_range(prop, 0.0f, 200.0f); RNA_def_property_ui_text(prop, "SL", "Alter spring lenght to shrink/blow up (unit %) 0 to disable"); prop= RNA_def_property(srna, "aero", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "aeroedge"); - RNA_def_property_range(prop, 0.0f, 30000.0f); + RNA_def_property_range(prop, 0.0f, 30000.0f); RNA_def_property_ui_text(prop, "Aero", "Make edges 'sail'"); prop= RNA_def_property(srna, "plastic", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "plastic"); - RNA_def_property_range(prop, 0.0f, 100.0f); + RNA_def_property_range(prop, 0.0f, 100.0f); RNA_def_property_ui_text(prop, "Plastic", "Permanent deform"); prop= RNA_def_property(srna, "bending", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "secondspring"); - RNA_def_property_range(prop, 0.0f, 10.0f); + RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_ui_text(prop, "Bending", "Bending Stiffness"); prop= RNA_def_property(srna, "shear", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "shearstiff"); - RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Shear", "Shear Stiffness"); + + /* Collision */ + + prop= RNA_def_property(srna, "collision_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "sbc_mode"); + RNA_def_property_enum_items(prop, collision_type_items); + RNA_def_property_ui_text(prop, "Collision Type", "Choose Collision Type"); + + prop= RNA_def_property(srna, "ball_size", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "colball"); + RNA_def_property_range(prop, -10.0f, 10.0f); + RNA_def_property_ui_text(prop, "Ball Size", "Absolute ball size or factor if not manual adjusted"); + + prop= RNA_def_property(srna, "ball_stiff", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "ballstiff"); + RNA_def_property_range(prop, 0.001f, 100.0f); + RNA_def_property_ui_text(prop, "Ball Size", "Ball inflating presure"); + + prop= RNA_def_property(srna, "ball_damp", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "balldamp"); + RNA_def_property_range(prop, 0.001f, 1.0f); + RNA_def_property_ui_text(prop, "Ball Size", "Blending to inelastic collision"); + + /* Solver */ + + prop= RNA_def_property(srna, "error_limit", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "rklimit"); + RNA_def_property_range(prop, 0.001f, 10.0f); + RNA_def_property_ui_text(prop, "Error Limit", "The Runge-Kutta ODE solver error limit, low value gives more precision, high values speed"); + + prop= RNA_def_property(srna, "minstep", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "minloops"); + RNA_def_property_range(prop, 0, 30000); + RNA_def_property_ui_text(prop, "Min Step", "Minimal # solver steps/frame"); + + prop= RNA_def_property(srna, "maxstep", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "maxloops"); + RNA_def_property_range(prop, 0, 30000); + RNA_def_property_ui_text(prop, "Max Step", "Maximal # solver steps/frame"); + + prop= RNA_def_property(srna, "choke", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "choke"); + RNA_def_property_range(prop, 0, 100); + RNA_def_property_ui_text(prop, "Choke", "'Viscosity' inside collision target"); + + prop= RNA_def_property(srna, "fuzzy", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "fuzzyness"); + RNA_def_property_range(prop, 1, 100); + RNA_def_property_ui_text(prop, "Fuzzy", "Fuzzyness while on collision, high values make collsion handling faster but less stable"); + + prop= RNA_def_property(srna, "auto_step", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "solverflags", SBSO_OLDERR); + RNA_def_property_ui_text(prop, "V", "Use velocities for automagic step sizes"); + + prop= RNA_def_property(srna, "diagnose", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "solverflags", SBSO_MONITOR); + RNA_def_property_ui_text(prop, "Print Performance to Console", "Turn on SB diagnose console prints"); } void RNA_def_object_force(BlenderRNA *brna) |