rigidbody: Flag bodies for validation when changing shape
[blender.git] / source / blender / makesrna / intern / rna_rigidbody.c
index cb27261c7bff7b5f12db0c272d0386e89c53009e..cc14e60f45a900618819fa5234afbf019734b7fa 100644 (file)
@@ -167,6 +167,14 @@ static void rna_RigidBodyOb_type_set(PointerRNA *ptr, int value)
        rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
 }
 
        rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
 }
 
+static void rna_RigidBodyOb_shape_set(PointerRNA *ptr, int value)
+{
+       RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+
+       rbo->shape = value;
+       rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
+}
+
 static void rna_RigidBodyOb_disabled_set(PointerRNA *ptr, int value)
 {
        RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
 static void rna_RigidBodyOb_disabled_set(PointerRNA *ptr, int value)
 {
        RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
@@ -771,6 +779,7 @@ static void rna_def_rigidbody_object(BlenderRNA *brna)
        prop = RNA_def_property(srna, "collision_shape", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "shape");
        RNA_def_property_enum_items(prop, rigidbody_object_shape_items);
        prop = RNA_def_property(srna, "collision_shape", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "shape");
        RNA_def_property_enum_items(prop, rigidbody_object_shape_items);
+       RNA_def_property_enum_funcs(prop, NULL, "rna_RigidBodyOb_shape_set", NULL);
        RNA_def_property_ui_text(prop, "Collision Shape", "Collision Shape of object in Rigid Body Simulations");
        RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
        RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
        RNA_def_property_ui_text(prop, "Collision Shape", "Collision Shape of object in Rigid Body Simulations");
        RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
        RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");