mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-27 08:09:31 +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
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "util/fpsTracker.h"
|
||||
#include "console/console.h"
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
FPSTracker gFPS;
|
||||
|
||||
|
|
@ -87,7 +88,7 @@ void FPSTracker::update()
|
|||
}
|
||||
}
|
||||
|
||||
ConsoleFunction( resetFPSTracker, void, 1, 1, "()"
|
||||
DefineConsoleFunction( resetFPSTracker, void, (), , "()"
|
||||
"@brief Reset FPS stats (fps::)\n\n"
|
||||
"@ingroup Game")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "platform/threads/mutex.h"
|
||||
#include "core/tSimpleHashTable.h"
|
||||
#include "core/util/safeDelete.h"
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
namespace Dispatcher
|
||||
{
|
||||
|
|
@ -330,67 +331,67 @@ extern void unlockDispatcherMutex()
|
|||
|
||||
using namespace Dispatcher;
|
||||
|
||||
ConsoleFunction(isQueueRegistered, bool, 2, 2, "(string queueName)"
|
||||
DefineConsoleFunction( isQueueRegistered, bool, (const char * queueName), , "(string queueName)"
|
||||
"@brief Determines if a dispatcher queue exists\n\n"
|
||||
"@param queueName String containing the name of queue\n"
|
||||
"@ingroup Messaging")
|
||||
{
|
||||
return isQueueRegistered(argv[1]);
|
||||
return Dispatcher::isQueueRegistered(queueName);
|
||||
}
|
||||
|
||||
ConsoleFunction(registerMessageQueue, void, 2, 2, "(string queueName)"
|
||||
DefineConsoleFunction( registerMessageQueue, void, (const char *queueName), , "(string queueName)"
|
||||
"@brief Registeres a dispatcher queue\n\n"
|
||||
"@param queueName String containing the name of queue\n"
|
||||
"@ingroup Messaging")
|
||||
{
|
||||
return registerMessageQueue(argv[1]);
|
||||
return Dispatcher::registerMessageQueue(queueName);
|
||||
}
|
||||
|
||||
ConsoleFunction(unregisterMessageQueue, void, 2, 2, "(string queueName)"
|
||||
DefineConsoleFunction( unregisterMessageQueue, void, (const char *queueName), , "(string queueName)"
|
||||
"@brief Unregisters a dispatcher queue\n\n"
|
||||
"@param queueName String containing the name of queue\n"
|
||||
"@ingroup Messaging")
|
||||
{
|
||||
return unregisterMessageQueue(argv[1]);
|
||||
return Dispatcher::unregisterMessageQueue(queueName);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleFunction(registerMessageListener, bool, 3, 3, "(string queueName, string listener)"
|
||||
DefineConsoleFunction( registerMessageListener, bool, (const char *queueName, const char *listenerName), , "(string queueName, string listener)"
|
||||
"@brief Registers an event message\n\n"
|
||||
"@param queueName String containing the name of queue to attach listener to\n"
|
||||
"@param listener Name of event messenger\n"
|
||||
"@ingroup Messaging")
|
||||
{
|
||||
IMessageListener *listener = dynamic_cast<IMessageListener *>(Sim::findObject(argv[2]));
|
||||
Dispatcher::IMessageListener *listener = dynamic_cast<Dispatcher::IMessageListener *>(Sim::findObject(listenerName));
|
||||
if(listener == NULL)
|
||||
{
|
||||
Con::errorf("registerMessageListener - Unable to find listener object, not an IMessageListener ?!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return registerMessageListener(argv[1], listener);
|
||||
return Dispatcher::registerMessageListener(queueName, listener);
|
||||
}
|
||||
|
||||
ConsoleFunction(unregisterMessageListener, void, 3, 3, "(string queueName, string listener)"
|
||||
DefineConsoleFunction( unregisterMessageListener, void, (const char *queueName, const char *listenerName), , "(string queueName, string listener)"
|
||||
"@brief Unregisters an event message\n\n"
|
||||
"@param queueName String containing the name of queue\n"
|
||||
"@param listener Name of event messenger\n"
|
||||
"@ingroup Messaging")
|
||||
{
|
||||
IMessageListener *listener = dynamic_cast<IMessageListener *>(Sim::findObject(argv[2]));
|
||||
Dispatcher::IMessageListener *listener = dynamic_cast<Dispatcher::IMessageListener *>(Sim::findObject(listenerName));
|
||||
if(listener == NULL)
|
||||
{
|
||||
Con::errorf("unregisterMessageListener - Unable to find listener object, not an IMessageListener ?!");
|
||||
return;
|
||||
}
|
||||
|
||||
unregisterMessageListener(argv[1], listener);
|
||||
Dispatcher::unregisterMessageListener(queueName, listener);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleFunction(dispatchMessage, bool, 3, 4, "(string queueName, string message, string data)"
|
||||
DefineConsoleFunction( dispatchMessage, bool, (const char *queueName, const char *message, const char *data), (""), "(string queueName, string message, string data)"
|
||||
"@brief Dispatch a message to a queue\n\n"
|
||||
"@param queueName Queue to dispatch the message to\n"
|
||||
"@param message Message to dispatch\n"
|
||||
|
|
@ -399,10 +400,10 @@ ConsoleFunction(dispatchMessage, bool, 3, 4, "(string queueName, string message,
|
|||
"@see dispatchMessageObject\n"
|
||||
"@ingroup Messaging")
|
||||
{
|
||||
return dispatchMessage(argv[1], argv[2], argc > 3 ? argv[3] : "" );
|
||||
return Dispatcher::dispatchMessage(queueName, message, data);
|
||||
}
|
||||
|
||||
ConsoleFunction(dispatchMessageObject, bool, 3, 3, "(string queueName, string message)"
|
||||
DefineConsoleFunction( dispatchMessageObject, bool, (const char *queueName, const char *message), ("", ""), "(string queueName, string message)"
|
||||
"@brief Dispatch a message object to a queue\n\n"
|
||||
"@param queueName Queue to dispatch the message to\n"
|
||||
"@param message Message to dispatch\n"
|
||||
|
|
@ -410,12 +411,12 @@ ConsoleFunction(dispatchMessageObject, bool, 3, 3, "(string queueName, string me
|
|||
"@see dispatchMessage\n"
|
||||
"@ingroup Messaging")
|
||||
{
|
||||
Message *msg = dynamic_cast<Message *>(Sim::findObject(argv[2]));
|
||||
Message *msg = dynamic_cast<Message *>(Sim::findObject(message));
|
||||
if(msg == NULL)
|
||||
{
|
||||
Con::errorf("dispatchMessageObject - Unable to find message object");
|
||||
return false;
|
||||
}
|
||||
|
||||
return dispatchMessageObject(argv[1], msg);
|
||||
return Dispatcher::dispatchMessageObject(queueName, msg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "platform/platform.h"
|
||||
#include "util/messaging/eventManager.h"
|
||||
|
||||
#include "console/engineAPI.h"
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/consoleInternal.h"
|
||||
|
||||
|
|
@ -418,30 +419,30 @@ void EventManager::dumpSubscribers()
|
|||
//-----------------------------------------------------------------------------
|
||||
// Console Methods
|
||||
//-----------------------------------------------------------------------------
|
||||
ConsoleMethod( EventManager, registerEvent, bool, 3, 3, "( String event )\n"
|
||||
DefineConsoleMethod( EventManager, registerEvent, bool, ( const char * evt ), , "( String event )\n"
|
||||
"Register an event with the event manager.\n"
|
||||
"@param event The event to register.\n"
|
||||
"@return Whether or not the event was registered successfully." )
|
||||
{
|
||||
return object->registerEvent( argv[2] );
|
||||
return object->registerEvent( evt );
|
||||
}
|
||||
|
||||
ConsoleMethod( EventManager, unregisterEvent, void, 3, 3, "( String event )\n"
|
||||
DefineConsoleMethod( EventManager, unregisterEvent, void, ( const char * evt ), , "( String event )\n"
|
||||
"Remove an event from the EventManager.\n"
|
||||
"@param event The event to remove.\n" )
|
||||
{
|
||||
object->unregisterEvent( argv[2] );
|
||||
object->unregisterEvent( evt );
|
||||
}
|
||||
|
||||
ConsoleMethod( EventManager, isRegisteredEvent, bool, 3, 3, "( String event )\n"
|
||||
DefineConsoleMethod( EventManager, isRegisteredEvent, bool, ( const char * evt ), , "( String event )\n"
|
||||
"Check if an event is registered or not.\n"
|
||||
"@param event The event to check.\n"
|
||||
"@return Whether or not the event exists." )
|
||||
{
|
||||
return object->isRegisteredEvent( argv[2] );
|
||||
return object->isRegisteredEvent( evt );
|
||||
}
|
||||
|
||||
ConsoleMethod( EventManager, postEvent, bool, 3, 4, "( String event, String data )\n"
|
||||
DefineConsoleMethod( EventManager, postEvent, bool, ( const char * evt, const char * data ), (""), "( String event, String data )\n"
|
||||
"~Trigger an event.\n"
|
||||
"@param event The event to trigger.\n"
|
||||
"@param data The data associated with the event.\n"
|
||||
|
|
@ -453,10 +454,10 @@ ConsoleMethod( EventManager, postEvent, bool, 3, 4, "( String event, String data
|
|||
return false;
|
||||
}
|
||||
|
||||
return object->postEvent( argv[2], argc > 3 ? argv[3] : "" );
|
||||
return object->postEvent( evt, data );
|
||||
}
|
||||
|
||||
ConsoleMethod( EventManager, subscribe, bool, 4, 5, "( SimObject listener, String event, String callback )\n\n"
|
||||
DefineConsoleMethod( EventManager, subscribe, bool, ( const char * listenerName, const char * evt, const char * callback ), (""), "( SimObject listener, String event, String callback )\n\n"
|
||||
"Subscribe a listener to an event.\n"
|
||||
"@param listener The listener to subscribe.\n"
|
||||
"@param event The event to subscribe to.\n"
|
||||
|
|
@ -464,49 +465,50 @@ ConsoleMethod( EventManager, subscribe, bool, 4, 5, "( SimObject listener, Strin
|
|||
"@return Whether or not the subscription was successful." )
|
||||
{
|
||||
// Find the listener object.
|
||||
SimObject *cbObj = dynamic_cast<SimObject *>(Sim::findObject(argv[2]));
|
||||
SimObject *cbObj = dynamic_cast<SimObject *>(Sim::findObject(listenerName));
|
||||
if( cbObj == NULL )
|
||||
{
|
||||
Con::warnf( "EventManager::subscribe - Invalid listener." );
|
||||
return false;
|
||||
}
|
||||
|
||||
return object->subscribe( cbObj, argv[3], argc > 4 ? (const char*)argv[4] : NULL );
|
||||
return object->subscribe( cbObj, evt, callback );
|
||||
}
|
||||
|
||||
ConsoleMethod( EventManager, remove, void, 4, 4, "( SimObject listener, String event )\n\n"
|
||||
DefineConsoleMethod( EventManager, remove, void, ( const char * listenerName, const char * evt), , "( SimObject listener, String event )\n\n"
|
||||
"Remove a listener from an event.\n"
|
||||
"@param listener The listener to remove.\n"
|
||||
"@param event The event to be removed from.\n")
|
||||
{
|
||||
// Find the listener object.
|
||||
SimObject * listener = dynamic_cast< SimObject * >( Sim::findObject( argv[2] ) );
|
||||
SimObject * listener = dynamic_cast< SimObject * >( Sim::findObject( listenerName ) );
|
||||
if( listener )
|
||||
object->remove( listener, argv[3] );
|
||||
object->remove( listener, evt );
|
||||
}
|
||||
|
||||
ConsoleMethod( EventManager, removeAll, void, 3, 3, "( SimObject listener )\n\n"
|
||||
DefineConsoleMethod( EventManager, removeAll, void, ( const char * listenerName ), , "( SimObject listener )\n\n"
|
||||
"Remove a listener from all events.\n"
|
||||
"@param listener The listener to remove.\n")
|
||||
{
|
||||
// Find the listener object.
|
||||
SimObject * listener = dynamic_cast< SimObject * >( Sim::findObject( argv[2] ) );
|
||||
|
||||
SimObject * listener = dynamic_cast< SimObject * >( Sim::findObject( listenerName ) );
|
||||
if( listener )
|
||||
object->removeAll( listener );
|
||||
}
|
||||
|
||||
ConsoleMethod( EventManager, dumpEvents, void, 2, 2, "()\n\n"
|
||||
DefineConsoleMethod( EventManager, dumpEvents, void, (), , "()\n\n"
|
||||
"Print all registered events to the console." )
|
||||
{
|
||||
object->dumpEvents();
|
||||
}
|
||||
|
||||
ConsoleMethod( EventManager, dumpSubscribers, void, 2, 3, "( String event )\n\n"
|
||||
DefineConsoleMethod( EventManager, dumpSubscribers, void, ( const char * listenerName ), (""), "( String event )\n\n"
|
||||
"Print all subscribers to an event to the console.\n"
|
||||
"@param event The event whose subscribers are to be printed. If this parameter isn't specified, all events will be dumped." )
|
||||
{
|
||||
if( argc > 2 )
|
||||
object->dumpSubscribers( argv[2] );
|
||||
if( listenerName != "" )
|
||||
object->dumpSubscribers( listenerName );
|
||||
else
|
||||
object->dumpSubscribers();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,19 +155,19 @@ const char *Message::getType()
|
|||
// Console Methods
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod(Message, getType, const char *, 2, 2, "() Get message type (script class name or C++ class name if no script defined class)")
|
||||
DefineConsoleMethod(Message, getType, const char *, (), , "() Get message type (script class name or C++ class name if no script defined class)")
|
||||
{
|
||||
return object->getType();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod(Message, addReference, void, 2, 2, "() Increment the reference count for this message")
|
||||
DefineConsoleMethod(Message, addReference, void, (), , "() Increment the reference count for this message")
|
||||
{
|
||||
object->addReference();
|
||||
}
|
||||
|
||||
ConsoleMethod(Message, freeReference, void, 2, 2, "() Decrement the reference count for this message")
|
||||
DefineConsoleMethod(Message, freeReference, void, (), , "() Decrement the reference count for this message")
|
||||
{
|
||||
object->freeReference();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "core/util/tVector.h"
|
||||
#include "core/stream/fileStream.h"
|
||||
#include "console/console.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "console/consoleTypes.h"
|
||||
|
||||
/// Bookkeeping structure for registered sampling keys.
|
||||
|
|
@ -393,7 +394,7 @@ SAMPLE_FUNC( const char* );
|
|||
// Console Functions.
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
ConsoleFunction( beginSampling, void, 2, 3, "(location, [backend]) -"
|
||||
DefineConsoleFunction( beginSampling, void, (const char * location, const char * backend), ("CSV"), "(location, [backend]) -"
|
||||
"@brief Takes a string informing the backend where to store "
|
||||
"sample data and optionally a name of the specific logging "
|
||||
"backend to use. The default is the CSV backend. In most "
|
||||
|
|
@ -403,30 +404,22 @@ ConsoleFunction( beginSampling, void, 2, 3, "(location, [backend]) -"
|
|||
"@endtsexample\n\n"
|
||||
"@ingroup Rendering")
|
||||
{
|
||||
const char* location = argv[ 1 ];
|
||||
const char* backend = "CSV";
|
||||
if( argc > 2 )
|
||||
backend = argv[ 2 ];
|
||||
|
||||
beginSampling( location, backend );
|
||||
}
|
||||
|
||||
ConsoleFunction( stopSampling, void, 1, 1, "()"
|
||||
DefineConsoleFunction( stopSampling, void, (), , "()"
|
||||
"@brief Stops the rendering sampler\n\n"
|
||||
"@ingroup Rendering\n")
|
||||
{
|
||||
stopSampling();
|
||||
}
|
||||
|
||||
ConsoleFunction( enableSamples, void, 2, 3, "(pattern, [state]) -"
|
||||
DefineConsoleFunction( enableSamples, void, (const char * pattern, bool state), (true), "(pattern, [state]) -"
|
||||
"@brief Enable sampling for all keys that match the given name "
|
||||
"pattern. Slashes are treated as separators.\n\n"
|
||||
"@ingroup Rendering")
|
||||
{
|
||||
const char* pattern = argv[ 1 ];
|
||||
bool state = true;
|
||||
if( argc > 2 )
|
||||
state = dAtob( argv[ 2 ] );
|
||||
|
||||
Sampler::enableKeys( pattern, state );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "util/settings.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/SimXMLDocument.h"
|
||||
|
||||
|
|
@ -481,19 +482,12 @@ const char* Settings::findNextValue()
|
|||
}
|
||||
|
||||
// make sure to replace the strings
|
||||
ConsoleMethod(Settings, findFirstValue, const char*, 2, 5, "settingObj.findFirstValue();")
|
||||
DefineConsoleMethod(Settings, findFirstValue, const char*, ( const char* pattern, bool deepSearch, bool includeDefaults ), ("", false, false), "settingObj.findFirstValue();")
|
||||
{
|
||||
if( argc == 3 )
|
||||
return object->findFirstValue( argv[2] );
|
||||
else if( argc == 4 )
|
||||
return object->findFirstValue( argv[2], dAtob(argv[3]) );
|
||||
else if( argc == 5 )
|
||||
return object->findFirstValue( argv[2], dAtob(argv[3]), dAtob(argv[4]) );
|
||||
else
|
||||
return "";
|
||||
return object->findFirstValue( pattern, deepSearch, includeDefaults );
|
||||
}
|
||||
|
||||
ConsoleMethod(Settings, findNextValue, const char*, 2, 2, "settingObj.findNextValue();")
|
||||
DefineConsoleMethod(Settings, findNextValue, const char*, (), , "settingObj.findNextValue();")
|
||||
{
|
||||
return object->findNextValue();
|
||||
}
|
||||
|
|
@ -650,48 +644,41 @@ void SettingSaveNode::buildDocument(SimXMLDocument *document, bool skipWrite)
|
|||
document->popElement();
|
||||
}
|
||||
|
||||
ConsoleMethod(Settings, setValue, void, 3, 4, "settingObj.setValue(settingName, value);")
|
||||
DefineConsoleMethod(Settings, setValue, void, (const char * settingName, const char * value), (""), "settingObj.setValue(settingName, value);")
|
||||
{
|
||||
const char *fieldName = StringTable->insert( argv[2] );
|
||||
const char *fieldName = StringTable->insert( settingName );
|
||||
|
||||
if(argc == 3)
|
||||
object->setValue( fieldName);
|
||||
else if(argc == 4)
|
||||
object->setValue( fieldName, argv[3] );
|
||||
if( value != "")
|
||||
object->setValue( fieldName, value );
|
||||
else
|
||||
object->setValue( fieldName );
|
||||
}
|
||||
|
||||
ConsoleMethod(Settings, setDefaultValue, void, 4, 4, "settingObj.setDefaultValue(settingName, value);")
|
||||
DefineConsoleMethod(Settings, setDefaultValue, void, (const char * settingName, const char * value), , "settingObj.setDefaultValue(settingName, value);")
|
||||
{
|
||||
const char *fieldName = StringTable->insert( argv[2] );
|
||||
object->setDefaultValue( fieldName, argv[3] );
|
||||
const char *fieldName = StringTable->insert( settingName );
|
||||
object->setDefaultValue( fieldName, value );
|
||||
}
|
||||
|
||||
ConsoleMethod(Settings, value, const char*, 3, 4, "settingObj.value(settingName, defaultValue);")
|
||||
DefineConsoleMethod(Settings, value, const char*, (const char * settingName, const char * defaultValue), (""), "settingObj.value(settingName, defaultValue);")
|
||||
{
|
||||
const char *fieldName = StringTable->insert( argv[2] );
|
||||
const char *fieldName = StringTable->insert( settingName );
|
||||
|
||||
if(argc == 3)
|
||||
if(defaultValue != "")
|
||||
return object->value( fieldName, defaultValue );
|
||||
else if(settingName != "")
|
||||
return object->value( fieldName );
|
||||
if(argc == 4)
|
||||
return object->value( fieldName, argv[3] );
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
ConsoleMethod(Settings, remove, void, 3, 4, "settingObj.remove(settingName, includeDefaults = false);")
|
||||
DefineConsoleMethod(Settings, remove, void, (const char * settingName, bool includeDefaults), (false), "settingObj.remove(settingName, includeDefaults = false);")
|
||||
{
|
||||
// there's a problem with some fields not being removed properly, but works if you run it twice,
|
||||
// a temporary solution for now is simply to call the remove twice
|
||||
if(argc == 3)
|
||||
{
|
||||
object->remove( argv[2] );
|
||||
object->remove( argv[2] );
|
||||
}
|
||||
else if(argc == 4)
|
||||
{
|
||||
object->remove( argv[2], dAtob(argv[3]) );
|
||||
object->remove( argv[2], dAtob(argv[3]) );
|
||||
}
|
||||
|
||||
object->remove( settingName, includeDefaults );
|
||||
object->remove( settingName, includeDefaults );
|
||||
}
|
||||
|
||||
ConsoleMethod(Settings, write, bool, 2, 2, "%success = settingObj.write();")
|
||||
|
|
@ -700,33 +687,27 @@ ConsoleMethod(Settings, write, bool, 2, 2, "%success = settingObj.write();")
|
|||
return object->write();
|
||||
}
|
||||
|
||||
ConsoleMethod(Settings, read, bool, 2, 2, "%success = settingObj.read();")
|
||||
DefineConsoleMethod(Settings, read, bool, (), , "%success = settingObj.read();")
|
||||
{
|
||||
TORQUE_UNUSED(argc); TORQUE_UNUSED(argv);
|
||||
return object->read();
|
||||
}
|
||||
|
||||
ConsoleMethod(Settings, beginGroup, void, 3, 4, "settingObj.beginGroup(groupName, fromStart = false);")
|
||||
DefineConsoleMethod(Settings, beginGroup, void, (const char * groupName, bool includeDefaults), (false), "settingObj.beginGroup(groupName, fromStart = false);")
|
||||
{
|
||||
if(argc == 3)
|
||||
object->beginGroup( argv[2] );
|
||||
if(argc == 4)
|
||||
object->beginGroup( argv[2], dAtob(argv[3]) );
|
||||
object->beginGroup( groupName, includeDefaults );
|
||||
}
|
||||
|
||||
ConsoleMethod(Settings, endGroup, void, 2, 2, "settingObj.endGroup();")
|
||||
DefineConsoleMethod(Settings, endGroup, void, (), , "settingObj.endGroup();")
|
||||
{
|
||||
TORQUE_UNUSED(argc); TORQUE_UNUSED(argv);
|
||||
object->endGroup();
|
||||
}
|
||||
|
||||
ConsoleMethod(Settings, clearGroups, void, 2, 2, "settingObj.clearGroups();")
|
||||
DefineConsoleMethod(Settings, clearGroups, void, (), , "settingObj.clearGroups();")
|
||||
{
|
||||
TORQUE_UNUSED(argc); TORQUE_UNUSED(argv);
|
||||
object->clearGroups();
|
||||
}
|
||||
|
||||
ConsoleMethod(Settings, getCurrentGroups, const char*, 2, 2, "settingObj.getCurrentGroups();")
|
||||
DefineConsoleMethod(Settings, getCurrentGroups, const char*, (), , "settingObj.getCurrentGroups();")
|
||||
{
|
||||
return object->getCurrentGroups();
|
||||
}
|
||||
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "console/console.h"
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// UndoAction
|
||||
|
|
@ -144,10 +145,10 @@ void CompoundUndoAction::onDeleteNotify( SimObject* object )
|
|||
Parent::onDeleteNotify( object );
|
||||
}
|
||||
|
||||
ConsoleMethod( CompoundUndoAction, addAction, void, 3, 3, "addAction( UndoAction )" )
|
||||
DefineConsoleMethod( CompoundUndoAction, addAction, void, (const char * objName), , "addAction( UndoAction )" )
|
||||
{
|
||||
UndoAction *action;
|
||||
if ( Sim::findObject( argv[2], action ) )
|
||||
if ( Sim::findObject( objName, action ) )
|
||||
object->addAction( action );
|
||||
}
|
||||
|
||||
|
|
@ -205,7 +206,7 @@ UndoManager& UndoManager::getDefaultManager()
|
|||
return *defaultMan;
|
||||
}
|
||||
|
||||
ConsoleMethod(UndoManager, clearAll, void, 2, 2, "Clears the undo manager.")
|
||||
DefineConsoleMethod(UndoManager, clearAll, void, (),, "Clears the undo manager.")
|
||||
{
|
||||
object->clearAll();
|
||||
}
|
||||
|
|
@ -343,7 +344,7 @@ void UndoManager::redo()
|
|||
(*react).redo();
|
||||
}
|
||||
|
||||
ConsoleMethod(UndoManager, getUndoCount, S32, 2, 2, "")
|
||||
DefineConsoleMethod(UndoManager, getUndoCount, S32, (),, "")
|
||||
{
|
||||
return object->getUndoCount();
|
||||
}
|
||||
|
|
@ -353,9 +354,9 @@ S32 UndoManager::getUndoCount()
|
|||
return mUndoStack.size();
|
||||
}
|
||||
|
||||
ConsoleMethod(UndoManager, getUndoName, const char*, 3, 3, "(index)")
|
||||
DefineConsoleMethod(UndoManager, getUndoName, const char*, (S32 index), , "(index)")
|
||||
{
|
||||
return object->getUndoName(dAtoi(argv[2]));
|
||||
return object->getUndoName(index);
|
||||
}
|
||||
|
||||
const char* UndoManager::getUndoName(S32 index)
|
||||
|
|
@ -366,9 +367,9 @@ const char* UndoManager::getUndoName(S32 index)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ConsoleMethod(UndoManager, getUndoAction, S32, 3, 3, "(index)")
|
||||
DefineConsoleMethod(UndoManager, getUndoAction, S32, (S32 index), , "(index)")
|
||||
{
|
||||
UndoAction * action = object->getUndoAction(dAtoi(argv[2]));
|
||||
UndoAction * action = object->getUndoAction(index);
|
||||
if ( !action )
|
||||
return -1;
|
||||
|
||||
|
|
@ -385,7 +386,7 @@ UndoAction* UndoManager::getUndoAction(S32 index)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ConsoleMethod(UndoManager, getRedoCount, S32, 2, 2, "")
|
||||
DefineConsoleMethod(UndoManager, getRedoCount, S32, (),, "")
|
||||
{
|
||||
return object->getRedoCount();
|
||||
}
|
||||
|
|
@ -395,9 +396,9 @@ S32 UndoManager::getRedoCount()
|
|||
return mRedoStack.size();
|
||||
}
|
||||
|
||||
ConsoleMethod(UndoManager, getRedoName, const char*, 3, 3, "(index)")
|
||||
DefineConsoleMethod(UndoManager, getRedoName, const char*, (S32 index), , "(index)")
|
||||
{
|
||||
return object->getRedoName(dAtoi(argv[2]));
|
||||
return object->getRedoName(index);
|
||||
}
|
||||
|
||||
const char* UndoManager::getRedoName(S32 index)
|
||||
|
|
@ -408,9 +409,9 @@ const char* UndoManager::getRedoName(S32 index)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ConsoleMethod(UndoManager, getRedoAction, S32, 3, 3, "(index)")
|
||||
DefineConsoleMethod(UndoManager, getRedoAction, S32, (S32 index), , "(index)")
|
||||
{
|
||||
UndoAction * action = object->getRedoAction(dAtoi(argv[2]));
|
||||
UndoAction * action = object->getRedoAction(index);
|
||||
|
||||
if ( !action )
|
||||
return -1;
|
||||
|
|
@ -500,12 +501,12 @@ void UndoManager::popCompound( bool discard )
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
ConsoleMethod(UndoAction, addToManager, void, 2, 3, "action.addToManager([undoManager])")
|
||||
DefineConsoleMethod(UndoAction, addToManager, void, (const char * undoManager), (""), "action.addToManager([undoManager])")
|
||||
{
|
||||
UndoManager *theMan = NULL;
|
||||
if(argc == 3)
|
||||
if(undoManager != "")
|
||||
{
|
||||
SimObject *obj = Sim::findObject(argv[2]);
|
||||
SimObject *obj = Sim::findObject(undoManager);
|
||||
if(obj)
|
||||
theMan = dynamic_cast<UndoManager*> (obj);
|
||||
}
|
||||
|
|
@ -514,32 +515,32 @@ ConsoleMethod(UndoAction, addToManager, void, 2, 3, "action.addToManager([undoMa
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod( UndoAction, undo, void, 2, 2, "() - Undo action contained in undo." )
|
||||
DefineConsoleMethod( UndoAction, undo, void, (),, "() - Undo action contained in undo." )
|
||||
{
|
||||
object->undo();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod( UndoAction, redo, void, 2, 2, "() - Reo action contained in undo." )
|
||||
DefineConsoleMethod( UndoAction, redo, void, (),, "() - Reo action contained in undo." )
|
||||
{
|
||||
object->redo();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
ConsoleMethod(UndoManager, undo, void, 2, 2, "UndoManager.undo();")
|
||||
DefineConsoleMethod(UndoManager, undo, void, (),, "UndoManager.undo();")
|
||||
{
|
||||
object->undo();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
ConsoleMethod(UndoManager, redo, void, 2, 2, "UndoManager.redo();")
|
||||
DefineConsoleMethod(UndoManager, redo, void, (),, "UndoManager.redo();")
|
||||
{
|
||||
object->redo();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
ConsoleMethod(UndoManager, getNextUndoName, const char *, 2, 2, "UndoManager.getNextUndoName();")
|
||||
DefineConsoleMethod(UndoManager, getNextUndoName, const char *, (),, "UndoManager.getNextUndoName();")
|
||||
{
|
||||
const char *name = object->getNextUndoName();
|
||||
if(!name)
|
||||
|
|
@ -550,7 +551,7 @@ ConsoleMethod(UndoManager, getNextUndoName, const char *, 2, 2, "UndoManager.get
|
|||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
ConsoleMethod(UndoManager, getNextRedoName, const char *, 2, 2, "UndoManager.getNextRedoName();")
|
||||
DefineConsoleMethod(UndoManager, getNextRedoName, const char *, (),, "UndoManager.getNextRedoName();")
|
||||
{
|
||||
const char *name = object->getNextRedoName();
|
||||
if(!name)
|
||||
|
|
@ -562,11 +563,8 @@ ConsoleMethod(UndoManager, getNextRedoName, const char *, 2, 2, "UndoManager.get
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod( UndoManager, pushCompound, const char*, 2, 3, "( string name=\"\" ) - Push a CompoundUndoAction onto the compound stack for assembly." )
|
||||
DefineConsoleMethod( UndoManager, pushCompound, const char*, ( String name ), ("\"\""), "( string name=\"\" ) - Push a CompoundUndoAction onto the compound stack for assembly." )
|
||||
{
|
||||
String name;
|
||||
if( argc > 2 )
|
||||
name = (const char*)argv[ 2 ];
|
||||
|
||||
CompoundUndoAction* action = object->pushCompound( name );
|
||||
if( !action )
|
||||
|
|
@ -580,17 +578,14 @@ ConsoleMethod( UndoManager, pushCompound, const char*, 2, 3, "( string name=\"\"
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod( UndoManager, popCompound, void, 2, 3, "( bool discard=false ) - Pop the current CompoundUndoAction off the stack." )
|
||||
DefineConsoleMethod( UndoManager, popCompound, void, ( bool discard ), (false), "( bool discard=false ) - Pop the current CompoundUndoAction off the stack." )
|
||||
{
|
||||
if( !object->getCompoundStackDepth() )
|
||||
{
|
||||
Con::errorf( "%s::popCompound - no compound on stack", (const char*)argv[ 0 ] );
|
||||
Con::errorf( "UndoManager::popCompound - no compound on stack" );
|
||||
return;
|
||||
}
|
||||
|
||||
bool discard = false;
|
||||
if( argc > 2 )
|
||||
discard = dAtob( argv[ 2 ] );
|
||||
|
||||
object->popCompound( discard );
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue