Replaced a ton of ConsoleMethods with the DefineConsoleMethod Macro.

This commit is contained in:
Vincent Gee 2014-11-03 22:42:51 -05:00
parent 378a933894
commit acb192e2a5
133 changed files with 1716 additions and 2087 deletions

View file

@ -24,6 +24,7 @@
#include "environment/editors/guiMeshRoadEditorCtrl.h"
#include "console/consoleTypes.h"
#include "console/engineAPI.h"
#include "environment/meshRoad.h"
#include "renderInstance/renderPassManager.h"
#include "collision/collision.h"
@ -1185,125 +1186,95 @@ void GuiMeshRoadEditorCtrl::matchTerrainToRoad()
// with the terrain underneath it.
}
ConsoleMethod( GuiMeshRoadEditorCtrl, deleteNode, void, 2, 2, "deleteNode()" )
DefineConsoleMethod( GuiMeshRoadEditorCtrl, deleteNode, void, (), , "deleteNode()" )
{
object->deleteSelectedNode();
}
ConsoleMethod( GuiMeshRoadEditorCtrl, getMode, const char*, 2, 2, "" )
DefineConsoleMethod( GuiMeshRoadEditorCtrl, getMode, const char*, (), , "" )
{
return object->getMode();
}
ConsoleMethod( GuiMeshRoadEditorCtrl, setMode, void, 3, 3, "setMode( String mode )" )
DefineConsoleMethod( GuiMeshRoadEditorCtrl, setMode, void, (const char * mode), , "setMode( String mode )" )
{
String newMode = ( argv[2] );
String newMode = ( mode );
object->setMode( newMode );
}
ConsoleMethod( GuiMeshRoadEditorCtrl, getNodeWidth, F32, 2, 2, "" )
DefineConsoleMethod( GuiMeshRoadEditorCtrl, getNodeWidth, F32, (), , "" )
{
return object->getNodeWidth();
}
ConsoleMethod( GuiMeshRoadEditorCtrl, setNodeWidth, void, 3, 3, "" )
DefineConsoleMethod( GuiMeshRoadEditorCtrl, setNodeWidth, void, ( F32 width ), , "" )
{
object->setNodeWidth( dAtof(argv[2]) );
object->setNodeWidth( width );
}
ConsoleMethod( GuiMeshRoadEditorCtrl, getNodeDepth, F32, 2, 2, "" )
DefineConsoleMethod( GuiMeshRoadEditorCtrl, getNodeDepth, F32, (), , "" )
{
return object->getNodeDepth();
}
ConsoleMethod( GuiMeshRoadEditorCtrl, setNodeDepth, void, 3, 3, "" )
DefineConsoleMethod( GuiMeshRoadEditorCtrl, setNodeDepth, void, ( F32 depth ), , "" )
{
object->setNodeDepth( dAtof(argv[2]) );
object->setNodeDepth( depth );
}
ConsoleMethod( GuiMeshRoadEditorCtrl, getNodePosition, const char*, 2, 2, "" )
DefineConsoleMethod( GuiMeshRoadEditorCtrl, getNodePosition, Point3F, (), , "" )
{
static const U32 bufSize = 256;
char* returnBuffer = Con::getReturnBuffer(bufSize);
dSprintf(returnBuffer, bufSize, "%f %f %f",
object->getNodePosition().x, object->getNodePosition().y, object->getNodePosition().z);
return returnBuffer;
return object->getNodePosition();
}
ConsoleMethod( GuiMeshRoadEditorCtrl, setNodePosition, void, 3, 3, "" )
DefineConsoleMethod( GuiMeshRoadEditorCtrl, setNodePosition, void, (Point3F pos), , "" )
{
Point3F pos;
S32 count = dSscanf( argv[2], "%f %f %f",
&pos.x, &pos.y, &pos.z);
if ( (count != 3) )
{
Con::printf("Failed to parse node information \"px py pz\" from '%s'", (const char*)argv[3]);
return;
}
object->setNodePosition( pos );
}
ConsoleMethod( GuiMeshRoadEditorCtrl, getNodeNormal, const char*, 2, 2, "" )
DefineConsoleMethod( GuiMeshRoadEditorCtrl, getNodeNormal, Point3F, (), , "" )
{
static const U32 bufSize = 256;
char* returnBuffer = Con::getReturnBuffer(bufSize);
dSprintf(returnBuffer, bufSize, "%f %f %f",
object->getNodeNormal().x, object->getNodeNormal().y, object->getNodeNormal().z);
return returnBuffer;
return object->getNodeNormal();
}
ConsoleMethod( GuiMeshRoadEditorCtrl, setNodeNormal, void, 3, 3, "" )
DefineConsoleMethod( GuiMeshRoadEditorCtrl, setNodeNormal, void, (Point3F normal), , "" )
{
VectorF normal;
S32 count = dSscanf( argv[2], "%f %f %f",
&normal.x, &normal.y, &normal.z);
if ( (count != 3) )
{
Con::printf("Failed to parse node information \"px py pz\" from '%s'", (const char*)argv[3]);
return;
}
object->setNodeNormal( normal );
}
ConsoleMethod( GuiMeshRoadEditorCtrl, setSelectedRoad, void, 2, 3, "" )
DefineConsoleMethod( GuiMeshRoadEditorCtrl, setSelectedRoad, void, (const char * objName), (""), "" )
{
if ( argc == 2 )
if ( dStrcmp(objName, "" )==0)
object->setSelectedRoad(NULL);
else
{
MeshRoad *road = NULL;
if ( Sim::findObject( argv[2], road ) )
if ( Sim::findObject( objName, road ) )
object->setSelectedRoad(road);
}
}
ConsoleMethod( GuiMeshRoadEditorCtrl, getSelectedRoad, const char*, 2, 2, "" )
DefineConsoleMethod( GuiMeshRoadEditorCtrl, getSelectedRoad, S32, (), , "" )
{
MeshRoad *road = object->getSelectedRoad();
if ( !road )
return NULL;
return road->getIdString();
return road->getId();
}
ConsoleMethod( GuiMeshRoadEditorCtrl, regenerate, void, 2, 2, "" )
DefineConsoleMethod( GuiMeshRoadEditorCtrl, regenerate, void, (), , "" )
{
MeshRoad *road = object->getSelectedRoad();
if ( road )
road->regenerate();
}
ConsoleMethod( GuiMeshRoadEditorCtrl, matchTerrainToRoad, void, 2, 2, "" )
DefineConsoleMethod( GuiMeshRoadEditorCtrl, matchTerrainToRoad, void, (), , "" )
{
object->matchTerrainToRoad();
}