mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 06:34:36 +00:00
Replaced a ton of ConsoleMethods with the DefineConsoleMethod Macro.
This commit is contained in:
parent
378a933894
commit
acb192e2a5
133 changed files with 1716 additions and 2087 deletions
|
|
@ -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,76 +2479,60 @@ 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;
|
||||
|
|
@ -2556,71 +2540,65 @@ ConsoleMethod( GuiEditCtrl, getCurrentAddSet, S32, 2, 2, "Returns the set to whi
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (object)
|
||||
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"
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "gfx/gfxDrawUtil.h"
|
||||
#include "console/console.h"
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "gui/core/guiCanvas.h"
|
||||
|
||||
#include "gui/editor/guiParticleGraphCtrl.h"
|
||||
|
|
@ -1008,11 +1009,10 @@ bool GuiParticleGraphCtrl::renderGraphTooltip(Point2I cursorPos, StringTableEntr
|
|||
return true;
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, setSelectedPoint, void, 3, 3, "(int point)"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, setSelectedPoint, void, (S32 point), , "(int point)"
|
||||
"Set the selected point on the graph.\n"
|
||||
"@return No return value")
|
||||
{
|
||||
S32 point = dAtoi(argv[2]);
|
||||
if(point >= object->mPlots[object->mSelectedPlot].mGraphData.size() || point < 0)
|
||||
{
|
||||
Con::errorf("Invalid point to select.");
|
||||
|
|
@ -1021,11 +1021,10 @@ ConsoleMethod(GuiParticleGraphCtrl, setSelectedPoint, void, 3, 3, "(int point)"
|
|||
object->setSelectedPoint( point );
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, setSelectedPlot, void, 3, 3, "(int plotID)"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, setSelectedPlot, void, (S32 plotID), , "(int plotID)"
|
||||
"Set the selected plot (a.k.a. graph)."
|
||||
"@return No return value" )
|
||||
{
|
||||
S32 plotID = dAtoi(argv[2]);
|
||||
if(plotID > object->MaxPlots)
|
||||
{
|
||||
Con::errorf("Invalid plotID.");
|
||||
|
|
@ -1034,11 +1033,10 @@ ConsoleMethod(GuiParticleGraphCtrl, setSelectedPlot, void, 3, 3, "(int plotID)"
|
|||
object->setSelectedPlot( plotID );
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, clearGraph, void, 3, 3, "(int plotID)"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, clearGraph, void, (S32 plotID), , "(int plotID)"
|
||||
"Clear the graph of the given plot."
|
||||
"@return No return value")
|
||||
{
|
||||
S32 plotID = dAtoi(argv[2]);
|
||||
if(plotID > object->MaxPlots)
|
||||
{
|
||||
Con::errorf("Invalid plotID.");
|
||||
|
|
@ -1047,111 +1045,95 @@ ConsoleMethod(GuiParticleGraphCtrl, clearGraph, void, 3, 3, "(int plotID)"
|
|||
object->clearGraph( plotID );
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, clearAllGraphs, void, 2, 2, "()"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, clearAllGraphs, void, (), , "()"
|
||||
"Clear all of the graphs."
|
||||
"@return No return value")
|
||||
{
|
||||
object->clearAllGraphs();
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, addPlotPoint, const char*, 5, 6, "(int plotID, float x, float y, bool setAdded = true;)"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, addPlotPoint, const char*, (S32 plotID, F32 x, F32 y, bool setAdded), (true), "(int plotID, float x, float y, bool setAdded = true;)"
|
||||
"Add a data point to the given plot."
|
||||
"@return")
|
||||
{
|
||||
S32 plotID = dAtoi(argv[2]);
|
||||
S32 pointAdded = 0;
|
||||
static const U32 bufSize = 32;
|
||||
char *retBuffer = Con::getReturnBuffer(bufSize);
|
||||
char *retBuffer = Con::getReturnBuffer(32);
|
||||
|
||||
if(plotID > object->MaxPlots)
|
||||
{
|
||||
Con::errorf("Invalid plotID.");
|
||||
dSprintf(retBuffer, bufSize, "%d", -2);
|
||||
dSprintf(retBuffer, 32, "%d", -2);
|
||||
return retBuffer;
|
||||
}
|
||||
|
||||
if(argc == 5)
|
||||
{
|
||||
pointAdded = object->addPlotPoint( plotID, Point2F(dAtof(argv[3]), dAtof(argv[4])));
|
||||
} else if(argc == 6)
|
||||
{
|
||||
pointAdded = object->addPlotPoint( plotID, Point2F(dAtof(argv[3]), dAtof(argv[4])), dAtob(argv[5]));
|
||||
}
|
||||
|
||||
pointAdded = object->addPlotPoint( plotID, Point2F(x, y), setAdded);
|
||||
|
||||
dSprintf(retBuffer, bufSize, "%d", pointAdded);
|
||||
dSprintf(retBuffer, 32, "%d", pointAdded);
|
||||
|
||||
return retBuffer;
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, insertPlotPoint, void, 6, 6, "(int plotID, int i, float x, float y)\n"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, insertPlotPoint, void, (S32 plotID, S32 i, F32 x, F32 y), , "(int plotID, int i, float x, float y)\n"
|
||||
"Insert a data point to the given plot and plot position.\n"
|
||||
"@param plotID The plot you want to access\n"
|
||||
"@param i The data point.\n"
|
||||
"@param x,y The plot position.\n"
|
||||
"@return No return value.")
|
||||
{
|
||||
S32 plotID = dAtoi(argv[2]);
|
||||
if(plotID > object->MaxPlots)
|
||||
{
|
||||
Con::errorf("Invalid plotID.");
|
||||
return;
|
||||
}
|
||||
object->insertPlotPoint( plotID, dAtoi(argv[3]), Point2F(dAtof(argv[4]), dAtof(argv[5])));
|
||||
object->insertPlotPoint( plotID, i, Point2F(x, y));
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, changePlotPoint, const char*, 6, 6, "(int plotID, int i, float x, float y)"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, changePlotPoint, const char*, (S32 plotID, S32 i, F32 x, F32 y), , "(int plotID, int i, float x, float y)"
|
||||
"Change a data point to the given plot and plot position.\n"
|
||||
"@param plotID The plot you want to access\n"
|
||||
"@param i The data point.\n"
|
||||
"@param x,y The plot position.\n"
|
||||
"@return No return value.")
|
||||
{
|
||||
S32 plotID = dAtoi(argv[2]);
|
||||
static const U32 bufSize = 64;
|
||||
if(plotID > object->MaxPlots)
|
||||
{
|
||||
Con::errorf("Invalid plotID.");
|
||||
|
||||
char *retBuffer = Con::getReturnBuffer(bufSize);
|
||||
char *retBuffer = Con::getReturnBuffer(64);
|
||||
const S32 index = -1;
|
||||
dSprintf(retBuffer, bufSize, "%d", index);
|
||||
dSprintf(retBuffer, 64, "%d", index);
|
||||
return retBuffer;
|
||||
}
|
||||
|
||||
char *retBuffer = Con::getReturnBuffer(bufSize);
|
||||
const S32 index = object->changePlotPoint( plotID, dAtoi(argv[3]), Point2F(dAtof(argv[4]), dAtof(argv[5])));
|
||||
dSprintf(retBuffer, bufSize, "%d", index);
|
||||
char *retBuffer = Con::getReturnBuffer(64);
|
||||
const S32 index = object->changePlotPoint( plotID, i, Point2F(x, y));
|
||||
dSprintf(retBuffer, 64, "%d", index);
|
||||
return retBuffer;
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, getSelectedPlot, const char*, 2, 2, "() "
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, getSelectedPlot, const char*, (), , "() "
|
||||
"Gets the selected Plot (a.k.a. graph).\n"
|
||||
"@return The plot's ID.")
|
||||
{
|
||||
static const U32 bufSize = 32;
|
||||
char *retBuffer = Con::getReturnBuffer(bufSize);
|
||||
char *retBuffer = Con::getReturnBuffer(32);
|
||||
const S32 plot = object->getSelectedPlot();
|
||||
dSprintf(retBuffer, bufSize, "%d", plot);
|
||||
dSprintf(retBuffer, 32, "%d", plot);
|
||||
return retBuffer;
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, getSelectedPoint, const char*, 2, 2, "()"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, getSelectedPoint, const char*, (), , "()"
|
||||
"Gets the selected Point on the Plot (a.k.a. graph)."
|
||||
"@return The last selected point ID")
|
||||
{
|
||||
static const U32 bufSize = 32;
|
||||
char *retBuffer = Con::getReturnBuffer(bufSize);
|
||||
char *retBuffer = Con::getReturnBuffer(32);
|
||||
const S32 point = object->getSelectedPoint();
|
||||
dSprintf(retBuffer, bufSize, "%d", point);
|
||||
dSprintf(retBuffer, 32, "%d", point);
|
||||
return retBuffer;
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, isExistingPoint, const char*, 4, 4, "(int plotID, int samples)"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, isExistingPoint, const char*, (S32 plotID, S32 samples), , "(int plotID, int samples)"
|
||||
"@return Returns true or false whether or not the point in the plot passed is an existing point.")
|
||||
{
|
||||
S32 plotID = dAtoi(argv[2]);
|
||||
S32 samples = dAtoi(argv[3]);
|
||||
|
||||
if(plotID > object->MaxPlots)
|
||||
{
|
||||
|
|
@ -1162,19 +1144,16 @@ ConsoleMethod(GuiParticleGraphCtrl, isExistingPoint, const char*, 4, 4, "(int pl
|
|||
Con::errorf("Invalid sample.");
|
||||
}
|
||||
|
||||
static const U32 bufSize = 32;
|
||||
char *retBuffer = Con::getReturnBuffer(bufSize);
|
||||
char *retBuffer = Con::getReturnBuffer(32);
|
||||
const bool isPoint = object->isExistingPoint(plotID, samples);
|
||||
dSprintf(retBuffer, bufSize, "%d", isPoint);
|
||||
dSprintf(retBuffer, 32, "%d", isPoint);
|
||||
return retBuffer;
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, getPlotPoint, const char*, 4, 4, "(int plotID, int samples)"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, getPlotPoint, const char*, (S32 plotID, S32 samples), , "(int plotID, int samples)"
|
||||
"Get a data point from the plot specified, samples from the start of the graph."
|
||||
"@return The data point ID")
|
||||
{
|
||||
S32 plotID = dAtoi(argv[2]);
|
||||
S32 samples = dAtoi(argv[3]);
|
||||
|
||||
if(plotID > object->MaxPlots)
|
||||
{
|
||||
|
|
@ -1185,114 +1164,100 @@ ConsoleMethod(GuiParticleGraphCtrl, getPlotPoint, const char*, 4, 4, "(int plotI
|
|||
Con::errorf("Invalid sample.");
|
||||
}
|
||||
|
||||
static const U32 bufSize = 64;
|
||||
char *retBuffer = Con::getReturnBuffer(bufSize);
|
||||
char *retBuffer = Con::getReturnBuffer(64);
|
||||
const Point2F &pos = object->getPlotPoint(plotID, samples);
|
||||
dSprintf(retBuffer, bufSize, "%f %f", pos.x, pos.y);
|
||||
dSprintf(retBuffer, 64, "%f %f", pos.x, pos.y);
|
||||
return retBuffer;
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, getPlotIndex, const char*, 5, 5, "(int plotID, float x, float y)\n"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, getPlotIndex, const char*, (S32 plotID, F32 x, F32 y), , "(int plotID, float x, float y)\n"
|
||||
"Gets the index of the point passed on the plotID passed (graph ID).\n"
|
||||
"@param plotID The plot you wish to check.\n"
|
||||
"@param x,y The coordinates of the point to get.\n"
|
||||
"@return Returns the index of the point.\n")
|
||||
{
|
||||
S32 plotID = dAtoi(argv[2]);
|
||||
F32 x = dAtof(argv[3]);
|
||||
F32 y = dAtof(argv[4]);
|
||||
|
||||
if(plotID > object->MaxPlots)
|
||||
{
|
||||
Con::errorf("Invalid plotID.");
|
||||
}
|
||||
|
||||
static const U32 bufSize = 32;
|
||||
char *retBuffer = Con::getReturnBuffer(bufSize);
|
||||
char *retBuffer = Con::getReturnBuffer(32);
|
||||
const S32 &index = object->getPlotIndex(plotID, x, y);
|
||||
dSprintf(retBuffer, bufSize, "%d", index);
|
||||
dSprintf(retBuffer, 32, "%d", index);
|
||||
return retBuffer;
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, getGraphColor, const char*, 3, 3, "(int plotID)"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, getGraphColor, const char*, (S32 plotID), , "(int plotID)"
|
||||
"Get the color of the graph passed."
|
||||
"@return Returns the color of the graph as a string of RGB values formatted as \"R G B\"")
|
||||
{
|
||||
S32 plotID = dAtoi(argv[2]);
|
||||
|
||||
if(plotID > object->MaxPlots)
|
||||
{
|
||||
Con::errorf("Invalid plotID.");
|
||||
}
|
||||
|
||||
static const U32 bufSize = 64;
|
||||
char *retBuffer = Con::getReturnBuffer(bufSize);
|
||||
char *retBuffer = Con::getReturnBuffer(64);
|
||||
const ColorF &color = object->getGraphColor(plotID);
|
||||
dSprintf(retBuffer, bufSize, "%f %f %f", color.red, color.green, color.blue);
|
||||
dSprintf(retBuffer, 64, "%f %f %f", color.red, color.green, color.blue);
|
||||
return retBuffer;
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, getGraphMin, const char*, 3, 3, "(int plotID) "
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, getGraphMin, const char*, (S32 plotID), , "(int plotID) "
|
||||
"Get the minimum values of the graph ranges.\n"
|
||||
"@return Returns the minimum of the range formatted as \"x-min y-min\"")
|
||||
{
|
||||
S32 plotID = dAtoi(argv[2]);
|
||||
|
||||
if(plotID > object->MaxPlots)
|
||||
{
|
||||
Con::errorf("Invalid plotID.");
|
||||
}
|
||||
|
||||
static const U32 bufSize = 64;
|
||||
char *retBuffer = Con::getReturnBuffer(bufSize);
|
||||
char *retBuffer = Con::getReturnBuffer(64);
|
||||
const Point2F graphMin = object->getGraphMin(plotID);
|
||||
dSprintf(retBuffer, bufSize, "%f %f", graphMin.x, graphMin.y);
|
||||
dSprintf(retBuffer, 64, "%f %f", graphMin.x, graphMin.y);
|
||||
return retBuffer;
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, getGraphMax, const char*, 3, 3, "(int plotID) "
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, getGraphMax, const char*, (S32 plotID), , "(int plotID) "
|
||||
"Get the maximum values of the graph ranges.\n"
|
||||
"@return Returns the maximum of the range formatted as \"x-max y-max\"")
|
||||
{
|
||||
S32 plotID = dAtoi(argv[2]);
|
||||
|
||||
if(plotID > object->MaxPlots)
|
||||
{
|
||||
Con::errorf("Invalid plotID.");
|
||||
}
|
||||
|
||||
static const U32 bufSize = 64;
|
||||
char *retBuffer = Con::getReturnBuffer(bufSize);
|
||||
char *retBuffer = Con::getReturnBuffer(64);
|
||||
const Point2F graphMax = object->getGraphMax(plotID);
|
||||
dSprintf(retBuffer, bufSize, "%f %f", graphMax.x, graphMax.y);
|
||||
dSprintf(retBuffer, 64, "%f %f", graphMax.x, graphMax.y);
|
||||
return retBuffer;
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, getGraphName, const char*, 3, 3, "(int plotID) "
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, getGraphName, const char*, (S32 plotID), , "(int plotID) "
|
||||
"Get the name of the graph passed.\n"
|
||||
"@return Returns the name of the plot")
|
||||
{
|
||||
S32 plotID = dAtoi(argv[2]);
|
||||
|
||||
if(plotID > object->MaxPlots)
|
||||
{
|
||||
Con::errorf("Invalid plotID.");
|
||||
}
|
||||
|
||||
static const U32 bufSize = 64;
|
||||
char *retBuffer = Con::getReturnBuffer(bufSize);
|
||||
char *retBuffer = Con::getReturnBuffer(64);
|
||||
const StringTableEntry graphName = object->getGraphName(plotID);
|
||||
dSprintf(retBuffer, bufSize, "%s", graphName);
|
||||
dSprintf(retBuffer, 64, "%s", graphName);
|
||||
return retBuffer;
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, setGraphMin, void, 5, 5, "(int plotID, float minX, float minY) "
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, setGraphMin, void, (S32 plotID, F32 minX, F32 minY), , "(int plotID, float minX, float minY) "
|
||||
"Set the min values of the graph of plotID.\n"
|
||||
"@param plotID The plot to modify\n"
|
||||
"@param minX,minY The minimum bound of the value range.\n"
|
||||
"@return No return value.")
|
||||
{
|
||||
S32 plotID = dAtoi(argv[2]);
|
||||
|
||||
if(plotID > object->MaxPlots)
|
||||
{
|
||||
|
|
@ -1300,16 +1265,15 @@ ConsoleMethod(GuiParticleGraphCtrl, setGraphMin, void, 5, 5, "(int plotID, float
|
|||
return;
|
||||
}
|
||||
|
||||
object->setGraphMin(dAtoi(argv[2]), Point2F(dAtof(argv[3]), dAtof(argv[4])));
|
||||
object->setGraphMin(plotID, Point2F(minX, minY));
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, setGraphMinX, void, 4, 4, "(int plotID, float minX) "
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, setGraphMinX, void, (S32 plotID, F32 minX), , "(int plotID, float minX) "
|
||||
"Set the min X value of the graph of plotID.\n"
|
||||
"@param plotID The plot to modify.\n"
|
||||
"@param minX The minimum x value.\n"
|
||||
"@return No return Value.")
|
||||
{
|
||||
S32 plotID = dAtoi(argv[2]);
|
||||
|
||||
if(plotID > object->MaxPlots)
|
||||
{
|
||||
|
|
@ -1317,16 +1281,15 @@ ConsoleMethod(GuiParticleGraphCtrl, setGraphMinX, void, 4, 4, "(int plotID, floa
|
|||
return;
|
||||
}
|
||||
|
||||
object->setGraphMinX(dAtoi(argv[2]), dAtof(argv[3]));
|
||||
object->setGraphMinX(plotID, minX);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, setGraphMinY, void, 4, 4, "(int plotID, float minY) "
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, setGraphMinY, void, (S32 plotID, F32 minX), , "(int plotID, float minY) "
|
||||
"Set the min Y value of the graph of plotID."
|
||||
"@param plotID The plot to modify.\n"
|
||||
"@param minY The minimum y value.\n"
|
||||
"@return No return Value.")
|
||||
{
|
||||
S32 plotID = dAtoi(argv[2]);
|
||||
|
||||
if(plotID > object->MaxPlots)
|
||||
{
|
||||
|
|
@ -1334,16 +1297,15 @@ ConsoleMethod(GuiParticleGraphCtrl, setGraphMinY, void, 4, 4, "(int plotID, floa
|
|||
return;
|
||||
}
|
||||
|
||||
object->setGraphMinY(dAtoi(argv[2]), dAtof(argv[3]));
|
||||
object->setGraphMinY(plotID, minX);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, setGraphMax, void, 5, 5, "(int plotID, float maxX, float maxY) "
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, setGraphMax, void, (S32 plotID, F32 maxX, F32 maxY), , "(int plotID, float maxX, float maxY) "
|
||||
"Set the max values of the graph of plotID."
|
||||
"@param plotID The plot to modify\n"
|
||||
"@param maxX,maxY The maximum bound of the value range.\n"
|
||||
"@return No return value.")
|
||||
{
|
||||
S32 plotID = dAtoi(argv[2]);
|
||||
|
||||
if(plotID > object->MaxPlots)
|
||||
{
|
||||
|
|
@ -1351,16 +1313,15 @@ ConsoleMethod(GuiParticleGraphCtrl, setGraphMax, void, 5, 5, "(int plotID, float
|
|||
return;
|
||||
}
|
||||
|
||||
object->setGraphMax(dAtoi(argv[2]), Point2F(dAtof(argv[3]), dAtof(argv[4])));
|
||||
object->setGraphMax(plotID, Point2F(maxX, maxY));
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, setGraphMaxX, void, 4, 4, "(int plotID, float maxX)"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, setGraphMaxX, void, (S32 plotID, F32 maxX), , "(int plotID, float maxX)"
|
||||
"Set the max X value of the graph of plotID."
|
||||
"@param plotID The plot to modify.\n"
|
||||
"@param maxX The maximum x value.\n"
|
||||
"@return No return Value.")
|
||||
{
|
||||
S32 plotID = dAtoi(argv[2]);
|
||||
|
||||
if(plotID > object->MaxPlots)
|
||||
{
|
||||
|
|
@ -1368,16 +1329,15 @@ ConsoleMethod(GuiParticleGraphCtrl, setGraphMaxX, void, 4, 4, "(int plotID, floa
|
|||
return;
|
||||
}
|
||||
|
||||
object->setGraphMaxX(dAtoi(argv[2]), dAtof(argv[3]));
|
||||
object->setGraphMaxX(plotID, maxX);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, setGraphMaxY, void, 4, 4, "(int plotID, float maxY)"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, setGraphMaxY, void, (S32 plotID, F32 maxX), , "(int plotID, float maxY)"
|
||||
"Set the max Y value of the graph of plotID."
|
||||
"@param plotID The plot to modify.\n"
|
||||
"@param maxY The maximum y value.\n"
|
||||
"@return No return Value.")
|
||||
{
|
||||
S32 plotID = dAtoi(argv[2]);
|
||||
|
||||
if(plotID > object->MaxPlots)
|
||||
{
|
||||
|
|
@ -1385,14 +1345,13 @@ ConsoleMethod(GuiParticleGraphCtrl, setGraphMaxY, void, 4, 4, "(int plotID, floa
|
|||
return;
|
||||
}
|
||||
|
||||
object->setGraphMaxY(dAtoi(argv[2]), dAtof(argv[3]));
|
||||
object->setGraphMaxY(plotID, maxX);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, setGraphHidden, void, 4, 4, "(int plotID, bool isHidden)"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, setGraphHidden, void, (S32 plotID, bool isHidden), , "(int plotID, bool isHidden)"
|
||||
"Set whether the graph number passed is hidden or not."
|
||||
"@return No return value.")
|
||||
{
|
||||
S32 plotID = dAtoi(argv[2]);
|
||||
|
||||
if(plotID > object->MaxPlots)
|
||||
{
|
||||
|
|
@ -1400,52 +1359,51 @@ ConsoleMethod(GuiParticleGraphCtrl, setGraphHidden, void, 4, 4, "(int plotID, bo
|
|||
return;
|
||||
}
|
||||
|
||||
object->setGraphHidden(dAtoi(argv[2]), dAtob(argv[3]));
|
||||
object->setGraphHidden(plotID, isHidden);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, setAutoGraphMax, void, 3, 3, "(bool autoMax) "
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, setAutoGraphMax, void, (bool autoMax), , "(bool autoMax) "
|
||||
"Set whether the max will automatically be set when adding points "
|
||||
"(ie if you add a value over the current max, the max is increased to that value).\n"
|
||||
"@return No return value.")
|
||||
{
|
||||
object->setAutoGraphMax(dAtob(argv[2]));
|
||||
object->setAutoGraphMax(autoMax);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, setAutoRemove, void, 3, 3, "(bool autoRemove) "
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, setAutoRemove, void, (bool autoRemove), , "(bool autoRemove) "
|
||||
"Set whether or not a point should be deleted when you drag another one over it."
|
||||
"@return No return value.")
|
||||
{
|
||||
object->setAutoRemove(dAtob(argv[2]));
|
||||
object->setAutoRemove(autoRemove);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, setRenderAll, void, 3, 3, "(bool renderAll)"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, setRenderAll, void, (bool autoRemove), , "(bool renderAll)"
|
||||
"Set whether or not a position should be rendered on every point or just the last selected."
|
||||
"@return No return value.")
|
||||
{
|
||||
object->setRenderAll(dAtob(argv[2]));
|
||||
object->setRenderAll(autoRemove);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, setPointXMovementClamped, void, 3, 3, "(bool clamped)"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, setPointXMovementClamped, void, (bool autoRemove), , "(bool clamped)"
|
||||
"Set whether the x position of the selected graph point should be clamped"
|
||||
"@return No return value.")
|
||||
{
|
||||
object->setPointXMovementClamped(dAtob(argv[2]));
|
||||
object->setPointXMovementClamped(autoRemove);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, setRenderGraphTooltip, void, 3, 3, "(bool renderGraphTooltip)"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, setRenderGraphTooltip, void, (bool autoRemove), , "(bool renderGraphTooltip)"
|
||||
"Set whether or not to render the graph tooltip."
|
||||
"@return No return value.")
|
||||
{
|
||||
object->setRenderGraphTooltip(dAtob(argv[2]));
|
||||
object->setRenderGraphTooltip(autoRemove);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, setGraphName, void, 4, 4, "(int plotID, string graphName) "
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, setGraphName, void, (S32 plotID, const char * graphName), , "(int plotID, string graphName) "
|
||||
"Set the name of the given plot.\n"
|
||||
"@param plotID The plot to modify.\n"
|
||||
"@param graphName The name to set on the plot.\n"
|
||||
"@return No return value.")
|
||||
{
|
||||
S32 plotID = dAtoi(argv[2]);
|
||||
|
||||
if(plotID > object->MaxPlots)
|
||||
{
|
||||
|
|
@ -1453,10 +1411,10 @@ ConsoleMethod(GuiParticleGraphCtrl, setGraphName, void, 4, 4, "(int plotID, stri
|
|||
return;
|
||||
}
|
||||
|
||||
object->setGraphName(dAtoi(argv[2]), argv[3]);
|
||||
object->setGraphName(plotID, graphName);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, resetSelectedPoint, void, 2, 2, "()"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, resetSelectedPoint, void, (), , "()"
|
||||
"This will reset the currently selected point to nothing."
|
||||
"@return No return value.")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue