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();
}

View file

@ -24,6 +24,7 @@
#include "environment/editors/guiRiverEditorCtrl.h"
#include "console/consoleTypes.h"
#include "console/engineAPI.h"
#include "environment/river.h"
#include "renderInstance/renderPassManager.h"
#include "collision/collision.h"
@ -1392,118 +1393,87 @@ void GuiRiverEditorCtrl::_renderSelectedRiver( ObjectRenderInst *ri, SceneRender
}
}
ConsoleMethod( GuiRiverEditorCtrl, deleteNode, void, 2, 2, "deleteNode()" )
DefineConsoleMethod( GuiRiverEditorCtrl, deleteNode, void, (), , "deleteNode()" )
{
object->deleteSelectedNode();
}
ConsoleMethod( GuiRiverEditorCtrl, getMode, const char*, 2, 2, "" )
DefineConsoleMethod( GuiRiverEditorCtrl, getMode, const char*, (), , "" )
{
return object->getMode();
}
ConsoleMethod( GuiRiverEditorCtrl, setMode, void, 3, 3, "setMode( String mode )" )
DefineConsoleMethod( GuiRiverEditorCtrl, setMode, void, ( const char * mode ), , "setMode( String mode )" )
{
String newMode = ( argv[2] );
String newMode = ( mode );
object->setMode( newMode );
}
ConsoleMethod( GuiRiverEditorCtrl, getNodeWidth, F32, 2, 2, "" )
DefineConsoleMethod( GuiRiverEditorCtrl, getNodeWidth, F32, (), , "" )
{
return object->getNodeWidth();
}
ConsoleMethod( GuiRiverEditorCtrl, setNodeWidth, void, 3, 3, "" )
DefineConsoleMethod( GuiRiverEditorCtrl, setNodeWidth, void, ( F32 width ), , "" )
{
object->setNodeWidth( dAtof(argv[2]) );
object->setNodeWidth( width );
}
ConsoleMethod( GuiRiverEditorCtrl, getNodeDepth, F32, 2, 2, "" )
DefineConsoleMethod( GuiRiverEditorCtrl, getNodeDepth, F32, (), , "" )
{
return object->getNodeDepth();
}
ConsoleMethod( GuiRiverEditorCtrl, setNodeDepth, void, 3, 3, "" )
DefineConsoleMethod( GuiRiverEditorCtrl, setNodeDepth, void, ( F32 depth ), , "" )
{
object->setNodeDepth( dAtof(argv[2]) );
object->setNodeDepth( depth );
}
ConsoleMethod( GuiRiverEditorCtrl, getNodePosition, const char*, 2, 2, "" )
DefineConsoleMethod( GuiRiverEditorCtrl, 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( GuiRiverEditorCtrl, setNodePosition, void, 3, 3, "" )
DefineConsoleMethod( GuiRiverEditorCtrl, 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( GuiRiverEditorCtrl, getNodeNormal, const char*, 2, 2, "" )
DefineConsoleMethod( GuiRiverEditorCtrl, 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( GuiRiverEditorCtrl, setNodeNormal, void, 3, 3, "" )
DefineConsoleMethod( GuiRiverEditorCtrl, 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( GuiRiverEditorCtrl, setSelectedRiver, void, 2, 3, "" )
DefineConsoleMethod( GuiRiverEditorCtrl, setSelectedRiver, void, (const char * objName), (""), "" )
{
if ( argc == 2 )
if (dStrcmp( objName,"" )==0)
object->setSelectedRiver(NULL);
else
{
River *river = NULL;
if ( Sim::findObject( argv[2], river ) )
if ( Sim::findObject( objName, river ) )
object->setSelectedRiver(river);
}
}
ConsoleMethod( GuiRiverEditorCtrl, getSelectedRiver, const char*, 2, 2, "" )
DefineConsoleMethod( GuiRiverEditorCtrl, getSelectedRiver, S32, (), , "" )
{
River *river = object->getSelectedRiver();
if ( !river )
return NULL;
return river->getIdString();
return river->getId();
}
ConsoleMethod( GuiRiverEditorCtrl, regenerate, void, 2, 2, "" )
DefineConsoleMethod( GuiRiverEditorCtrl, regenerate, void, (), , "" )
{
River *river = object->getSelectedRiver();
if ( river )

View file

@ -24,6 +24,7 @@
#include "environment/editors/guiRoadEditorCtrl.h"
#include "console/consoleTypes.h"
#include "console/engineAPI.h"
#include "scene/sceneManager.h"
#include "collision/collision.h"
#include "math/util/frustum.h"
@ -1036,86 +1037,71 @@ void GuiRoadEditorCtrl::submitUndo( const UTF8 *name )
undoMan->addAction( action );
}
ConsoleMethod( GuiRoadEditorCtrl, deleteNode, void, 2, 2, "deleteNode()" )
DefineConsoleMethod( GuiRoadEditorCtrl, deleteNode, void, (), , "deleteNode()" )
{
object->deleteSelectedNode();
}
ConsoleMethod( GuiRoadEditorCtrl, getMode, const char*, 2, 2, "" )
DefineConsoleMethod( GuiRoadEditorCtrl, getMode, const char*, (), , "" )
{
return object->getMode();
}
ConsoleMethod( GuiRoadEditorCtrl, setMode, void, 3, 3, "setMode( String mode )" )
DefineConsoleMethod( GuiRoadEditorCtrl, setMode, void, ( const char * mode ), , "setMode( String mode )" )
{
String newMode = ( argv[2] );
String newMode = ( mode );
object->setMode( newMode );
}
ConsoleMethod( GuiRoadEditorCtrl, getNodeWidth, F32, 2, 2, "" )
DefineConsoleMethod( GuiRoadEditorCtrl, getNodeWidth, F32, (), , "" )
{
return object->getNodeWidth();
}
ConsoleMethod( GuiRoadEditorCtrl, setNodeWidth, void, 3, 3, "" )
DefineConsoleMethod( GuiRoadEditorCtrl, setNodeWidth, void, ( F32 width ), , "" )
{
object->setNodeWidth( dAtof(argv[2]) );
object->setNodeWidth( width );
}
ConsoleMethod( GuiRoadEditorCtrl, getNodePosition, const char*, 2, 2, "" )
DefineConsoleMethod( GuiRoadEditorCtrl, 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( GuiRoadEditorCtrl, setNodePosition, void, 3, 3, "" )
DefineConsoleMethod( GuiRoadEditorCtrl, 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( GuiRoadEditorCtrl, setSelectedRoad, void, 2, 3, "" )
DefineConsoleMethod( GuiRoadEditorCtrl, setSelectedRoad, void, ( const char * pathRoad ), (""), "" )
{
if ( argc == 2 )
if (dStrcmp( pathRoad,"")==0 )
object->setSelectedRoad(NULL);
else
{
DecalRoad *road = NULL;
if ( Sim::findObject( argv[2], road ) )
if ( Sim::findObject( pathRoad, road ) )
object->setSelectedRoad(road);
}
}
ConsoleMethod( GuiRoadEditorCtrl, getSelectedRoad, const char*, 2, 2, "" )
DefineConsoleMethod( GuiRoadEditorCtrl, getSelectedRoad, S32, (), , "" )
{
DecalRoad *road = object->getSelectedRoad();
if ( road )
return road->getIdString();
return road->getId();
return NULL;
}
ConsoleMethod( GuiRoadEditorCtrl, getSelectedNode, S32, 2, 2, "" )
DefineConsoleMethod( GuiRoadEditorCtrl, getSelectedNode, S32, (), , "" )
{
return object->getSelectedNode();
}
ConsoleMethod( GuiRoadEditorCtrl, deleteRoad, void, 2, 2, "" )
DefineConsoleMethod( GuiRoadEditorCtrl, deleteRoad, void, (), , "" )
{
object->deleteSelectedRoad();
}

View file

@ -24,6 +24,7 @@
#include "environment/skyBox.h"
#include "console/consoleTypes.h"
#include "console/engineAPI.h"
#include "scene/sceneRenderState.h"
#include "renderInstance/renderPassManager.h"
#include "gfx/primBuilder.h"
@ -637,7 +638,7 @@ BaseMatInstance* SkyBox::_getMaterialInstance()
return mMatInstance;
}
ConsoleMethod( SkyBox, postApply, void, 2, 2, "")
DefineConsoleMethod( SkyBox, postApply, void, (), , "")
{
object->inspectPostApply();
}

View file

@ -27,6 +27,7 @@
#include "math/mathIO.h"
#include "core/stream/bitStream.h"
#include "console/consoleTypes.h"
#include "console/engineAPI.h"
#include "scene/sceneManager.h"
#include "math/mathUtils.h"
#include "lighting/lightInfo.h"
@ -546,18 +547,13 @@ void Sun::_onUnselected()
Parent::_onUnselected();
}
ConsoleMethod(Sun, apply, void, 2, 2, "")
DefineConsoleMethod(Sun, apply, void, (), , "")
{
object->inspectPostApply();
}
ConsoleMethod(Sun, animate, void, 7, 7, "animate( F32 duration, F32 startAzimuth, F32 endAzimuth, F32 startElevation, F32 endElevation )")
DefineConsoleMethod(Sun, animate, void, ( F32 duration, F32 startAzimuth, F32 endAzimuth, F32 startElevation, F32 endElevation ), , "animate( F32 duration, F32 startAzimuth, F32 endAzimuth, F32 startElevation, F32 endElevation )")
{
F32 duration = dAtof(argv[2]);
F32 startAzimuth = dAtof(argv[3]);
F32 endAzimuth = dAtof(argv[4]);
F32 startElevation = dAtof(argv[5]);
F32 endElevation = dAtof(argv[6]);
object->animate(duration, startAzimuth, endAzimuth, startElevation, endElevation);
}