@@ -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();
}
@@ -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();
}
@@ -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);
}
@@ -23,7 +23,7 @@
#include "platform/platform.h"
#include "forest/editor/forestBrushElement.h"

#include "console/consoleTypes.h"
#include "console/engineAPI.h"
#include "forest/forestItem.h"


@@ -187,10 +187,10 @@ bool ForestBrush::containsItemData( const ForestItemData *inData )
return false;
}

ConsoleMethod( ForestBrush, containsItemData, bool, 3, 3, "( ForestItemData obj )" )
DefineConsoleMethod( ForestBrush, containsItemData, bool, ( const char * obj ), , "( ForestItemData obj )" )
{
ForestItemData *data = NULL;
if ( !Sim::findObject( argv[2], data ) )
if ( !Sim::findObject( obj, data ) )
{
Con::warnf( "ForestBrush::containsItemData - invalid object passed" );
return false;
@@ -30,6 +30,7 @@

#include "gui/worldEditor/editTSCtrl.h"
#include "console/consoleTypes.h"
#include "console/engineAPI.h"
#include "core/util/tVector.h"
#include "gfx/gfxDrawUtil.h"
#include "gui/core/guiCanvas.h"
@@ -681,7 +682,7 @@ bool ForestBrushTool::getGroundAt( const Point3F &worldPt, F32 *zValueOut, Vecto
return true;
}

ConsoleMethod( ForestBrushTool, collectElements, void, 2, 2, "" )
DefineConsoleMethod( ForestBrushTool, collectElements, void, (), , "" )
{
object->collectElements();
}
@@ -25,6 +25,7 @@

#include "forest/editor/forestBrushTool.h"
#include "console/consoleTypes.h"
#include "console/engineAPI.h"
#include "gui/core/guiCanvas.h"
#include "windowManager/platformCursorController.h"
#include "forest/editor/forestUndo.h"
@@ -370,33 +371,33 @@ bool ForestEditorCtrl::isDirty()
return foundDirty;
}

ConsoleMethod( ForestEditorCtrl, updateActiveForest, void, 2, 2, "()" )
DefineConsoleMethod( ForestEditorCtrl, updateActiveForest, void, (), , "()" )
{
object->updateActiveForest( true );
}

ConsoleMethod( ForestEditorCtrl, setActiveTool, void, 3, 3, "( ForestTool tool )" )
DefineConsoleMethod( ForestEditorCtrl, setActiveTool, void, ( const char * toolName ), , "( ForestTool tool )" )
{
ForestTool *tool = dynamic_cast<ForestTool*>( Sim::findObject( argv[2] ) );
ForestTool *tool = dynamic_cast<ForestTool*>( Sim::findObject( toolName ) );
object->setActiveTool( tool );
}

ConsoleMethod( ForestEditorCtrl, getActiveTool, S32, 2, 2, "()" )
DefineConsoleMethod( ForestEditorCtrl, getActiveTool, S32, (), , "()" )
{
ForestTool *tool = object->getActiveTool();
return tool ? tool->getId() : 0;
}

ConsoleMethod( ForestEditorCtrl, deleteMeshSafe, void, 3, 3, "( ForestItemData obj )" )
DefineConsoleMethod( ForestEditorCtrl, deleteMeshSafe, void, ( const char * obj ), , "( ForestItemData obj )" )
{
ForestItemData *db;
if ( !Sim::findObject( argv[2], db ) )
if ( !Sim::findObject( obj, db ) )
return;

object->deleteMeshSafe( db );
}

ConsoleMethod( ForestEditorCtrl, isDirty, bool, 2, 2, "" )
DefineConsoleMethod( ForestEditorCtrl, isDirty, bool, (), , "" )
{
return object->isDirty();
}
@@ -30,6 +30,7 @@
#include "gui/worldEditor/editTSCtrl.h"
#include "gui/worldEditor/gizmo.h"
#include "console/consoleTypes.h"
#include "console/engineAPI.h"
#include "core/util/tVector.h"
#include "core/util/safeDelete.h"
#include "gfx/gfxDrawUtil.h"
@@ -558,32 +559,32 @@ void ForestSelectionTool::onUndoAction()
mBounds.intersect( mSelection[i].getWorldBox() );
}

ConsoleMethod( ForestSelectionTool, getSelectionCount, S32, 2, 2, "" )
DefineConsoleMethod( ForestSelectionTool, getSelectionCount, S32, (), , "" )
{
return object->getSelectionCount();
}

ConsoleMethod( ForestSelectionTool, deleteSelection, void, 2, 2, "" )
DefineConsoleMethod( ForestSelectionTool, deleteSelection, void, (), , "" )
{
object->deleteSelection();
}

ConsoleMethod( ForestSelectionTool, clearSelection, void, 2, 2, "" )
DefineConsoleMethod( ForestSelectionTool, clearSelection, void, (), , "" )
{
object->clearSelection();
}

ConsoleMethod( ForestSelectionTool, cutSelection, void, 2, 2, "" )
DefineConsoleMethod( ForestSelectionTool, cutSelection, void, (), , "" )
{
object->cutSelection();
}

ConsoleMethod( ForestSelectionTool, copySelection, void, 2, 2, "" )
DefineConsoleMethod( ForestSelectionTool, copySelection, void, (), , "" )
{
object->copySelection();
}

ConsoleMethod( ForestSelectionTool, pasteSelection, void, 2, 2, "" )
DefineConsoleMethod( ForestSelectionTool, pasteSelection, void, (), , "" )
{
object->pasteSelection();
}
@@ -38,8 +38,10 @@
#include "environment/sun.h"
#include "scene/sceneManager.h"
#include "math/mathUtils.h"
#include "math/mTransform.h"
#include "T3D/physics/physicsBody.h"
#include "forest/editor/forestBrushElement.h"
#include "console/engineAPI.h"

/// For frame signal
#include "gui/core/guiCanvas.h"
@@ -359,23 +361,22 @@ void Forest::saveDataFile( const char *path )
mData->write( mDataFileName );
}

ConsoleMethod( Forest, saveDataFile, bool, 2, 3, "saveDataFile( [path] )" )
DefineConsoleMethod( Forest, saveDataFile, void, (const char * path), (""), "saveDataFile( [path] )" )
{
object->saveDataFile( argc == 3 ? (const char*)argv[2] : NULL );
return true;
object->saveDataFile( path );
}

ConsoleMethod(Forest, isDirty, bool, 2, 2, "()")
DefineConsoleMethod(Forest, isDirty, bool, (), , "()")
{
return object->getData() && object->getData()->isDirty();
}

ConsoleMethod(Forest, regenCells, void, 2, 2, "()")
DefineConsoleMethod(Forest, regenCells, void, (), , "()")
{
object->getData()->regenCells();
}

ConsoleMethod(Forest, clear, void, 2, 2, "()" )
DefineConsoleMethod(Forest, clear, void, (), , "()" )
{
object->clear();
}
@@ -53,7 +53,7 @@ void GFXCardProfiler::loadProfileScript(const char* aScriptName)

Con::printf(" - Loaded card profile %s", scriptName.c_str());

Con::executef("eval", script);
Con::evaluate(script, false, NULL);
delete[] script;
}

@@ -58,16 +58,20 @@ U32 GFXTextureObject::dumpActiveTOs()
return smActiveTOCount;
}



#endif // TORQUE_DEBUG

DefineEngineFunction( dumpTextureObjects, void, (),,
"Dumps a list of all active texture objects to the console.\n"
"@note This function is only available in debug builds.\n"
"@ingroup GFX\n" )
{
#ifdef TORQUE_DEBUG
GFXTextureObject::dumpActiveTOs();
#endif
}

#endif // TORQUE_DEBUG

//-----------------------------------------------------------------------------
// GFXTextureObject
//-----------------------------------------------------------------------------
@@ -305,10 +305,11 @@ void VideoFrameGrabber::_onTextureEvent(GFXTexCallbackCode code)
///----------------------------------------------------------------------

///----------------------------------------------------------------------

