Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwin Coumans <blender@erwincoumans.com>2006-12-20 09:43:43 +0300
committerErwin Coumans <blender@erwincoumans.com>2006-12-20 09:43:43 +0300
commit1852d1a410c23e5be7792ac810b2568c930c86a1 (patch)
tree2034af773cd29d4500c7103f2b96912099805236
parent427e306196f07ed0f276de614a98cfb783c2e4d6 (diff)
Enable 'show physics visualization' in the Game Menu. Should help to locate problems with collision detection/physics (also useful when baking, and/or using the new rigidbody constraints).
-rw-r--r--source/blender/blenkernel/BKE_global.h1
-rw-r--r--source/blender/src/header_info.c8
-rw-r--r--source/blender/src/space.c3
-rw-r--r--source/gameengine/Converter/KX_BlenderSceneConverter.cpp6
4 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h
index e2308d2ac2c..37f761d5098 100644
--- a/source/blender/blenkernel/BKE_global.h
+++ b/source/blender/blenkernel/BKE_global.h
@@ -207,6 +207,7 @@ typedef struct Global {
#define G_FILE_GAME_TO_IPO (1 << 11)
#define G_FILE_GAME_MAT (1 << 12)
#define G_FILE_DIAPLAY_LISTS (1 << 13)
+#define G_FILE_SHOW_PHYSICS (1 << 14)
/* G.windowstate */
#define G_WINDOWSTATE_USERDEF 0
diff --git a/source/blender/src/header_info.c b/source/blender/src/header_info.c
index 57b35174acd..d6c217534bb 100644
--- a/source/blender/src/header_info.c
+++ b/source/blender/src/header_info.c
@@ -1439,6 +1439,7 @@ static void do_info_gamemenu(void *arg, int event)
case G_FILE_AUTOPLAY:
case G_FILE_GAME_TO_IPO:
case G_FILE_GAME_MAT:
+ case G_FILE_SHOW_PHYSICS:
G.fileflags ^= event;
break;
default:
@@ -1493,6 +1494,13 @@ static uiBlock *info_gamemenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Show Framerate and Profile", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_SHOW_FRAMERATE, "");
}
+
+ if(G.fileflags & G_FILE_SHOW_PHYSICS) {
+ uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Show Physics Visualization", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_SHOW_PHYSICS, "");
+ } else {
+ uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Show Physics Visualization", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_SHOW_PHYSICS, "");
+ }
+
if(G.fileflags & G_FILE_SHOW_DEBUG_PROPS) {
uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Show Debug Properties", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_SHOW_DEBUG_PROPS, "");
} else {
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index dfbbdf13b1e..af6a5043244 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -381,6 +381,9 @@ void space_set_commmandline_options(void) {
|| (G.vd->drawtype == OB_SOLID) );
SYS_WriteCommandLineInt(syshandle, "show_properties", a);
}
+
+ a= (G.fileflags & G_FILE_SHOW_PHYSICS);
+ SYS_WriteCommandLineInt(syshandle, "show_physics", a);
a= (G.fileflags & G_FILE_ENABLE_ALL_FRAMES);
SYS_WriteCommandLineInt(syshandle, "fixedtime", a);
diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
index 75c0e54eb68..44e62f1601a 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
@@ -43,6 +43,7 @@
#include "KX_KetsjiEngine.h"
#include "KX_IPhysicsController.h"
#include "BL_Material.h"
+#include "SYS_System.h"
#include "DummyPhysicsEnvironment.h"
@@ -305,6 +306,11 @@ void KX_BlenderSceneConverter::ConvertScene(const STR_String& scenename,
ccdPhysEnv->setDeactivationLinearTreshold(0.8f); // default, can be overridden by Python
ccdPhysEnv->setDeactivationAngularTreshold(1.0f); // default, can be overridden by Python
+ SYS_SystemHandle syshandle = SYS_GetSystem(); /*unused*/
+ int visualizePhysics = SYS_GetCommandLineInt(syshandle,"show_physics",0);
+ if (visualizePhysics)
+ ccdPhysEnv->setDebugMode(btIDebugDraw::DBG_DrawWireframe|btIDebugDraw::DBG_DrawAabb|btIDebugDraw::DBG_DrawContactPoints|btIDebugDraw::DBG_DrawText);
+
//todo: get a button in blender ?
//disable / enable debug drawing (contact points, aabb's etc)
//ccdPhysEnv->setDebugMode(1);