Game Development Community

This is just annoying... PhysX warning Var

by John "Mythic" Henry · in Torque 3D Professional · 10/07/2011 (12:23 pm) · 4 replies

All I'm gonna say is this was annoying and unnecessary:

bool PxConsoleStream::smLogWarnings = false;

PxConsoleStream::PxConsoleStream()
{
//   #ifndef TORQUE_RELEASE
//      smLogWarnings = true;
//   #endif

   Con::addVariable( "$PhysXLogWarnings", TypeBool, &smLogWarnings );
}

I commented it out and set the var in core/scripts/server/defaults.cs instead...
Enuff said!

#1
10/07/2011 (12:42 pm)
Fixed for 1.2
#2
10/07/2011 (1:36 pm)
Yeah, I temporarily switched it to a global only checking for it Once
when the Plugin is initialized.

I understand why you had it enabled that way for Debug as you had only
two options with current setup.

Check the Script Var every time a warning occurred
OR
do like I did and make it a Global Var.
#3
10/07/2011 (5:23 pm)
Well, it's psuedo fixed right now and yes it's annoying. First we changed it from logging as an error so it wouldn't so up as red.

But, that didn't really help much. I was able to convince Derek to have it commented out by default and if someone really needs all the PhysX debug info they can uncomment it.
#4
10/08/2011 (3:10 am)
Well what I did enables the use of the Script Var:

T3D/physics/physicsplugin.cpp
String PhysicsPlugin::smClientWorldName( "client" );

extern bool gSmLogWarnings; //Mythic DEBUG Added

...
...

   Con::addVariable( "$pref::Physics::threadCount", TypeS32, &PhysicsPlugin::smThreadCount, "Number of threads to use in a single pass of the physics engine.n"
	   "@ingroup Physicsn");
   Con::addVariable( "$PhysXLogWarnings", TypeBool, &gSmLogWarnings ); //Mythic DEBUG Added

T3D/physics/physx/pxstream.cpp

...
...
bool gSmLogWarnings = false; //Mythic DEBUG
PxConsoleStream::PxConsoleStream()
{
//   #ifndef TORQUE_RELEASE
//      smLogWarnings = true;
//   #endif
}

PxConsoleStream::~PxConsoleStream()
{
   //Con::removeVariable( "$PhysXLogWarnings" );
}

...
..
   // In all other cases we just dump the message to the console.
   if ( code == NXE_DB_WARNING )
   {
      if ( gSmLogWarnings )
         Con::errorf( "PhysX Warning:n   %s(%d) : %sn", file, line, message );
   }
   else
      Con::errorf( "PhysX Error:n   %s(%d) : %sn", file, line, message );

and finally..
T3DphysicsphysxpxPlugin.cpp

...
...
extern bool gSmLogWarnings;
AFTER_MODULE_INIT( Sim )
{

...
..
PxPlugin::PxPlugin()
{
	gSmLogWarnings = Con::getBoolVariable("PhysXLogWarnings");
}

Seems to work well

*edit*
Looking at this,
could make it similar to before and just Add/Remove the Var in pxPlugin.
During the PxPlugin::PxPlugin() / PxPlugin::~PxPlugin()
Still getting the Var during the PxPlugin::PxPlugin().
THis would remove the use in physicsPlugin.cpp

**Edit**
Nope, forgot I had tried that, Need the Var Added earlier, which is Why
I had it in the physicsplugin :)