Fix for [#22667] Soft Body Aero on/off switch
authorMatt Ebb <matt@mke3.net>
Wed, 30 Jun 2010 02:34:34 +0000 (02:34 +0000)
committerMatt Ebb <matt@mke3.net>
Wed, 30 Jun 2010 02:34:34 +0000 (02:34 +0000)
Under guidance from Jens, converted the 'aero' property into a two-way switch,
which is what it actually represents.

release/scripts/ui/properties_physics_softbody.py
source/blender/makesrna/intern/rna_object_force.c

index d253943b724b5e740bd94df4d51e9510f7bb58e9..3bd27f382c5842b2603213fb88bf59dedfe5e57c 100644 (file)
@@ -186,11 +186,13 @@ class PHYSICS_PT_softbody_edge(PhysicButtonsPanel):
         sub.active = softbody.stiff_quads
         sub.prop(softbody, "shear")
 
-        col.label(text="Extra Aerodynamics:")
+        col.label(text="Aerodynamics:")
+        col.row().prop(softbody, "aerodynamics_type", expand=True)
         col.prop(softbody, "aero", text="Factor")
-        sub = col.column()
-        sub.enabled = softbody.aero > 0
-        sub.prop(softbody, "new_aero", text="Straw Dynamics")
+        
+        #sub = col.column()
+        #sub.enabled = softbody.aero > 0
+        
 
         col.label(text="Collision:")
         col.prop(softbody, "edge_collision", text="Edge")
index 0069f3332e8ef94cf28b817e0f043ede2e1b507f..ec1f1bf164e66a9b8f83e4c86aab755f476e42cf 100644 (file)
@@ -357,14 +357,19 @@ static void rna_SoftBodySettings_self_collision_set(PointerRNA *ptr, int value)
 static int rna_SoftBodySettings_new_aero_get(PointerRNA *ptr)
 {
        Object *data= (Object*)(ptr->id.data);
-       return (((data->softflag) & OB_SB_AERO_ANGLE) != 0);
+       if (data->softflag & OB_SB_AERO_ANGLE)
+               return 1;
+       else
+               return 0;
 }
 
 static void rna_SoftBodySettings_new_aero_set(PointerRNA *ptr, int value)
 {
        Object *data= (Object*)(ptr->id.data);
-       if(value) data->softflag |= OB_SB_AERO_ANGLE;
-       else data->softflag &= ~OB_SB_AERO_ANGLE;
+       if (value == 1)
+               data->softflag |= OB_SB_AERO_ANGLE;
+       else    /* value == 0 */
+               data->softflag &= ~OB_SB_AERO_ANGLE;
 }
 
 static int rna_SoftBodySettings_face_collision_get(PointerRNA *ptr)
@@ -1404,6 +1409,11 @@ static void rna_def_softbody(BlenderRNA *brna)
                {SBC_MODE_MAX, "MAXIMAL", 0, "Maximal", "Maximal Spring length * Ball Size"},
                {SBC_MODE_AVGMINMAX, "MINMAX", 0, "AvMinMax", "(Min+Max)/2 * Ball Size"},
                {0, NULL, 0, NULL, NULL}};
+       
+       static EnumPropertyItem aerodynamics_type[] = {
+               {0, "SIMPLE", 0, "Simple", "Edges receive a drag force from surrounding media"},
+               {1, "LIFT_FORCE", 0, "Lift Force", "Edges receive a lift force when passing through surrounding media"},
+               {0, NULL, 0, NULL, NULL}};
 
        srna= RNA_def_struct(brna, "SoftBodySettings", NULL);
        RNA_def_struct_sdna(srna, "SoftBody");
@@ -1660,12 +1670,13 @@ static void rna_def_softbody(BlenderRNA *brna)
        
        prop= RNA_def_property(srna, "face_collision", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_face_collision_get", "rna_SoftBodySettings_face_collision_set");
-       RNA_def_property_ui_text(prop, "Face Collision", "Faces collide too, SLOOOOOW warning");
+       RNA_def_property_ui_text(prop, "Face Collision", "Faces collide too, can be very slow");
        RNA_def_property_update(prop, 0, "rna_softbody_update");
        
-       prop= RNA_def_property(srna, "new_aero", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_new_aero_get", "rna_SoftBodySettings_new_aero_set");
-       RNA_def_property_ui_text(prop, "N", "New aero(uses angle and length)");
+       prop= RNA_def_property(srna, "aerodynamics_type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_items(prop, aerodynamics_type);
+       RNA_def_property_enum_funcs(prop, "rna_SoftBodySettings_new_aero_get", "rna_SoftBodySettings_new_aero_set", NULL);
+       RNA_def_property_ui_text(prop, "Aerodynamics Type", "Method of calculating aerodynamic interaction");
        RNA_def_property_update(prop, 0, "rna_softbody_update");
        
        prop= RNA_def_property(srna, "self_collision", PROP_BOOLEAN, PROP_NONE);