Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/rigidbody.c
| Show First 20 Lines • Show All 361 Lines • ▼ Show 20 Lines | case RBO_MESH_BASE: | ||||
| /* This mesh may be used for computing looptris, which should be done | /* This mesh may be used for computing looptris, which should be done | ||||
| * on the original; otherwise every time the CoW is recreated it will | * on the original; otherwise every time the CoW is recreated it will | ||||
| * have to be recomputed. */ | * have to be recomputed. */ | ||||
| BLI_assert(ob->rigidbody_object->mesh_source == RBO_MESH_BASE); | BLI_assert(ob->rigidbody_object->mesh_source == RBO_MESH_BASE); | ||||
| return (Mesh *)ob->runtime.data_orig; | return (Mesh *)ob->runtime.data_orig; | ||||
| } | } | ||||
| /* Just return something sensible so that at least Blender won't crash. */ | /* Just return something sensible so that at least Blender won't crash. */ | ||||
| BLI_assert(!"Unknown mesh source"); | BLI_assert_msg(0, "Unknown mesh source"); | ||||
| return BKE_object_get_evaluated_mesh(ob); | return BKE_object_get_evaluated_mesh(ob); | ||||
| } | } | ||||
| /* create collision shape of mesh - convex hull */ | /* create collision shape of mesh - convex hull */ | ||||
| static rbCollisionShape *rigidbody_get_shape_convexhull_from_mesh(Object *ob, | static rbCollisionShape *rigidbody_get_shape_convexhull_from_mesh(Object *ob, | ||||
| float margin, | float margin, | ||||
| bool *can_embed) | bool *can_embed) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 1,430 Lines • ▼ Show 20 Lines | static void rigidbody_update_simulation(Depsgraph *depsgraph, | ||||
| FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (rbw->group, ob) { | FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (rbw->group, ob) { | ||||
| if (ob->type == OB_MESH) { | if (ob->type == OB_MESH) { | ||||
| /* validate that we've got valid object set up here... */ | /* validate that we've got valid object set up here... */ | ||||
| RigidBodyOb *rbo = ob->rigidbody_object; | RigidBodyOb *rbo = ob->rigidbody_object; | ||||
| /* TODO: remove this whole block once we are sure we never get NULL rbo here anymore. */ | /* TODO: remove this whole block once we are sure we never get NULL rbo here anymore. */ | ||||
| /* This cannot be done in CoW evaluation context anymore... */ | /* This cannot be done in CoW evaluation context anymore... */ | ||||
| if (rbo == NULL) { | if (rbo == NULL) { | ||||
| BLI_assert(!"CoW object part of RBW object collection without RB object data, " | BLI_assert_msg(0, | ||||
| "CoW object part of RBW object collection without RB object data, " | |||||
| "should not happen.\n"); | "should not happen.\n"); | ||||
| /* Since this object is included in the sim group but doesn't have | /* Since this object is included in the sim group but doesn't have | ||||
| * rigid body settings (perhaps it was added manually), add! | * rigid body settings (perhaps it was added manually), add! | ||||
| * - assume object to be active? That is the default for newly added settings... | * - assume object to be active? That is the default for newly added settings... | ||||
| */ | */ | ||||
| ob->rigidbody_object = BKE_rigidbody_create_object(scene, ob, RBO_TYPE_ACTIVE); | ob->rigidbody_object = BKE_rigidbody_create_object(scene, ob, RBO_TYPE_ACTIVE); | ||||
| rigidbody_validate_sim_object(rbw, ob, true); | rigidbody_validate_sim_object(rbw, ob, true); | ||||
| rbo = ob->rigidbody_object; | rbo = ob->rigidbody_object; | ||||
| Show All 39 Lines | static void rigidbody_update_simulation(Depsgraph *depsgraph, | ||||
| FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (rbw->constraints, ob) { | FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (rbw->constraints, ob) { | ||||
| /* validate that we've got valid object set up here... */ | /* validate that we've got valid object set up here... */ | ||||
| RigidBodyCon *rbc = ob->rigidbody_constraint; | RigidBodyCon *rbc = ob->rigidbody_constraint; | ||||
| /* TODO: remove this whole block once we are sure we never get NULL rbo here anymore. */ | /* TODO: remove this whole block once we are sure we never get NULL rbo here anymore. */ | ||||
| /* This cannot be done in CoW evaluation context anymore... */ | /* This cannot be done in CoW evaluation context anymore... */ | ||||
| if (rbc == NULL) { | if (rbc == NULL) { | ||||
| BLI_assert(!"CoW object part of RBW constraints collection without RB constraint data, " | BLI_assert_msg(0, | ||||
| "CoW object part of RBW constraints collection without RB constraint data, " | |||||
| "should not happen.\n"); | "should not happen.\n"); | ||||
| /* Since this object is included in the group but doesn't have | /* Since this object is included in the group but doesn't have | ||||
| * constraint settings (perhaps it was added manually), add! | * constraint settings (perhaps it was added manually), add! | ||||
| */ | */ | ||||
| ob->rigidbody_constraint = BKE_rigidbody_create_constraint(scene, ob, RBC_TYPE_FIXED); | ob->rigidbody_constraint = BKE_rigidbody_create_constraint(scene, ob, RBC_TYPE_FIXED); | ||||
| rigidbody_validate_sim_constraint(rbw, ob, true); | rigidbody_validate_sim_constraint(rbw, ob, true); | ||||
| rbc = ob->rigidbody_constraint; | rbc = ob->rigidbody_constraint; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 513 Lines • Show Last 20 Lines | |||||