Browse Source

bullet: fix various unprotected debug() prints

rdb 6 years ago
parent
commit
0e27f19d94

+ 6 - 3
panda/src/bullet/bulletContactCallbacks.h

@@ -61,7 +61,9 @@ contact_added_callback(btManifoldPoint &cp,
     PT(PandaNode) node1 = (PandaNode *)obj1->getUserPointer();
 #endif
 
-    bullet_cat.debug() << "contact added: " << cp.m_userPersistentData << std::endl;
+    if (bullet_cat.is_debug()) {
+      bullet_cat.debug() << "contact added: " << cp.m_userPersistentData << std::endl;
+    }
 
     // Gather persistent data
     UserPersistentData *data = new UserPersistentData();
@@ -123,8 +125,9 @@ contact_processed_callback(btManifoldPoint &cp,
  */
 static bool
 contact_destroyed_callback(void *userPersistentData) {
-
-  bullet_cat.debug() << "contact removed: " << userPersistentData << std::endl;
+  if (bullet_cat.is_debug()) {
+    bullet_cat.debug() << "contact removed: " << userPersistentData << std::endl;
+  }
 
   UserPersistentData *data = (UserPersistentData *)userPersistentData;
 

+ 6 - 4
panda/src/bullet/bulletDebugNode.cxx

@@ -384,8 +384,9 @@ drawTriangle(const btVector3 &v0, const btVector3 &v1, const btVector3 &v2, cons
  */
 void BulletDebugNode::DebugDraw::
 drawTriangle(const btVector3 &v0, const btVector3 &v1, const btVector3 &v2, const btVector3 &n0, const btVector3 &n1, const btVector3 &n2, const btVector3 &color, btScalar alpha) {
-
-  bullet_cat.debug() << "drawTriangle(2) - not yet implemented!" << std::endl;
+  if (bullet_cat.is_debug()) {
+    bullet_cat.debug() << "drawTriangle(2) - not yet implemented!" << std::endl;
+  }
 }
 
 /**
@@ -405,8 +406,9 @@ drawContactPoint(const btVector3 &point, const btVector3 &normal, btScalar dista
  */
 void BulletDebugNode::DebugDraw::
 draw3dText(const btVector3 &location, const char *text) {
-
-  bullet_cat.debug() << "draw3dText - not yet implemented!" << std::endl;
+  if (bullet_cat.is_debug()) {
+    bullet_cat.debug() << "draw3dText - not yet implemented!" << std::endl;
+  }
 }
 
 /**

+ 3 - 1
panda/src/bullet/config_bullet.cxx

@@ -207,7 +207,9 @@ init_libbullet() {
 
   // Initialize notification category
   bullet_cat.init();
-  bullet_cat.debug() << "initialize module" << std::endl;
+  if (bullet_cat.is_debug()) {
+    bullet_cat.debug() << "initialize module" << std::endl;
+  }
 
   // Register the Bullet system
   PandaSystem *ps = PandaSystem::get_global_ptr();