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

@ -21,6 +21,7 @@
//-----------------------------------------------------------------------------
#include "platform/platform.h"
#include "console/engineAPI.h"
#include "gui/worldEditor/creator.h"
#include "gfx/gfxDrawUtil.h"
@ -218,37 +219,38 @@ void CreatorTree::sort()
}
//------------------------------------------------------------------------------
ConsoleMethod( CreatorTree, addGroup, S32, 4, 4, "(string group, string name, string value)")
DefineConsoleMethod( CreatorTree, addGroup, S32, (S32 group, const char * name, const char * value), , "(string group, string name, string value)")
{
CreatorTree::Node * grp = object->findNode(dAtoi(argv[2]));
CreatorTree::Node * grp = object->findNode(group);
if(!grp || !grp->isGroup())
return(-1);
// return same named group if found...
for(U32 i = 0; i < grp->mChildren.size(); i++)
if(!dStricmp(argv[3], grp->mChildren[i]->mName))
if(!dStricmp(name, grp->mChildren[i]->mName))
return(grp->mChildren[i]->mId);
CreatorTree::Node * node = object->createNode(argv[3], 0, true, grp);
CreatorTree::Node * node = object->createNode(name, 0, true, grp);
object->build();
return(node ? node->getId() : -1);
}
ConsoleMethod( CreatorTree, addItem, S32, 5, 5, "(Node group, string name, string value)")
DefineConsoleMethod( CreatorTree, addItem, S32, (S32 group, const char * name, const char * value), , "(Node group, string name, string value)")
{
CreatorTree::Node * grp = object->findNode(dAtoi(argv[2]));
CreatorTree::Node * grp = object->findNode(group);
if(!grp || !grp->isGroup())
return -1;
CreatorTree::Node * node = object->createNode(argv[3], argv[4], false, grp);
CreatorTree::Node * node = object->createNode(name, value, false, grp);
object->build();
return(node ? node->getId() : -1);
}
//------------------------------------------------------------------------------
ConsoleMethod( CreatorTree, fileNameMatch, bool, 5, 5, "(string world, string type, string filename)"){
DefineConsoleMethod( CreatorTree, fileNameMatch, bool, (const char * world, const char * type, const char * filename), , "(string world, string type, string filename)")
{
// argv[2] - world short
// argv[3] - type short
// argv[4] - filename
@ -256,50 +258,50 @@ ConsoleMethod( CreatorTree, fileNameMatch, bool, 5, 5, "(string world, string ty
// interior filenames
// 0 - world short ('b', 'x', ...)
// 1-> - type short ('towr', 'bunk', ...)
U32 typeLen = dStrlen(argv[3]);
if(dStrlen(argv[4]) < (typeLen + 1))
U32 typeLen = dStrlen(type);
if(dStrlen(filename) < (typeLen + 1))
return(false);
// world
if(dToupper(argv[4][0]) != dToupper(argv[2][0]))
if(dToupper(filename[0]) != dToupper(world[0]))
return(false);
return(!dStrnicmp(((const char*)argv[4])+1, argv[3], typeLen));
return(!dStrnicmp(filename+1, type, typeLen));
}
ConsoleMethod( CreatorTree, getSelected, S32, 2, 2, "Return a handle to the currently selected item.")
DefineConsoleMethod( CreatorTree, getSelected, S32, (), , "Return a handle to the currently selected item.")
{
return(object->getSelected());
}
ConsoleMethod( CreatorTree, isGroup, bool, 3, 3, "(Group g)")
DefineConsoleMethod( CreatorTree, isGroup, bool, (const char * group), , "(Group g)")
{
CreatorTree::Node * node = object->findNode(dAtoi(argv[2]));
CreatorTree::Node * node = object->findNode(dAtoi(group));
if(node && node->isGroup())
return(true);
return(false);
}
ConsoleMethod( CreatorTree, getName, const char*, 3, 3, "(Node item)")
DefineConsoleMethod( CreatorTree, getName, const char*, (const char * item), , "(Node item)")
{
CreatorTree::Node * node = object->findNode(dAtoi(argv[2]));
CreatorTree::Node * node = object->findNode(dAtoi(item));
return(node ? node->mName : 0);
}
ConsoleMethod( CreatorTree, getValue, const char*, 3, 3, "(Node n)")
DefineConsoleMethod( CreatorTree, getValue, const char*, (S32 nodeValue), , "(Node n)")
{
CreatorTree::Node * node = object->findNode(dAtoi(argv[2]));
CreatorTree::Node * node = object->findNode(nodeValue);
return(node ? node->mValue : 0);
}
ConsoleMethod( CreatorTree, clear, void, 2, 2, "Clear the tree.")
DefineConsoleMethod( CreatorTree, clear, void, (), , "Clear the tree.")
{
object->clear();
}
ConsoleMethod( CreatorTree, getParent, S32, 3, 3, "(Node n)")
DefineConsoleMethod( CreatorTree, getParent, S32, (S32 nodeValue), , "(Node n)")
{
CreatorTree::Node * node = object->findNode(dAtoi(argv[2]));
CreatorTree::Node * node = object->findNode(nodeValue);
if(node && node->mParent)
return(node->mParent->getId());

View file

@ -23,6 +23,7 @@
#include "gui/worldEditor/editor.h"
#include "console/console.h"
#include "console/consoleInternal.h"
#include "console/engineAPI.h"
#include "gui/controls/guiTextListCtrl.h"
#include "T3D/shapeBase.h"
#include "T3D/gameBase/gameConnection.h"
@ -127,9 +128,8 @@ static GameBase * getControlObj()
return(control);
}
ConsoleMethod( EditManager, setBookmark, void, 3, 3, "(int slot)")
DefineConsoleMethod( EditManager, setBookmark, void, (S32 val), , "(int slot)")
{
S32 val = dAtoi(argv[2]);
if(val < 0 || val > 9)
return;
@ -138,9 +138,8 @@ ConsoleMethod( EditManager, setBookmark, void, 3, 3, "(int slot)")
object->mBookmarks[val] = control->getTransform();
}
ConsoleMethod( EditManager, gotoBookmark, void, 3, 3, "(int slot)")
DefineConsoleMethod( EditManager, gotoBookmark, void, (S32 val), , "(int slot)")
{
S32 val = dAtoi(argv[2]);
if(val < 0 || val > 9)
return;
@ -149,17 +148,17 @@ ConsoleMethod( EditManager, gotoBookmark, void, 3, 3, "(int slot)")
control->setTransform(object->mBookmarks[val]);
}
ConsoleMethod( EditManager, editorEnabled, void, 2, 2, "Perform the onEditorEnabled callback on all SimObjects and set gEditingMission true" )
DefineConsoleMethod( EditManager, editorEnabled, void, (), , "Perform the onEditorEnabled callback on all SimObjects and set gEditingMission true" )
{
object->editorEnabled();
}
ConsoleMethod( EditManager, editorDisabled, void, 2, 2, "Perform the onEditorDisabled callback on all SimObjects and set gEditingMission false" )
DefineConsoleMethod( EditManager, editorDisabled, void, (), , "Perform the onEditorDisabled callback on all SimObjects and set gEditingMission false" )
{
object->editorDisabled();
}
ConsoleMethod( EditManager, isEditorEnabled, bool, 2, 2, "Return the value of gEditingMission." )
DefineConsoleMethod( EditManager, isEditorEnabled, bool, (), , "Return the value of gEditingMission." )
{
return gEditingMission;
}

View file

@ -24,6 +24,7 @@
#include "gui/worldEditor/guiConvexShapeEditorCtrl.h"
#include "console/consoleTypes.h"
#include "console/engineAPI.h"
#include "T3D/convexShape.h"
#include "renderInstance/renderPassManager.h"
#include "collision/collision.h"
@ -2178,44 +2179,43 @@ void GuiConvexEditorCtrl::splitSelectedFace()
updateGizmoPos();
}
ConsoleMethod( GuiConvexEditorCtrl, hollowSelection, void, 2, 2, "" )
DefineConsoleMethod( GuiConvexEditorCtrl, hollowSelection, void, (), , "" )
{
object->hollowSelection();
}
ConsoleMethod( GuiConvexEditorCtrl, recenterSelection, void, 2, 2, "" )
DefineConsoleMethod( GuiConvexEditorCtrl, recenterSelection, void, (), , "" )
{
object->recenterSelection();
}
ConsoleMethod( GuiConvexEditorCtrl, hasSelection, S32, 2, 2, "" )
DefineConsoleMethod( GuiConvexEditorCtrl, hasSelection, S32, (), , "" )
{
return object->hasSelection();
}
ConsoleMethod( GuiConvexEditorCtrl, handleDelete, void, 2, 2, "" )
DefineConsoleMethod( GuiConvexEditorCtrl, handleDelete, void, (), , "" )
{
object->handleDelete();
}
ConsoleMethod( GuiConvexEditorCtrl, handleDeselect, void, 2, 2, "" )
DefineConsoleMethod( GuiConvexEditorCtrl, handleDeselect, void, (), , "" )
{
object->handleDeselect();
}
ConsoleMethod( GuiConvexEditorCtrl, dropSelectionAtScreenCenter, void, 2, 2, "" )
DefineConsoleMethod( GuiConvexEditorCtrl, dropSelectionAtScreenCenter, void, (), , "" )
{
object->dropSelectionAtScreenCenter();
}
ConsoleMethod( GuiConvexEditorCtrl, selectConvex, void, 3, 3, "( ConvexShape )" )
DefineConsoleMethod( GuiConvexEditorCtrl, selectConvex, void, (ConvexShape *convex), , "( ConvexShape )" )
{
ConvexShape *convex;
if ( Sim::findObject( argv[2], convex ) )
if (convex)
object->setSelection( convex, -1 );
}
ConsoleMethod( GuiConvexEditorCtrl, splitSelectedFace, void, 2, 2, "" )
DefineConsoleMethod( GuiConvexEditorCtrl, splitSelectedFace, void, (), , "" )
{
object->splitSelectedFace();
}

View file

@ -26,6 +26,7 @@
#include "platform/platform.h"
#include "console/consoleTypes.h"
#include "console/engineAPI.h"
#include "scene/sceneManager.h"
#include "collision/collision.h"
#include "math/util/frustum.h"
@ -785,49 +786,47 @@ void GuiDecalEditorCtrl::setMode( String mode, bool sourceShortcut = false )
Con::executef( this, "paletteSync", mMode );
}
ConsoleMethod( GuiDecalEditorCtrl, deleteSelectedDecal, void, 2, 2, "deleteSelectedDecal()" )
DefineConsoleMethod( GuiDecalEditorCtrl, deleteSelectedDecal, void, (), , "deleteSelectedDecal()" )
{
object->deleteSelectedDecal();
}
ConsoleMethod( GuiDecalEditorCtrl, deleteDecalDatablock, void, 3, 3, "deleteSelectedDecalDatablock( String datablock )" )
DefineConsoleMethod( GuiDecalEditorCtrl, deleteDecalDatablock, void, ( const char * datablock ), , "deleteSelectedDecalDatablock( String datablock )" )
{
String lookupName( (const char*)argv[2] );
String lookupName( datablock );
if( lookupName == String::EmptyString )
return;
object->deleteDecalDatablock( lookupName );
}
ConsoleMethod( GuiDecalEditorCtrl, setMode, void, 3, 3, "setMode( String mode )()" )
DefineConsoleMethod( GuiDecalEditorCtrl, setMode, void, ( String newMode ), , "setMode( String mode )()" )
{
String newMode = ( (const char*)argv[2] );
object->setMode( newMode );
}
ConsoleMethod( GuiDecalEditorCtrl, getMode, const char*, 2, 2, "getMode()" )
DefineConsoleMethod( GuiDecalEditorCtrl, getMode, const char*, (), , "getMode()" )
{
return object->mMode;
}
ConsoleMethod( GuiDecalEditorCtrl, getDecalCount, S32, 2, 2, "getDecalCount()" )
DefineConsoleMethod( GuiDecalEditorCtrl, getDecalCount, S32, (), , "getDecalCount()" )
{
return gDecalManager->mDecalInstanceVec.size();
}
ConsoleMethod( GuiDecalEditorCtrl, getDecalTransform, const char*, 3, 3, "getDecalTransform()" )
DefineConsoleMethod( GuiDecalEditorCtrl, getDecalTransform, const char*, ( U32 id ), , "getDecalTransform()" )
{
DecalInstance *decalInstance = gDecalManager->mDecalInstanceVec[dAtoi(argv[2])];
DecalInstance *decalInstance = gDecalManager->mDecalInstanceVec[id];
if( decalInstance == NULL )
return "";
static const U32 bufSize = 256;
char* returnBuffer = Con::getReturnBuffer(bufSize);
char* returnBuffer = Con::getReturnBuffer(256);
returnBuffer[0] = 0;
if ( decalInstance )
{
dSprintf(returnBuffer, bufSize, "%f %f %f %f %f %f %f",
dSprintf(returnBuffer, 256, "%f %f %f %f %f %f %f",
decalInstance->mPosition.x, decalInstance->mPosition.y, decalInstance->mPosition.z,
decalInstance->mTangent.x, decalInstance->mTangent.y, decalInstance->mTangent.z,
decalInstance->mSize);
@ -836,42 +835,30 @@ ConsoleMethod( GuiDecalEditorCtrl, getDecalTransform, const char*, 3, 3, "getDec
return returnBuffer;
}
ConsoleMethod( GuiDecalEditorCtrl, getDecalLookupName, const char*, 3, 3, "getDecalLookupName( S32 )()" )
DefineConsoleMethod( GuiDecalEditorCtrl, getDecalLookupName, const char*, ( U32 id ), , "getDecalLookupName( S32 )()" )
{
DecalInstance *decalInstance = gDecalManager->mDecalInstanceVec[dAtoi(argv[2])];
DecalInstance *decalInstance = gDecalManager->mDecalInstanceVec[id];
if( decalInstance == NULL )
return "invalid";
return decalInstance->mDataBlock->lookupName;
}
ConsoleMethod( GuiDecalEditorCtrl, selectDecal, void, 3, 3, "selectDecal( S32 )()" )
DefineConsoleMethod( GuiDecalEditorCtrl, selectDecal, void, ( U32 id ), , "selectDecal( S32 )()" )
{
DecalInstance *decalInstance = gDecalManager->mDecalInstanceVec[dAtoi(argv[2])];
DecalInstance *decalInstance = gDecalManager->mDecalInstanceVec[id];
if( decalInstance == NULL )
return;
object->selectDecal( decalInstance );
}
ConsoleMethod( GuiDecalEditorCtrl, editDecalDetails, void, 4, 4, "editDecalDetails( S32 )()" )
DefineConsoleMethod( GuiDecalEditorCtrl, editDecalDetails, void, ( U32 id, Point3F pos, Point3F tan,F32 size ), , "editDecalDetails( S32 )()" )
{
DecalInstance *decalInstance = gDecalManager->mDecalInstanceVec[ dAtoi(argv[2]) ];
DecalInstance *decalInstance = gDecalManager->mDecalInstanceVec[id];
if( decalInstance == NULL )
return;
Point3F pos;
Point3F tan;
F32 size;
S32 count = dSscanf( argv[3], "%f %f %f %f %f %f %f",
&pos.x, &pos.y, &pos.z, &tan.x, &tan.y, &tan.z, &size);
if ( (count != 7) )
{
Con::printf("Failed to parse decal information \"px py pz tx ty tz s\" from '%s'", (const char*)argv[3]);
return;
}
decalInstance->mPosition = pos;
decalInstance->mTangent = tan;
@ -885,17 +872,17 @@ ConsoleMethod( GuiDecalEditorCtrl, editDecalDetails, void, 4, 4, "editDecalDetai
gDecalManager->notifyDecalModified( decalInstance );
}
ConsoleMethod( GuiDecalEditorCtrl, getSelectionCount, S32, 2, 2, "" )
DefineConsoleMethod( GuiDecalEditorCtrl, getSelectionCount, S32, (), , "" )
{
if ( object->mSELDecal != NULL )
return 1;
return 0;
}
ConsoleMethod( GuiDecalEditorCtrl, retargetDecalDatablock, void, 4, 4, "" )
DefineConsoleMethod( GuiDecalEditorCtrl, retargetDecalDatablock, void, ( const char * dbFrom, const char * dbTo ), , "" )
{
if( dStrcmp( argv[2], "" ) != 0 && dStrcmp( argv[3], "" ) != 0 )
object->retargetDecalDatablock( argv[2], argv[3] );
if( dStrcmp( dbFrom, "" ) != 0 && dStrcmp( dbTo, "" ) != 0 )
object->retargetDecalDatablock( dbFrom, dbTo );
}
void GuiDecalEditorCtrl::setGizmoFocus( DecalInstance * decalInstance )

View file

@ -22,6 +22,7 @@
#include "gui/worldEditor/guiMissionAreaEditor.h"
#include "gui/core/guiCanvas.h"
#include "console/engineAPI.h"
IMPLEMENT_CONOBJECT(GuiMissionAreaEditorCtrl);
@ -94,19 +95,19 @@ void GuiMissionAreaEditorCtrl::setSelectedMissionArea( MissionArea *missionArea
Con::executef( this, "onMissionAreaSelected" );
}
ConsoleMethod( GuiMissionAreaEditorCtrl, setSelectedMissionArea, void, 2, 3, "" )
DefineConsoleMethod( GuiMissionAreaEditorCtrl, setSelectedMissionArea, void, (const char * missionAreaName), (""), "" )
{
if ( argc == 2 )
if ( missionAreaName == "" )
object->setSelectedMissionArea(NULL);
else
{
MissionArea *missionArea = NULL;
if ( Sim::findObject( argv[2], missionArea ) )
if ( Sim::findObject( missionAreaName, missionArea ) )
object->setSelectedMissionArea(missionArea);
}
}
ConsoleMethod( GuiMissionAreaEditorCtrl, getSelectedMissionArea, const char*, 2, 2, "" )
DefineConsoleMethod( GuiMissionAreaEditorCtrl, getSelectedMissionArea, const char*, (), , "" )
{
MissionArea *missionArea = object->getSelectedMissionArea();
if ( !missionArea )

View file

@ -21,6 +21,7 @@
//-----------------------------------------------------------------------------
#include "console/console.h"
#include "console/engineAPI.h"
#include "console/consoleTypes.h"
#include "terrain/terrData.h"
#include "gui/worldEditor/guiTerrPreviewCtrl.h"
@ -87,41 +88,35 @@ void GuiTerrPreviewCtrl::initPersistFields()
}
ConsoleMethod( GuiTerrPreviewCtrl, reset, void, 2, 2, "Reset the view of the terrain.")
DefineConsoleMethod( GuiTerrPreviewCtrl, reset, void, (), , "Reset the view of the terrain.")
{
object->reset();
}
ConsoleMethod( GuiTerrPreviewCtrl, setRoot, void, 2, 2, "Add the origin to the root and reset the origin.")
DefineConsoleMethod( GuiTerrPreviewCtrl, setRoot, void, (), , "Add the origin to the root and reset the origin.")
{
object->setRoot();
}
ConsoleMethod( GuiTerrPreviewCtrl, getRoot, const char *, 2, 2, "Return a Point2F representing the position of the root.")
DefineConsoleMethod( GuiTerrPreviewCtrl, getRoot, Point2F, (), , "Return a Point2F representing the position of the root.")
{
Point2F p = object->getRoot();
return object->getRoot();
static char rootbuf[32];
dSprintf(rootbuf,sizeof(rootbuf),"%g %g", p.x, -p.y);
return rootbuf;
}
ConsoleMethod( GuiTerrPreviewCtrl, setOrigin, void, 4, 4, "(float x, float y)"
DefineConsoleMethod( GuiTerrPreviewCtrl, setOrigin, void, (Point2F pos), , "(float x, float y)"
"Set the origin of the view.")
{
object->setOrigin( Point2F( dAtof(argv[2]), -dAtof(argv[3]) ) );
object->setOrigin( pos );
}
ConsoleMethod( GuiTerrPreviewCtrl, getOrigin, const char*, 2, 2, "Return a Point2F containing the position of the origin.")
DefineConsoleMethod( GuiTerrPreviewCtrl, getOrigin, Point2F, (), , "Return a Point2F containing the position of the origin.")
{
Point2F p = object->getOrigin();
return object->getOrigin();
static char originbuf[32];
dSprintf(originbuf,sizeof(originbuf),"%g %g", p.x, -p.y);
return originbuf;
}
ConsoleMethod( GuiTerrPreviewCtrl, getValue, const char*, 2, 2, "Returns a 4-tuple containing: root_x root_y origin_x origin_y")
DefineConsoleMethod( GuiTerrPreviewCtrl, getValue, const char*, (), , "Returns a 4-tuple containing: root_x root_y origin_x origin_y")
{
Point2F r = object->getRoot();
Point2F o = object->getOrigin();
@ -131,11 +126,11 @@ ConsoleMethod( GuiTerrPreviewCtrl, getValue, const char*, 2, 2, "Returns a 4-tup
return valuebuf;
}
ConsoleMethod( GuiTerrPreviewCtrl, setValue, void, 3, 3, "Accepts a 4-tuple in the same form as getValue returns.\n\n"
DefineConsoleMethod( GuiTerrPreviewCtrl, setValue, void, (const char * tuple), , "Accepts a 4-tuple in the same form as getValue returns.\n\n"
"@see GuiTerrPreviewCtrl::getValue()")
{
Point2F r,o;
dSscanf(argv[2],"%g %g %g %g", &r.x, &r.y, &o.x, &o.y);
dSscanf(tuple, "%g %g %g %g", &r.x, &r.y, &o.x, &o.y);
r.y = -r.y;
o.y = -o.y;
object->reset();

View file

@ -20,6 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "console/engineAPI.h"
#include "platform/platform.h"
#include "gui/worldEditor/terrainActions.h"
@ -796,11 +797,10 @@ void TerrainSmoothAction::smooth( TerrainBlock *terrain, F32 factor, U32 steps )
redo();
}
ConsoleMethod( TerrainSmoothAction, smooth, void, 5, 5, "( TerrainBlock obj, F32 factor, U32 steps )")
DefineConsoleMethod( TerrainSmoothAction, smooth, void, ( TerrainBlock *terrain, F32 factor, U32 steps ), , "( TerrainBlock obj, F32 factor, U32 steps )")
{
TerrainBlock *terrain = NULL;
if ( Sim::findObject( argv[2], terrain ) && terrain )
object->smooth( terrain, dAtof( argv[3] ), mClamp( dAtoi( argv[4] ), 1, 13 ) );
if (terrain)
object->smooth( terrain, factor, mClamp( steps, 1, 13 ) );
}
void TerrainSmoothAction::undo()

View file

@ -27,6 +27,7 @@
#include "core/strings/stringUnit.h"
#include "console/consoleTypes.h"
#include "console/simEvents.h"
#include "console/engineAPI.h"
#include "sim/netConnection.h"
#include "math/mathUtils.h"
#include "gfx/primBuilder.h"
@ -2401,7 +2402,7 @@ void TerrainEditor::reorderMaterial( S32 index, S32 orderPos )
//------------------------------------------------------------------------------
ConsoleMethod( TerrainEditor, attachTerrain, void, 2, 3, "(TerrainBlock terrain)")
DefineConsoleMethod( TerrainEditor, attachTerrain, void, (const char * terrain), (""), "(TerrainBlock terrain)")
{
SimSet * missionGroup = dynamic_cast<SimSet*>(Sim::findObject("MissionGroup"));
if (!missionGroup)
@ -2413,7 +2414,7 @@ ConsoleMethod( TerrainEditor, attachTerrain, void, 2, 3, "(TerrainBlock terrain)
VectorPtr<TerrainBlock*> terrains;
// attach to first found terrainBlock
if (argc == 2)
if (dStrcmp (terrain,"")==0)
{
for(SimSetIterator itr(missionGroup); *itr; ++itr)
{
@ -2428,13 +2429,13 @@ ConsoleMethod( TerrainEditor, attachTerrain, void, 2, 3, "(TerrainBlock terrain)
}
else // attach to named object
{
TerrainBlock* terrBlock = dynamic_cast<TerrainBlock*>(Sim::findObject(argv[2]));
TerrainBlock* terrBlock = dynamic_cast<TerrainBlock*>(Sim::findObject(terrain));
if (terrBlock)
terrains.push_back(terrBlock);
if(terrains.size() == 0)
Con::errorf(ConsoleLogEntry::Script, "TerrainEditor::attach: failed to attach to object '%s'", (const char*)argv[2]);
Con::errorf(ConsoleLogEntry::Script, "TerrainEditor::attach: failed to attach to object '%s'", terrain);
}
if (terrains.size() > 0)
@ -2457,21 +2458,21 @@ ConsoleMethod( TerrainEditor, attachTerrain, void, 2, 3, "(TerrainBlock terrain)
}
}
ConsoleMethod( TerrainEditor, getTerrainBlockCount, S32, 2, 2, "()")
DefineConsoleMethod( TerrainEditor, getTerrainBlockCount, S32, (), , "()")
{
return object->getTerrainBlockCount();
}
ConsoleMethod( TerrainEditor, getTerrainBlock, S32, 3, 3, "(S32 index)")
DefineConsoleMethod( TerrainEditor, getTerrainBlock, S32, (S32 index), , "(S32 index)")
{
TerrainBlock* tb = object->getTerrainBlock(dAtoi(argv[2]));
TerrainBlock* tb = object->getTerrainBlock(index);
if(!tb)
return 0;
else
return tb->getId();
}
ConsoleMethod(TerrainEditor, getTerrainBlocksMaterialList, const char *, 2, 2, "() gets the list of current terrain materials for all terrain blocks.")
DefineConsoleMethod(TerrainEditor, getTerrainBlocksMaterialList, const char *, (), , "() gets the list of current terrain materials for all terrain blocks.")
{
Vector<StringTableEntry> list;
object->getTerrainBlocksMaterialList(list);
@ -2500,112 +2501,99 @@ ConsoleMethod(TerrainEditor, getTerrainBlocksMaterialList, const char *, 2, 2, "
return ret;
}
ConsoleMethod( TerrainEditor, setBrushType, void, 3, 3, "(string type)"
DefineConsoleMethod( TerrainEditor, setBrushType, void, (String type), , "(string type)"
"One of box, ellipse, selection.")
{
object->setBrushType(argv[2]);
object->setBrushType(type);
}
ConsoleMethod( TerrainEditor, getBrushType, const char*, 2, 2, "()")
DefineConsoleMethod( TerrainEditor, getBrushType, const char*, (), , "()")
{
return object->getBrushType();
}
ConsoleMethod( TerrainEditor, setBrushSize, void, 3, 4, "(int w [, int h])")
DefineConsoleMethod( TerrainEditor, setBrushSize, void, ( S32 w, S32 h), (0), "(int w [, int h])")
{
S32 w = dAtoi(argv[2]);
S32 h = argc > 3 ? dAtoi(argv[3]) : w;
object->setBrushSize( w, h );
object->setBrushSize( w, h==0?w:h );
}
ConsoleMethod( TerrainEditor, getBrushSize, const char*, 2, 2, "()")
DefineConsoleMethod( TerrainEditor, getBrushSize, const char*, (), , "()")
{
Point2I size = object->getBrushSize();
static const U32 bufSize = 32;
char * ret = Con::getReturnBuffer(bufSize);
dSprintf(ret, bufSize, "%d %d", size.x, size.y);
char * ret = Con::getReturnBuffer(32);
dSprintf(ret, 32, "%d %d", size.x, size.y);
return ret;
}
ConsoleMethod( TerrainEditor, setBrushPressure, void, 3, 3, "(float pressure)")
DefineConsoleMethod( TerrainEditor, setBrushPressure, void, (F32 pressure), , "(float pressure)")
{
object->setBrushPressure( dAtof( argv[2] ) );
object->setBrushPressure( pressure );
}
ConsoleMethod( TerrainEditor, getBrushPressure, F32, 2, 2, "()")
DefineConsoleMethod( TerrainEditor, getBrushPressure, F32, (), , "()")
{
return object->getBrushPressure();
}
ConsoleMethod( TerrainEditor, setBrushSoftness, void, 3, 3, "(float softness)")
DefineConsoleMethod( TerrainEditor, setBrushSoftness, void, (F32 softness), , "(float softness)")
{
object->setBrushSoftness( dAtof( argv[2] ) );
object->setBrushSoftness( softness );
}
ConsoleMethod( TerrainEditor, getBrushSoftness, F32, 2, 2, "()")
DefineConsoleMethod( TerrainEditor, getBrushSoftness, F32, (), , "()")
{
return object->getBrushSoftness();
}
ConsoleMethod( TerrainEditor, getBrushPos, const char*, 2, 2, "Returns a Point2I.")
DefineConsoleMethod( TerrainEditor, getBrushPos, const char*, (), , "Returns a Point2I.")
{
return object->getBrushPos();
}
ConsoleMethod( TerrainEditor, setBrushPos, void, 3, 4, "(int x, int y)")
DefineConsoleMethod( TerrainEditor, setBrushPos, void, (Point2I pos), , "Location")
{
//
Point2I pos;
if(argc == 3)
dSscanf(argv[2], "%d %d", &pos.x, &pos.y);
else
{
pos.x = dAtoi(argv[2]);
pos.y = dAtoi(argv[3]);
}
object->setBrushPos(pos);
}
ConsoleMethod( TerrainEditor, setAction, void, 3, 3, "(string action_name)")
DefineConsoleMethod( TerrainEditor, setAction, void, (const char * action_name), , "(string action_name)")
{
object->setAction(argv[2]);
object->setAction(action_name);
}
ConsoleMethod( TerrainEditor, getActionName, const char*, 3, 3, "(int num)")
DefineConsoleMethod( TerrainEditor, getActionName, const char*, (U32 index), , "(int num)")
{
return (object->getActionName(dAtoi(argv[2])));
return (object->getActionName(index));
}
ConsoleMethod( TerrainEditor, getNumActions, S32, 2, 2, "")
DefineConsoleMethod( TerrainEditor, getNumActions, S32, (), , "")
{
return(object->getNumActions());
}
ConsoleMethod( TerrainEditor, getCurrentAction, const char*, 2, 2, "")
DefineConsoleMethod( TerrainEditor, getCurrentAction, const char*, (), , "")
{
return object->getCurrentAction();
}
ConsoleMethod( TerrainEditor, resetSelWeights, void, 3, 3, "(bool clear)")
DefineConsoleMethod( TerrainEditor, resetSelWeights, void, (bool clear), , "(bool clear)")
{
object->resetSelWeights(dAtob(argv[2]));
object->resetSelWeights(clear);
}
ConsoleMethod( TerrainEditor, clearSelection, void, 2, 2, "")
DefineConsoleMethod( TerrainEditor, clearSelection, void, (), , "")
{
object->clearSelection();
}
ConsoleMethod( TerrainEditor, processAction, void, 2, 3, "(string action=NULL)")
DefineConsoleMethod( TerrainEditor, processAction, void, (String action), (""), "(string action=NULL)")
{
if(argc == 3)
object->processAction(argv[2]);
else object->processAction("");
object->processAction(action);
}
ConsoleMethod( TerrainEditor, getActiveTerrain, S32, 2, 2, "")
DefineConsoleMethod( TerrainEditor, getActiveTerrain, S32, (), , "")
{
S32 ret = 0;
@ -2617,27 +2605,27 @@ ConsoleMethod( TerrainEditor, getActiveTerrain, S32, 2, 2, "")
return ret;
}
ConsoleMethod( TerrainEditor, getNumTextures, S32, 2, 2, "")
DefineConsoleMethod( TerrainEditor, getNumTextures, S32, (), , "")
{
return object->getNumTextures();
}
ConsoleMethod( TerrainEditor, markEmptySquares, void, 2, 2, "")
DefineConsoleMethod( TerrainEditor, markEmptySquares, void, (), , "")
{
object->markEmptySquares();
}
ConsoleMethod( TerrainEditor, mirrorTerrain, void, 3, 3, "")
DefineConsoleMethod( TerrainEditor, mirrorTerrain, void, (S32 mirrorIndex), , "")
{
object->mirrorTerrain(dAtoi(argv[2]));
object->mirrorTerrain(mirrorIndex);
}
ConsoleMethod(TerrainEditor, setTerraformOverlay, void, 3, 3, "(bool overlayEnable) - sets the terraformer current heightmap to draw as an overlay over the current terrain.")
DefineConsoleMethod(TerrainEditor, setTerraformOverlay, void, (bool overlayEnable), , "(bool overlayEnable) - sets the terraformer current heightmap to draw as an overlay over the current terrain.")
{
// XA: This one needs to be implemented :)
}
ConsoleMethod(TerrainEditor, updateMaterial, bool, 4, 4,
DefineConsoleMethod(TerrainEditor, updateMaterial, bool, ( U32 index, String matName ), ,
"( int index, string matName )\n"
"Changes the material name at the index." )
{
@ -2645,18 +2633,17 @@ ConsoleMethod(TerrainEditor, updateMaterial, bool, 4, 4,
if ( !terr )
return false;
U32 index = dAtoi( argv[2] );
if ( index >= terr->getMaterialCount() )
return false;
terr->updateMaterial( index, argv[3] );
terr->updateMaterial( index, matName );
object->setDirty();
return true;
}
ConsoleMethod(TerrainEditor, addMaterial, S32, 3, 3,
DefineConsoleMethod(TerrainEditor, addMaterial, S32, ( String matName ), ,
"( string matName )\n"
"Adds a new material." )
{
@ -2664,20 +2651,19 @@ ConsoleMethod(TerrainEditor, addMaterial, S32, 3, 3,
if ( !terr )
return false;
terr->addMaterial( argv[2] );
terr->addMaterial( matName );
object->setDirty();
return true;
}
ConsoleMethod( TerrainEditor, removeMaterial, void, 3, 3, "( int index ) - Remove the material at the given index." )
DefineConsoleMethod( TerrainEditor, removeMaterial, void, ( S32 index ), , "( int index ) - Remove the material at the given index." )
{
TerrainBlock *terr = object->getClientTerrain();
if ( !terr )
return;
S32 index = dAtoi( argv[ 2 ] );
if ( index < 0 || index >= terr->getMaterialCount() )
{
Con::errorf( "TerrainEditor::removeMaterial - index out of range!" );
@ -2701,7 +2687,7 @@ ConsoleMethod( TerrainEditor, removeMaterial, void, 3, 3, "( int index ) - Remov
object->setGridUpdateMinMax();
}
ConsoleMethod(TerrainEditor, getMaterialCount, S32, 2, 2,
DefineConsoleMethod(TerrainEditor, getMaterialCount, S32, (), ,
"Returns the current material count." )
{
TerrainBlock *terr = object->getClientTerrain();
@ -2711,7 +2697,7 @@ ConsoleMethod(TerrainEditor, getMaterialCount, S32, 2, 2,
return 0;
}
ConsoleMethod(TerrainEditor, getMaterials, const char *, 2, 2, "() gets the list of current terrain materials.")
DefineConsoleMethod(TerrainEditor, getMaterials, const char *, (), , "() gets the list of current terrain materials.")
{
TerrainBlock *terr = object->getClientTerrain();
if ( !terr )
@ -2728,13 +2714,12 @@ ConsoleMethod(TerrainEditor, getMaterials, const char *, 2, 2, "() gets the list
return ret;
}
ConsoleMethod( TerrainEditor, getMaterialName, const char*, 3, 3, "( int index ) - Returns the name of the material at the given index." )
DefineConsoleMethod( TerrainEditor, getMaterialName, const char*, (S32 index), , "( int index ) - Returns the name of the material at the given index." )
{
TerrainBlock *terr = object->getClientTerrain();
if ( !terr )
return "";
S32 index = dAtoi( argv[ 2 ] );
if( index < 0 || index >= terr->getMaterialCount() )
{
Con::errorf( "TerrainEditor::getMaterialName - index out of range!" );
@ -2745,13 +2730,12 @@ ConsoleMethod( TerrainEditor, getMaterialName, const char*, 3, 3, "( int index )
return Con::getReturnBuffer( name );
}
ConsoleMethod( TerrainEditor, getMaterialIndex, S32, 3, 3, "( string name ) - Returns the index of the material with the given name or -1." )
DefineConsoleMethod( TerrainEditor, getMaterialIndex, S32, ( String name ), , "( string name ) - Returns the index of the material with the given name or -1." )
{
TerrainBlock *terr = object->getClientTerrain();
if ( !terr )
return -1;
const char* name = argv[ 2 ];
const U32 count = terr->getMaterialCount();
for( U32 i = 0; i < count; ++ i )
@ -2761,13 +2745,14 @@ ConsoleMethod( TerrainEditor, getMaterialIndex, S32, 3, 3, "( string name ) - Re
return -1;
}
ConsoleMethod( TerrainEditor, reorderMaterial, void, 4, 4, "( int index, int order ) "
DefineConsoleMethod( TerrainEditor, reorderMaterial, void, ( S32 index, S32 orderPos ), , "( int index, int order ) "
"- Reorder material at the given index to the new position, changing the order in which it is rendered / blended." )
{
object->reorderMaterial( dAtoi( argv[2] ), dAtoi( argv[3] ) );
object->reorderMaterial( index, orderPos );
}
ConsoleMethod(TerrainEditor, getTerrainUnderWorldPoint, S32, 3, 5, "(x/y/z) Gets the terrain block that is located under the given world point.\n"
DefineConsoleMethod(TerrainEditor, getTerrainUnderWorldPoint, S32, (const char * ptOrX, const char * Y, const char * Z), ("", "", ""),
"(x/y/z) Gets the terrain block that is located under the given world point.\n"
"@param x/y/z The world coordinates (floating point values) you wish to query at. "
"These can be formatted as either a string (\"x y z\") or separately as (x, y, z)\n"
"@return Returns the ID of the requested terrain block (0 if not found).\n\n")
@ -2776,13 +2761,13 @@ ConsoleMethod(TerrainEditor, getTerrainUnderWorldPoint, S32, 3, 5, "(x/y/z) Gets
if(tEditor == NULL)
return 0;
Point3F pos;
if(argc == 3)
dSscanf(argv[2], "%f %f %f", &pos.x, &pos.y, &pos.z);
else if(argc == 5)
if(ptOrX != "" && Y == "" && Z == "")
dSscanf(ptOrX, "%f %f %f", &pos.x, &pos.y, &pos.z);
else if(ptOrX != "" && Y != "" && Z != "")
{
pos.x = dAtof(argv[2]);
pos.y = dAtof(argv[3]);
pos.z = dAtof(argv[4]);
pos.x = dAtof(ptOrX);
pos.y = dAtof(Y);
pos.z = dAtof(Z);
}
else
@ -2835,14 +2820,13 @@ void TerrainEditor::initPersistFields()
Parent::initPersistFields();
}
ConsoleMethod( TerrainEditor, getSlopeLimitMinAngle, F32, 2, 2, 0)
DefineConsoleMethod( TerrainEditor, getSlopeLimitMinAngle, F32, (), , "")
{
return object->mSlopeMinAngle;
}
ConsoleMethod( TerrainEditor, setSlopeLimitMinAngle, F32, 3, 3, 0)
DefineConsoleMethod( TerrainEditor, setSlopeLimitMinAngle, F32, (F32 angle), , "")
{
F32 angle = dAtof( argv[2] );
if ( angle < 0.0f )
angle = 0.0f;
if ( angle > object->mSlopeMaxAngle )
@ -2852,14 +2836,13 @@ ConsoleMethod( TerrainEditor, setSlopeLimitMinAngle, F32, 3, 3, 0)
return angle;
}
ConsoleMethod( TerrainEditor, getSlopeLimitMaxAngle, F32, 2, 2, 0)
DefineConsoleMethod( TerrainEditor, getSlopeLimitMaxAngle, F32, (), , "")
{
return object->mSlopeMaxAngle;
}
ConsoleMethod( TerrainEditor, setSlopeLimitMaxAngle, F32, 3, 3, 0)
DefineConsoleMethod( TerrainEditor, setSlopeLimitMaxAngle, F32, (F32 angle), , "")
{
F32 angle = dAtof( argv[2] );
if ( angle > 90.0f )
angle = 90.0f;
if ( angle < object->mSlopeMinAngle )
@ -2938,7 +2921,7 @@ void TerrainEditor::autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinS
scheduleMaterialUpdate();
}
ConsoleMethod( TerrainEditor, autoMaterialLayer, void, 7, 7, "(float minHeight, float maxHeight, float minSlope, float maxSlope, float coverage)")
DefineConsoleMethod( TerrainEditor, autoMaterialLayer, void, (F32 minHeight, F32 maxHeight, F32 minSlope, F32 maxSlope, F32 coverage), , "(F32 minHeight, F32 maxHeight, F32 minSlope, F32 maxSlope , F32 coverage)")
{
object->autoMaterialLayer( dAtof(argv[2]), dAtof(argv[3]), dAtof(argv[4]), dAtof(argv[5]), dAtof(argv[6]));
}
object->autoMaterialLayer( minHeight,maxHeight, minSlope, maxSlope, coverage );
}

View file

@ -26,6 +26,7 @@
#include "gui/editor/inspector/field.h"
#include "gui/editor/guiInspector.h"
#include "console/consoleTypes.h"
#include "console/engineAPI.h"
IMPLEMENT_CONOBJECT( MECreateUndoAction );
@ -57,10 +58,9 @@ void MECreateUndoAction::addObject( SimObject *object )
mObjects.last().id = object->getId();
}
ConsoleMethod( MECreateUndoAction, addObject, void, 3, 3, "( SimObject obj )")
DefineConsoleMethod( MECreateUndoAction, addObject, void, (SimObject *obj), , "( SimObject obj )")
{
SimObject *obj = NULL;
if ( Sim::findObject( argv[2], obj ) && obj )
if (obj)
object->addObject( obj );
}
@ -163,10 +163,9 @@ void MEDeleteUndoAction::deleteObject( const Vector<SimObject*> &objectList )
deleteObject( objectList[i] );
}
ConsoleMethod( MEDeleteUndoAction, deleteObject, void, 3, 3, "( SimObject obj )")
DefineConsoleMethod( MEDeleteUndoAction, deleteObject, void, (SimObject *obj ), , "( SimObject obj )")
{
SimObject *obj = NULL;
if ( Sim::findObject( argv[2], obj ) && obj )
if (obj)
object->deleteObject( obj );
}

View file

@ -3187,17 +3187,17 @@ ConsoleMethod( WorldEditor, ignoreObjClass, void, 3, 0, "(string class_name, ...
object->ignoreObjClass(argc, argv);
}
ConsoleMethod( WorldEditor, clearIgnoreList, void, 2, 2, "")
DefineConsoleMethod( WorldEditor, clearIgnoreList, void, (), , "")
{
object->clearIgnoreList();
}
ConsoleMethod( WorldEditor, clearSelection, void, 2, 2, "")
DefineConsoleMethod( WorldEditor, clearSelection, void, (), , "")
{
object->clearSelection();
}
ConsoleMethod( WorldEditor, getActiveSelection, S32, 2, 2, "() - Return the currently active WorldEditorSelection object." )
DefineConsoleMethod( WorldEditor, getActiveSelection, S32, (), , "() - Return the currently active WorldEditorSelection object." )
{
if( !object->getActiveSelectionSet() )
return 0;
@ -3205,43 +3205,36 @@ ConsoleMethod( WorldEditor, getActiveSelection, S32, 2, 2, "() - Return the curr
return object->getActiveSelectionSet()->getId();
}
ConsoleMethod( WorldEditor, setActiveSelection, void, 3, 3, "( id set ) - Set the currently active WorldEditorSelection object." )
DefineConsoleMethod( WorldEditor, setActiveSelection, void, ( WorldEditorSelection* selection), , "( id set ) - Set the currently active WorldEditorSelection object." )
{
WorldEditorSelection* selection;
if( !Sim::findObject( argv[ 2 ], selection ) )
{
Con::errorf( "WorldEditor::setActiveSelectionSet - no selection set '%s'", (const char*)argv[ 2 ] );
return;
}
if (selection)
object->makeActiveSelectionSet( selection );
}
ConsoleMethod( WorldEditor, selectObject, void, 3, 3, "(SimObject obj)")
DefineConsoleMethod( WorldEditor, selectObject, void, (const char * objName), , "(SimObject obj)")
{
object->selectObject(argv[2]);
object->selectObject(objName);
}
ConsoleMethod( WorldEditor, unselectObject, void, 3, 3, "(SimObject obj)")
DefineConsoleMethod( WorldEditor, unselectObject, void, (const char * objName), , "(SimObject obj)")
{
object->unselectObject(argv[2]);
object->unselectObject(objName);
}
ConsoleMethod( WorldEditor, invalidateSelectionCentroid, void, 2, 2, "")
DefineConsoleMethod( WorldEditor, invalidateSelectionCentroid, void, (), , "")
{
WorldEditor::Selection* sel = object->getActiveSelectionSet();
if(sel)
sel->invalidateCentroid();
}
ConsoleMethod( WorldEditor, getSelectionSize, S32, 2, 2, "() - Return the number of objects currently selected in the editor.")
DefineConsoleMethod( WorldEditor, getSelectionSize, S32, (), , "() - Return the number of objects currently selected in the editor.")
{
return object->getSelectionSize();
}
ConsoleMethod( WorldEditor, getSelectedObject, S32, 3, 3, "(int index)")
DefineConsoleMethod( WorldEditor, getSelectedObject, S32, (S32 index), , "(int index)")
{
S32 index = dAtoi(argv[2]);
if(index < 0 || index >= object->getSelectionSize())
{
Con::errorf(ConsoleLogEntry::General, "WorldEditor::getSelectedObject: invalid object index");
@ -3251,30 +3244,23 @@ ConsoleMethod( WorldEditor, getSelectedObject, S32, 3, 3, "(int index)")
return(object->getSelectObject(index));
}
ConsoleMethod( WorldEditor, getSelectionRadius, F32, 2, 2, "")
DefineConsoleMethod( WorldEditor, getSelectionRadius, F32, (), , "")
{
return object->getSelectionRadius();
}
ConsoleMethod( WorldEditor, getSelectionCentroid, const char *, 2, 2, "")
DefineConsoleMethod( WorldEditor, getSelectionCentroid, const char *, (), , "")
{
return object->getSelectionCentroidText();
}
ConsoleMethod( WorldEditor, getSelectionExtent, const char *, 2, 2, "")
DefineConsoleMethod( WorldEditor, getSelectionExtent, Point3F, (), , "")
{
Point3F bounds = object->getSelectionExtent();
static const U32 bufSize = 100;
char * ret = Con::getReturnBuffer(bufSize);
dSprintf(ret, bufSize, "%g %g %g", bounds.x, bounds.y, bounds.z);
return ret;
return object->getSelectionExtent();
}
ConsoleMethod( WorldEditor, dropSelection, void, 2, 3, "( bool skipUndo = false )")
DefineConsoleMethod( WorldEditor, dropSelection, void, ( bool skipUndo ), (false), "( bool skipUndo = false )")
{
bool skipUndo = false;
if ( argc > 2 )
skipUndo = dAtob( argv[2] );
object->dropCurrentSelection( skipUndo );
}
@ -3289,17 +3275,17 @@ void WorldEditor::copyCurrentSelection()
copySelection(mSelected);
}
ConsoleMethod( WorldEditor, cutSelection, void, 2, 2, "")
DefineConsoleMethod( WorldEditor, cutSelection, void, (),, "")
{
object->cutCurrentSelection();
}
ConsoleMethod( WorldEditor, copySelection, void, 2, 2, "")
DefineConsoleMethod( WorldEditor, copySelection, void, (),, "")
{
object->copyCurrentSelection();
}
ConsoleMethod( WorldEditor, pasteSelection, void, 2, 2, "")
DefineConsoleMethod( WorldEditor, pasteSelection, void, (),, "")
{
object->pasteSelection();
}
@ -3309,88 +3295,86 @@ bool WorldEditor::canPasteSelection()
return mCopyBuffer.empty() != true;
}
ConsoleMethod( WorldEditor, canPasteSelection, bool, 2, 2, "")
DefineConsoleMethod( WorldEditor, canPasteSelection, bool, (),, "")
{
return object->canPasteSelection();
}
ConsoleMethod( WorldEditor, hideObject, void, 4, 4, "(Object obj, bool hide)")
DefineConsoleMethod( WorldEditor, hideObject, void, (SceneObject *obj, bool hide), , "(Object obj, bool hide)")
{
SceneObject *obj;
if ( !Sim::findObject( argv[2], obj ) )
return;
object->hideObject(obj, dAtob(argv[3]));
if (obj)
object->hideObject(obj, hide);
}
ConsoleMethod( WorldEditor, hideSelection, void, 3, 3, "(bool hide)")
DefineConsoleMethod( WorldEditor, hideSelection, void, (bool hide), , "(bool hide)")
{
object->hideSelection(dAtob(argv[2]));
object->hideSelection(hide);
}
ConsoleMethod( WorldEditor, lockSelection, void, 3, 3, "(bool lock)")
DefineConsoleMethod( WorldEditor, lockSelection, void, (bool lock), , "(bool lock)")
{
object->lockSelection(dAtob(argv[2]));
object->lockSelection(lock);
}
ConsoleMethod( WorldEditor, alignByBounds, void, 3, 3, "(int boundsAxis)"
DefineConsoleMethod( WorldEditor, alignByBounds, void, (S32 boundsAxis), , "(int boundsAxis)"
"Align all selected objects against the given bounds axis.")
{
if(!object->alignByBounds(dAtoi(argv[2])))
Con::warnf(ConsoleLogEntry::General, avar("worldEditor.alignByBounds: invalid bounds axis '%s'", (const char*)argv[2]));
if(!object->alignByBounds(boundsAxis))
Con::warnf(ConsoleLogEntry::General, avar("worldEditor.alignByBounds: invalid bounds axis '%s'", boundsAxis));
}
ConsoleMethod( WorldEditor, alignByAxis, void, 3, 3, "(int axis)"
DefineConsoleMethod( WorldEditor, alignByAxis, void, (S32 boundsAxis), , "(int axis)"
"Align all selected objects along the given axis.")
{
if(!object->alignByAxis(dAtoi(argv[2])))
Con::warnf(ConsoleLogEntry::General, avar("worldEditor.alignByAxis: invalid axis '%s'", (const char*)argv[2]));
if(!object->alignByAxis(boundsAxis))
Con::warnf(ConsoleLogEntry::General, avar("worldEditor.alignByAxis: invalid axis '%s'", boundsAxis));
}
ConsoleMethod( WorldEditor, resetSelectedRotation, void, 2, 2, "")
DefineConsoleMethod( WorldEditor, resetSelectedRotation, void, (),, "")
{
object->resetSelectedRotation();
}
ConsoleMethod( WorldEditor, resetSelectedScale, void, 2, 2, "")
DefineConsoleMethod( WorldEditor, resetSelectedScale, void, (),, "")
{
object->resetSelectedScale();
}
ConsoleMethod( WorldEditor, redirectConsole, void, 3, 3, "( int objID )")
DefineConsoleMethod( WorldEditor, redirectConsole, void, (S32 objID), , "( int objID )")
{
object->redirectConsole(dAtoi(argv[2]));
object->redirectConsole(objID);
}
ConsoleMethod( WorldEditor, addUndoState, void, 2, 2, "")
DefineConsoleMethod( WorldEditor, addUndoState, void, (),, "")
{
object->addUndoState();
}
//-----------------------------------------------------------------------------
ConsoleMethod( WorldEditor, getSoftSnap, bool, 2, 2, "getSoftSnap()\n"
DefineConsoleMethod( WorldEditor, getSoftSnap, bool, (),, "getSoftSnap()\n"
"Is soft snapping always on?")
{
return object->mSoftSnap;
}
ConsoleMethod( WorldEditor, setSoftSnap, void, 3, 3, "setSoftSnap(bool)\n"
DefineConsoleMethod( WorldEditor, setSoftSnap, void, (bool enable), , "setSoftSnap(bool)\n"
"Allow soft snapping all of the time.")
{
object->mSoftSnap = dAtob(argv[2]);
object->mSoftSnap = enable;
}
ConsoleMethod( WorldEditor, getSoftSnapSize, F32, 2, 2, "getSoftSnapSize()\n"
DefineConsoleMethod( WorldEditor, getSoftSnapSize, F32, (),, "getSoftSnapSize()\n"
"Get the absolute size to trigger a soft snap.")
{
return object->mSoftSnapSize;
}
ConsoleMethod( WorldEditor, setSoftSnapSize, void, 3, 3, "setSoftSnapSize(F32)\n"
DefineConsoleMethod( WorldEditor, setSoftSnapSize, void, (F32 size), , "setSoftSnapSize(F32)\n"
"Set the absolute size to trigger a soft snap.")
{
object->mSoftSnapSize = dAtof(argv[2]);
object->mSoftSnapSize = size;
}
DefineEngineMethod( WorldEditor, getSoftSnapAlignment, WorldEditor::AlignmentType, (),,
@ -3405,40 +3389,40 @@ DefineEngineMethod( WorldEditor, setSoftSnapAlignment, void, ( WorldEditor::Alig
object->mSoftSnapAlignment = type;
}
ConsoleMethod( WorldEditor, softSnapSizeByBounds, void, 3, 3, "softSnapSizeByBounds(bool)\n"
DefineConsoleMethod( WorldEditor, softSnapSizeByBounds, void, (bool enable), , "softSnapSizeByBounds(bool)\n"
"Use selection bounds size as soft snap bounds.")
{
object->mSoftSnapSizeByBounds = dAtob(argv[2]);
object->mSoftSnapSizeByBounds = enable;
}
ConsoleMethod( WorldEditor, getSoftSnapBackfaceTolerance, F32, 2, 2, "getSoftSnapBackfaceTolerance()\n"
DefineConsoleMethod( WorldEditor, getSoftSnapBackfaceTolerance, F32, (), , "getSoftSnapBackfaceTolerance()\n"
"The fraction of the soft snap radius that backfaces may be included.")
{
return object->mSoftSnapBackfaceTolerance;
}
ConsoleMethod( WorldEditor, setSoftSnapBackfaceTolerance, void, 3, 3, "setSoftSnapBackfaceTolerance(F32 with range of 0..1)\n"
DefineConsoleMethod( WorldEditor, setSoftSnapBackfaceTolerance, void, (F32 range), , "setSoftSnapBackfaceTolerance(F32 with range of 0..1)\n"
"The fraction of the soft snap radius that backfaces may be included.")
{
object->mSoftSnapBackfaceTolerance = dAtof(argv[2]);
object->mSoftSnapBackfaceTolerance = range;
}
ConsoleMethod( WorldEditor, softSnapRender, void, 3, 3, "softSnapRender(bool)\n"
DefineConsoleMethod( WorldEditor, softSnapRender, void, (bool enable), , "softSnapRender(bool)\n"
"Render the soft snapping bounds.")
{
object->mSoftSnapRender = dAtob(argv[2]);
object->mSoftSnapRender = enable;
}
ConsoleMethod( WorldEditor, softSnapRenderTriangle, void, 3, 3, "softSnapRenderTriangle(bool)\n"
DefineConsoleMethod( WorldEditor, softSnapRenderTriangle, void, (bool enable), , "softSnapRenderTriangle(bool)\n"
"Render the soft snapped triangle.")
{
object->mSoftSnapRenderTriangle = dAtob(argv[2]);
object->mSoftSnapRenderTriangle = enable;
}
ConsoleMethod( WorldEditor, softSnapDebugRender, void, 3, 3, "softSnapDebugRender(bool)\n"
DefineConsoleMethod( WorldEditor, softSnapDebugRender, void, (bool enable), , "softSnapDebugRender(bool)\n"
"Toggle soft snapping debug rendering.")
{
object->mSoftSnapDebugRender = dAtob(argv[2]);
object->mSoftSnapDebugRender = enable;
}
DefineEngineMethod( WorldEditor, getTerrainSnapAlignment, WorldEditor::AlignmentType, (),,
@ -3453,27 +3437,22 @@ DefineEngineMethod( WorldEditor, setTerrainSnapAlignment, void, ( WorldEditor::A
object->mTerrainSnapAlignment = alignment;
}
ConsoleMethod( WorldEditor, transformSelection, void, 13, 13, "transformSelection(...)\n"
DefineConsoleMethod( WorldEditor, transformSelection, void,
( bool position,
Point3F point,
bool relativePos,
bool rotate,
Point3F rotation,
bool relativeRot,
bool rotLocal,
S32 scaleType,
Point3F scale,
bool sRelative,
bool sLocal ), , "transformSelection(...)\n"
"Transform selection by given parameters.")
{
bool position = dAtob(argv[2]);
Point3F p(0.0f, 0.0f, 0.0f);
dSscanf(argv[3], "%g %g %g", &p.x, &p.y, &p.z);
bool relativePos = dAtob(argv[4]);
bool rotate = dAtob(argv[5]);
EulerF r(0.0f, 0.0f, 0.0f);
dSscanf(argv[6], "%g %g %g", &r.x, &r.y, &r.z);
bool relativeRot = dAtob(argv[7]);
bool rotLocal = dAtob(argv[8]);
S32 scaleType = dAtoi(argv[9]);
Point3F s(1.0f, 1.0f, 1.0f);
dSscanf(argv[10], "%g %g %g", &s.x, &s.y, &s.z);
bool sRelative = dAtob(argv[11]);
bool sLocal = dAtob(argv[12]);
object->transformSelection(position, p, relativePos, rotate, r, relativeRot, rotLocal, scaleType, s, sRelative, sLocal);
object->transformSelection(position, point, relativePos, rotate, rotation, relativeRot, rotLocal, scaleType, scale, sRelative, sLocal);
}
#include "core/strings/stringUnit.h"
@ -3546,10 +3525,10 @@ void WorldEditor::colladaExportSelection( const String &path )
#endif
}
ConsoleMethod( WorldEditor, colladaExportSelection, void, 3, 3,
DefineConsoleMethod( WorldEditor, colladaExportSelection, void, (const char * path), ,
"( String path ) - Export the combined geometry of all selected objects to the specified path in collada format." )
{
object->colladaExportSelection( (const char*)argv[2] );
object->colladaExportSelection( path );
}
void WorldEditor::makeSelectionPrefab( const char *filename )
@ -3700,25 +3679,20 @@ void WorldEditor::explodeSelectedPrefab()
setDirty();
}
ConsoleMethod( WorldEditor, makeSelectionPrefab, void, 3, 3, "( string filename ) - Save selected objects to a .prefab file and replace them in the level with a Prefab object." )
DefineConsoleMethod( WorldEditor, makeSelectionPrefab, void, ( const char * filename ), , "( string filename ) - Save selected objects to a .prefab file and replace them in the level with a Prefab object." )
{
object->makeSelectionPrefab( argv[2] );
object->makeSelectionPrefab( filename );
}
ConsoleMethod( WorldEditor, explodeSelectedPrefab, void, 2, 2, "() - Replace selected Prefab objects with a SimGroup containing all children objects defined in the .prefab." )
DefineConsoleMethod( WorldEditor, explodeSelectedPrefab, void, (),, "() - Replace selected Prefab objects with a SimGroup containing all children objects defined in the .prefab." )
{
object->explodeSelectedPrefab();
}
ConsoleMethod( WorldEditor, mountRelative, void, 4, 4, "( Object A, Object B )" )
DefineConsoleMethod( WorldEditor, mountRelative, void, ( SceneObject *objA, SceneObject *objB ), , "( Object A, Object B )" )
{
SceneObject *objA;
if ( !Sim::findObject( argv[2], objA ) )
return;
SceneObject *objB;
if ( !Sim::findObject( argv[3], objB ) )
return;
if (!objA || !objB)
return;
MatrixF xfm = objB->getTransform();
MatrixF mat = objA->getWorldTransform();