forked from bartvdbraak/blender
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).
This commit is contained in:
parent
427e306196
commit
1852d1a410
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user