//WLE - Vince
//Changing the resolution to Point2I::Zero instead of the Point2I(0,0) better to use constants.
DefineEngineFunction( startVideoCapture, void,
( GuiCanvas *canvas, const char *filename, const char *encoder, F32 framerate, Point2I resolution ),
( "THEORA", 30.0f, Point2I( 0, 0 ) ),
( "THEORA", 30.0f, Point2I::Zero ),
"Begins a video capture session.\n"
"@see stopVideoCapture\n"
"@ingroup Rendering\n" )
@@ -339,7 +340,7 @@ DefineEngineFunction( stopVideoCapture, void, (),,

DefineEngineFunction( playJournalToVideo, void,
( const char *journalFile, const char *videoFile, const char *encoder, F32 framerate, Point2I resolution ),
( NULL, "THEORA", 30.0f, Point2I( 0, 0 ) ),
( NULL, "THEORA", 30.0f, Point2I::Zero ),
"Load a journal file and capture it video.\n"
"@ingroup Rendering\n" )
{
@@ -24,6 +24,7 @@
#include "gui/buttons/guiToolboxButtonCtrl.h"

#include "console/console.h"
#include "console/engineAPI.h"
#include "gfx/gfxDevice.h"
#include "gfx/gfxDrawUtil.h"
#include "console/consoleTypes.h"
@@ -91,19 +92,19 @@ void GuiToolboxButtonCtrl::onSleep()

//-------------------------------------

ConsoleMethod( GuiToolboxButtonCtrl, setNormalBitmap, void, 3, 3, "( filepath name ) sets the bitmap that shows when the button is active")
DefineConsoleMethod( GuiToolboxButtonCtrl, setNormalBitmap, void, ( const char * name ), , "( filepath name ) sets the bitmap that shows when the button is active")
{
object->setNormalBitmap(argv[2]);
object->setNormalBitmap(name);
}

ConsoleMethod( GuiToolboxButtonCtrl, setLoweredBitmap, void, 3, 3, "( filepath name ) sets the bitmap that shows when the button is disabled")
DefineConsoleMethod( GuiToolboxButtonCtrl, setLoweredBitmap, void, ( const char * name ), , "( filepath name ) sets the bitmap that shows when the button is disabled")
{
object->setLoweredBitmap(argv[2]);
object->setLoweredBitmap(name);
}

ConsoleMethod( GuiToolboxButtonCtrl, setHoverBitmap, void, 3, 3, "( filepath name ) sets the bitmap that shows when the button is disabled")
DefineConsoleMethod( GuiToolboxButtonCtrl, setHoverBitmap, void, ( const char * name ), , "( filepath name ) sets the bitmap that shows when the button is disabled")
{
object->setHoverBitmap(argv[2]);
object->setHoverBitmap(name);
}

//-------------------------------------
@@ -256,11 +256,11 @@ static ConsoleDocFragment _sGuiBitmapCtrlSetBitmap2(


//"Set the bitmap displayed in the control. Note that it is limited in size, to 256x256."
ConsoleMethod( GuiBitmapCtrl, setBitmap, void, 3, 4,
DefineConsoleMethod( GuiBitmapCtrl, setBitmap, void, ( const char * fileRoot, bool resize), ( false),
"( String filename | String filename, bool resize ) Assign an image to the control.\n\n"
"@hide" )
{
char filename[1024];
Con::expandScriptFilename(filename, sizeof(filename), argv[2]);
object->setBitmap(filename, argc > 3 ? dAtob( argv[3] ) : false );
Con::expandScriptFilename(filename, sizeof(filename), fileRoot);
object->setBitmap(filename, resize );
}
@@ -22,6 +22,7 @@
#include "console/console.h"
#include "gfx/gfxDevice.h"
#include "console/consoleTypes.h"
#include "console/engineAPI.h"
#include "gui/core/guiCanvas.h"
#include "gui/buttons/guiButtonCtrl.h"
#include "gui/core/guiDefaultControlRender.h"
@@ -524,24 +525,17 @@ void GuiColorPickerCtrl::setScriptValue(const char *value)
setValue(newValue);
}

ConsoleMethod(GuiColorPickerCtrl, getSelectorPos, const char*, 2, 2, "Gets the current position of the selector")
DefineConsoleMethod(GuiColorPickerCtrl, getSelectorPos, Point2I, (), , "Gets the current position of the selector")
{
static const U32 bufSize = 256;
char *temp = Con::getReturnBuffer(bufSize);
Point2I pos;
pos = object->getSelectorPos();
dSprintf(temp,bufSize,"%d %d",pos.x, pos.y);
return temp;
return object->getSelectorPos();
}

ConsoleMethod(GuiColorPickerCtrl, setSelectorPos, void, 3, 3, "Sets the current position of the selector")
DefineConsoleMethod(GuiColorPickerCtrl, setSelectorPos, void, (Point2I newPos), , "Sets the current position of the selector")
{
Point2I newPos;
dSscanf(argv[2], "%d %d", &newPos.x, &newPos.y);
object->setSelectorPos(newPos);
}

ConsoleMethod(GuiColorPickerCtrl, updateColor, void, 2, 2, "Forces update of pick color")
DefineConsoleMethod(GuiColorPickerCtrl, updateColor, void, (), , "Forces update of pick color")
{
object->updateColor();
}
@@ -25,6 +25,7 @@
#include "gui/buttons/guiButtonBaseCtrl.h"

#include "console/consoleTypes.h"
#include "console/engineAPI.h"
#include "gfx/primBuilder.h"

//-----------------------------------------------------------------------------
@@ -25,6 +25,7 @@
#include "core/frameAllocator.h"
#include "core/strings/stringUnit.h"
#include "console/consoleTypes.h"
#include "console/engineAPI.h"


IMPLEMENT_CONOBJECT(GuiFileTreeCtrl);
@@ -378,18 +379,18 @@ void GuiFileTreeCtrl::recurseInsert( Item* parent, StringTableEntry path )

}

ConsoleMethod( GuiFileTreeCtrl, getSelectedPath, const char*, 2, 2, "getSelectedPath() - returns the currently selected path in the tree")
DefineConsoleMethod( GuiFileTreeCtrl, getSelectedPath, const char*, (), , "getSelectedPath() - returns the currently selected path in the tree")
{
const String& path = object->getSelectedPath();
return Con::getStringArg( path );
}

ConsoleMethod( GuiFileTreeCtrl, setSelectedPath, bool, 3, 3, "setSelectedPath(path) - expands the tree to the specified path")
DefineConsoleMethod( GuiFileTreeCtrl, setSelectedPath, bool, (const char * path), , "setSelectedPath(path) - expands the tree to the specified path")
{
return object->setSelectedPath( argv[ 2 ] );
return object->setSelectedPath( path );
}

ConsoleMethod( GuiFileTreeCtrl, reload, void, 2, 2, "() - Reread the directory tree hierarchy." )
DefineConsoleMethod( GuiFileTreeCtrl, reload, void, (), , "() - Reread the directory tree hierarchy." )
{
object->updateTree();
}
@@ -599,7 +599,7 @@ void GuiGradientCtrl::sortColorRange()
dQsort( mAlphaRange.address(), mAlphaRange.size(), sizeof(ColorRange), _numIncreasing);
}

ConsoleMethod(GuiGradientCtrl, getColorCount, S32, 2, 2, "Get color count")
DefineConsoleMethod(GuiGradientCtrl, getColorCount, S32, (), , "Get color count")
{
if( object->getDisplayMode() == GuiGradientCtrl::pHorizColorRange )
return object->mColorRange.size();
@@ -609,44 +609,25 @@ ConsoleMethod(GuiGradientCtrl, getColorCount, S32, 2, 2, "Get color count")
return 0;
}

ConsoleMethod(GuiGradientCtrl, getColor, const char*, 3, 3, "Get color value")
DefineConsoleMethod(GuiGradientCtrl, getColor, ColorF, (S32 idx), , "Get color value")
{
S32 idx = dAtoi(argv[2]);

if( object->getDisplayMode() == GuiGradientCtrl::pHorizColorRange )
{
if ( idx >= 0 && idx < object->mColorRange.size() )
{
static const U32 bufSize = 256;
char* rColor = Con::getReturnBuffer(bufSize);
rColor[0] = 0;

dSprintf(rColor, bufSize, "%f %f %f %f",
object->mColorRange[idx].swatch->getColor().red,
object->mColorRange[idx].swatch->getColor().green,
object->mColorRange[idx].swatch->getColor().blue,
object->mColorRange[idx].swatch->getColor().alpha);

return rColor;
return object->mColorRange[idx].swatch->getColor();
}
}
else if( object->getDisplayMode() == GuiGradientCtrl::pHorizColorRange )
{
if ( idx >= 0 && idx < object->mAlphaRange.size() )
{
static const U32 bufSize = 256;
char* rColor = Con::getReturnBuffer(bufSize);
rColor[0] = 0;

dSprintf(rColor, bufSize, "%f %f %f %f",
object->mAlphaRange[idx].swatch->getColor().red,
object->mAlphaRange[idx].swatch->getColor().green,
object->mAlphaRange[idx].swatch->getColor().blue,
object->mAlphaRange[idx].swatch->getColor().alpha);

return rColor;
return object->mAlphaRange[idx].swatch->getColor();
}
}

return "1 1 1 1";
return ColorF::ONE;
}
@@ -29,6 +29,7 @@
#include "core/util/safeDelete.h"
#include "console/console.h"
#include "console/consoleTypes.h"
#include "console/engineAPI.h"
#include "gfx/gfxDevice.h"
#include "math/util/matrixSet.h"
#include "scene/sceneRenderState.h"
@@ -166,8 +167,8 @@ void GuiMaterialCtrl::onRender( Point2I offset, const RectI &updateRect )
GFX->setTexture( 0, NULL );
}

ConsoleMethod( GuiMaterialCtrl, setMaterial, bool, 3, 3, "( string materialName )"
DefineConsoleMethod( GuiMaterialCtrl, setMaterial, bool, ( const char * materialName ), , "( string materialName )"
"Set the material to be displayed in the control." )
{
return object->setMaterial( (const char*)argv[2] );
return object->setMaterial( materialName );
}
@@ -23,6 +23,7 @@
#include "gui/core/guiCanvas.h"
#include "gui/controls/guiPopUpCtrl.h"
#include "console/consoleTypes.h"
#include "console/engineAPI.h"
#include "gui/core/guiDefaultControlRender.h"
#include "gfx/primBuilder.h"
#include "gfx/gfxDrawUtil.h"
@@ -299,121 +300,82 @@ void GuiPopUpMenuCtrl::initPersistFields(void)
}

//------------------------------------------------------------------------------
ConsoleMethod( GuiPopUpMenuCtrl, add, void, 3, 5, "(string name, int idNum, int scheme=0)")
DefineConsoleMethod( GuiPopUpMenuCtrl, add, void, (const char * name, S32 idNum, U32 scheme), ("", -1, 0), "(string name, int idNum, int scheme=0)")
{
if ( argc == 4 )
object->addEntry(argv[2],dAtoi(argv[3]));
if ( argc == 5 )
object->addEntry(argv[2],dAtoi(argv[3]),dAtoi(argv[4]));
else
object->addEntry(argv[2]);
object->addEntry(name, idNum, scheme);
}

