[Bf-blender-cvs] [3e4ce32] fracture_modifier: allow deforming rigidbodies now with mesh_source 'FINAL' as well

Martin Felke noreply at git.blender.org
Tue Oct 6 22:47:48 CEST 2015


Commit: 3e4ce322c4a7634e0ed4916aaae24c3c39ef2e1e
Author: Martin Felke
Date:   Tue Oct 6 22:47:25 2015 +0200
Branches: fracture_modifier
https://developer.blender.org/rB3e4ce322c4a7634e0ed4916aaae24c3c39ef2e1e

allow deforming rigidbodies now with mesh_source 'FINAL' as well

===================================================================

M	release/scripts/startup/bl_ui/properties_physics_rigidbody.py
M	source/blender/blenkernel/intern/rigidbody.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_physics_rigidbody.py b/release/scripts/startup/bl_ui/properties_physics_rigidbody.py
index d5a1dca..4f4fcaf 100644
--- a/release/scripts/startup/bl_ui/properties_physics_rigidbody.py
+++ b/release/scripts/startup/bl_ui/properties_physics_rigidbody.py
@@ -79,7 +79,7 @@ class PHYSICS_PT_rigid_body_collisions(PHYSICS_PT_rigidbody_panel, Panel):
         if rbo.collision_shape in {'MESH', 'CONVEX_HULL'}:
             layout.prop(rbo, "mesh_source", text="Source")
 
-        if rbo.collision_shape == 'MESH' and rbo.mesh_source == 'DEFORM':
+        if rbo.collision_shape == 'MESH' and rbo.mesh_source in ('DEFORM', 'FINAL'):
             layout.prop(rbo, "use_deform", text="Deforming")
 
         split = layout.split()
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 1115355..56e1e63 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -2681,7 +2681,15 @@ static void rigidbody_update_sim_ob(Scene *scene, RigidBodyWorld *rbw, Object *o
 		return;
 
 	if (rbo->shape == RB_SHAPE_TRIMESH && rbo->flag & RBO_FLAG_USE_DEFORM) {
-		DerivedMesh *dm = ob->derivedDeform;
+		DerivedMesh *dm = NULL;
+
+		if (rbo->mesh_source == RBO_MESH_DEFORM) {
+			ob->derivedDeform;
+		}
+		else if (rbo->mesh_source == RBO_MESH_FINAL) {
+			dm = ob->derivedFinal;
+		}
+
 		if (dm) {
 			MVert *mvert = dm->getVertArray(dm);
 			int totvert = dm->getNumVerts(dm);
@@ -2690,6 +2698,7 @@ static void rigidbody_update_sim_ob(Scene *scene, RigidBodyWorld *rbw, Object *o
 			RB_shape_trimesh_update(rbo->physics_shape, (float *)mvert, totvert, sizeof(MVert), bb->vec[0], bb->vec[6]);
 		}
 	}
+
 	copy_v3_v3(centr, centroid);
 	
 	mat4_decompose(loc, rot, scale, ob->obmat);




More information about the Bf-blender-cvs mailing list