From 318112379d6d251334b8f3d2a20b935210446b4f Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 27 Feb 2020 11:23:15 +0100 Subject: Objects: make evaluated data runtime storage usable for types other than mesh This is in preparation of new object types. This only changes mesh_eval, we may do the same for mesh_deform_eval and other areas in the future if there is a need for it. This previously caused a bug in T74283, that should be fixed now. Differential Revision: https://developer.blender.org/D6695 --- source/blender/blenkernel/intern/rigidbody.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'source/blender/blenkernel/intern/rigidbody.c') diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index c2180e50b74..494c5e21613 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -332,22 +332,24 @@ void BKE_rigidbody_object_copy(Main *bmain, Object *ob_dst, const Object *ob_src /* get the appropriate evaluated mesh based on rigid body mesh source */ static Mesh *rigidbody_get_mesh(Object *ob) { + BLI_assert(ob->type == OB_MESH); + switch (ob->rigidbody_object->mesh_source) { case RBO_MESH_DEFORM: return ob->runtime.mesh_deform_eval; case RBO_MESH_FINAL: - return ob->runtime.mesh_eval; + return BKE_object_get_evaluated_mesh(ob); case RBO_MESH_BASE: /* This mesh may be used for computing looptris, which should be done * on the original; otherwise every time the CoW is recreated it will * have to be recomputed. */ BLI_assert(ob->rigidbody_object->mesh_source == RBO_MESH_BASE); - return ob->runtime.mesh_orig; + return (Mesh *)ob->runtime.data_orig; } /* Just return something sensible so that at least Blender won't crash. */ BLI_assert(!"Unknown mesh source"); - return ob->runtime.mesh_eval; + return BKE_object_get_evaluated_mesh(ob); } /* create collision shape of mesh - convex hull */ -- cgit v1.2.3