ConsoleMethod( GuiPopUpMenuCtrl, addScheme, void, 6, 6, "(int id, ColorI fontColor, ColorI fontColorHL, ColorI fontColorSEL)")
{
ColorI fontColor, fontColorHL, fontColorSEL;
U32 r, g, b;
char buf[64];

dStrcpy( buf, argv[3] );
char* temp = dStrtok( buf, " \0" );
r = temp ? dAtoi( temp ) : 0;
temp = dStrtok( NULL, " \0" );
g = temp ? dAtoi( temp ) : 0;
temp = dStrtok( NULL, " \0" );
b = temp ? dAtoi( temp ) : 0;
fontColor.set( r, g, b );

dStrcpy( buf, argv[4] );
temp = dStrtok( buf, " \0" );
r = temp ? dAtoi( temp ) : 0;
temp = dStrtok( NULL, " \0" );
g = temp ? dAtoi( temp ) : 0;
temp = dStrtok( NULL, " \0" );
b = temp ? dAtoi( temp ) : 0;
fontColorHL.set( r, g, b );

dStrcpy( buf, argv[5] );
temp = dStrtok( buf, " \0" );
r = temp ? dAtoi( temp ) : 0;
temp = dStrtok( NULL, " \0" );
g = temp ? dAtoi( temp ) : 0;
temp = dStrtok( NULL, " \0" );
b = temp ? dAtoi( temp ) : 0;
fontColorSEL.set( r, g, b );

object->addScheme( dAtoi( argv[2] ), fontColor, fontColorHL, fontColorSEL );
DefineConsoleMethod( GuiPopUpMenuCtrl, addScheme, void, (U32 id, ColorI fontColor, ColorI fontColorHL, ColorI fontColorSEL), ,
"(int id, ColorI fontColor, ColorI fontColorHL, ColorI fontColorSEL)")
{

object->addScheme( id, fontColor, fontColorHL, fontColorSEL );
}

ConsoleMethod( GuiPopUpMenuCtrl, getText, const char*, 2, 2, "")
DefineConsoleMethod( GuiPopUpMenuCtrl, getText, const char*, (), , "")
{
return object->getText();
}

ConsoleMethod( GuiPopUpMenuCtrl, clear, void, 2, 2, "Clear the popup list.")
DefineConsoleMethod( GuiPopUpMenuCtrl, clear, void, (), , "Clear the popup list.")
{
object->clear();
}

//FIXME: clashes with SimSet.sort
ConsoleMethod(GuiPopUpMenuCtrl, sort, void, 2, 2, "Sort the list alphabetically.")
DefineConsoleMethod(GuiPopUpMenuCtrl, sort, void, (), , "Sort the list alphabetically.")
{
object->sort();
}

// Added to sort the entries by ID
ConsoleMethod(GuiPopUpMenuCtrl, sortID, void, 2, 2, "Sort the list by ID.")
DefineConsoleMethod(GuiPopUpMenuCtrl, sortID, void, (), , "Sort the list by ID.")
{
object->sortID();
}

ConsoleMethod( GuiPopUpMenuCtrl, forceOnAction, void, 2, 2, "")
DefineConsoleMethod( GuiPopUpMenuCtrl, forceOnAction, void, (), , "")
{
object->onAction();
}

ConsoleMethod( GuiPopUpMenuCtrl, forceClose, void, 2, 2, "")
DefineConsoleMethod( GuiPopUpMenuCtrl, forceClose, void, (), , "")
{
object->closePopUp();
}

ConsoleMethod( GuiPopUpMenuCtrl, getSelected, S32, 2, 2, "")
DefineConsoleMethod( GuiPopUpMenuCtrl, getSelected, S32, (), , "")
{
return object->getSelected();
}

ConsoleMethod( GuiPopUpMenuCtrl, setSelected, void, 3, 4, "(int id, [scriptCallback=true])")
DefineConsoleMethod( GuiPopUpMenuCtrl, setSelected, void, (S32 id, bool scriptCallback), (true), "(int id, [scriptCallback=true])")
{
if( argc > 3 )
object->setSelected( dAtoi( argv[2] ), dAtob( argv[3] ) );
else
object->setSelected( dAtoi( argv[2] ) );
object->setSelected( id, scriptCallback );
}

ConsoleMethod( GuiPopUpMenuCtrl, setFirstSelected, void, 2, 3, "([scriptCallback=true])")
DefineConsoleMethod( GuiPopUpMenuCtrl, setFirstSelected, void, (bool scriptCallback), (true), "([scriptCallback=true])")
{
if( argc > 2 )
object->setFirstSelected( dAtob( argv[2] ) );
else
object->setFirstSelected();
object->setFirstSelected( scriptCallback );

}

ConsoleMethod( GuiPopUpMenuCtrl, setNoneSelected, void, 2, 2, "")
DefineConsoleMethod( GuiPopUpMenuCtrl, setNoneSelected, void, (), , "")
{
object->setNoneSelected();
}

ConsoleMethod( GuiPopUpMenuCtrl, getTextById, const char*, 3, 3, "(int id)")
DefineConsoleMethod( GuiPopUpMenuCtrl, getTextById, const char*, (S32 id), , "(int id)")
{
return(object->getTextById(dAtoi(argv[2])));
return(object->getTextById(id));
}

ConsoleMethod( GuiPopUpMenuCtrl, changeTextById, void, 4, 4, "( int id, string text )" )
DefineConsoleMethod( GuiPopUpMenuCtrl, changeTextById, void, ( S32 id, const char * text ), , "( int id, string text )" )
{
object->setEntryText( dAtoi( argv[ 2 ] ), argv[ 3 ] );
object->setEntryText( id, text );
}

ConsoleMethod( GuiPopUpMenuCtrl, setEnumContent, void, 4, 4, "(string class, string enum)"
DefineConsoleMethod( GuiPopUpMenuCtrl, setEnumContent, void, (const char * className, const char * enumName), , "(string class, string enum)"
"This fills the popup with a classrep's field enumeration type info.\n\n"
"More of a helper function than anything. If console access to the field list is added, "
"at least for the enumerated types, then this should go away..")
@@ -423,28 +385,28 @@ ConsoleMethod( GuiPopUpMenuCtrl, setEnumContent, void, 4, 4, "(string class, str
// walk the class list to get our class
while(classRep)
{
if(!dStricmp(classRep->getClassName(), argv[2]))
if(!dStricmp(classRep->getClassName(), className))
break;
classRep = classRep->getNextClass();
}

// get it?
if(!classRep)
{
Con::warnf(ConsoleLogEntry::General, "failed to locate class rep for '%s'", (const char*)argv[2]);
Con::warnf(ConsoleLogEntry::General, "failed to locate class rep for '%s'", className);
return;
}

// walk the fields to check for this one (findField checks StringTableEntry ptrs...)
U32 i;
for(i = 0; i < classRep->mFieldList.size(); i++)
if(!dStricmp(classRep->mFieldList[i].pFieldname, argv[3]))
if(!dStricmp(classRep->mFieldList[i].pFieldname, enumName))
break;

// found it?
if(i == classRep->mFieldList.size())
{
Con::warnf(ConsoleLogEntry::General, "failed to locate field '%s' for class '%s'", (const char*)argv[3], (const char*)argv[2]);
Con::warnf(ConsoleLogEntry::General, "failed to locate field '%s' for class '%s'", enumName, className);
return;
}

@@ -454,7 +416,7 @@ ConsoleMethod( GuiPopUpMenuCtrl, setEnumContent, void, 4, 4, "(string class, str
// check the type
if( !conType->getEnumTable() )
{
Con::warnf(ConsoleLogEntry::General, "field '%s' is not an enumeration for class '%s'", (const char*)argv[3], (const char*)argv[2]);
Con::warnf(ConsoleLogEntry::General, "field '%s' is not an enumeration for class '%s'", enumName, className);
return;
}

@@ -467,22 +429,22 @@ ConsoleMethod( GuiPopUpMenuCtrl, setEnumContent, void, 4, 4, "(string class, str
}

//------------------------------------------------------------------------------
ConsoleMethod( GuiPopUpMenuCtrl, findText, S32, 3, 3, "(string text)"
DefineConsoleMethod( GuiPopUpMenuCtrl, findText, S32, (const char * text), , "(string text)"
"Returns the position of the first entry containing the specified text.")
{
return( object->findText( argv[2] ) );
return( object->findText( text ) );
}

//------------------------------------------------------------------------------
ConsoleMethod( GuiPopUpMenuCtrl, size, S32, 2, 2, "Get the size of the menu - the number of entries in it.")
DefineConsoleMethod( GuiPopUpMenuCtrl, size, S32, (), , "Get the size of the menu - the number of entries in it.")
{
return( object->getNumEntries() );
}

//------------------------------------------------------------------------------
ConsoleMethod( GuiPopUpMenuCtrl, replaceText, void, 3, 3, "(bool doReplaceText)")
DefineConsoleMethod( GuiPopUpMenuCtrl, replaceText, void, (bool doReplaceText), , "(bool doReplaceText)")
{
object->replaceText(dAtoi(argv[2]));
object->replaceText(S32(doReplaceText));
}

//------------------------------------------------------------------------------
@@ -570,9 +532,9 @@ void GuiPopUpMenuCtrl::clearEntry( S32 entry )
}

//------------------------------------------------------------------------------
ConsoleMethod( GuiPopUpMenuCtrl, clearEntry, void, 3, 3, "(S32 entry)")
DefineConsoleMethod( GuiPopUpMenuCtrl, clearEntry, void, (S32 entry), , "(S32 entry)")
{
object->clearEntry(dAtoi(argv[2]));
object->clearEntry(entry);
}

//------------------------------------------------------------------------------
@@ -23,6 +23,7 @@
#include "gui/core/guiCanvas.h"
#include "gui/controls/guiPopUpCtrlEx.h"
#include "console/consoleTypes.h"
#include "console/engineAPI.h"
#include "gui/core/guiDefaultControlRender.h"
#include "gfx/primBuilder.h"
#include "gfx/gfxDrawUtil.h"
@@ -363,14 +364,9 @@ ConsoleDocFragment _GuiPopUpMenuCtrlExAdd(
"void add(string name, S32 idNum, S32 scheme=0);"
);

ConsoleMethod( GuiPopUpMenuCtrlEx, add, void, 3, 5, "(string name, int idNum, int scheme=0)")
DefineConsoleMethod( GuiPopUpMenuCtrlEx, add, void, (const char * name, S32 idNum, U32 scheme), ("", -1, 0), "(string name, int idNum, int scheme=0)")
{
if ( argc == 4 )
object->addEntry(argv[2],dAtoi(argv[3]));
if ( argc == 5 )
object->addEntry(argv[2],dAtoi(argv[3]),dAtoi(argv[4]));
else
object->addEntry(argv[2]);
object->addEntry(name, idNum, scheme);
}

DefineEngineMethod( GuiPopUpMenuCtrlEx, addCategory, void, (const char* text),,
@@ -529,13 +525,10 @@ ConsoleDocFragment _GuiPopUpMenuCtrlExsetSelected(
"setSelected(int id, bool scriptCallback=true);"
);
ConsoleMethod( GuiPopUpMenuCtrlEx, setSelected, void, 3, 4, "(int id, [scriptCallback=true])"
DefineConsoleMethod( GuiPopUpMenuCtrlEx, setSelected, void, (S32 id, bool scriptCallback), (true), "(int id, [scriptCallback=true])"
"@hide")
{
if( argc > 3 )
object->setSelected( dAtoi( argv[2] ), dAtob( argv[3] ) );
else
object->setSelected( dAtoi( argv[2] ) );
object->setSelected( id, scriptCallback );
}
ConsoleDocFragment _GuiPopUpMenuCtrlExsetFirstSelected(
@@ -546,13 +539,10 @@ ConsoleDocFragment _GuiPopUpMenuCtrlExsetFirstSelected(
);
ConsoleMethod( GuiPopUpMenuCtrlEx, setFirstSelected, void, 2, 3, "([scriptCallback=true])"
DefineConsoleMethod( GuiPopUpMenuCtrlEx, setFirstSelected, void, (bool scriptCallback), (true), "([scriptCallback=true])"
"@hide")
{
if( argc > 2 )
object->setFirstSelected( dAtob( argv[2] ) );
else
object->setFirstSelected();
object->setFirstSelected( scriptCallback );
}
DefineEngineMethod( GuiPopUpMenuCtrlEx, setNoneSelected, void, ( S32 param),,
@@ -571,21 +561,18 @@ DefineEngineMethod( GuiPopUpMenuCtrlEx, getTextById, const char*, (S32 id),,
}
ConsoleMethod( GuiPopUpMenuCtrlEx, getColorById, const char*, 3, 3,
DefineConsoleMethod( GuiPopUpMenuCtrlEx, getColorById, ColorI, (S32 id), ,
"@brief Get color of an entry's box\n\n"
"@param id ID number of entry to query\n\n"
"@return ColorI in the format of \"Red Green Blue Alpha\", each of with is a value between 0 - 255")
{
ColorI color;
object->getColoredBox(color, dAtoi(argv[2]));
object->getColoredBox(color, id);
return color;
static const U32 bufSize = 512;
char *strBuffer = Con::getReturnBuffer(bufSize);
dSprintf(strBuffer, bufSize, "%d %d %d %d", color.red, color.green, color.blue, color.alpha);
return strBuffer;
}
ConsoleMethod( GuiPopUpMenuCtrlEx, setEnumContent, void, 4, 4,
DefineConsoleMethod( GuiPopUpMenuCtrlEx, setEnumContent, void, ( const char * className, const char * enumName ), ,
"@brief This fills the popup with a classrep's field enumeration type info.\n\n"
"More of a helper function than anything. If console access to the field list is added, "
"at least for the enumerated types, then this should go away.\n\n"
@@ -597,28 +584,28 @@ ConsoleMethod( GuiPopUpMenuCtrlEx, setEnumContent, void, 4, 4,
// walk the class list to get our class
while(classRep)
{
if(!dStricmp(classRep->getClassName(), argv[2]))
if(!dStricmp(classRep->getClassName(), className))
break;
classRep = classRep->getNextClass();
}
// get it?
if(!classRep)
{
Con::warnf(ConsoleLogEntry::General, "failed to locate class rep for '%s'", (const char*)argv[2]);
Con::warnf(ConsoleLogEntry::General, "failed to locate class rep for '%s'", className);
return;
}
// walk the fields to check for this one (findField checks StringTableEntry ptrs...)
U32 i;
for(i = 0; i < classRep->mFieldList.size(); i++)
if(!dStricmp(classRep->mFieldList[i].pFieldname, argv[3]))
if(!dStricmp(classRep->mFieldList[i].pFieldname, enumName))
break;
// found it?
if(i == classRep->mFieldList.size())
{
Con::warnf(ConsoleLogEntry::General, "failed to locate field '%s' for class '%s'", (const char*)argv[3], (const char*)argv[2]);
Con::warnf(ConsoleLogEntry::General, "failed to locate field '%s' for class '%s'", enumName, className);
return;
}
@@ -628,7 +615,7 @@ ConsoleMethod( GuiPopUpMenuCtrlEx, setEnumContent, void, 4, 4,
// check the type
if( !conType->getEnumTable() )
{
Con::warnf(ConsoleLogEntry::General, "field '%s' is not an enumeration for class '%s'", (const char*)argv[3], (const char*)argv[2]);
Con::warnf(ConsoleLogEntry::General, "field '%s' is not an enumeration for class '%s'", enumName, className);
return;
}
@@ -641,28 +628,28 @@ ConsoleMethod( GuiPopUpMenuCtrlEx, setEnumContent, void, 4, 4,
}
//------------------------------------------------------------------------------
ConsoleMethod( GuiPopUpMenuCtrlEx, findText, S32, 3, 3, "(string text)"
DefineConsoleMethod( GuiPopUpMenuCtrlEx, findText, S32, (const char * text), , "(string text)"
"Returns the id of the first entry containing the specified text or -1 if not found."
"@param text String value used for the query\n\n"
"@return Numerical ID of entry containing the text.")
{
return( object->findText( argv[2] ) );
return( object->findText( text ) );
}
//------------------------------------------------------------------------------
ConsoleMethod( GuiPopUpMenuCtrlEx, size, S32, 2, 2,
DefineConsoleMethod( GuiPopUpMenuCtrlEx, size, S32, (), ,
"@brief Get the size of the menu\n\n"
"@return Number of entries in the menu\n")
{
return( object->getNumEntries() );
}
//------------------------------------------------------------------------------
ConsoleMethod( GuiPopUpMenuCtrlEx, replaceText, void, 3, 3,
DefineConsoleMethod( GuiPopUpMenuCtrlEx, replaceText, void, (S32 boolVal), ,
"@brief Flag that causes each new text addition to replace the current entry\n\n"
"@param True to turn on replacing, false to disable it")
{
object->replaceText(dAtoi(argv[2]));
object->replaceText(boolVal);
}
//------------------------------------------------------------------------------
@@ -750,9 +737,9 @@ void GuiPopUpMenuCtrlEx::clearEntry( S32 entry )
}
//------------------------------------------------------------------------------
ConsoleMethod( GuiPopUpMenuCtrlEx, clearEntry, void, 3, 3, "(S32 entry)")
DefineConsoleMethod( GuiPopUpMenuCtrlEx, clearEntry, void, (S32 entry), , "(S32 entry)")
{
object->clearEntry(dAtoi(argv[2]));
object->clearEntry(entry);
}
//------------------------------------------------------------------------------

Large diffs are not rendered by default.

@@ -454,6 +454,9 @@ class GuiTreeViewCtrl : public GuiArrayCtrl
GuiTreeViewCtrl();
virtual ~GuiTreeViewCtrl();

//WLE Vince, Moving this into a function so I don't have to bounce off the console. 12/05/2013
const char* getSelectedObjectList();

/// Used for syncing the mSelected and mSelectedItems lists.
void syncSelection();

@@ -592,6 +595,7 @@ class GuiTreeViewCtrl : public GuiArrayCtrl
static void initPersistFields();

void inspectObject(SimObject * obj, bool okToEdit);
S32 insertObject(S32 parentId, SimObject * obj, bool okToEdit);
void buildVisibleTree(bool bForceFullUpdate = false);

void cancelRename();
@@ -2015,25 +2015,18 @@ ConsoleDocFragment _pushDialog(
"void pushDialog( GuiControl ctrl, int layer=0, bool center=false);"
);
ConsoleMethod( GuiCanvas, pushDialog, void, 3, 5, "(GuiControl ctrl, int layer=0, bool center=false)"
DefineConsoleMethod( GuiCanvas, pushDialog, void, (const char * ctrlName, S32 layer, bool center), ( 0, false), "(GuiControl ctrl, int layer=0, bool center=false)"
"@hide")
{
GuiControl *gui;
if (! Sim::findObject(argv[2], gui))
if (! Sim::findObject(ctrlName, gui))
{
Con::printf("%s(): Invalid control: %s", (const char*)argv[0], (const char*)argv[2]);
Con::printf("pushDialog(): Invalid control: %s", ctrlName);
return;
}
//find the layer
S32 layer = 0;
if( argc > 3 )
layer = dAtoi( argv[ 3 ] );
bool center = false;
if( argc > 4 )
center = dAtob( argv[ 4 ] );
//set the new content control
object->pushDialogControl(gui, layer, center);
@@ -2059,19 +2052,9 @@ ConsoleDocFragment _popDialog2(
"void popDialog();"
);
ConsoleMethod( GuiCanvas, popDialog, void, 2, 3, "(GuiControl ctrl=NULL)"
DefineConsoleMethod( GuiCanvas, popDialog, void, (GuiControl * gui), (NULL), "(GuiControl ctrl=NULL)"
"@hide")
{
GuiControl *gui = NULL;
if (argc == 3)
{
if (!Sim::findObject(argv[2], gui))
{
Con::printf("%s(): Invalid control: %s", (const char*)argv[0], (const char*)argv[2]);
return;
}
}
if (gui)
object->popDialogControl(gui);
else
@@ -2097,12 +2080,9 @@ ConsoleDocFragment _popLayer2(
"void popLayer(S32 layer);"
);
ConsoleMethod( GuiCanvas, popLayer, void, 2, 3, "(int layer)"
DefineConsoleMethod( GuiCanvas, popLayer, void, (S32 layer), (0), "(int layer)"
"@hide")
{
S32 layer = 0;
if (argc == 3)
layer = dAtoi(argv[2]);
object->popDialogControl(layer);
}
@@ -2258,15 +2238,9 @@ ConsoleDocFragment _setCursorPos2(
"bool setCursorPos( F32 posX, F32 posY);"
);
ConsoleMethod( GuiCanvas, setCursorPos, void, 3, 4, "(Point2I pos)"
DefineConsoleMethod( GuiCanvas, setCursorPos, void, (Point2I pos), , "(Point2I pos)"
"@hide")
{
Point2I pos(0,0);
if(argc == 4)
pos.set(dAtoi(argv[2]), dAtoi(argv[3]));
else
dSscanf(argv[2], "%d %d", &pos.x, &pos.y);
object->setCursorPos(pos);
}
@@ -2549,7 +2523,7 @@ DefineEngineMethod( GuiCanvas, setWindowPosition, void, ( Point2I position ),,
object->getPlatformWindow()->setPosition( position );
}
ConsoleMethod( GuiCanvas, isFullscreen, bool, 2, 2, "() - Is this canvas currently fullscreen?" )
DefineConsoleMethod( GuiCanvas, isFullscreen, bool, (), , "() - Is this canvas currently fullscreen?" )
{
if (Platform::getWebDeployment())
return false;
@@ -2560,14 +2534,14 @@ ConsoleMethod( GuiCanvas, isFullscreen, bool, 2, 2, "() - Is this canvas current
return object->getPlatformWindow()->getVideoMode().fullScreen;
}
ConsoleMethod( GuiCanvas, minimizeWindow, void, 2, 2, "() - minimize this canvas' window." )
DefineConsoleMethod( GuiCanvas, minimizeWindow, void, (), , "() - minimize this canvas' window." )
{
PlatformWindow* window = object->getPlatformWindow();
if ( window )
window->minimize();
}
ConsoleMethod( GuiCanvas, isMinimized, bool, 2, 2, "()" )
DefineConsoleMethod( GuiCanvas, isMinimized, bool, (), , "()" )
{
PlatformWindow* window = object->getPlatformWindow();
if ( window )
@@ -2576,7 +2550,7 @@ ConsoleMethod( GuiCanvas, isMinimized, bool, 2, 2, "()" )
return false;
}
ConsoleMethod( GuiCanvas, isMaximized, bool, 2, 2, "()" )
DefineConsoleMethod( GuiCanvas, isMaximized, bool, (), , "()" )
{
PlatformWindow* window = object->getPlatformWindow();
if ( window )
@@ -2585,28 +2559,30 @@ ConsoleMethod( GuiCanvas, isMaximized, bool, 2, 2, "()" )
return false;
}
ConsoleMethod( GuiCanvas, maximizeWindow, void, 2, 2, "() - maximize this canvas' window." )
DefineConsoleMethod( GuiCanvas, maximizeWindow, void, (), , "() - maximize this canvas' window." )
{
PlatformWindow* window = object->getPlatformWindow();
if ( window )
window->maximize();
}
ConsoleMethod( GuiCanvas, restoreWindow, void, 2, 2, "() - restore this canvas' window." )
DefineConsoleMethod( GuiCanvas, restoreWindow, void, (), , "() - restore this canvas' window." )
{
PlatformWindow* window = object->getPlatformWindow();
if( window )
window->restore();
}
ConsoleMethod( GuiCanvas, setFocus, void, 2,2, "() - Claim OS input focus for this canvas' window.")
DefineConsoleMethod( GuiCanvas, setFocus, void, (), , "() - Claim OS input focus for this canvas' window.")
{
PlatformWindow* window = object->getPlatformWindow();
if( window )
window->setFocus();
}
ConsoleMethod( GuiCanvas, setVideoMode, void, 5, 8,
DefineConsoleMethod( GuiCanvas, setVideoMode, void,
(U32 width, U32 height, bool fullscreen, U32 bitDepth, U32 refreshRate, U32 antialiasLevel),
( false, 0, 0, 0),
"(int width, int height, bool fullscreen, [int bitDepth], [int refreshRate], [int antialiasLevel] )\n"
"Change the video mode of this canvas. This method has the side effect of setting the $pref::Video::mode to the new values.\n\n"
"\\param width The screen width to set.\n"
@@ -2625,8 +2601,6 @@ ConsoleMethod( GuiCanvas, setVideoMode, void, 5, 8,
// Update the video mode and tell the window to reset.
GFXVideoMode vm = object->getPlatformWindow()->getVideoMode();
U32 width = dAtoi(argv[2]);
U32 height = dAtoi(argv[3]);
bool changed = false;
if (width == 0 && height > 0)
@@ -2673,28 +2647,31 @@ ConsoleMethod( GuiCanvas, setVideoMode, void, 5, 8,
}
if (changed)
Con::errorf("GuiCanvas::setVideoMode(): Error - Invalid resolution of (%d, %d) - attempting (%d, %d)", dAtoi(argv[2]), dAtoi(argv[3]), width, height);
{
Con::errorf("GuiCanvas::setVideoMode(): Error - Invalid resolution of (%d, %d) - attempting (%d, %d)", width, height, width, height);
}

vm.resolution = Point2I(width, height);
vm.fullScreen = dAtob(argv[4]);
vm.fullScreen = fullscreen;

if (Platform::getWebDeployment())
vm.fullScreen = false;

// These optional params are set to default at construction of vm. If they
// aren't specified, just leave them at whatever they were set to.
if ((argc > 5) && (dStrlen(argv[5]) > 0))
if (bitDepth > 0)
{
vm.bitDepth = dAtoi(argv[5]);
vm.bitDepth = refreshRate;
}
if ((argc > 6) && (dStrlen(argv[6]) > 0))

if (refreshRate > 0)
{
vm.refreshRate = dAtoi(argv[6]);
vm.refreshRate = refreshRate;
}

if ((argc > 7) && (dStrlen(argv[7]) > 0))
if (antialiasLevel > 0)
{
vm.antialiasLevel = dAtoi(argv[7]);
vm.antialiasLevel = antialiasLevel;
}

object->getPlatformWindow()->setVideoMode(vm);
@@ -2613,17 +2613,21 @@ DefineEngineMethod( GuiControl, setValue, void, ( const char* value ),,
object->setScriptValue( value );
}
ConsoleMethod( GuiControl, getValue, const char*, 2, 2, "")
//ConsoleMethod( GuiControl, getValue, const char*, 2, 2, "")
DefineConsoleMethod( GuiControl, getValue, const char*, (), , "")
{
return object->getScriptValue();
}
ConsoleMethod( GuiControl, makeFirstResponder, void, 3, 3, "(bool isFirst)")
//ConsoleMethod( GuiControl, makeFirstResponder, void, 3, 3, "(bool isFirst)")
DefineConsoleMethod( GuiControl, makeFirstResponder, void, (bool isFirst), , "(bool isFirst)")
{
object->makeFirstResponder(dAtob(argv[2]));
//object->makeFirstResponder(dAtob(argv[2]));
object->makeFirstResponder(isFirst);
}
ConsoleMethod( GuiControl, isActive, bool, 2, 2, "")
//ConsoleMethod( GuiControl, isActive, bool, 2, 2, "")
DefineConsoleMethod( GuiControl, isActive, bool, (), , "")
{
return object->isActive();
}
@@ -2806,22 +2810,19 @@ static ConsoleDocFragment _sGuiControlSetExtent2(
"GuiControl", // The class to place the method in; use NULL for functions.
"void setExtent( Point2I p );" ); // The definition string.
ConsoleMethod( GuiControl, setExtent, void, 3, 4,
DefineConsoleMethod( GuiControl, setExtent, void, ( const char* extOrX, const char* y ), (""),
"( Point2I p | int x, int y ) Set the width and height of the control.\n\n"
"@hide" )
{
if ( argc == 3 )
Point2I extent;
if(!dStrIsEmpty(extOrX) && dStrIsEmpty(y))
dSscanf(extOrX, "%f %f", &extent.x, &extent.y);
else if(!dStrIsEmpty(extOrX) && !dStrIsEmpty(y))
{
// We scan for floats because its possible that math
// done on the extent can result in fractional values.
Point2F ext;
if ( dSscanf( argv[2], "%g %g", &ext.x, &ext.y ) == 2 )
object->setExtent( (S32)ext.x, (S32)ext.y );
else
Con::errorf( "GuiControl::setExtent, not enough parameters!" );
extent.x = dAtof(extOrX);
extent.y = dAtof(y);
}
else if ( argc == 4 )
object->setExtent( dAtoi(argv[2]), dAtoi(argv[3]) );
object->setExtent( extent );
}
//-----------------------------------------------------------------------------
@@ -24,6 +24,7 @@
#include "platform/types.h"
#include "console/consoleTypes.h"
#include "console/console.h"
#include "console/engineAPI.h"
#include "gui/core/guiTypes.h"
#include "gui/core/guiControl.h"
#include "gfx/gFont.h"
@@ -694,9 +695,9 @@ bool GuiControlProfile::loadFont()
return true;
}

ConsoleMethod( GuiControlProfile, getStringWidth, S32, 3, 3, "( pString )" )
DefineConsoleMethod( GuiControlProfile, getStringWidth, S32, ( const char * pString ), , "( pString )" )
{
return object->mFont->getStrNWidth( argv[2], dStrlen( argv[2] ) );
return object->mFont->getStrNWidth( pString, dStrlen( pString ) );
}

//-----------------------------------------------------------------------------
@@ -24,6 +24,7 @@
#include "gui/editor/guiDebugger.h"

#include "gui/core/guiCanvas.h"
#include "console/engineAPI.h"
#include "gfx/gfxDrawUtil.h"
#include "core/volume.h"

@@ -65,61 +66,60 @@ DbgFileView::DbgFileView()
mSize.set(1, 0);
}

ConsoleMethod(DbgFileView, setCurrentLine, void, 4, 4, "(int line, bool selected)"
DefineConsoleMethod(DbgFileView, setCurrentLine, void, (S32 line, bool selected), , "(int line, bool selected)"
"Set the current highlighted line.")
{
object->setCurrentLine(dAtoi(argv[2]), dAtob(argv[3]));
object->setCurrentLine(line, selected);
}

ConsoleMethod(DbgFileView, getCurrentLine, const char *, 2, 2, "()"
DefineConsoleMethod(DbgFileView, getCurrentLine, const char *, (), , "()"
"Get the currently executing file and line, if any.\n\n"
"@returns A string containing the file, a tab, and then the line number."
" Use getField() with this.")
{
S32 lineNum;
const char *file = object->getCurrentLine(lineNum);
static const U32 bufSize = 256;
char* ret = Con::getReturnBuffer(bufSize);
dSprintf(ret, bufSize, "%s\t%d", file, lineNum);
char* ret = Con::getReturnBuffer(256);
dSprintf(ret, sizeof(ret), "%s\t%d", file, lineNum);
return ret;
}

ConsoleMethod(DbgFileView, open, bool, 3, 3, "(string filename)"
DefineConsoleMethod(DbgFileView, open, bool, (const char * filename), , "(string filename)"
"Open a file for viewing.\n\n"
"@note This loads the file from the local system.")
{
return object->openFile(argv[2]);
return object->openFile(filename);
}

ConsoleMethod(DbgFileView, clearBreakPositions, void, 2, 2, "()"
DefineConsoleMethod(DbgFileView, clearBreakPositions, void, (), , "()"
"Clear all break points in the current file.")
{
object->clearBreakPositions();
}

ConsoleMethod(DbgFileView, setBreakPosition, void, 3, 3, "(int line)"
DefineConsoleMethod(DbgFileView, setBreakPosition, void, (U32 line), , "(int line)"
"Set a breakpoint at the specified line.")
{
object->setBreakPosition(dAtoi(argv[2]));
object->setBreakPosition(line);
}

ConsoleMethod(DbgFileView, setBreak, void, 3, 3, "(int line)"
DefineConsoleMethod(DbgFileView, setBreak, void, (U32 line), , "(int line)"
"Set a breakpoint at the specified line.")
{
object->setBreakPointStatus(dAtoi(argv[2]), true);
object->setBreakPointStatus(line, true);
}

ConsoleMethod(DbgFileView, removeBreak, void, 3, 3, "(int line)"
DefineConsoleMethod(DbgFileView, removeBreak, void, (U32 line), , "(int line)"
"Remove a breakpoint from the specified line.")
{
object->setBreakPointStatus(dAtoi(argv[2]), false);
object->setBreakPointStatus(line, false);
}

ConsoleMethod(DbgFileView, findString, bool, 3, 3, "(string findThis)"
DefineConsoleMethod(DbgFileView, findString, bool, (const char * findThis), , "(string findThis)"
"Find the specified string in the currently viewed file and "
"scroll it into view.")
{
return object->findString(argv[2]);
return object->findString(findThis);
}

//this value is the offset used in the ::onRender() method...
@@ -2468,7 +2468,7 @@ void GuiEditCtrl::startMouseGuideDrag( guideAxis axis, U32 guideIndex, bool lock

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, getContentControl, S32, 2, 2, "() - Return the toplevel control edited inside the GUI editor." )
DefineConsoleMethod( GuiEditCtrl, getContentControl, S32, (), , "() - Return the toplevel control edited inside the GUI editor." )
{
GuiControl* ctrl = object->getContentControl();
if( ctrl )
@@ -2479,148 +2479,126 @@ ConsoleMethod( GuiEditCtrl, getContentControl, S32, 2, 2, "() - Return the tople

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, setContentControl, void, 3, 3, "( GuiControl ctrl ) - Set the toplevel control to edit in the GUI editor." )
DefineConsoleMethod( GuiEditCtrl, setContentControl, void, (GuiControl *ctrl ), , "( GuiControl ctrl ) - Set the toplevel control to edit in the GUI editor." )
{
GuiControl *ctrl;
if(!Sim::findObject(argv[2], ctrl))
return;
object->setContentControl(ctrl);
if (ctrl)
object->setContentControl(ctrl);
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, addNewCtrl, void, 3, 3, "(GuiControl ctrl)")
DefineConsoleMethod( GuiEditCtrl, addNewCtrl, void, (GuiControl *ctrl), , "(GuiControl ctrl)")
{
GuiControl *ctrl;
if(!Sim::findObject(argv[2], ctrl))
return;
object->addNewControl(ctrl);
if (ctrl)
object->addNewControl(ctrl);
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, addSelection, void, 3, 3, "selects a control.")
DefineConsoleMethod( GuiEditCtrl, addSelection, void, (S32 id), , "selects a control.")
{
S32 id = dAtoi(argv[2]);
object->addSelection(id);
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, removeSelection, void, 3, 3, "deselects a control.")
DefineConsoleMethod( GuiEditCtrl, removeSelection, void, (S32 id), , "deselects a control.")
{
S32 id = dAtoi(argv[2]);
object->removeSelection(id);
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, clearSelection, void, 2, 2, "Clear selected controls list.")
DefineConsoleMethod( GuiEditCtrl, clearSelection, void, (), , "Clear selected controls list.")
{
object->clearSelection();
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, select, void, 3, 3, "(GuiControl ctrl)")
DefineConsoleMethod( GuiEditCtrl, select, void, (GuiControl *ctrl), , "(GuiControl ctrl)")
{
GuiControl *ctrl;

if(!Sim::findObject(argv[2], ctrl))
return;

if (ctrl)
object->setSelection(ctrl, false);
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, setCurrentAddSet, void, 3, 3, "(GuiControl ctrl)")
DefineConsoleMethod( GuiEditCtrl, setCurrentAddSet, void, (GuiControl *addSet), , "(GuiControl ctrl)")
{
GuiControl *addSet;

if (!Sim::findObject(argv[2], addSet))
{
Con::printf("%s(): Invalid control: %s", (const char*)argv[0], (const char*)argv[2]);
return;
}
if (addSet)
object->setCurrentAddSet(addSet);
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, getCurrentAddSet, S32, 2, 2, "Returns the set to which new controls will be added")
DefineConsoleMethod( GuiEditCtrl, getCurrentAddSet, S32, (), , "Returns the set to which new controls will be added")
{
const GuiControl* add = object->getCurrentAddSet();
return add ? add->getId() : 0;
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, toggle, void, 2, 2, "Toggle activation.")
DefineConsoleMethod( GuiEditCtrl, toggle, void, (), , "Toggle activation.")
{
object->setEditMode( !object->isActive() );
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, justify, void, 3, 3, "(int mode)" )
DefineConsoleMethod( GuiEditCtrl, justify, void, (U32 mode), , "(int mode)" )
{
object->justifySelection((GuiEditCtrl::Justification)dAtoi(argv[2]));
object->justifySelection( (GuiEditCtrl::Justification)mode );
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, bringToFront, void, 2, 2, "")
DefineConsoleMethod( GuiEditCtrl, bringToFront, void, (), , "")
{
object->bringToFront();
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, pushToBack, void, 2, 2, "")
DefineConsoleMethod( GuiEditCtrl, pushToBack, void, (), , "")
{
object->pushToBack();
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, deleteSelection, void, 2, 2, "() - Delete the selected controls.")
DefineConsoleMethod( GuiEditCtrl, deleteSelection, void, (), , "() - Delete the selected controls.")
{
object->deleteSelection();
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, moveSelection, void, 4, 4, "(int dx, int dy) - Move all controls in the selection by (dx,dy) pixels.")
DefineConsoleMethod( GuiEditCtrl, moveSelection, void, (Point2I pos), , "Move all controls in the selection by (dx,dy) pixels.")
{
object->moveAndSnapSelection(Point2I(dAtoi(argv[2]), dAtoi(argv[3])));
object->moveAndSnapSelection(Point2I(pos));
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, saveSelection, void, 2, 3, "( string fileName=null ) - Save selection to file or clipboard.")
DefineConsoleMethod( GuiEditCtrl, saveSelection, void, (const char * filename), (NULL), "( string fileName=null ) - Save selection to file or clipboard.")
{
const char* filename = NULL;
if( argc > 2 )
filename = argv[ 2 ];

object->saveSelection( filename );
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, loadSelection, void, 2, 3, "( string fileName=null ) - Load selection from file or clipboard.")
DefineConsoleMethod( GuiEditCtrl, loadSelection, void, (const char * filename), (NULL), "( string fileName=null ) - Load selection from file or clipboard.")
{
const char* filename = NULL;
if( argc > 2 )
filename = argv[ 2 ];

object->loadSelection( filename );
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, selectAll, void, 2, 2, "()")
DefineConsoleMethod( GuiEditCtrl, selectAll, void, (), , "()")
{
object->selectAll();
}
@@ -2635,14 +2613,14 @@ DefineEngineMethod( GuiEditCtrl, getSelection, SimSet*, (),,

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, getNumSelected, S32, 2, 2, "() - Return the number of controls currently selected." )
DefineConsoleMethod( GuiEditCtrl, getNumSelected, S32, (), , "() - Return the number of controls currently selected." )
{
return object->getNumSelected();
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, getSelectionGlobalBounds, const char*, 2, 2, "() - Returns global bounds of current selection as vector 'x y width height'." )
DefineConsoleMethod( GuiEditCtrl, getSelectionGlobalBounds, const char*, (), , "() - Returns global bounds of current selection as vector 'x y width height'." )
{
RectI bounds = object->getSelectionGlobalBounds();
String str = String::ToString( "%i %i %i %i", bounds.point.x, bounds.point.y, bounds.extent.x, bounds.extent.y );
@@ -2655,22 +2633,16 @@ ConsoleMethod( GuiEditCtrl, getSelectionGlobalBounds, const char*, 2, 2, "() - R

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, selectParents, void, 2, 3, "( bool addToSelection=false ) - Select parents of currently selected controls." )
DefineConsoleMethod( GuiEditCtrl, selectParents, void, ( bool addToSelection ), (false), "( bool addToSelection=false ) - Select parents of currently selected controls." )
{
bool addToSelection = false;
if( argc > 2 )
addToSelection = dAtob( argv[ 2 ] );

object->selectParents( addToSelection );
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, selectChildren, void, 2, 3, "( bool addToSelection=false ) - Select children of currently selected controls." )
DefineConsoleMethod( GuiEditCtrl, selectChildren, void, ( bool addToSelection ), (false), "( bool addToSelection=false ) - Select children of currently selected controls." )
{
bool addToSelection = false;
if( argc > 2 )
addToSelection = dAtob( argv[ 2 ] );

object->selectChildren( addToSelection );
}
@@ -2685,33 +2657,29 @@ DefineEngineMethod( GuiEditCtrl, getTrash, SimGroup*, (),,

//-----------------------------------------------------------------------------

ConsoleMethod(GuiEditCtrl, setSnapToGrid, void, 3, 3, "GuiEditCtrl.setSnapToGrid(gridsize)")
DefineConsoleMethod(GuiEditCtrl, setSnapToGrid, void, (U32 gridsize), , "GuiEditCtrl.setSnapToGrid(gridsize)")
{
U32 gridsize = dAtoi(argv[2]);
object->setSnapToGrid(gridsize);
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, readGuides, void, 3, 4, "( GuiControl ctrl [, int axis ] ) - Read the guides from the given control." )
DefineConsoleMethod( GuiEditCtrl, readGuides, void, ( GuiControl* ctrl, S32 axis ), (-1), "( GuiControl ctrl [, int axis ] ) - Read the guides from the given control." )
{
// Find the control.

GuiControl* ctrl;
if( !Sim::findObject( argv[ 2 ], ctrl ) )
if( !ctrl )
{
Con::errorf( "GuiEditCtrl::readGuides - no control '%s'", (const char*)argv[ 2 ] );
return;
}

// Read the guides.

if( argc > 3 )
if( axis != -1 )
{
S32 axis = dAtoi( argv[ 3 ] );
if( axis < 0 || axis > 1 )
{
Con::errorf( "GuiEditCtrl::readGuides - invalid axis '%s'", (const char*)argv[ 3 ] );
Con::errorf( "GuiEditCtrl::readGuides - invalid axis '%s'", axis );
return;
}

@@ -2726,25 +2694,22 @@ ConsoleMethod( GuiEditCtrl, readGuides, void, 3, 4, "( GuiControl ctrl [, int ax

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, writeGuides, void, 3, 4, "( GuiControl ctrl [, int axis ] ) - Write the guides to the given control." )
DefineConsoleMethod( GuiEditCtrl, writeGuides, void, ( GuiControl* ctrl, S32 axis ), ( -1), "( GuiControl ctrl [, int axis ] ) - Write the guides to the given control." )
{
// Find the control.

GuiControl* ctrl;
if( !Sim::findObject( argv[ 2 ], ctrl ) )
if( ! ctrl )
{
Con::errorf( "GuiEditCtrl::writeGuides - no control '%i'", (const char*)argv[ 2 ] );
return;
}

// Write the guides.

if( argc > 3 )
if( axis != -1 )
{
S32 axis = dAtoi( argv[ 3 ] );
if( axis < 0 || axis > 1 )
{
Con::errorf( "GuiEditCtrl::writeGuides - invalid axis '%s'", (const char*)argv[ 3 ] );
Con::errorf( "GuiEditCtrl::writeGuides - invalid axis '%s'", axis );
return;
}

@@ -2759,11 +2724,10 @@ ConsoleMethod( GuiEditCtrl, writeGuides, void, 3, 4, "( GuiControl ctrl [, int a

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, clearGuides, void, 2, 3, "( [ int axis ] ) - Clear all currently set guide lines." )
DefineConsoleMethod( GuiEditCtrl, clearGuides, void, ( S32 axis ), (-1), "( [ int axis ] ) - Clear all currently set guide lines." )
{
if( argc > 2 )
if( axis != -1 )
{
S32 axis = dAtoi( argv[ 2 ] );
if( axis < 0 || axis > 1 )
{
Con::errorf( "GuiEditCtrl::clearGuides - invalid axis '%i'", axis );
@@ -2781,22 +2745,15 @@ ConsoleMethod( GuiEditCtrl, clearGuides, void, 2, 3, "( [ int axis ] ) - Clear a

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, fitIntoParents, void, 2, 4, "( bool width=true, bool height=true ) - Fit selected controls into their parents." )
DefineConsoleMethod( GuiEditCtrl, fitIntoParents, void, (bool width, bool height), (true, true), "( bool width=true, bool height=true ) - Fit selected controls into their parents." )
{
bool width = true;
bool height = true;

if( argc > 2 )
width = dAtob( argv[ 2 ] );
if( argc > 3 )
height = dAtob( argv[ 3 ] );

object->fitIntoParents( width, height );
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiEditCtrl, getMouseMode, const char*, 2, 2, "() - Return the current mouse mode." )
DefineConsoleMethod( GuiEditCtrl, getMouseMode, const char*, (), , "() - Return the current mouse mode." )
{
switch( object->getMouseMode() )
{
@@ -23,6 +23,7 @@
#include "platform/platform.h"
#include "gui/editor/guiFilterCtrl.h"

#include "console/engineAPI.h"
#include "console/console.h"
#include "console/consoleTypes.h"
#include "guiFilterCtrl.h"
@@ -59,10 +60,9 @@ void GuiFilterCtrl::initPersistFields()
Parent::initPersistFields();
}

ConsoleMethod( GuiFilterCtrl, getValue, const char*, 2, 2, "Return a tuple containing all the values in the filter."
DefineConsoleMethod( GuiFilterCtrl, getValue, const char*, (), , "Return a tuple containing all the values in the filter."
"@internal")
{
TORQUE_UNUSED(argv);
static char buffer[512];
const Filter *filter = object->get();
*buffer = 0;
@@ -89,7 +89,7 @@ ConsoleMethod( GuiFilterCtrl, setValue, void, 3, 20, "(f1, f2, ...)"
object->set(filter);
}

ConsoleMethod( GuiFilterCtrl, identity, void, 2, 2, "Reset the filtering."
DefineConsoleMethod( GuiFilterCtrl, identity, void, (), , "Reset the filtering."
"@internal")
{
object->identity();
@@ -20,6 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------

#include "console/engineAPI.h"
#include "gui/editor/guiInspector.h"
#include "gui/editor/inspector/field.h"
#include "gui/editor/inspector/group.h"
@@ -771,14 +772,13 @@ void GuiInspector::sendInspectPostApply()

//-----------------------------------------------------------------------------

ConsoleMethod( GuiInspector, inspect, void, 3, 3, "Inspect(Object)")
DefineConsoleMethod( GuiInspector, inspect, void, (const char * className), , "Inspect(Object)")
{
SimObject * target = Sim::findObject(argv[2]);
SimObject * target = Sim::findObject(className);
if(!target)
{
if(dAtoi(argv[2]) > 0)
Con::warnf("%s::inspect(): invalid object: %s", (const char*)argv[0], (const char*)argv[2]);

if(dAtoi(className) > 0)
Con::warnf("GuiInspector::inspect(): invalid object: %s", className);
object->clearInspectObjects();
return;
}
@@ -788,38 +788,29 @@ ConsoleMethod( GuiInspector, inspect, void, 3, 3, "Inspect(Object)")

//-----------------------------------------------------------------------------

ConsoleMethod( GuiInspector, addInspect, void, 3, 4, "( id object, (bool autoSync = true) ) - Add the object to the list of objects being inspected." )
DefineConsoleMethod( GuiInspector, addInspect, void, (const char * className, bool autoSync), (true), "( id object, (bool autoSync = true) ) - Add the object to the list of objects being inspected." )
{
SimObject* obj;
if( !Sim::findObject( argv[ 2 ], obj ) )
if( !Sim::findObject( className, obj ) )
{
Con::errorf( "%s::addInspect(): invalid object: %s", (const char*)argv[ 0 ], (const char*)argv[ 2 ] );
Con::errorf( "GuiInspector::addInspect(): invalid object: %s", className );
return;
}

if( argc > 3 )
object->addInspectObject( obj, false );
else
object->addInspectObject( obj );
object->addInspectObject( obj, autoSync );
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiInspector, removeInspect, void, 3, 3, "( id object ) - Remove the object from the list of objects being inspected." )
DefineConsoleMethod( GuiInspector, removeInspect, void, (SimObject* obj), , "( id object ) - Remove the object from the list of objects being inspected." )
{
SimObject* obj;
if( !Sim::findObject( argv[ 2 ], obj ) )
{
Con::errorf( "%s::removeInspect(): invalid object: %s", (const char*)argv[ 0 ], (const char*)argv[ 2 ] );
return;
}

object->removeInspectObject( obj );
if (obj)
object->removeInspectObject( obj );
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiInspector, refresh, void, 2, 2, "Reinspect the currently selected object." )
DefineConsoleMethod( GuiInspector, refresh, void, (), , "Reinspect the currently selected object." )
{
if ( object->getNumInspectObjects() == 0 )
return;
@@ -831,11 +822,8 @@ ConsoleMethod( GuiInspector, refresh, void, 2, 2, "Reinspect the currently selec

//-----------------------------------------------------------------------------

ConsoleMethod( GuiInspector, getInspectObject, const char*, 2, 3, "getInspectObject( int index=0 ) - Returns currently inspected object" )
DefineConsoleMethod( GuiInspector, getInspectObject, const char*, (U32 index), (0), "getInspectObject( int index=0 ) - Returns currently inspected object" )
{
U32 index = 0;
if( argc > 2 )
index = dAtoi( argv[ 2 ] );

if( index >= object->getNumInspectObjects() )
{
@@ -848,40 +836,40 @@ ConsoleMethod( GuiInspector, getInspectObject, const char*, 2, 3, "getInspectObj

//-----------------------------------------------------------------------------

ConsoleMethod( GuiInspector, getNumInspectObjects, S32, 2, 2, "() - Return the number of objects currently being inspected." )
DefineConsoleMethod( GuiInspector, getNumInspectObjects, S32, (), , "() - Return the number of objects currently being inspected." )
{
return object->getNumInspectObjects();
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiInspector, setName, void, 3, 3, "setName(NewObjectName)")
DefineConsoleMethod( GuiInspector, setName, void, (const char * newObjectName), , "setName(NewObjectName)")
{
object->setName(argv[2]);
object->setName(newObjectName);
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiInspector, apply, void, 2, 2, "apply() - Force application of inspected object's attributes" )
DefineConsoleMethod( GuiInspector, apply, void, (), , "apply() - Force application of inspected object's attributes" )
{
object->sendInspectPostApply();
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiInspector, setObjectField, void, 4, 4,
DefineConsoleMethod( GuiInspector, setObjectField, void, (const char * fieldname, const char * data ), ,
"setObjectField( fieldname, data ) - Set a named fields value on the inspected object if it exists. This triggers all the usual callbacks that would occur if the field had been changed through the gui." )
{
object->setObjectField( argv[2], argv[3] );
object->setObjectField( fieldname, data );
}

//-----------------------------------------------------------------------------

ConsoleStaticMethod( GuiInspector, findByObject, S32, 2, 2,
DefineConsoleStaticMethod( GuiInspector, findByObject, S32, (const char * className ), ,
"findByObject( SimObject ) - returns the id of an awake inspector that is inspecting the passed object if one exists." )
{
SimObject *obj;
if ( !Sim::findObject( argv[1], obj ) )
if ( !Sim::findObject( className, obj ) )
return NULL;

obj = GuiInspector::findByObject( obj );
@@ -216,7 +216,7 @@ DefineEngineMethod(GuiMenuBar, addMenu, void, (const char* menuText, S32 menuId)
}

DefineEngineMethod(GuiMenuBar, addMenuItem, void, (const char* targetMenu, const char* menuItemText, S32 menuItemId, const char* accelerator, int checkGroup),
("","",0,NULL,-1),
("","",0,"",-1),
"@brief Adds a menu item to the specified menu. The menu argument can be either the text of a menu or its id.\n\n"
"@param menu Menu name or menu Id to add the new item to.\n"
"@param menuItemText Text for the new menu item.\n"

Large diffs are not rendered by default.

@@ -22,6 +22,7 @@

#include "console/console.h"
#include "console/consoleTypes.h"
#include "console/engineAPI.h"
#include "gfx/gfxDevice.h"
#include "gfx/gfxDrawUtil.h"

@@ -24,6 +24,7 @@
#include "gui/editor/inspector/dynamicGroup.h"
#include "gui/editor/guiInspector.h"
#include "gui/buttons/guiIconButtonCtrl.h"
#include "console/engineAPI.h"

//-----------------------------------------------------------------------------
// GuiInspectorDynamicField - Child class of GuiInspectorField
@@ -315,7 +316,7 @@ void GuiInspectorDynamicField::_executeSelectedCallback()
Con::executef( mInspector, "onFieldSelected", mDynField->slotName, "TypeDynamicField" );
}

ConsoleMethod( GuiInspectorDynamicField, renameField, void, 3,3, "field.renameField(newDynamicFieldName);" )
DefineConsoleMethod( GuiInspectorDynamicField, renameField, void, (const char* newDynamicFieldName),, "field.renameField(newDynamicFieldName);" )
{
object->renameField( argv[ 2 ] );
object->renameField( newDynamicFieldName );
}
@@ -24,6 +24,7 @@
#include "gui/editor/guiInspector.h"
#include "gui/editor/inspector/dynamicGroup.h"
#include "gui/editor/inspector/dynamicField.h"
#include "console/engineAPI.h"

IMPLEMENT_CONOBJECT(GuiInspectorDynamicGroup);

@@ -176,7 +177,7 @@ void GuiInspectorDynamicGroup::updateAllFields()
inspectGroup();
}

ConsoleMethod(GuiInspectorDynamicGroup, inspectGroup, bool, 2, 2, "Refreshes the dynamic fields in the inspector.")
DefineConsoleMethod(GuiInspectorDynamicGroup, inspectGroup, bool, (), , "Refreshes the dynamic fields in the inspector.")
{
return object->inspectGroup();
}
@@ -251,11 +252,11 @@ void GuiInspectorDynamicGroup::addDynamicField()
instantExpand();
}

ConsoleMethod( GuiInspectorDynamicGroup, addDynamicField, void, 2, 2, "obj.addDynamicField();" )
DefineConsoleMethod( GuiInspectorDynamicGroup, addDynamicField, void, (), , "obj.addDynamicField();" )
{
object->addDynamicField();
}
ConsoleMethod( GuiInspectorDynamicGroup, removeDynamicField, void, 3, 3, "" )
DefineConsoleMethod( GuiInspectorDynamicGroup, removeDynamicField, void, (), , "" )
{
}
@@ -20,6 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------

#include "console/engineAPI.h"
#include "platform/platform.h"
#include "gui/editor/inspector/field.h"
#include "gui/buttons/guiIconButtonCtrl.h"
@@ -615,53 +616,49 @@ void GuiInspectorField::_setFieldDocs( StringTableEntry docs )

//-----------------------------------------------------------------------------

ConsoleMethod( GuiInspectorField, getInspector, S32, 2, 2, "() - Return the GuiInspector to which this field belongs." )
DefineConsoleMethod( GuiInspectorField, getInspector, S32, (), , "() - Return the GuiInspector to which this field belongs." )
{
return object->getInspector()->getId();
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiInspectorField, getInspectedFieldName, const char*, 2, 2, "() - Return the name of the field edited by this inspector field." )
DefineConsoleMethod( GuiInspectorField, getInspectedFieldName, const char*, (), , "() - Return the name of the field edited by this inspector field." )
{
return object->getFieldName();
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiInspectorField, getInspectedFieldType, const char*, 2, 2, "() - Return the type of the field edited by this inspector field." )
DefineConsoleMethod( GuiInspectorField, getInspectedFieldType, const char*, (), , "() - Return the type of the field edited by this inspector field." )
{
return object->getFieldType();
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiInspectorField, apply, void, 3, 4, "( string newValue, bool callbacks=true ) - Set the field's value. Suppress callbacks for undo if callbacks=false." )
DefineConsoleMethod( GuiInspectorField, apply, void, ( const char * newValue, bool callbacks ), (true), "( string newValue, bool callbacks=true ) - Set the field's value. Suppress callbacks for undo if callbacks=false." )
{
bool callbacks = true;
if( argc > 3 )
callbacks = dAtob( argv[ 3 ] );

object->setData( argv[ 2 ], callbacks );
object->setData( newValue, callbacks );
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiInspectorField, applyWithoutUndo, void, 3, 3, "() - Set field value without recording undo (same as 'apply( value, false )')." )
DefineConsoleMethod( GuiInspectorField, applyWithoutUndo, void, (const char * data), , "() - Set field value without recording undo (same as 'apply( value, false )')." )
{
object->setData( argv[ 2 ], false );
object->setData( data, false );
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiInspectorField, getData, const char*, 2, 2, "() - Return the value currently displayed on the field." )
DefineConsoleMethod( GuiInspectorField, getData, const char*, (), , "() - Return the value currently displayed on the field." )
{
return object->getData();
}

//-----------------------------------------------------------------------------

ConsoleMethod( GuiInspectorField, reset, void, 2, 2, "() - Reset to default value." )
DefineConsoleMethod( GuiInspectorField, reset, void, (), , "() - Reset to default value." )
{
object->resetData();
}
@@ -22,6 +22,7 @@

#include "gui/editor/inspector/variableInspector.h"
#include "gui/editor/inspector/variableGroup.h"
#include "console/engineAPI.h"

GuiVariableInspector::GuiVariableInspector()
{
@@ -61,7 +62,7 @@ void GuiVariableInspector::loadVars( String searchStr )
//group->inspectGroup();
}

ConsoleMethod( GuiVariableInspector, loadVars, void, 3, 3, "loadVars( searchString )" )
DefineConsoleMethod( GuiVariableInspector, loadVars, void, ( const char * searchString ), , "loadVars( searchString )" )
{
object->loadVars( argv[2] );
object->loadVars( searchString );
}
@@ -31,35 +31,8 @@
#include "gfx/gfxDrawUtil.h"
#include "console/engineAPI.h"

#include "guiChunkedBitmapCtrl.h"

class GuiChunkedBitmapCtrl : public GuiControl
{
private:
typedef GuiControl Parent;
void renderRegion(const Point2I &offset, const Point2I &extent);

protected:
StringTableEntry mBitmapName;
GFXTexHandle mTexHandle;
bool mUseVariable;
bool mTile;

public:
//creation methods
DECLARE_CONOBJECT(GuiChunkedBitmapCtrl);
DECLARE_CATEGORY( "Gui Images" );

GuiChunkedBitmapCtrl();
static void initPersistFields();

//Parental methods
bool onWake();
void onSleep();

void setBitmap(const char *name);

void onRender(Point2I offset, const RectI &updateRect);
};

IMPLEMENT_CONOBJECT(GuiChunkedBitmapCtrl);

@@ -0,0 +1,37 @@
#include "console/console.h"
#include "console/consoleTypes.h"
#include "gfx/bitmap/gBitmap.h"
#include "gui/core/guiControl.h"
#include "gfx/gfxDevice.h"
#include "gfx/gfxTextureHandle.h"
#include "gfx/gfxDrawUtil.h"
#include "console/engineAPI.h"

class GuiChunkedBitmapCtrl : public GuiControl
{
private:
typedef GuiControl Parent;
void renderRegion(const Point2I &offset, const Point2I &extent);

protected:
StringTableEntry mBitmapName;
GFXTexHandle mTexHandle;
bool mUseVariable;
bool mTile;

public:
//creation methods
DECLARE_CONOBJECT(GuiChunkedBitmapCtrl);
DECLARE_CATEGORY( "Gui Images" );

GuiChunkedBitmapCtrl();
static void initPersistFields();

//Parental methods
bool onWake();
void onSleep();

void setBitmap(const char *name);

void onRender(Point2I offset, const RectI &updateRect);
};
@@ -25,6 +25,7 @@

#include "console/console.h"
#include "console/consoleTypes.h"
#include "console/engineAPI.h"
#include "gfx/gfxDrawUtil.h"


@@ -176,13 +177,13 @@ ConsoleDocClass( GuiIdleCamFadeBitmapCtrl,
"This is going to be deprecated, and any useful code ported to FadeinBitmap\n\n"
"@internal");

ConsoleMethod(GuiIdleCamFadeBitmapCtrl, fadeIn, void, 2, 2, "()"
DefineConsoleMethod(GuiIdleCamFadeBitmapCtrl, fadeIn, void, (), , "()"
"@internal")
{
object->fadeIn();
}

ConsoleMethod(GuiIdleCamFadeBitmapCtrl, fadeOut, void, 2, 2, "()"
DefineConsoleMethod(GuiIdleCamFadeBitmapCtrl, fadeOut, void, (), , "()"
"@internal")
{
object->fadeOut();
@@ -20,6 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "gui/shiny/guiTickCtrl.h"
#include "console/engineAPI.h"

IMPLEMENT_CONOBJECT( GuiTickCtrl );

@@ -57,10 +58,8 @@ static ConsoleDocFragment _setProcessTicks(
"GuiTickCtrl",
"void setProcessTicks( bool tick )"
);
ConsoleMethod( GuiTickCtrl, setProcessTicks, void, 2, 3, "( [tick = true] ) - This will set this object to either be processing ticks or not" )

DefineConsoleMethod( GuiTickCtrl, setProcessTicks, void, (bool tick), (true), "( [tick = true] ) - This will set this object to either be processing ticks or not" )
{
if( argc == 3 )
object->setProcessTicks( dAtob( argv[2] ) );
else
object->setProcessTicks();
object->setProcessTicks(tick);
}
@@ -258,15 +258,12 @@ static ConsoleDocFragment _MessageVectordump2(
"MessageVector",
"void dump( string filename, string header);");

ConsoleMethod( MessageVector, dump, void, 3, 4, "(string filename, string header=NULL)"
DefineConsoleMethod( MessageVector, dump, void, (const char * filename, const char * header), (""), "(string filename, string header=NULL)"
"Dump the message vector to a file, optionally prefixing a header."
"@hide")
{

if ( argc == 4 )
object->dump( argv[2], argv[3] );
else
object->dump( argv[2] );
object->dump( filename, header );
}

DefineEngineMethod( MessageVector, getNumLines, S32, (),,
@@ -21,6 +21,7 @@
//-----------------------------------------------------------------------------

#include "platform/platform.h"
#include "console/engineAPI.h"
#include "gui/worldEditor/creator.h"

#include "gfx/gfxDrawUtil.h"
@@ -218,88 +219,89 @@ 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

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

@@ -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;
}
@@ -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();
}
@@ -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,41 +786,41 @@ 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])];
if( decalInstance == NULL )
return "";
DecalInstance *decalInstance = gDecalManager->mDecalInstanceVec[id];

if( decalInstance == NULL )
return "";

static const U32 bufSize = 256;
char* returnBuffer = Con::getReturnBuffer(bufSize);
@@ -836,42 +837,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 +874,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 )
@@ -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 ( dStrcmp( missionAreaName, "" )==0 )
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 )
@@ -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();
@@ -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()