[Bf-blender-cvs] [b89f7af] fracture_modifier: added ghost objects, they do not collide but can activate animated objects

Martin Felke noreply at git.blender.org
Sun Nov 16 03:07:53 CET 2014


Commit: b89f7af28783176a4ba76e7462d1f793ccaed916
Author: Martin Felke
Date:   Sun Nov 16 03:07:31 2014 +0100
Branches: fracture_modifier
https://developer.blender.org/rBb89f7af28783176a4ba76e7462d1f793ccaed916

added ghost objects, they do not collide but can activate animated objects

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

M	release/scripts/startup/bl_ui/properties_physics_rigidbody.py
M	source/blender/blenkernel/intern/rigidbody.c
M	source/blender/makesdna/DNA_rigidbody_types.h
M	source/blender/makesrna/intern/rna_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 7d62fee..449d905 100644
--- a/release/scripts/startup/bl_ui/properties_physics_rigidbody.py
+++ b/release/scripts/startup/bl_ui/properties_physics_rigidbody.py
@@ -49,7 +49,9 @@ class PHYSICS_PT_rigid_body(PHYSICS_PT_rigidbody_panel, Panel):
                 row.prop(rbo, "enabled", text="Dynamic")
             row.prop(rbo, "kinematic", text="Animated")
             if rbo.type == 'ACTIVE':
+                row = layout.row()
                 row.prop(rbo, "use_kinematic_deactivation", text="Triggered")
+                row.prop(rbo, "is_ghost")
 
             if rbo.type == 'ACTIVE':
                 layout.prop(rbo, "mass")
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 4f2c50a..133480d 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1629,6 +1629,7 @@ static int filterCallback(void* world, void* island1, void* island2, void *blend
 	int ob_index1, ob_index2;
 	FractureModifierData *fmd1, *fmd2;
 	bool validOb = true;
+	bool ret = false;
 
 	mi1 = (MeshIsland*)island1;
 	mi2 = (MeshIsland*)island2;
@@ -1774,7 +1775,8 @@ static int filterCallback(void* world, void* island1, void* island2, void *blend
 		}
 	}
 
-	return colgroup_check(ob1->rigidbody_object->col_groups, ob2->rigidbody_object->col_groups);
+	ret = colgroup_check(ob1->rigidbody_object->col_groups, ob2->rigidbody_object->col_groups);
+	return ret && !(ob1->rigidbody_object->flag & RBO_FLAG_IS_GHOST) && !(ob2->rigidbody_object->flag & RBO_FLAG_IS_GHOST);
 }
 
 #if 0
diff --git a/source/blender/makesdna/DNA_rigidbody_types.h b/source/blender/makesdna/DNA_rigidbody_types.h
index 019f370..faba30b 100644
--- a/source/blender/makesdna/DNA_rigidbody_types.h
+++ b/source/blender/makesdna/DNA_rigidbody_types.h
@@ -164,6 +164,8 @@ typedef enum eRigidBodyOb_Flag {
 	RBO_FLAG_KINEMATIC_REBUILD	= (1 << 8),
 	/* enable / disable kinematic state change after collision */
 	RBO_FLAG_USE_KINEMATIC_DEACTIVATION = (1 << 9),
+	/* ghost flag, do not collide with object (but can activate although) */
+	RBO_FLAG_IS_GHOST = (1 << 10),
 } eRigidBodyOb_Flag;
 
 /* RigidBody Collision Shape */
diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c
index 2c324af..0f91dbc 100644
--- a/source/blender/makesrna/intern/rna_rigidbody.c
+++ b/source/blender/makesrna/intern/rna_rigidbody.c
@@ -1005,6 +1005,11 @@ static void rna_def_rigidbody_object(BlenderRNA *brna)
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_USE_KINEMATIC_DEACTIVATION);
 	RNA_def_property_ui_text(prop, "Kinematic Deactivation", "Allow kinematic state being reset by collisions");
 	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+	prop = RNA_def_property(srna, "is_ghost", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_IS_GHOST);
+	RNA_def_property_ui_text(prop, "Ghost", "Do not collide with object, but can activate other animated objects");
+	RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
 	
 	/* Physics Parameters */
 	prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_UNIT_MASS);




More information about the Bf-blender-cvs mailing list