[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60281] branches/soc-2013-rigid_body_sim: drawobject: Add option to disable physics visualization

Sergej Reich sergej.reich at googlemail.com
Sat Sep 21 07:12:00 CEST 2013


Revision: 60281
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60281
Author:   sergof
Date:     2013-09-21 05:12:00 +0000 (Sat, 21 Sep 2013)
Log Message:
-----------
drawobject: Add option to disable physics visualization

Right now this only disables rigid body visualizaion.
TODO: Disable visualizaion for other simulations as well.

Modified Paths:
--------------
    branches/soc-2013-rigid_body_sim/release/scripts/startup/bl_ui/space_view3d.py
    branches/soc-2013-rigid_body_sim/source/blender/editors/space_view3d/drawobject.c
    branches/soc-2013-rigid_body_sim/source/blender/makesdna/DNA_view3d_types.h
    branches/soc-2013-rigid_body_sim/source/blender/makesrna/intern/rna_space.c

Modified: branches/soc-2013-rigid_body_sim/release/scripts/startup/bl_ui/space_view3d.py
===================================================================
--- branches/soc-2013-rigid_body_sim/release/scripts/startup/bl_ui/space_view3d.py	2013-09-21 05:11:58 UTC (rev 60280)
+++ branches/soc-2013-rigid_body_sim/release/scripts/startup/bl_ui/space_view3d.py	2013-09-21 05:12:00 UTC (rev 60281)
@@ -2573,6 +2573,7 @@
         col.prop(view, "show_outline_selected")
         col.prop(view, "show_all_objects_origin")
         col.prop(view, "show_relationship_lines")
+        col.prop(view, "show_physics")
 
         col = layout.column()
         col.active = display_all

Modified: branches/soc-2013-rigid_body_sim/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- branches/soc-2013-rigid_body_sim/source/blender/editors/space_view3d/drawobject.c	2013-09-21 05:11:58 UTC (rev 60280)
+++ branches/soc-2013-rigid_body_sim/source/blender/editors/space_view3d/drawobject.c	2013-09-21 05:12:00 UTC (rev 60281)
@@ -7157,26 +7157,28 @@
 	}
 
 	if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
-		bConstraint *con;
+		if ((v3d->flag2 & V3D_NO_PHYSICS) == 0) {
+			bConstraint *con;
 
-		for (con = ob->constraints.first; con; con = con->next) {
-			if (con->type == CONSTRAINT_TYPE_RIGIDBODYJOINT) {
-				bRigidBodyJointConstraint *data = (bRigidBodyJointConstraint *)con->data;
-				if (data->flag & CONSTRAINT_DRAW_PIVOT)
-					draw_rigid_body_pivot(data, dflag, ob_wire_col);
+			for (con = ob->constraints.first; con; con = con->next) {
+				if (con->type == CONSTRAINT_TYPE_RIGIDBODYJOINT) {
+					bRigidBodyJointConstraint *data = (bRigidBodyJointConstraint *)con->data;
+					if (data->flag & CONSTRAINT_DRAW_PIVOT)
+						draw_rigid_body_pivot(data, dflag, ob_wire_col);
+				}
 			}
-		}
 
-		if (ob->gameflag & OB_BOUNDS) {
-			if (ob->boundtype != ob->collision_boundtype || (dtx & OB_DRAWBOUNDOX) == 0) {
-				setlinestyle(2);
-				draw_bounding_volume(scene, ob, ob->collision_boundtype);
-				setlinestyle(0);
+			if (ob->gameflag & OB_BOUNDS) {
+				if (ob->boundtype != ob->collision_boundtype || (dtx & OB_DRAWBOUNDOX) == 0) {
+					setlinestyle(2);
+					draw_bounding_volume(scene, ob, ob->collision_boundtype);
+					setlinestyle(0);
+				}
 			}
+			if (ob->rigidbody_object) {
+				draw_rigidbody_shape(ob);
+			}
 		}
-		if (ob->rigidbody_object) {
-			draw_rigidbody_shape(ob);
-		}
 
 		/* draw extra: after normal draw because of makeDispList */
 		if (dtx && (G.f & G_RENDER_OGL) == 0) {

Modified: branches/soc-2013-rigid_body_sim/source/blender/makesdna/DNA_view3d_types.h
===================================================================
--- branches/soc-2013-rigid_body_sim/source/blender/makesdna/DNA_view3d_types.h	2013-09-21 05:11:58 UTC (rev 60280)
+++ branches/soc-2013-rigid_body_sim/source/blender/makesdna/DNA_view3d_types.h	2013-09-21 05:12:00 UTC (rev 60281)
@@ -280,6 +280,7 @@
 #define V3D_SOLID_MATCAP		4096	/* user flag */
 #define V3D_SHOW_SOLID_MATCAP	8192	/* runtime flag */
 #define V3D_OCCLUDE_WIRE		16384
+#define V3D_NO_PHYSICS			32768
 
 
 /* View3D->around */

Modified: branches/soc-2013-rigid_body_sim/source/blender/makesrna/intern/rna_space.c
===================================================================
--- branches/soc-2013-rigid_body_sim/source/blender/makesrna/intern/rna_space.c	2013-09-21 05:11:58 UTC (rev 60280)
+++ branches/soc-2013-rigid_body_sim/source/blender/makesrna/intern/rna_space.c	2013-09-21 05:12:00 UTC (rev 60281)
@@ -1960,6 +1960,11 @@
 	RNA_def_property_ui_text(prop, "Only Render", "Display only objects which will be rendered");
 	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 	
+	prop = RNA_def_property(srna, "show_physics", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag2", V3D_NO_PHYSICS);
+	RNA_def_property_ui_text(prop, "Physics", "Display physics visualization");
+	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
 	prop = RNA_def_property(srna, "use_occlude_geometry", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_ZBUF_SELECT);
 	RNA_def_property_ui_text(prop, "Occlude Geometry", "Limit selection to visible (clipped with depth buffer)");




More information about the Bf-blender-cvs mailing list