mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Merge remote-tracking branch 'Winterleaf/Development-Console' into defineconsolemethod
Conflicts: Engine/source/T3D/missionMarker.cpp
This commit is contained in:
commit
9396ae7176
|
|
@ -28,6 +28,7 @@
|
|||
#include "T3D/player.h"
|
||||
#include "T3D/gameBase/moveManager.h"
|
||||
#include "console/consoleInternal.h"
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
|
||||
IMPLEMENT_CONOBJECT( AIClient );
|
||||
|
|
@ -52,6 +53,8 @@ ConsoleDocClass( AIClient,
|
|||
"@ingroup Networking\n"
|
||||
);
|
||||
|
||||
IMPLEMENT_CALLBACK(AIClient, onConnect, void, (const char* idString), (idString),"");
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
|
@ -415,15 +418,17 @@ void AIClient::onAdd( const char *nameSpace ) {
|
|||
/**
|
||||
* Sets the move speed for an AI object
|
||||
*/
|
||||
ConsoleMethod( AIClient, setMoveSpeed, void, 3, 3, "ai.setMoveSpeed( float );" ) {
|
||||
DefineConsoleMethod( AIClient, setMoveSpeed, void, (F32 speed), , "ai.setMoveSpeed( float );" )
|
||||
{
|
||||
AIClient *ai = static_cast<AIClient *>( object );
|
||||
ai->setMoveSpeed( dAtof( argv[2] ) );
|
||||
ai->setMoveSpeed( speed );
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops all AI movement, halt!
|
||||
*/
|
||||
ConsoleMethod( AIClient, stop, void, 2, 2, "ai.stop();" ) {
|
||||
DefineConsoleMethod( AIClient, stop, void, (),, "ai.stop();" )
|
||||
{
|
||||
AIClient *ai = static_cast<AIClient *>( object );
|
||||
ai->setMoveMode( AIClient::ModeStop );
|
||||
}
|
||||
|
|
@ -431,10 +436,9 @@ ConsoleMethod( AIClient, stop, void, 2, 2, "ai.stop();" ) {
|
|||
/**
|
||||
* Tells the AI to aim at the location provided
|
||||
*/
|
||||
ConsoleMethod( AIClient, setAimLocation, void, 3, 3, "ai.setAimLocation( x y z );" ) {
|
||||
DefineConsoleMethod( AIClient, setAimLocation, void, (Point3F v), , "ai.setAimLocation( x y z );" )
|
||||
{
|
||||
AIClient *ai = static_cast<AIClient *>( object );
|
||||
Point3F v( 0.0f,0.0f,0.0f );
|
||||
dSscanf( argv[2], "%f %f %f", &v.x, &v.y, &v.z );
|
||||
|
||||
ai->setAimLocation( v );
|
||||
}
|
||||
|
|
@ -442,10 +446,9 @@ ConsoleMethod( AIClient, setAimLocation, void, 3, 3, "ai.setAimLocation( x y z )
|
|||
/**
|
||||
* Tells the AI to move to the location provided
|
||||
*/
|
||||
ConsoleMethod( AIClient, setMoveDestination, void, 3, 3, "ai.setMoveDestination( x y z );" ) {
|
||||
DefineConsoleMethod( AIClient, setMoveDestination, void, (Point3F v), , "ai.setMoveDestination( x y z );" )
|
||||
{
|
||||
AIClient *ai = static_cast<AIClient *>( object );
|
||||
Point3F v( 0.0f, 0.0f, 0.0f );
|
||||
dSscanf( argv[2], "%f %f", &v.x, &v.y );
|
||||
|
||||
ai->setMoveDestination( v );
|
||||
}
|
||||
|
|
@ -453,40 +456,31 @@ ConsoleMethod( AIClient, setMoveDestination, void, 3, 3, "ai.setMoveDestination(
|
|||
/**
|
||||
* Returns the point the AI is aiming at
|
||||
*/
|
||||
ConsoleMethod( AIClient, getAimLocation, const char *, 2, 2, "ai.getAimLocation();" ) {
|
||||
DefineConsoleMethod( AIClient, getAimLocation, Point3F, (),, "ai.getAimLocation();" )
|
||||
{
|
||||
AIClient *ai = static_cast<AIClient *>( object );
|
||||
Point3F aimPoint = ai->getAimLocation();
|
||||
|
||||
static const U32 bufSize = 256;
|
||||
char *returnBuffer = Con::getReturnBuffer( bufSize );
|
||||
dSprintf( returnBuffer, bufSize, "%f %f %f", aimPoint.x, aimPoint.y, aimPoint.z );
|
||||
|
||||
return returnBuffer;
|
||||
return ai->getAimLocation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the point the AI is set to move to
|
||||
*/
|
||||
ConsoleMethod( AIClient, getMoveDestination, const char *, 2, 2, "ai.getMoveDestination();" ) {
|
||||
DefineConsoleMethod( AIClient, getMoveDestination, Point3F, (),, "ai.getMoveDestination();" )
|
||||
{
|
||||
AIClient *ai = static_cast<AIClient *>( object );
|
||||
Point3F movePoint = ai->getMoveDestination();
|
||||
|
||||
static const U32 bufSize = 256;
|
||||
char *returnBuffer = Con::getReturnBuffer( bufSize );
|
||||
dSprintf( returnBuffer, bufSize, "%f %f %f", movePoint.x, movePoint.y, movePoint.z );
|
||||
|
||||
return returnBuffer;
|
||||
return ai->getMoveDestination();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the bots target object
|
||||
*/
|
||||
ConsoleMethod( AIClient, setTargetObject, void, 3, 3, "ai.setTargetObject( obj );" ) {
|
||||
DefineConsoleMethod( AIClient, setTargetObject, void, (const char * objName), , "ai.setTargetObject( obj );" )
|
||||
{
|
||||
AIClient *ai = static_cast<AIClient *>( object );
|
||||
|
||||
// Find the target
|
||||
ShapeBase *targetObject;
|
||||
if( Sim::findObject( argv[2], targetObject ) )
|
||||
if( Sim::findObject( objName, targetObject ) )
|
||||
ai->setTargetObject( targetObject );
|
||||
else
|
||||
ai->setTargetObject( NULL );
|
||||
|
|
@ -495,7 +489,8 @@ ConsoleMethod( AIClient, setTargetObject, void, 3, 3, "ai.setTargetObject( obj )
|
|||
/**
|
||||
* Gets the object the AI is targeting
|
||||
*/
|
||||
ConsoleMethod( AIClient, getTargetObject, S32, 2, 2, "ai.getTargetObject();" ) {
|
||||
DefineConsoleMethod( AIClient, getTargetObject, S32, (),, "ai.getTargetObject();" )
|
||||
{
|
||||
AIClient *ai = static_cast<AIClient *>( object );
|
||||
|
||||
return ai->getTargetObject();
|
||||
|
|
@ -504,7 +499,8 @@ ConsoleMethod( AIClient, getTargetObject, S32, 2, 2, "ai.getTargetObject();" ) {
|
|||
/**
|
||||
* Tells the bot the mission is cycling
|
||||
*/
|
||||
ConsoleMethod( AIClient, missionCycleCleanup, void, 2, 2, "ai.missionCycleCleanup();" ) {
|
||||
DefineConsoleMethod( AIClient, missionCycleCleanup, void, (),, "ai.missionCycleCleanup();" )
|
||||
{
|
||||
AIClient *ai = static_cast<AIClient*>( object );
|
||||
ai->missionCycleCleanup();
|
||||
}
|
||||
|
|
@ -512,7 +508,8 @@ ConsoleMethod( AIClient, missionCycleCleanup, void, 2, 2, "ai.missionCycleCleanu
|
|||
/**
|
||||
* Sets the AI to run mode
|
||||
*/
|
||||
ConsoleMethod( AIClient, move, void, 2, 2, "ai.move();" ) {
|
||||
DefineConsoleMethod( AIClient, move, void, (),, "ai.move();" )
|
||||
{
|
||||
AIClient *ai = static_cast<AIClient *>( object );
|
||||
ai->setMoveMode( AIClient::ModeMove );
|
||||
}
|
||||
|
|
@ -520,21 +517,17 @@ ConsoleMethod( AIClient, move, void, 2, 2, "ai.move();" ) {
|
|||
/**
|
||||
* Gets the AI's location in the world
|
||||
*/
|
||||
ConsoleMethod( AIClient, getLocation, const char *, 2, 2, "ai.getLocation();" ) {
|
||||
DefineConsoleMethod( AIClient, getLocation, Point3F, (),, "ai.getLocation();" )
|
||||
{
|
||||
AIClient *ai = static_cast<AIClient *>( object );
|
||||
Point3F locPoint = ai->getLocation();
|
||||
|
||||
static const U32 bufSize = 256;
|
||||
char *returnBuffer = Con::getReturnBuffer( bufSize );
|
||||
dSprintf( returnBuffer, bufSize, "%f %f %f", locPoint.x, locPoint.y, locPoint.z );
|
||||
|
||||
return returnBuffer;
|
||||
return ai->getLocation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an AI Player to the game
|
||||
*/
|
||||
ConsoleFunction( aiAddPlayer, S32 , 2, 3, "aiAddPlayer( 'playerName'[, 'AIClassType'] );" ) {
|
||||
DefineConsoleFunction( aiAddPlayer, S32, (const char * name, const char * ns), (""), "'playerName'[, 'AIClassType'] );")
|
||||
{
|
||||
// Create the player
|
||||
AIClient *aiPlayer = new AIClient();
|
||||
aiPlayer->registerObject();
|
||||
|
|
@ -548,18 +541,13 @@ ConsoleFunction( aiAddPlayer, S32 , 2, 3, "aiAddPlayer( 'playerName'[, 'AIClassT
|
|||
SimGroup *g = Sim::getClientGroup();
|
||||
g->addObject( aiPlayer );
|
||||
|
||||
char *name = new char[ dStrlen( argv[1] ) + 1];
|
||||
char *ns = new char[ dStrlen( argv[2] ) + 1];
|
||||
|
||||
dStrcpy( name, argv[1] );
|
||||
dStrcpy( ns, argv[2] );
|
||||
|
||||
// Execute the connect console function, this is the same
|
||||
// onConnect function invoked for normal client connections
|
||||
Con::executef( aiPlayer, "onConnect", name );
|
||||
aiPlayer->onConnect_callback( name );
|
||||
|
||||
// Now execute the onAdd command and feed it the namespace
|
||||
if( argc > 2 )
|
||||
if(dStrcmp( ns,"" ) != 0 )
|
||||
aiPlayer->onAdd( ns );
|
||||
else
|
||||
aiPlayer->onAdd( "AIClient" );
|
||||
|
|
@ -571,7 +559,8 @@ ConsoleFunction( aiAddPlayer, S32 , 2, 3, "aiAddPlayer( 'playerName'[, 'AIClassT
|
|||
/**
|
||||
* Tells the AI to move forward 100 units...TEST FXN
|
||||
*/
|
||||
ConsoleMethod( AIClient, moveForward, void, 2, 2, "ai.moveForward();" ) {
|
||||
DefineConsoleMethod( AIClient, moveForward, void, (),, "ai.moveForward();" )
|
||||
{
|
||||
|
||||
AIClient *ai = static_cast<AIClient *>( object );
|
||||
ShapeBase *player = dynamic_cast<ShapeBase*>(ai->getControlObject());
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@ class AIClient : public AIConnection {
|
|||
|
||||
DECLARE_CONOBJECT( AIClient );
|
||||
|
||||
DECLARE_CALLBACK( void, onConnect, (const char* idString) );
|
||||
|
||||
enum {
|
||||
ModeStop = 0,
|
||||
ModeMove,
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "T3D/aiConnection.h"
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
IMPLEMENT_CONOBJECT( AIConnection );
|
||||
|
||||
|
|
@ -159,7 +160,7 @@ ConsoleFunction(aiConnect, S32 , 2, 20, "(...)"
|
|||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
ConsoleMethod(AIConnection,setMove,void,4, 4,"(string field, float value)"
|
||||
DefineConsoleMethod(AIConnection, setMove, void, (const char * field, F32 value), ,"(string field, float value)"
|
||||
"Set a field on the current move.\n\n"
|
||||
"@param field One of {'x','y','z','yaw','pitch','roll'}\n"
|
||||
"@param value Value to set field to.")
|
||||
|
|
@ -167,59 +168,59 @@ ConsoleMethod(AIConnection,setMove,void,4, 4,"(string field, float value)"
|
|||
Move move = object->getMove();
|
||||
|
||||
// Ok, a little slow for now, but this is just an example..
|
||||
if (!dStricmp(argv[2],"x"))
|
||||
move.x = mClampF(dAtof(argv[3]),-1,1);
|
||||
if (!dStricmp(field,"x"))
|
||||
move.x = mClampF(value,-1,1);
|
||||
else
|
||||
if (!dStricmp(argv[2],"y"))
|
||||
move.y = mClampF(dAtof(argv[3]),-1,1);
|
||||
if (!dStricmp(field,"y"))
|
||||
move.y = mClampF(value,-1,1);
|
||||
else
|
||||
if (!dStricmp(argv[2],"z"))
|
||||
move.z = mClampF(dAtof(argv[3]),-1,1);
|
||||
if (!dStricmp(field,"z"))
|
||||
move.z = mClampF(value,-1,1);
|
||||
else
|
||||
if (!dStricmp(argv[2],"yaw"))
|
||||
move.yaw = moveClamp(dAtof(argv[3]));
|
||||
if (!dStricmp(field,"yaw"))
|
||||
move.yaw = moveClamp(value);
|
||||
else
|
||||
if (!dStricmp(argv[2],"pitch"))
|
||||
move.pitch = moveClamp(dAtof(argv[3]));
|
||||
if (!dStricmp(field,"pitch"))
|
||||
move.pitch = moveClamp(value);
|
||||
else
|
||||
if (!dStricmp(argv[2],"roll"))
|
||||
move.roll = moveClamp(dAtof(argv[3]));
|
||||
if (!dStricmp(field,"roll"))
|
||||
move.roll = moveClamp(value);
|
||||
|
||||
//
|
||||
object->setMove(&move);
|
||||
}
|
||||
|
||||
ConsoleMethod(AIConnection,getMove,F32,3, 3,"(string field)"
|
||||
DefineConsoleMethod(AIConnection,getMove,F32, (const char * field), ,"(string field)"
|
||||
"Get the given field of a move.\n\n"
|
||||
"@param field One of {'x','y','z','yaw','pitch','roll'}\n"
|
||||
"@returns The requested field on the current move.")
|
||||
{
|
||||
const Move& move = object->getMove();
|
||||
if (!dStricmp(argv[2],"x"))
|
||||
if (!dStricmp(field,"x"))
|
||||
return move.x;
|
||||
if (!dStricmp(argv[2],"y"))
|
||||
if (!dStricmp(field,"y"))
|
||||
return move.y;
|
||||
if (!dStricmp(argv[2],"z"))
|
||||
if (!dStricmp(field,"z"))
|
||||
return move.z;
|
||||
if (!dStricmp(argv[2],"yaw"))
|
||||
if (!dStricmp(field,"yaw"))
|
||||
return move.yaw;
|
||||
if (!dStricmp(argv[2],"pitch"))
|
||||
if (!dStricmp(field,"pitch"))
|
||||
return move.pitch;
|
||||
if (!dStricmp(argv[2],"roll"))
|
||||
if (!dStricmp(field,"roll"))
|
||||
return move.roll;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
ConsoleMethod(AIConnection,setFreeLook,void,3, 3,"(bool isFreeLook)"
|
||||
DefineConsoleMethod(AIConnection,setFreeLook,void,(bool isFreeLook), ,"(bool isFreeLook)"
|
||||
"Enable/disable freelook on the current move.")
|
||||
{
|
||||
Move move = object->getMove();
|
||||
move.freeLook = dAtob(argv[2]);
|
||||
move.freeLook = isFreeLook;
|
||||
object->setMove(&move);
|
||||
}
|
||||
|
||||
ConsoleMethod(AIConnection,getFreeLook,bool,2, 2,"getFreeLook()"
|
||||
DefineConsoleMethod(AIConnection, getFreeLook, bool, (), ,"getFreeLook()"
|
||||
"Is freelook on for the current move?")
|
||||
{
|
||||
return object->getMove().freeLook;
|
||||
|
|
@ -228,21 +229,20 @@ ConsoleMethod(AIConnection,getFreeLook,bool,2, 2,"getFreeLook()"
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod(AIConnection,setTrigger,void,4, 4,"(int trigger, bool set)"
|
||||
DefineConsoleMethod(AIConnection,setTrigger,void, (S32 idx, bool set), ,"(int trigger, bool set)"
|
||||
"Set a trigger.")
|
||||
{
|
||||
S32 idx = dAtoi(argv[2]);
|
||||
if (idx >= 0 && idx < MaxTriggerKeys) {
|
||||
if (idx >= 0 && idx < MaxTriggerKeys)
|
||||
{
|
||||
Move move = object->getMove();
|
||||
move.trigger[idx] = dAtob(argv[3]);
|
||||
move.trigger[idx] = set;
|
||||
object->setMove(&move);
|
||||
}
|
||||
}
|
||||
|
||||
ConsoleMethod(AIConnection,getTrigger,bool,4, 4,"(int trigger)"
|
||||
DefineConsoleMethod(AIConnection,getTrigger,bool, (S32 idx), ,"(int trigger)"
|
||||
"Is the given trigger set?")
|
||||
{
|
||||
S32 idx = dAtoi(argv[2]);
|
||||
if (idx >= 0 && idx < MaxTriggerKeys)
|
||||
return object->getMove().trigger[idx];
|
||||
return false;
|
||||
|
|
@ -251,7 +251,7 @@ ConsoleMethod(AIConnection,getTrigger,bool,4, 4,"(int trigger)"
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod(AIConnection,getAddress,const char*,2, 2,"")
|
||||
DefineConsoleMethod(AIConnection,getAddress,const char*,(), ,"")
|
||||
{
|
||||
// Override the netConnection method to return to indicate
|
||||
// this is an ai connection.
|
||||
|
|
|
|||
|
|
@ -575,23 +575,21 @@ ConsoleDocFragment _setAimObject(
|
|||
"AIPlayer",
|
||||
"void setAimObject(GameBase targetObject, Point3F offset);"
|
||||
);
|
||||
ConsoleMethod( AIPlayer, setAimObject, void, 3, 4, "( GameBase obj, [Point3F offset] )"
|
||||
|
||||
DefineConsoleMethod( AIPlayer, setAimObject, void, ( const char * objName, Point3F offset ), (Point3F::Zero), "( GameBase obj, [Point3F offset] )"
|
||||
"Sets the bot's target object. Optionally set an offset from target location."
|
||||
"@hide")
|
||||
{
|
||||
Point3F off( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
// Find the target
|
||||
GameBase *targetObject;
|
||||
if( Sim::findObject( argv[2], targetObject ) )
|
||||
if( Sim::findObject( objName, targetObject ) )
|
||||
{
|
||||
if (argc == 4)
|
||||
dSscanf( argv[3], "%g %g %g", &off.x, &off.y, &off.z );
|
||||
|
||||
object->setAimObject( targetObject, off );
|
||||
object->setAimObject( targetObject, offset );
|
||||
}
|
||||
else
|
||||
object->setAimObject( 0, off );
|
||||
object->setAimObject( 0, offset );
|
||||
}
|
||||
|
||||
DefineEngineMethod( AIPlayer, getAimObject, S32, (),,
|
||||
|
|
|
|||
|
|
@ -1860,7 +1860,7 @@ DefineEngineMethod( Camera, setOffset, void, (Point3F offset), ,
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineMethod( Camera, setOrbitMode, void, (GameBase* orbitObject, TransformF orbitPoint, F32 minDistance, F32 maxDistance,
|
||||
F32 initDistance, bool ownClientObj, Point3F offset, bool locked), (false, Point3F(0.0f, 0.0f, 0.0f), false),
|
||||
F32 initDistance, bool ownClientObj, Point3F offset, bool locked), (false, Point3F::Zero, false),
|
||||
"Set the camera to orbit around the given object, or if none is given, around the given point.\n\n"
|
||||
"@param orbitObject The object to orbit around. If no object is given (0 or blank string is passed in) use the orbitPoint instead\n"
|
||||
"@param orbitPoint The point to orbit around when no object is given. In the form of \"x y z ax ay az aa\" such as returned by SceneObject::getTransform().\n"
|
||||
|
|
@ -1883,7 +1883,7 @@ DefineEngineMethod( Camera, setOrbitMode, void, (GameBase* orbitObject, Transfor
|
|||
|
||||
DefineEngineMethod( Camera, setOrbitObject, bool, (GameBase* orbitObject, VectorF rotation, F32 minDistance,
|
||||
F32 maxDistance, F32 initDistance, bool ownClientObject, Point3F offset, bool locked),
|
||||
(false, Point3F(0.0f, 0.0f, 0.0f), false),
|
||||
(false, Point3F::Zero, false),
|
||||
"Set the camera to orbit around a given object.\n\n"
|
||||
"@param orbitObject The object to orbit around.\n"
|
||||
"@param rotation The initial camera rotation about the object in radians in the form of \"x y z\".\n"
|
||||
|
|
@ -1911,7 +1911,7 @@ DefineEngineMethod( Camera, setOrbitObject, bool, (GameBase* orbitObject, Vector
|
|||
|
||||
DefineEngineMethod( Camera, setOrbitPoint, void, (TransformF orbitPoint, F32 minDistance, F32 maxDistance, F32 initDistance,
|
||||
Point3F offset, bool locked),
|
||||
(Point3F(0.0f, 0.0f, 0.0f), false),
|
||||
(Point3F::Zero, false),
|
||||
"Set the camera to orbit around a given point.\n\n"
|
||||
"@param orbitPoint The point to orbit around. In the form of \"x y z ax ay az aa\" such as returned by SceneObject::getTransform().\n"
|
||||
"@param minDistance The minimum distance allowed to the orbit object or point.\n"
|
||||
|
|
@ -1929,7 +1929,7 @@ DefineEngineMethod( Camera, setOrbitPoint, void, (TransformF orbitPoint, F32 min
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineMethod( Camera, setTrackObject, bool, (GameBase* trackObject, Point3F offset), (Point3F(0.0f, 0.0f, 0.0f)),
|
||||
DefineEngineMethod( Camera, setTrackObject, bool, (GameBase* trackObject, Point3F offset), (Point3F::Zero),
|
||||
"Set the camera to track a given object.\n\n"
|
||||
"@param trackObject The object to track.\n"
|
||||
"@param offset [optional] An offset added to the camera's position. Default is no offset.\n"
|
||||
|
|
|
|||
|
|
@ -138,8 +138,17 @@ ConsoleDocClass( Explosion,
|
|||
|
||||
MRandomLCG sgRandom(0xdeadbeef);
|
||||
|
||||
//WLE - Vince - The defaults are bad, the whole point of calling this function\
|
||||
//is to determine the explosion coverage on a object. Why would you want them
|
||||
//To call this with a null for the ID? In fact, it just returns a 1f if
|
||||
//it can't find the object. Seems useless to me. Cause how can I apply
|
||||
//damage to a object that doesn't exist?
|
||||
|
||||
DefineEngineFunction(calcExplosionCoverage, F32, (Point3F pos, S32 id, U32 covMask),(Point3F(0.0f,0.0f,0.0f), NULL, NULL),
|
||||
//I could possible see a use with passing in a null covMask, but even that
|
||||
//sounds flaky because it will be 100 percent if your saying not to take
|
||||
//any thing in consideration for coverage. So I'm removing these defaults they are just bad.
|
||||
|
||||
DefineEngineFunction(calcExplosionCoverage, F32, (Point3F pos, S32 id, U32 covMask),,
|
||||
"@brief Calculates how much an explosion effects a specific object.\n\n"
|
||||
"Use this to determine how much damage to apply to objects based on their "
|
||||
"distance from the explosion's center point, and whether the explosion is "
|
||||
|
|
|
|||
|
|
@ -929,13 +929,10 @@ DefineEngineMethod(Lightning, strikeRandomPoint, void, (),,
|
|||
object->strikeRandomPoint();
|
||||
}
|
||||
|
||||
DefineEngineMethod(Lightning, strikeObject, void, (S32 id), (NULL),
|
||||
DefineEngineMethod(Lightning, strikeObject, void, (ShapeBase* pSB),,
|
||||
"Creates a LightningStrikeEvent which strikes a specific object.\n"
|
||||
"@note This method is currently unimplemented.\n" )
|
||||
{
|
||||
ShapeBase* pSB;
|
||||
|
||||
if (object->isServerObject() && Sim::findObject(id, pSB))
|
||||
object->strikeObject(pSB);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -393,8 +393,9 @@ void ParticleEmitterNode::setEmitterDataBlock(ParticleEmitterData* data)
|
|||
|
||||
mEmitterDatablock = data;
|
||||
}
|
||||
|
||||
DefineEngineMethod(ParticleEmitterNode, setEmitterDataBlock, void, (ParticleEmitterData* emitterDatablock), (0),
|
||||
|
||||
|
||||
DefineEngineMethod(ParticleEmitterNode, setEmitterDataBlock, void, (ParticleEmitterData* emitterDatablock), (NULL),
|
||||
"Assigns the datablock for this emitter node.\n"
|
||||
"@param emitterDatablock ParticleEmitterData datablock to assign\n"
|
||||
"@tsexample\n"
|
||||
|
|
|
|||
|
|
@ -506,7 +506,7 @@ DefineEngineMethod(Precipitation, modifyStorm, void, (F32 percentage, F32 second
|
|||
object->modifyStorm(percentage, S32(seconds * 1000.0f));
|
||||
}
|
||||
|
||||
DefineEngineMethod(Precipitation, setTurbulence, void, (F32 max, F32 speed, F32 seconds), (1.0f, 5.0f, 5.0),
|
||||
DefineEngineMethod(Precipitation, setTurbulence, void, (F32 max, F32 speed, F32 seconds), (1.0f, 5.0f, 5.0f),
|
||||
"Smoothly change the turbulence parameters over a period of time.\n"
|
||||
"@param max New #maxTurbulence value. Set to 0 to disable turbulence.\n"
|
||||
"@param speed New #turbulenceSpeed value.\n"
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "console/engineAPI.h"
|
||||
#include "platform/platform.h"
|
||||
#include "T3D/gameBase/gameProcess.h"
|
||||
|
||||
|
|
@ -33,7 +34,7 @@ ClientProcessList* ClientProcessList::smClientProcessList = NULL;
|
|||
ServerProcessList* ServerProcessList::smServerProcessList = NULL;
|
||||
static U32 gNetOrderNextId = 0;
|
||||
|
||||
ConsoleFunction( dumpProcessList, void, 1, 1,
|
||||
DefineConsoleFunction( dumpProcessList, void, ( ), ,
|
||||
"Dumps all ProcessObjects in ServerProcessList and ClientProcessList to the console." )
|
||||
{
|
||||
Con::printf( "client process list:" );
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ extern void ShowInit();
|
|||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Camera and FOV info
|
||||
namespace {
|
||||
namespace CameraAndFOV{
|
||||
|
||||
const U32 MaxZoomSpeed = 2000; ///< max number of ms to reach target FOV
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ static U32 sgServerQueryIndex = 0;
|
|||
//SERVER FUNCTIONS ONLY
|
||||
ConsoleFunctionGroupBegin( Containers, "Spatial query functions. <b>Server side only!</b>");
|
||||
|
||||
ConsoleFunction(containerFindFirst, const char*, 6, 6, "(int mask, Point3F point, float x, float y, float z)"
|
||||
DefineConsoleFunction( containerFindFirst, const char*, (U32 typeMask, Point3F origin, Point3F size), , "(int mask, Point3F point, float x, float y, float z)"
|
||||
"@brief Find objects matching the bitmask type within a box centered at point, with extents x, y, z.\n\n"
|
||||
"@returns The first object found, or an empty string if nothing was found. Thereafter, you can get more "
|
||||
"results using containerFindNext()."
|
||||
|
|
@ -120,17 +120,6 @@ ConsoleFunction(containerFindFirst, const char*, 6, 6, "(int mask, Point3F point
|
|||
"@ingroup Game")
|
||||
{
|
||||
//find out what we're looking for
|
||||
U32 typeMask = U32(dAtoi(argv[1]));
|
||||
|
||||
//find the center of the container volume
|
||||
Point3F origin(0.0f, 0.0f, 0.0f);
|
||||
dSscanf(argv[2], "%g %g %g", &origin.x, &origin.y, &origin.z);
|
||||
|
||||
//find the box dimensions
|
||||
Point3F size(0.0f, 0.0f, 0.0f);
|
||||
size.x = mFabs(dAtof(argv[3]));
|
||||
size.y = mFabs(dAtof(argv[4]));
|
||||
size.z = mFabs(dAtof(argv[5]));
|
||||
|
||||
//build the container volume
|
||||
Box3F queryBox;
|
||||
|
|
@ -155,7 +144,7 @@ ConsoleFunction(containerFindFirst, const char*, 6, 6, "(int mask, Point3F point
|
|||
return buff;
|
||||
}
|
||||
|
||||
ConsoleFunction( containerFindNext, const char*, 1, 1, "()"
|
||||
DefineConsoleFunction( containerFindNext, const char*, (), , "()"
|
||||
"@brief Get more results from a previous call to containerFindFirst().\n\n"
|
||||
"@note You must call containerFindFirst() to begin the search.\n"
|
||||
"@returns The next object found, or an empty string if nothing else was found.\n"
|
||||
|
|
@ -191,9 +180,9 @@ DefineEngineFunction( setDefaultFov, void, ( F32 defaultFOV ),,
|
|||
"@param defaultFOV The default field of view in degrees\n"
|
||||
"@ingroup CameraSystem")
|
||||
{
|
||||
sDefaultFov = mClampF(defaultFOV, MinCameraFov, MaxCameraFov);
|
||||
if(sCameraFov == sTargetFov)
|
||||
sTargetFov = sDefaultFov;
|
||||
CameraAndFOV::sDefaultFov = mClampF(defaultFOV, MinCameraFov, MaxCameraFov);
|
||||
if(CameraAndFOV::sCameraFov == CameraAndFOV::sTargetFov)
|
||||
CameraAndFOV::sTargetFov = CameraAndFOV::sDefaultFov;
|
||||
}
|
||||
|
||||
DefineEngineFunction( setZoomSpeed, void, ( S32 speed ),,
|
||||
|
|
@ -203,7 +192,7 @@ DefineEngineFunction( setZoomSpeed, void, ( S32 speed ),,
|
|||
"@param speed The camera's zoom speed in ms per 90deg FOV change\n"
|
||||
"@ingroup CameraSystem")
|
||||
{
|
||||
sZoomSpeed = mClamp(speed, 0, MaxZoomSpeed);
|
||||
CameraAndFOV::sZoomSpeed = mClamp(speed, 0, CameraAndFOV::MaxZoomSpeed);
|
||||
}
|
||||
|
||||
DefineEngineFunction( setFov, void, ( F32 FOV ),,
|
||||
|
|
@ -211,22 +200,22 @@ DefineEngineFunction( setFov, void, ( F32 FOV ),,
|
|||
"@param FOV The camera's new FOV in degrees\n"
|
||||
"@ingroup CameraSystem")
|
||||
{
|
||||
sTargetFov = mClampF(FOV, MinCameraFov, MaxCameraFov);
|
||||
CameraAndFOV::sTargetFov = mClampF(FOV, MinCameraFov, MaxCameraFov);
|
||||
}
|
||||
|
||||
F32 GameGetCameraFov()
|
||||
{
|
||||
return(sCameraFov);
|
||||
return(CameraAndFOV::sCameraFov);
|
||||
}
|
||||
|
||||
void GameSetCameraFov(F32 fov)
|
||||
{
|
||||
sTargetFov = sCameraFov = fov;
|
||||
CameraAndFOV::sTargetFov = CameraAndFOV::sCameraFov = fov;
|
||||
}
|
||||
|
||||
void GameSetCameraTargetFov(F32 fov)
|
||||
{
|
||||
sTargetFov = fov;
|
||||
CameraAndFOV::sTargetFov = fov;
|
||||
}
|
||||
|
||||
void GameUpdateCameraFov()
|
||||
|
|
@ -234,29 +223,29 @@ void GameUpdateCameraFov()
|
|||
F32 time = F32(Platform::getVirtualMilliseconds());
|
||||
|
||||
// need to update fov?
|
||||
if(sTargetFov != sCameraFov)
|
||||
if(CameraAndFOV::sTargetFov != CameraAndFOV::sCameraFov)
|
||||
{
|
||||
F32 delta = time - sLastCameraUpdateTime;
|
||||
F32 delta = time - CameraAndFOV::sLastCameraUpdateTime;
|
||||
|
||||
// snap zoom?
|
||||
if((sZoomSpeed == 0) || (delta <= 0.f))
|
||||
sCameraFov = sTargetFov;
|
||||
if((CameraAndFOV::sZoomSpeed == 0) || (delta <= 0.f))
|
||||
CameraAndFOV::sCameraFov = CameraAndFOV::sTargetFov;
|
||||
else
|
||||
{
|
||||
// gZoomSpeed is time in ms to zoom 90deg
|
||||
F32 step = 90.f * (delta / F32(sZoomSpeed));
|
||||
F32 step = 90.f * (delta / F32(CameraAndFOV::sZoomSpeed));
|
||||
|
||||
if(sCameraFov > sTargetFov)
|
||||
if(CameraAndFOV::sCameraFov > CameraAndFOV::sTargetFov)
|
||||
{
|
||||
sCameraFov -= step;
|
||||
if(sCameraFov < sTargetFov)
|
||||
sCameraFov = sTargetFov;
|
||||
CameraAndFOV::sCameraFov -= step;
|
||||
if(CameraAndFOV::sCameraFov < CameraAndFOV::sTargetFov)
|
||||
CameraAndFOV::sCameraFov = CameraAndFOV::sTargetFov;
|
||||
}
|
||||
else
|
||||
{
|
||||
sCameraFov += step;
|
||||
if(sCameraFov > sTargetFov)
|
||||
sCameraFov = sTargetFov;
|
||||
CameraAndFOV::sCameraFov += step;
|
||||
if(CameraAndFOV::sCameraFov > CameraAndFOV::sTargetFov)
|
||||
CameraAndFOV::sCameraFov = CameraAndFOV::sTargetFov;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -266,23 +255,23 @@ void GameUpdateCameraFov()
|
|||
if(connection)
|
||||
{
|
||||
// check if fov is valid on control object
|
||||
if(connection->isValidControlCameraFov(sCameraFov))
|
||||
connection->setControlCameraFov(sCameraFov);
|
||||
if(connection->isValidControlCameraFov(CameraAndFOV::sCameraFov))
|
||||
connection->setControlCameraFov(CameraAndFOV::sCameraFov);
|
||||
else
|
||||
{
|
||||
// will set to the closest fov (fails only on invalid control object)
|
||||
if(connection->setControlCameraFov(sCameraFov))
|
||||
if(connection->setControlCameraFov(CameraAndFOV::sCameraFov))
|
||||
{
|
||||
F32 setFov = sCameraFov;
|
||||
F32 setFov = CameraAndFOV::sCameraFov;
|
||||
connection->getControlCameraFov(&setFov);
|
||||
sTargetFov = sCameraFov = setFov;
|
||||
CameraAndFOV::sTargetFov =CameraAndFOV::sCameraFov = setFov;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// update the console variable
|
||||
sConsoleCameraFov = sCameraFov;
|
||||
sLastCameraUpdateTime = time;
|
||||
CameraAndFOV::sConsoleCameraFov = CameraAndFOV::sCameraFov;
|
||||
CameraAndFOV::sLastCameraUpdateTime = time;
|
||||
}
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -355,8 +344,8 @@ bool GameProcessCameraQuery(CameraQuery *query)
|
|||
|
||||
// Scale the normal visible distance by the performance
|
||||
// tuning scale which we never let over 1.
|
||||
sVisDistanceScale = mClampF( sVisDistanceScale, 0.01f, 1.0f );
|
||||
query->farPlane = gClientSceneGraph->getVisibleDistance() * sVisDistanceScale;
|
||||
CameraAndFOV::sVisDistanceScale = mClampF( CameraAndFOV::sVisDistanceScale, 0.01f, 1.0f );
|
||||
query->farPlane = gClientSceneGraph->getVisibleDistance() * CameraAndFOV::sVisDistanceScale;
|
||||
|
||||
// Provide some default values
|
||||
query->projectionOffset = Point2F::Zero;
|
||||
|
|
@ -432,10 +421,10 @@ static void Process3D()
|
|||
|
||||
static void RegisterGameFunctions()
|
||||
{
|
||||
Con::addVariable( "$pref::Camera::distanceScale", TypeF32, &sVisDistanceScale,
|
||||
Con::addVariable( "$pref::Camera::distanceScale", TypeF32, &CameraAndFOV::sVisDistanceScale,
|
||||
"A scale to apply to the normal visible distance, typically used for tuning performance.\n"
|
||||
"@ingroup Game");
|
||||
Con::addVariable( "$cameraFov", TypeF32, &sConsoleCameraFov,
|
||||
Con::addVariable( "$cameraFov", TypeF32, &CameraAndFOV::sConsoleCameraFov,
|
||||
"The camera's Field of View.\n\n"
|
||||
"@ingroup Game" );
|
||||
|
||||
|
|
|
|||
|
|
@ -425,21 +425,22 @@ static ConsoleDocFragment _lbplayAnimation2(
|
|||
"LightBase",
|
||||
"void playAnimation(LightAnimData anim);"
|
||||
);
|
||||
ConsoleMethod( LightBase, playAnimation, void, 2, 3, "( [LightAnimData anim] )\t"
|
||||
|
||||
DefineConsoleMethod( LightBase, playAnimation, void, (const char * anim), (""), "( [LightAnimData anim] )\t"
|
||||
"Plays a light animation on the light. If no LightAnimData is passed the "
|
||||
"existing one is played."
|
||||
"@hide")
|
||||
{
|
||||
if ( argc == 2 )
|
||||
if ( dStrcmp(anim,"" )==0)
|
||||
{
|
||||
object->playAnimation();
|
||||
return;
|
||||
}
|
||||
|
||||
LightAnimData *animData;
|
||||
if ( !Sim::findObject( argv[2], animData ) )
|
||||
if ( !Sim::findObject( anim, animData ) )
|
||||
{
|
||||
Con::errorf( "LightBase::playAnimation() - Invalid LightAnimData '%s'.", (const char*)argv[2] );
|
||||
Con::errorf( "LightBase::playAnimation() - Invalid LightAnimData '%s'.", anim );
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -469,7 +470,7 @@ void LightBase::playAnimation( LightAnimData *animData )
|
|||
}
|
||||
}
|
||||
|
||||
ConsoleMethod( LightBase, pauseAnimation, void, 2, 2, "Stops the light animation." )
|
||||
DefineConsoleMethod( LightBase, pauseAnimation, void, (), , "Stops the light animation." )
|
||||
{
|
||||
object->pauseAnimation();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -279,8 +279,6 @@ void WayPoint::unpackUpdate(NetConnection * con, BitStream * stream)
|
|||
setHidden(stream->readFlag());
|
||||
}
|
||||
|
||||
|
||||
|
||||
void WayPoint::initPersistFields()
|
||||
{
|
||||
addGroup("Misc");
|
||||
|
|
@ -506,16 +504,17 @@ ConsoleDocFragment _SpawnSpherespawnObject1(
|
|||
"bool spawnObject(string additionalProps);"
|
||||
);
|
||||
|
||||
ConsoleMethod(SpawnSphere, spawnObject, S32, 2, 3,
|
||||
//ConsoleMethod(SpawnSphere, spawnObject, S32, 2, 3,
|
||||
DefineConsoleMethod(SpawnSphere, spawnObject, S32, (String additionalProps), ,
|
||||
"([string additionalProps]) Spawns the object based on the SpawnSphere's "
|
||||
"class, datablock, properties, and script settings. Allows you to pass in "
|
||||
"extra properties."
|
||||
"@hide" )
|
||||
{
|
||||
String additionalProps;
|
||||
//String additionalProps;
|
||||
|
||||
if (argc == 3)
|
||||
additionalProps = (const char*)argv[2];
|
||||
//if (argc == 3)
|
||||
// additionalProps = String(argv[2]);
|
||||
|
||||
SimObject* obj = object->spawnObject(additionalProps);
|
||||
|
||||
|
|
|
|||
|
|
@ -581,7 +581,7 @@ static CameraSpline::Knot::Path resolveKnotPath(const char *arg)
|
|||
}
|
||||
|
||||
DefineEngineMethod(PathCamera, pushBack, void, (TransformF transform, F32 speed, const char* type, const char* path),
|
||||
(1.0, "Normal", "Linear"),
|
||||
(1.0f, "Normal", "Linear"),
|
||||
"@brief Adds a new knot to the back of a path camera's path.\n"
|
||||
"@param transform Transform for the new knot. In the form of \"x y z ax ay az aa\" such as returned by SceneObject::getTransform()\n"
|
||||
"@param speed Speed setting for this knot.\n"
|
||||
|
|
@ -606,7 +606,7 @@ DefineEngineMethod(PathCamera, pushBack, void, (TransformF transform, F32 speed,
|
|||
}
|
||||
|
||||
DefineEngineMethod(PathCamera, pushFront, void, (TransformF transform, F32 speed, const char* type, const char* path),
|
||||
(1.0, "Normal", "Linear"),
|
||||
(1.0f, "Normal", "Linear"),
|
||||
"@brief Adds a new knot to the front of a path camera's path.\n"
|
||||
"@param transform Transform for the new knot. In the form of \"x y z ax ay az aa\" such as returned by SceneObject::getTransform()\n"
|
||||
"@param speed Speed setting for this knot.\n"
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "math/mathUtils.h"
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/consoleObject.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "sim/netConnection.h"
|
||||
#include "scene/sceneRenderState.h"
|
||||
#include "scene/sceneManager.h"
|
||||
|
|
@ -237,7 +238,7 @@ void PhysicsDebrisData::unpackData(BitStream* stream)
|
|||
shapeName = stream->readSTString();
|
||||
}
|
||||
|
||||
ConsoleMethod( PhysicsDebrisData, preload, void, 2, 2,
|
||||
DefineConsoleMethod( PhysicsDebrisData, preload, void, (), ,
|
||||
"@brief Loads some information to have readily available at simulation time.\n\n"
|
||||
"Forces generation of shaders, materials, and other data used by the %PhysicsDebris object. "
|
||||
"This function should be used while a level is loading in order to shorten "
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include "T3D/physics/physicsPlugin.h"
|
||||
|
||||
#include "console/console.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/simSet.h"
|
||||
#include "core/strings/stringFunctions.h"
|
||||
|
|
@ -123,55 +124,53 @@ void PhysicsPlugin::_debugDraw( SceneManager *graph, const SceneRenderState *sta
|
|||
world->onDebugDraw( state );
|
||||
}
|
||||
|
||||
ConsoleFunction( physicsPluginPresent, bool, 1, 1, "physicsPluginPresent()\n"
|
||||
DefineConsoleFunction( physicsPluginPresent, bool, (), , "physicsPluginPresent()"
|
||||
"@brief Returns true if a physics plugin exists and is initialized.\n\n"
|
||||
"@ingroup Physics" )
|
||||
{
|
||||
return PHYSICSMGR != NULL;
|
||||
}
|
||||
|
||||
ConsoleFunction( physicsInit, bool, 1, 2, "physicsInit( [string library] )" )
|
||||
DefineConsoleFunction( physicsInit, bool, (const char * library), (""), "physicsInit( [string library] )")
|
||||
{
|
||||
const char *library = "default";
|
||||
if ( argc > 1 )
|
||||
library = argv[1];
|
||||
|
||||
return PhysicsPlugin::activate( library );
|
||||
}
|
||||
|
||||
ConsoleFunction( physicsDestroy, void, 1, 1, "physicsDestroy()" )
|
||||
DefineConsoleFunction( physicsDestroy, void, (), , "physicsDestroy()")
|
||||
{
|
||||
if ( PHYSICSMGR )
|
||||
PHYSICSMGR->destroyPlugin();
|
||||
}
|
||||
|
||||
ConsoleFunction( physicsInitWorld, bool, 2, 2, "physicsInitWorld( String worldName )" )
|
||||
DefineConsoleFunction( physicsInitWorld, bool, (const char * worldName), , "physicsInitWorld( String worldName )")
|
||||
{
|
||||
return PHYSICSMGR && PHYSICSMGR->createWorld( (const char*)argv[1] );
|
||||
bool res = PHYSICSMGR && PHYSICSMGR->createWorld( String( worldName ) );
|
||||
return res;
|
||||
}
|
||||
|
||||
ConsoleFunction( physicsDestroyWorld, void, 2, 2, "physicsDestroyWorld( String worldName )" )
|
||||
DefineConsoleFunction( physicsDestroyWorld, void, (const char * worldName), , "physicsDestroyWorld( String worldName )")
|
||||
{
|
||||
if ( PHYSICSMGR )
|
||||
PHYSICSMGR->destroyWorld( (const char*)argv[1] );
|
||||
{ PHYSICSMGR->destroyWorld( String( worldName ) ); }
|
||||
}
|
||||
|
||||
|
||||
// Control/query of the stop/started state
|
||||
// of the currently running simulation.
|
||||
ConsoleFunction( physicsStartSimulation, void, 2, 2, "physicsStartSimulation( String worldName )" )
|
||||
DefineConsoleFunction( physicsStartSimulation, void, (const char * worldName), , "physicsStartSimulation( String worldName )")
|
||||
{
|
||||
if ( PHYSICSMGR )
|
||||
PHYSICSMGR->enableSimulation( (const char*)argv[1], true );
|
||||
PHYSICSMGR->enableSimulation( String( worldName ), true );
|
||||
}
|
||||
|
||||
ConsoleFunction( physicsStopSimulation, void, 2, 2, "physicsStopSimulation( String worldName )" )
|
||||
DefineConsoleFunction( physicsStopSimulation, void, (const char * worldName), , "physicsStopSimulation( String worldName )")
|
||||
{
|
||||
if ( PHYSICSMGR )
|
||||
PHYSICSMGR->enableSimulation( (const char*)argv[1], false );
|
||||
PHYSICSMGR->enableSimulation( String( worldName ), false );
|
||||
}
|
||||
|
||||
ConsoleFunction( physicsSimulationEnabled, bool, 1, 1, "physicsSimulationEnabled()" )
|
||||
DefineConsoleFunction( physicsSimulationEnabled, bool, (), , "physicsStopSimulation( String worldName )")
|
||||
{
|
||||
return PHYSICSMGR && PHYSICSMGR->isSimulationEnabled();
|
||||
}
|
||||
|
|
@ -179,14 +178,14 @@ ConsoleFunction( physicsSimulationEnabled, bool, 1, 1, "physicsSimulationEnabled
|
|||
// Used for slowing down time on the
|
||||
// physics simulation, and for pausing/restarting
|
||||
// the simulation.
|
||||
ConsoleFunction( physicsSetTimeScale, void, 2, 2, "physicsSetTimeScale( F32 scale )" )
|
||||
DefineConsoleFunction( physicsSetTimeScale, void, (F32 scale), , "physicsSetTimeScale( F32 scale )")
|
||||
{
|
||||
if ( PHYSICSMGR )
|
||||
PHYSICSMGR->setTimeScale( argv[1] );
|
||||
PHYSICSMGR->setTimeScale( scale );
|
||||
}
|
||||
|
||||
// Get the currently set time scale.
|
||||
ConsoleFunction( physicsGetTimeScale, F32, 1, 1, "physicsGetTimeScale()" )
|
||||
DefineConsoleFunction( physicsGetTimeScale, F32, (), , "physicsGetTimeScale()")
|
||||
{
|
||||
return PHYSICSMGR && PHYSICSMGR->getTimeScale();
|
||||
}
|
||||
|
|
@ -195,7 +194,7 @@ ConsoleFunction( physicsGetTimeScale, F32, 1, 1, "physicsGetTimeScale()" )
|
|||
// physics simulation that they should store
|
||||
// their current state for later restoration,
|
||||
// such as when the editor is closed.
|
||||
ConsoleFunction( physicsStoreState, void, 1, 1, "physicsStoreState()" )
|
||||
DefineConsoleFunction( physicsStoreState, void, (), , "physicsStoreState()")
|
||||
{
|
||||
PhysicsPlugin::getPhysicsResetSignal().trigger( PhysicsResetEvent_Store );
|
||||
}
|
||||
|
|
@ -203,14 +202,14 @@ ConsoleFunction( physicsStoreState, void, 1, 1, "physicsStoreState()" )
|
|||
// Used to send a signal to objects in the
|
||||
// physics simulation that they should restore
|
||||
// their saved state, such as when the editor is opened.
|
||||
ConsoleFunction( physicsRestoreState, void, 1, 1, "physicsRestoreState()" )
|
||||
DefineConsoleFunction( physicsRestoreState, void, (), , "physicsRestoreState()")
|
||||
{
|
||||
if ( PHYSICSMGR )
|
||||
PHYSICSMGR->reset();
|
||||
}
|
||||
|
||||
ConsoleFunction( physicsDebugDraw, void, 2, 2, "physicsDebugDraw( bool enable )" )
|
||||
DefineConsoleFunction( physicsDebugDraw, void, (bool enable), , "physicsDebugDraw( bool enable )")
|
||||
{
|
||||
if ( PHYSICSMGR )
|
||||
PHYSICSMGR->enableDebugDraw( (S32)argv[1] );
|
||||
PHYSICSMGR->enableDebugDraw( enable );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include "console/simBase.h"
|
||||
#include "console/console.h"
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "T3D/gameBase/moveManager.h"
|
||||
#include "ts/tsShapeInstance.h"
|
||||
#include "T3D/staticShape.h"
|
||||
|
|
@ -317,15 +318,15 @@ void StaticShape::unpackUpdate(NetConnection *connection, BitStream *bstream)
|
|||
// This appears to be legacy T2 stuff
|
||||
// Marked internal, as this is flagged to be deleted
|
||||
// [8/1/2010 mperry]
|
||||
ConsoleMethod( StaticShape, setPoweredState, void, 3, 3, "(bool isPowered)"
|
||||
DefineConsoleMethod( StaticShape, setPoweredState, void, (bool isPowered), , "(bool isPowered)"
|
||||
"@internal")
|
||||
{
|
||||
if(!object->isServerObject())
|
||||
return;
|
||||
object->setPowered(dAtob(argv[2]));
|
||||
object->setPowered(isPowered);
|
||||
}
|
||||
|
||||
ConsoleMethod( StaticShape, getPoweredState, bool, 2, 2, "@internal")
|
||||
DefineConsoleMethod( StaticShape, getPoweredState, bool, (), , "@internal")
|
||||
{
|
||||
if(!object->isServerObject())
|
||||
return(false);
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include "console/simBase.h"
|
||||
#include "console/console.h"
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "gui/controls/guiMLTextCtrl.h"
|
||||
#ifdef TORQUE_TGB_ONLY
|
||||
#include "T2D/oldModel/networking/t2dGameConnection.h"
|
||||
|
|
@ -57,22 +58,22 @@ bool gEditingMission = false;
|
|||
|
||||
ConsoleFunctionGroupBegin( InputManagement, "Functions that let you deal with input from scripts" );
|
||||
|
||||
ConsoleFunction( deactivateDirectInput, void, 1, 1, "()"
|
||||
DefineConsoleFunction( deactivateDirectInput, void, (), ,
|
||||
"()"
|
||||
"@brief Disables DirectInput.\n\n"
|
||||
"Also deactivates any connected joysticks.\n\n"
|
||||
"@ingroup Input" )
|
||||
{
|
||||
TORQUE_UNUSED(argc); TORQUE_UNUSED(argv);
|
||||
if ( Input::isActive() )
|
||||
Input::deactivate();
|
||||
}
|
||||
|
||||
ConsoleFunction( activateDirectInput, void, 1, 1,"()"
|
||||
DefineConsoleFunction( activateDirectInput, void, (), ,
|
||||
"()"
|
||||
"@brief Activates DirectInput.\n\n"
|
||||
"Also activates any connected joysticks."
|
||||
"@ingroup Input")
|
||||
{
|
||||
TORQUE_UNUSED(argc); TORQUE_UNUSED(argv);
|
||||
if ( !Input::isActive() )
|
||||
Input::activate();
|
||||
}
|
||||
|
|
@ -81,11 +82,8 @@ ConsoleFunctionGroupEnd( InputManagement );
|
|||
//--------------------------------------------------------------------------
|
||||
|
||||
static const U32 MaxPlayerNameLength = 16;
|
||||
ConsoleFunction( strToPlayerName, const char*, 2, 2, "strToPlayerName( string )" )
|
||||
DefineConsoleFunction( strToPlayerName, const char*, (const char* ptr ), , "strToPlayerName(string);" )
|
||||
{
|
||||
TORQUE_UNUSED(argc);
|
||||
|
||||
const char* ptr = argv[1];
|
||||
|
||||
// Strip leading spaces and underscores:
|
||||
while ( *ptr == ' ' || *ptr == '_' )
|
||||
|
|
@ -140,16 +138,16 @@ ConsoleFunction( strToPlayerName, const char*, 2, 2, "strToPlayerName( string )"
|
|||
|
||||
ConsoleFunctionGroupBegin( Platform , "General platform functions.");
|
||||
|
||||
ConsoleFunction( lockMouse, void, 2, 2, "(bool isLocked)"
|
||||
DefineConsoleFunction( lockMouse, void, (bool isLocked ), , "(bool isLocked)"
|
||||
"@brief Lock or unlock the mouse to the window.\n\n"
|
||||
"When true, prevents the mouse from leaving the bounds of the game window.\n\n"
|
||||
"@ingroup Input")
|
||||
{
|
||||
Platform::setWindowLocked(dAtob(argv[1]));
|
||||
Platform::setWindowLocked(isLocked);
|
||||
}
|
||||
|
||||
|
||||
ConsoleFunction( setNetPort, bool, 2, 3, "(int port, bool bind=true)"
|
||||
DefineConsoleFunction( setNetPort, bool, (int port, bool bind), (true), "(int port, bool bind=true)"
|
||||
"@brief Set the network port for the game to use.\n\n"
|
||||
|
||||
"@param port The port to use.\n"
|
||||
|
|
@ -161,37 +159,34 @@ ConsoleFunction( setNetPort, bool, 2, 3, "(int port, bool bind=true)"
|
|||
"If you don't have firewall tunneling tech you can set this to false to avoid the prompt.\n\n"
|
||||
"@ingroup Networking")
|
||||
{
|
||||
bool bind = true;
|
||||
if (argc == 3)
|
||||
bind = dAtob(argv[2]);
|
||||
return Net::openPort(dAtoi(argv[1]), bind);
|
||||
return Net::openPort((S32)port, bind);
|
||||
}
|
||||
|
||||
ConsoleFunction( closeNetPort, void, 1, 1, "()"
|
||||
DefineConsoleFunction( closeNetPort, void, (), , "()"
|
||||
"@brief Closes the current network port\n\n"
|
||||
"@ingroup Networking")
|
||||
{
|
||||
Net::closePort();
|
||||
}
|
||||
|
||||
ConsoleFunction( saveJournal, void, 2, 2, "(string filename)"
|
||||
DefineConsoleFunction( saveJournal, void, (const char * filename), , "(string filename)"
|
||||
"Save the journal to the specified file.\n\n"
|
||||
"@ingroup Platform")
|
||||
{
|
||||
Journal::Record(argv[1]);
|
||||
Journal::Record(filename);
|
||||
}
|
||||
|
||||
ConsoleFunction( playJournal, void, 2, 3, "(string filename)"
|
||||
DefineConsoleFunction( playJournal, void, (const char * filename), , "(string filename)"
|
||||
"@brief Begin playback of a journal from a specified field.\n\n"
|
||||
"@param filename Name and path of file journal file\n"
|
||||
"@ingroup Platform")
|
||||
{
|
||||
// CodeReview - BJG 4/24/2007 - The break flag needs to be wired back in.
|
||||
// bool jBreak = (argc > 2)? dAtob(argv[2]): false;
|
||||
Journal::Play(argv[1]);
|
||||
Journal::Play(filename);
|
||||
}
|
||||
|
||||
ConsoleFunction( getSimTime, S32, 1, 1, "()"
|
||||
DefineConsoleFunction( getSimTime, S32, (), , "()"
|
||||
"Return the current sim time in milliseconds.\n\n"
|
||||
"@brief Sim time is time since the game started.\n\n"
|
||||
"@ingroup Platform")
|
||||
|
|
@ -199,7 +194,7 @@ ConsoleFunction( getSimTime, S32, 1, 1, "()"
|
|||
return Sim::getCurrentTime();
|
||||
}
|
||||
|
||||
ConsoleFunction( getRealTime, S32, 1, 1, "()"
|
||||
DefineConsoleFunction( getRealTime, S32, (), , "()"
|
||||
"@brief Return the current real time in milliseconds.\n\n"
|
||||
"Real time is platform defined; typically time since the computer booted.\n\n"
|
||||
"@ingroup Platform")
|
||||
|
|
|
|||
|
|
@ -410,25 +410,20 @@ void queryLanServers(U32 port, U8 flags, const char* gameType, const char* missi
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleFunction( queryAllServers, void, 12, 12, "queryAllServers(...);" )
|
||||
DefineConsoleFunction( queryAllServers
|
||||
, void, ( U32 lanPort
|
||||
, U32 flags
|
||||
, const char * gameType
|
||||
, const char * missionType
|
||||
, U32 minPlayers
|
||||
, U32 maxPlayers
|
||||
, U32 maxBots
|
||||
, U32 regionMask
|
||||
, U32 maxPing
|
||||
, U32 minCPU
|
||||
, U32 filterFlags )
|
||||
, , "queryAllServers(...);" )
|
||||
{
|
||||
TORQUE_UNUSED(argc);
|
||||
|
||||
U32 lanPort = dAtoi(argv[1]);
|
||||
U8 flags = dAtoi(argv[2]);
|
||||
|
||||
// It's not a good idea to hold onto args, recursive calls to
|
||||
// console exec will trash them.
|
||||
char* gameType = dStrdup(argv[3]);
|
||||
char* missionType = dStrdup(argv[4]);
|
||||
|
||||
U8 minPlayers = dAtoi(argv[5]);
|
||||
U8 maxPlayers = dAtoi(argv[6]);
|
||||
U8 maxBots = dAtoi(argv[7]);
|
||||
U32 regionMask = dAtoi(argv[8]);
|
||||
U32 maxPing = dAtoi(argv[9]);
|
||||
U16 minCPU = dAtoi(argv[10]);
|
||||
U8 filterFlags = dAtoi(argv[11]);
|
||||
U32 buddyList = 0;
|
||||
|
||||
clearServerList();
|
||||
|
|
@ -442,32 +437,27 @@ ConsoleFunction( queryAllServers, void, 12, 12, "queryAllServers(...);" )
|
|||
dFree(missionType);
|
||||
|
||||
}
|
||||
ConsoleFunction( queryLanServers, void, 12, 12, "queryLanServers(...);" )
|
||||
|
||||
DefineConsoleFunction( queryLanServers
|
||||
, void, ( U32 lanPort
|
||||
, U32 flags
|
||||
, const char * gameType
|
||||
, const char * missionType
|
||||
, U32 minPlayers
|
||||
, U32 maxPlayers
|
||||
, U32 maxBots
|
||||
, U32 regionMask
|
||||
, U32 maxPing
|
||||
, U32 minCPU
|
||||
, U32 filterFlags )
|
||||
, , "queryLanServers(...);" )
|
||||
|
||||
{
|
||||
TORQUE_UNUSED(argc);
|
||||
|
||||
U32 lanPort = dAtoi(argv[1]);
|
||||
U8 flags = dAtoi(argv[2]);
|
||||
|
||||
// It's not a good idea to hold onto args, recursive calls to
|
||||
// console exec will trash them.
|
||||
char* gameType = dStrdup(argv[3]);
|
||||
char* missionType = dStrdup(argv[4]);
|
||||
|
||||
U8 minPlayers = dAtoi(argv[5]);
|
||||
U8 maxPlayers = dAtoi(argv[6]);
|
||||
U8 maxBots = dAtoi(argv[7]);
|
||||
U32 regionMask = dAtoi(argv[8]);
|
||||
U32 maxPing = dAtoi(argv[9]);
|
||||
U16 minCPU = dAtoi(argv[10]);
|
||||
U8 filterFlags = dAtoi(argv[11]);
|
||||
|
||||
clearServerList();
|
||||
queryLanServers(lanPort, flags, gameType, missionType, minPlayers, maxPlayers, maxBots,
|
||||
regionMask, maxPing, minCPU, filterFlags);
|
||||
|
||||
dFree(gameType);
|
||||
dFree(missionType);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -550,24 +540,20 @@ void queryMasterServer(U8 flags, const char* gameType, const char* missionType,
|
|||
processMasterServerQuery( gPingSession );
|
||||
}
|
||||
|
||||
ConsoleFunction( queryMasterServer, void, 11, 11, "queryMasterServer(...);" )
|
||||
DefineConsoleFunction( queryMasterServer
|
||||
, void, ( U32 lanPort
|
||||
, U32 flags
|
||||
, const char * gameType
|
||||
, const char * missionType
|
||||
, U32 minPlayers
|
||||
, U32 maxPlayers
|
||||
, U32 maxBots
|
||||
, U32 regionMask
|
||||
, U32 maxPing
|
||||
, U32 minCPU
|
||||
, U32 filterFlags )
|
||||
, , "queryMasterServer(...);" )
|
||||
{
|
||||
TORQUE_UNUSED(argc);
|
||||
|
||||
U8 flags = dAtoi(argv[1]);
|
||||
|
||||
// It's not a good idea to hold onto args, recursive calls to
|
||||
// console exec will trash them.
|
||||
char* gameType = dStrdup(argv[2]);
|
||||
char* missionType = dStrdup(argv[3]);
|
||||
|
||||
U8 minPlayers = dAtoi(argv[4]);
|
||||
U8 maxPlayers = dAtoi(argv[5]);
|
||||
U8 maxBots = dAtoi(argv[6]);
|
||||
U32 regionMask = dAtoi(argv[7]);
|
||||
U32 maxPing = dAtoi(argv[8]);
|
||||
U16 minCPU = dAtoi(argv[9]);
|
||||
U8 filterFlags = dAtoi(argv[10]);
|
||||
U32 buddyList = 0;
|
||||
|
||||
clearServerList();
|
||||
|
|
@ -580,15 +566,12 @@ ConsoleFunction( queryMasterServer, void, 11, 11, "queryMasterServer(...);" )
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleFunction( querySingleServer, void, 3, 3, "querySingleServer(address, flags);" )
|
||||
DefineConsoleFunction( querySingleServer
|
||||
, void, ( const char* addrText, U8 flags )
|
||||
,(0) , "querySingleServer(...);" )
|
||||
{
|
||||
TORQUE_UNUSED(argc);
|
||||
|
||||
NetAddress addr;
|
||||
char* addrText;
|
||||
|
||||
addrText = dStrdup(argv[1]);
|
||||
U8 flags = dAtoi(argv[2]);
|
||||
|
||||
|
||||
Net::stringToAddress( addrText, &addr );
|
||||
|
|
@ -672,9 +655,8 @@ void cancelServerQuery()
|
|||
}
|
||||
}
|
||||
|
||||
ConsoleFunction( cancelServerQuery, void, 1, 1, "cancelServerQuery()" )
|
||||
DefineConsoleFunction( cancelServerQuery, void, (), , "cancelServerQuery(...);" )
|
||||
{
|
||||
TORQUE_UNUSED(argc); TORQUE_UNUSED(argv);
|
||||
cancelServerQuery();
|
||||
}
|
||||
|
||||
|
|
@ -701,43 +683,36 @@ void stopServerQuery()
|
|||
}
|
||||
}
|
||||
|
||||
ConsoleFunction( stopServerQuery, void, 1, 1, "stopServerQuery()" )
|
||||
DefineConsoleFunction( stopServerQuery, void, (), , "stopServerQuery(...);" )
|
||||
{
|
||||
TORQUE_UNUSED(argc); TORQUE_UNUSED(argv);
|
||||
stopServerQuery();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleFunction(startHeartbeat, void, 1, 1, "startHeartbeat()")
|
||||
DefineConsoleFunction( startHeartbeat, void, (), , "startHeartbeat(...);" )
|
||||
{
|
||||
TORQUE_UNUSED(argc); TORQUE_UNUSED(argv);
|
||||
|
||||
if (validateAuthenticatedServer()) {
|
||||
gHeartbeatSeq++;
|
||||
processHeartbeat(gHeartbeatSeq); // thump-thump...
|
||||
}
|
||||
}
|
||||
|
||||
ConsoleFunction(stopHeartbeat, void, 1, 1, "stopHeartbeat();")
|
||||
DefineConsoleFunction( stopHeartbeat, void, (), , "stopHeartbeat(...);" )
|
||||
{
|
||||
TORQUE_UNUSED(argc); TORQUE_UNUSED(argv);
|
||||
gHeartbeatSeq++;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleFunction( getServerCount, int, 1, 1, "getServerCount();" )
|
||||
DefineConsoleFunction( getServerCount, int, (), , "getServerCount(...);" )
|
||||
{
|
||||
TORQUE_UNUSED(argv); TORQUE_UNUSED(argc);
|
||||
return gServerList.size();
|
||||
}
|
||||
|
||||
ConsoleFunction( setServerInfo, bool, 2, 2, "setServerInfo(index);" )
|
||||
DefineConsoleFunction( setServerInfo, bool, (U32 index), , "setServerInfo(...);" )
|
||||
{
|
||||
TORQUE_UNUSED(argc);
|
||||
U32 index = dAtoi(argv[1]);
|
||||
if (index >= 0 && index < gServerList.size()) {
|
||||
if (index < gServerList.size()) {
|
||||
ServerInfo& info = gServerList[index];
|
||||
|
||||
char addrString[256];
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "platform/platform.h"
|
||||
#include "app/version.h"
|
||||
#include "console/console.h"
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
static const U32 csgVersionNumber = TORQUE_GAME_ENGINE;
|
||||
static const U32 appVersionNumber = TORQUE_APP_VERSION;
|
||||
|
|
@ -91,44 +92,44 @@ const char* getCompileTimeString()
|
|||
|
||||
ConsoleFunctionGroupBegin( CompileInformation, "Functions to get version information about the current executable." );
|
||||
|
||||
ConsoleFunction( getVersionNumber, S32, 1, 1, "Get the version of the engine build, as a string.\n\n"
|
||||
DefineConsoleFunction( getVersionNumber, S32, (), , "Get the version of the engine build, as a string.\n\n"
|
||||
"@ingroup Debugging")
|
||||
{
|
||||
return getVersionNumber();
|
||||
}
|
||||
|
||||
ConsoleFunction( getAppVersionNumber, S32, 1, 1, "Get the version of the application build, as a string.\n\n"
|
||||
DefineConsoleFunction( getAppVersionNumber, S32, (), , "Get the version of the application build, as a string.\n\n"
|
||||
"@ingroup Debugging")
|
||||
{
|
||||
return getAppVersionNumber();
|
||||
}
|
||||
|
||||
|
||||
ConsoleFunction( getVersionString, const char*, 1, 1, "Get the version of the engine build, as a human readable string.\n\n"
|
||||
DefineConsoleFunction( getVersionString, const char*, (), , "Get the version of the engine build, as a human readable string.\n\n"
|
||||
"@ingroup Debugging")
|
||||
{
|
||||
return getVersionString();
|
||||
}
|
||||
|
||||
ConsoleFunction( getAppVersionString, const char*, 1, 1, "Get the version of the aplication, as a human readable string.\n\n"
|
||||
DefineConsoleFunction( getAppVersionString, const char*, (), , "Get the version of the aplication build, as a human readable string.\n\n"
|
||||
"@ingroup Debugging")
|
||||
{
|
||||
return getAppVersionString();
|
||||
}
|
||||
|
||||
ConsoleFunction( getEngineName, const char*, 1, 1, "Get the name of the engine product that this is running from, as a string.\n\n"
|
||||
DefineConsoleFunction( getEngineName, const char*, (), , "Get the name of the engine product that this is running from, as a string.\n\n"
|
||||
"@ingroup Debugging")
|
||||
{
|
||||
return getEngineProductString();
|
||||
}
|
||||
|
||||
ConsoleFunction( getCompileTimeString, const char*, 1, 1, "Get the time of compilation.\n\n"
|
||||
DefineConsoleFunction( getCompileTimeString, const char*, (), , "Get the time of compilation.\n\n"
|
||||
"@ingroup Debugging")
|
||||
{
|
||||
return getCompileTimeString();
|
||||
}
|
||||
|
||||
ConsoleFunction( getBuildString, const char*, 1, 1, "Get the type of build, \"Debug\" or \"Release\".\n\n"
|
||||
DefineConsoleFunction( getBuildString, const char*, (), , "Get the type of build, \"Debug\" or \"Release\".\n\n"
|
||||
"@ingroup Debugging")
|
||||
{
|
||||
#ifdef TORQUE_DEBUG
|
||||
|
|
@ -140,7 +141,7 @@ ConsoleFunction( getBuildString, const char*, 1, 1, "Get the type of build, \"De
|
|||
|
||||
ConsoleFunctionGroupEnd( CompileInformation );
|
||||
|
||||
ConsoleFunction(isDemo, bool, 1, 1, "")
|
||||
DefineConsoleFunction( isDemo, bool, (), , "")
|
||||
{
|
||||
#ifdef TORQUE_DEMO
|
||||
return true;
|
||||
|
|
@ -149,7 +150,7 @@ ConsoleFunction(isDemo, bool, 1, 1, "")
|
|||
#endif
|
||||
}
|
||||
|
||||
ConsoleFunction(isWebDemo, bool, 1, 1, "")
|
||||
DefineConsoleFunction( isWebDemo, bool, (), , "")
|
||||
{
|
||||
#ifdef TORQUE_DEMO
|
||||
return Platform::getWebDeployment();
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "platform/platform.h"
|
||||
#include "console/compiler.h"
|
||||
#include "console/consoleInternal.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "core/util/tDictionary.h"
|
||||
#include "core/strings/stringFunctions.h"
|
||||
#include "app/mainLoop.h"
|
||||
|
|
@ -458,20 +459,16 @@ extern "C" {
|
|||
// By default, it is marked as secure by the web plugins and then can be called from
|
||||
// Javascript on the web page to ensure that function calls across the language
|
||||
// boundry are working with arguments and return values
|
||||
ConsoleFunction(testJavaScriptBridge, const char *, 4, 4, "testBridge(arg1, arg2, arg3)")
|
||||
DefineConsoleFunction( testJavaScriptBridge, const char *, (const char* arg1, const char* arg2, const char* arg3), , "testBridge(arg1, arg2, arg3)")
|
||||
{
|
||||
S32 failed = 0;
|
||||
if(argc != 4)
|
||||
failed = 1;
|
||||
else
|
||||
{
|
||||
if (dStrcmp(argv[1],"one"))
|
||||
if (dStrcmp(arg1,"one"))
|
||||
failed = 2;
|
||||
if (dStrcmp(argv[2],"two"))
|
||||
if (dStrcmp(arg2,"two"))
|
||||
failed = 2;
|
||||
if (dStrcmp(argv[3],"three"))
|
||||
if (dStrcmp(arg3,"three"))
|
||||
failed = 2;
|
||||
}
|
||||
|
||||
|
||||
//attempt to call from TorqueScript -> JavaScript
|
||||
const char* jret = Con::evaluate("JS::bridgeCallback(\"one\",\"two\",\"three\");");
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "console/consoleTypes.h"
|
||||
#include "component/simComponent.h"
|
||||
#include "core/stream/stream.h"
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
SimComponent::SimComponent() : mOwner( NULL )
|
||||
{
|
||||
|
|
@ -404,17 +405,16 @@ ConsoleMethod( SimComponent, removeComponents, bool, 3, 64, "%obj.removeComponen
|
|||
return true;
|
||||
}
|
||||
|
||||
ConsoleMethod( SimComponent, getComponentCount, S32, 2, 2, "() Get the current component count\n"
|
||||
DefineConsoleMethod( SimComponent, getComponentCount, S32, (), , "() Get the current component count\n"
|
||||
"@return The number of components in the list as an integer")
|
||||
{
|
||||
return object->getComponentCount();
|
||||
}
|
||||
|
||||
ConsoleMethod( SimComponent, getComponent, S32, 3, 3, "(idx) Get the component corresponding to the given index.\n"
|
||||
DefineConsoleMethod( SimComponent, getComponent, S32, (S32 idx), , "(idx) Get the component corresponding to the given index.\n"
|
||||
"@param idx An integer index value corresponding to the desired component.\n"
|
||||
"@return The id of the component at the given index as an integer")
|
||||
{
|
||||
S32 idx = dAtoi(argv[2]);
|
||||
if(idx < 0 || idx >= object->getComponentCount())
|
||||
{
|
||||
Con::errorf("SimComponent::getComponent - Invalid index %d", idx);
|
||||
|
|
@ -425,27 +425,27 @@ ConsoleMethod( SimComponent, getComponent, S32, 3, 3, "(idx) Get the component c
|
|||
return c ? c->getId() : 0;
|
||||
}
|
||||
|
||||
ConsoleMethod(SimComponent, setEnabled, void, 3, 3, "(enabled) Sets or unsets the enabled flag\n"
|
||||
DefineConsoleMethod(SimComponent, setEnabled, void, (bool enabled), , "(enabled) Sets or unsets the enabled flag\n"
|
||||
"@param enabled Boolean value\n"
|
||||
"@return No return value")
|
||||
{
|
||||
object->setEnabled(dAtob(argv[2]));
|
||||
object->setEnabled(enabled);
|
||||
}
|
||||
|
||||
ConsoleMethod(SimComponent, isEnabled, bool, 2, 2, "() Check whether SimComponent is currently enabled\n"
|
||||
DefineConsoleMethod(SimComponent, isEnabled, bool, (), , "() Check whether SimComponent is currently enabled\n"
|
||||
"@return true if enabled and false if not")
|
||||
{
|
||||
return object->isEnabled();
|
||||
}
|
||||
|
||||
ConsoleMethod(SimComponent, setIsTemplate, void, 3, 3, "(template) Sets or unsets the template flag\n"
|
||||
DefineConsoleMethod(SimComponent, setIsTemplate, void, (bool templateFlag), , "(template) Sets or unsets the template flag\n"
|
||||
"@param template Boolean value\n"
|
||||
"@return No return value")
|
||||
{
|
||||
object->setIsTemplate(dAtob(argv[2]));
|
||||
object->setIsTemplate(templateFlag);
|
||||
}
|
||||
|
||||
ConsoleMethod(SimComponent, getIsTemplate, bool, 2, 2, "() Check whether SimComponent is currently a template\n"
|
||||
DefineConsoleMethod(SimComponent, getIsTemplate, bool, (), , "() Check whether SimComponent is currently a template\n"
|
||||
"@return true if is a template and false if not")
|
||||
{
|
||||
return object->getIsTemplate();
|
||||
|
|
|
|||
|
|
@ -571,21 +571,22 @@ DefineEngineMethod( SimXMLDocument, attribute, const char*, ( const char* attrib
|
|||
}
|
||||
|
||||
// These two methods don't make a lot of sense the way TS works. Leaving them in for backwards-compatibility.
|
||||
ConsoleMethod( SimXMLDocument, attributeF32, F32, 3, 3, "(string attributeName)"
|
||||
DefineConsoleMethod( SimXMLDocument, attributeF32, F32, (const char * attributeName), , "(string attributeName)"
|
||||
"@brief Get float attribute from the current Element on the stack.\n\n"
|
||||
"@param attributeName Name of attribute to retrieve.\n"
|
||||
"@return The value of the given attribute in the form of a float.\n"
|
||||
"@deprecated Use attribute().")
|
||||
{
|
||||
return dAtof( object->attribute( argv[2] ) );
|
||||
return dAtof( object->attribute( attributeName ) );
|
||||
}
|
||||
ConsoleMethod(SimXMLDocument, attributeS32, S32, 3, 3, "(string attributeName)"
|
||||
|
||||
DefineConsoleMethod(SimXMLDocument, attributeS32, S32, (const char * attributeName), , "(string attributeName)"
|
||||
"@brief Get int attribute from the current Element on the stack.\n\n"
|
||||
"@param attributeName Name of attribute to retrieve.\n"
|
||||
"@return The value of the given attribute in the form of an integer.\n"
|
||||
"@deprecated Use attribute().")
|
||||
{
|
||||
return dAtoi( object->attribute( argv[2] ) );
|
||||
return dAtoi( object->attribute( attributeName ) );
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ bool useTimestamp = false;
|
|||
|
||||
ConsoleFunctionGroupBegin( Clipboard, "Miscellaneous functions to control the clipboard and clear the console.");
|
||||
|
||||
ConsoleFunction( cls, void, 1, 1, "()"
|
||||
DefineConsoleFunction( cls, void, (), , "()"
|
||||
"@brief Clears the console output.\n\n"
|
||||
"@ingroup Console")
|
||||
{
|
||||
|
|
@ -285,18 +285,18 @@ ConsoleFunction( cls, void, 1, 1, "()"
|
|||
consoleLog.setSize(0);
|
||||
};
|
||||
|
||||
ConsoleFunction( getClipboard, const char*, 1, 1, "()"
|
||||
DefineConsoleFunction( getClipboard, const char*, (), , "()"
|
||||
"@brief Get text from the clipboard.\n\n"
|
||||
"@internal")
|
||||
{
|
||||
return Platform::getClipboard();
|
||||
};
|
||||
|
||||
ConsoleFunction( setClipboard, bool, 2, 2, "(string text)"
|
||||
DefineConsoleFunction( setClipboard, bool, (const char* text), , "(string text)"
|
||||
"@brief Set the system clipboard.\n\n"
|
||||
"@internal")
|
||||
{
|
||||
return Platform::setClipboard(argv[1]);
|
||||
return Platform::setClipboard(text);
|
||||
};
|
||||
|
||||
ConsoleFunctionGroupEnd( Clipboard );
|
||||
|
|
|
|||
|
|
@ -1179,7 +1179,7 @@ static bool isInSet(char c, const char *set)
|
|||
return false;
|
||||
}
|
||||
|
||||
ConsoleFunction( nextToken, const char *, 4, 4, "( string str, string token, string delimiters ) "
|
||||
DefineConsoleFunction( nextToken, const char*, ( const char* str1, const char* token, const char* delim), , "( string str, string token, string delimiters ) "
|
||||
"Tokenize a string using a set of delimiting characters.\n"
|
||||
"This function first skips all leading charaters in @a str that are contained in @a delimiters. "
|
||||
"From that position, it then scans for the next character in @a str that is contained in @a delimiters and stores all characters "
|
||||
|
|
@ -1207,12 +1207,7 @@ ConsoleFunction( nextToken, const char *, 4, 4, "( string str, string token, str
|
|||
"@endtsexample\n\n"
|
||||
"@ingroup Strings" )
|
||||
{
|
||||
char buffer[4096];
|
||||
dStrncpy(buffer, argv[1], 4096);
|
||||
char *str = buffer;
|
||||
const char *token = argv[2];
|
||||
const char *delim = argv[3];
|
||||
|
||||
char *str = (char *)str1;
|
||||
if( str )
|
||||
{
|
||||
// skip over any characters that are a member of delim
|
||||
|
|
@ -1242,9 +1237,7 @@ ConsoleFunction( nextToken, const char *, 4, 4, "( string str, string token, str
|
|||
str++;
|
||||
}
|
||||
|
||||
char *ret = Con::getReturnBuffer(dStrlen(str)+1);
|
||||
dStrncpy(ret, str, dStrlen(str)+1);
|
||||
return ret;
|
||||
return str;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
|
@ -1289,7 +1282,7 @@ DefineEngineFunction( detag, const char*, ( const char* str ),,
|
|||
return str;
|
||||
}
|
||||
|
||||
ConsoleFunction(getTag, const char *, 2, 2, "(string textTagString)"
|
||||
DefineConsoleFunction( getTag, const char*, ( const char* textTagString ), , "( string textTagString ) "
|
||||
"@brief Extracts the tag from a tagged string\n\n"
|
||||
|
||||
"Should only be used within the context of a function that receives a tagged "
|
||||
|
|
@ -1303,26 +1296,24 @@ ConsoleFunction(getTag, const char *, 2, 2, "(string textTagString)"
|
|||
"@see detag()\n"
|
||||
"@ingroup Networking")
|
||||
{
|
||||
TORQUE_UNUSED(argc);
|
||||
if(argv[1][0] == StringTagPrefixByte)
|
||||
if(textTagString[0] == StringTagPrefixByte)
|
||||
{
|
||||
const char *arg = argv[1];
|
||||
const char * space = dStrchr(argv[1], ' ');
|
||||
const char * space = dStrchr(textTagString, ' ');
|
||||
|
||||
U32 len;
|
||||
U64 len;
|
||||
if(space)
|
||||
len = space - arg;
|
||||
len = space - textTagString;
|
||||
else
|
||||
len = dStrlen(arg) + 1;
|
||||
len = dStrlen(textTagString) + 1;
|
||||
|
||||
char * ret = Con::getReturnBuffer(len);
|
||||
dStrncpy(ret, arg + 1, len - 1);
|
||||
dStrncpy(ret, textTagString + 1, len - 1);
|
||||
ret[len - 1] = 0;
|
||||
|
||||
return(ret);
|
||||
}
|
||||
else
|
||||
return(argv[1]);
|
||||
return(textTagString);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1512,13 +1503,12 @@ DefineConsoleFunction( quit, void, ( ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifdef TORQUE_DEMO_PURCHASE
|
||||
ConsoleFunction( realQuit, void, 1, 1, "" )
|
||||
|
||||
DefineConsoleFunction( realQuit, void, (), , "")
|
||||
{
|
||||
TORQUE_UNUSED(argc); TORQUE_UNUSED(argv);
|
||||
Platform::postQuitMessage(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -2185,87 +2175,86 @@ DefineEngineFunction( exec, bool, ( const char* fileName, bool noCalls, bool jou
|
|||
return ret;
|
||||
}
|
||||
|
||||
ConsoleFunction(eval, const char *, 2, 2, "eval(consoleString)")
|
||||
DefineConsoleFunction( eval, const char*, ( const char* consoleString ), , "eval(consoleString)" )
|
||||
{
|
||||
TORQUE_UNUSED(argc);
|
||||
return Con::evaluate(argv[1], false, NULL);
|
||||
return Con::evaluate(consoleString, false, NULL);
|
||||
}
|
||||
|
||||
ConsoleFunction(getVariable, const char *, 2, 2, "(string varName)\n"
|
||||
DefineConsoleFunction( getVariable, const char*, ( const char* varName ), , "(string varName)\n"
|
||||
"@brief Returns the value of the named variable or an empty string if not found.\n\n"
|
||||
"@varName Name of the variable to search for\n"
|
||||
"@return Value contained by varName, \"\" if the variable does not exist\n"
|
||||
"@ingroup Scripting")
|
||||
{
|
||||
return Con::getVariable(argv[1]);
|
||||
return Con::getVariable(varName);
|
||||
}
|
||||
|
||||
ConsoleFunction(setVariable, void, 3, 3, "(string varName, string value)\n"
|
||||
DefineConsoleFunction( setVariable, void, ( const char* varName, const char* value ), , "(string varName, string value)\n"
|
||||
"@brief Sets the value of the named variable.\n\n"
|
||||
"@param varName Name of the variable to locate\n"
|
||||
"@param value New value of the variable\n"
|
||||
"@return True if variable was successfully found and set\n"
|
||||
"@ingroup Scripting")
|
||||
{
|
||||
return Con::setVariable(argv[1], argv[2]);
|
||||
return Con::setVariable(varName, value);
|
||||
}
|
||||
|
||||
ConsoleFunction(isFunction, bool, 2, 2, "(string funcName)"
|
||||
DefineConsoleFunction( isFunction, bool, ( const char* funcName ), , "(string funcName)"
|
||||
"@brief Determines if a function exists or not\n\n"
|
||||
"@param funcName String containing name of the function\n"
|
||||
"@return True if the function exists, false if not\n"
|
||||
"@ingroup Scripting")
|
||||
{
|
||||
return Con::isFunction(argv[1]);
|
||||
return Con::isFunction(funcName);
|
||||
}
|
||||
|
||||
ConsoleFunction(getFunctionPackage, const char*, 2, 2, "(string funcName)"
|
||||
DefineConsoleFunction( getFunctionPackage, const char*, ( const char* funcName ), , "(string funcName)"
|
||||
"@brief Provides the name of the package the function belongs to\n\n"
|
||||
"@param funcName String containing name of the function\n"
|
||||
"@return The name of the function's package\n"
|
||||
"@ingroup Packages")
|
||||
{
|
||||
Namespace::Entry* nse = Namespace::global()->lookup( StringTable->insert( argv[1] ) );
|
||||
Namespace::Entry* nse = Namespace::global()->lookup( StringTable->insert( funcName ) );
|
||||
if( !nse )
|
||||
return "";
|
||||
|
||||
return nse->mPackage;
|
||||
}
|
||||
|
||||
ConsoleFunction(isMethod, bool, 3, 3, "(string namespace, string method)"
|
||||
DefineConsoleFunction( isMethod, bool, ( const char* nameSpace, const char* method ), , "(string namespace, string method)"
|
||||
"@brief Determines if a class/namespace method exists\n\n"
|
||||
"@param namespace Class or namespace, such as Player\n"
|
||||
"@param method Name of the function to search for\n"
|
||||
"@return True if the method exists, false if not\n"
|
||||
"@ingroup Scripting\n")
|
||||
{
|
||||
Namespace* ns = Namespace::find( StringTable->insert( argv[1] ) );
|
||||
Namespace::Entry* nse = ns->lookup( StringTable->insert( argv[2] ) );
|
||||
Namespace* ns = Namespace::find( StringTable->insert( nameSpace ) );
|
||||
Namespace::Entry* nse = ns->lookup( StringTable->insert( method ) );
|
||||
if( !nse )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ConsoleFunction(getMethodPackage, const char*, 3, 3, "(string namespace, string method)"
|
||||
DefineConsoleFunction( getMethodPackage, const char*, ( const char* nameSpace, const char* method ), , "(string namespace, string method)"
|
||||
"@brief Provides the name of the package the method belongs to\n\n"
|
||||
"@param namespace Class or namespace, such as Player\n"
|
||||
"@param method Name of the funciton to search for\n"
|
||||
"@return The name of the method's package\n"
|
||||
"@ingroup Packages")
|
||||
{
|
||||
Namespace* ns = Namespace::find( StringTable->insert( argv[1] ) );
|
||||
Namespace* ns = Namespace::find( StringTable->insert( nameSpace ) );
|
||||
if( !ns )
|
||||
return "";
|
||||
|
||||
Namespace::Entry* nse = ns->lookup( StringTable->insert( argv[2] ) );
|
||||
Namespace::Entry* nse = ns->lookup( StringTable->insert( method ) );
|
||||
if( !nse )
|
||||
return "";
|
||||
|
||||
return nse->mPackage;
|
||||
}
|
||||
|
||||
ConsoleFunction(isDefined, bool, 2, 3, "(string varName)"
|
||||
DefineConsoleFunction( isDefined, bool, ( const char* varName, const char* varValue ), ("") , "(string varName)"
|
||||
"@brief Determines if a variable exists and contains a value\n"
|
||||
"@param varName Name of the variable to search for\n"
|
||||
"@return True if the variable was defined in script, false if not\n"
|
||||
|
|
@ -2274,13 +2263,13 @@ ConsoleFunction(isDefined, bool, 2, 3, "(string varName)"
|
|||
"@endtsexample\n\n"
|
||||
"@ingroup Scripting")
|
||||
{
|
||||
if(dStrlen(argv[1]) == 0)
|
||||
if(dStrlen(varName) == 0)
|
||||
{
|
||||
Con::errorf("isDefined() - did you forget to put quotes around the variable name?");
|
||||
return false;
|
||||
}
|
||||
|
||||
StringTableEntry name = StringTable->insert(argv[1]);
|
||||
StringTableEntry name = StringTable->insert(varName);
|
||||
|
||||
// Deal with <var>.<value>
|
||||
if (dStrchr(name, '.'))
|
||||
|
|
@ -2331,7 +2320,7 @@ ConsoleFunction(isDefined, bool, 2, 3, "(string varName)"
|
|||
|
||||
if (!value)
|
||||
{
|
||||
obj->setDataField(valName, 0, argv[2]);
|
||||
obj->setDataField(valName, 0, varValue);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -2350,8 +2339,11 @@ ConsoleFunction(isDefined, bool, 2, 3, "(string varName)"
|
|||
{
|
||||
if (dStrlen(value) > 0)
|
||||
return true;
|
||||
else if (argc > 2)
|
||||
obj->setDataField(valName, 0, argv[2]);
|
||||
else if (dStrcmp(varValue,"")!=0)
|
||||
{
|
||||
obj->setDataField(valName, 0, varValue);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2365,8 +2357,10 @@ ConsoleFunction(isDefined, bool, 2, 3, "(string varName)"
|
|||
|
||||
if (ent)
|
||||
return true;
|
||||
else if (argc > 2)
|
||||
gEvalState.getCurrentFrame().setVariable(name, argv[2]);
|
||||
else if (dStrcmp (varValue,"")!=0)
|
||||
{
|
||||
gEvalState.getCurrentFrame().setVariable(name, varValue);
|
||||
}
|
||||
}
|
||||
else
|
||||
Con::errorf("%s() - no local variable frame.", __FUNCTION__);
|
||||
|
|
@ -2378,16 +2372,20 @@ ConsoleFunction(isDefined, bool, 2, 3, "(string varName)"
|
|||
|
||||
if (ent)
|
||||
return true;
|
||||
else if (argc > 2)
|
||||
gEvalState.globalVars.setVariable(name, argv[2]);
|
||||
else if (dStrcmp( varValue,"") != 0)
|
||||
{
|
||||
gEvalState.globalVars.setVariable(name, varValue);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Is it an object?
|
||||
if (dStrcmp(argv[1], "0") && dStrcmp(argv[1], "") && (Sim::findObject(argv[1]) != NULL))
|
||||
if (dStrcmp(varName, "0") && dStrcmp(varName, "") && (Sim::findObject(varName) != NULL))
|
||||
return true;
|
||||
else if (argc > 2)
|
||||
Con::errorf("%s() - can't assign a value to a variable of the form \"%s\"", __FUNCTION__, (const char*)argv[1]);
|
||||
else if (dStrcmp(varValue, "" ) != 0)
|
||||
{
|
||||
Con::errorf("%s() - can't assign a value to a variable of the form \"%s\"", __FUNCTION__, varValue);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -2395,39 +2393,39 @@ ConsoleFunction(isDefined, bool, 2, 3, "(string varName)"
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleFunction( isCurrentScriptToolScript, bool, 1, 1,
|
||||
"() Returns true if the calling script is a tools script.\n"
|
||||
DefineConsoleFunction( isCurrentScriptToolScript, bool, (), , "()"
|
||||
"Returns true if the calling script is a tools script.\n"
|
||||
"@hide")
|
||||
{
|
||||
return Con::isCurrentScriptToolScript();
|
||||
}
|
||||
|
||||
ConsoleFunction(getModNameFromPath, const char *, 2, 2, "(string path)"
|
||||
DefineConsoleFunction( getModNameFromPath, const char *, ( const char* path ), , "(string path)"
|
||||
"@brief Attempts to extract a mod directory from path. Returns empty string on failure.\n\n"
|
||||
"@param File path of mod folder\n"
|
||||
"@note This is no longer relevant in Torque 3D (which does not use mod folders), should be deprecated\n"
|
||||
"@internal")
|
||||
{
|
||||
StringTableEntry modPath = Con::getModNameFromPath(argv[1]);
|
||||
StringTableEntry modPath = Con::getModNameFromPath(path);
|
||||
return modPath ? modPath : "";
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleFunction( pushInstantGroup, void, 1, 2, "([group])"
|
||||
DefineConsoleFunction( pushInstantGroup, void, ( String group ),("") , "([group])"
|
||||
"@brief Pushes the current $instantGroup on a stack "
|
||||
"and sets it to the given value (or clears it).\n\n"
|
||||
"@note Currently only used for editors\n"
|
||||
"@ingroup Editors\n"
|
||||
"@internal")
|
||||
{
|
||||
if( argc > 1 )
|
||||
Con::pushInstantGroup( (const char*)argv[ 1 ] );
|
||||
if( group.size() > 0 )
|
||||
Con::pushInstantGroup( group );
|
||||
else
|
||||
Con::pushInstantGroup();
|
||||
}
|
||||
|
||||
ConsoleFunction( popInstantGroup, void, 1, 1, "()"
|
||||
DefineConsoleFunction( popInstantGroup, void, (), , "()"
|
||||
"@brief Pop and restore the last setting of $instantGroup off the stack.\n\n"
|
||||
"@note Currently only used for editors\n\n"
|
||||
"@ingroup Editors\n"
|
||||
|
|
@ -2438,11 +2436,11 @@ ConsoleFunction( popInstantGroup, void, 1, 1, "()"
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleFunction(getPrefsPath, const char *, 1, 2, "([relativeFileName])"
|
||||
DefineConsoleFunction( getPrefsPath, const char *, ( const char* relativeFileName ), , "([relativeFileName])"
|
||||
"@note Appears to be useless in Torque 3D, should be deprecated\n"
|
||||
"@internal")
|
||||
{
|
||||
const char *filename = Platform::getPrefsPath(argc > 1 ? (const char*)argv[1] : NULL);
|
||||
const char *filename = Platform::getPrefsPath(relativeFileName);
|
||||
if(filename == NULL || *filename == 0)
|
||||
return "";
|
||||
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ void ConsoleLogger::log( const char *consoleLine )
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod( ConsoleLogger, attach, bool, 2, 2, "() Attaches the logger to the console and begins writing to file"
|
||||
DefineConsoleMethod( ConsoleLogger, attach, bool, (), , "() Attaches the logger to the console and begins writing to file"
|
||||
"@tsexample\n"
|
||||
"// Create the logger\n"
|
||||
"// Will automatically start writing to testLogging.txt with normal priority\n"
|
||||
|
|
@ -247,7 +247,7 @@ ConsoleMethod( ConsoleLogger, attach, bool, 2, 2, "() Attaches the logger to the
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod( ConsoleLogger, detach, bool, 2, 2, "() Detaches the logger from the console and stops writing to file"
|
||||
DefineConsoleMethod( ConsoleLogger, detach, bool, (), , "() Detaches the logger from the console and stops writing to file"
|
||||
"@tsexample\n"
|
||||
"// Create the logger\n"
|
||||
"// Will automatically start writing to testLogging.txt with normal priority\n"
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "console/consoleInternal.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "console/consoleObject.h"
|
||||
#include "console/SimXMLDocument.h"
|
||||
|
||||
|
|
@ -313,7 +314,7 @@ namespace Con {
|
|||
}; // namespace Con
|
||||
|
||||
|
||||
ConsoleFunction(consoleExportXML, const char*, 1, 1, "Exports console definition XML representation")
|
||||
DefineConsoleFunction( consoleExportXML, const char*, (), ,"Exports console definition XML representation" )
|
||||
{
|
||||
Con::XMLExport xmlExport;
|
||||
String xml;
|
||||
|
|
|
|||
|
|
@ -245,6 +245,19 @@ struct EngineUnmarshallData< F32 >
|
|||
}
|
||||
};
|
||||
template<>
|
||||
struct EngineUnmarshallData< U8 >
|
||||
{
|
||||
U8 operator()( ConsoleValueRef &ref ) const
|
||||
{
|
||||
return (U8)((S32)ref);
|
||||
}
|
||||
|
||||
U8 operator()( const char* str ) const
|
||||
{
|
||||
return dAtoui( str );
|
||||
}
|
||||
};
|
||||
template<>
|
||||
struct EngineUnmarshallData< const char* >
|
||||
{
|
||||
const char* operator()( const char* str ) const
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "core/strings/stringUnit.h"
|
||||
#include "console/fieldBrushObject.h"
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
// Prefix added to dynamic-fields when they're used to store any copied static-fields when peristing.
|
||||
#define INTERNAL_FIELD_PREFIX "_fieldBrush_"
|
||||
|
|
@ -122,12 +123,12 @@ static char* suppressSpaces(const char* in_pname)
|
|||
//-----------------------------------------------------------------------------
|
||||
// Query Groups.
|
||||
//-----------------------------------------------------------------------------
|
||||
ConsoleMethod(FieldBrushObject, queryGroups, const char*, 3, 3, "(simObject) Query available static-field groups for selected object./\n"
|
||||
DefineConsoleMethod(FieldBrushObject, queryGroups, const char*, (const char* simObjName), , "(simObject) Query available static-field groups for selected object./\n"
|
||||
"@param simObject Object to query static-field groups on.\n"
|
||||
"@return Space-seperated static-field group list.")
|
||||
{
|
||||
// Fetch selected object.
|
||||
SimObject* pSimObject = dynamic_cast<SimObject*>( Sim::findObject( argv[2] ) );
|
||||
SimObject* pSimObject = dynamic_cast<SimObject*>( Sim::findObject( simObjName ) );
|
||||
|
||||
// Valid object?
|
||||
if ( pSimObject == NULL )
|
||||
|
|
@ -190,13 +191,13 @@ ConsoleMethod(FieldBrushObject, queryGroups, const char*, 3, 3, "(simObject) Que
|
|||
//-----------------------------------------------------------------------------
|
||||
// Query Fields.
|
||||
//-----------------------------------------------------------------------------
|
||||
ConsoleMethod(FieldBrushObject, queryFields, const char*, 3, 4, "(simObject, [groupList]) Query available static-fields for selected object./\n"
|
||||
DefineConsoleMethod(FieldBrushObject, queryFields, const char*, (const char* simObjName, const char* groupList), (""), "(simObject, [groupList]) Query available static-fields for selected object./\n"
|
||||
"@param simObject Object to query static-fields on.\n"
|
||||
"@param groupList groups to filter static-fields against.\n"
|
||||
"@return Space-seperated static-field list.")
|
||||
{
|
||||
// Fetch selected object.
|
||||
SimObject* pSimObject = dynamic_cast<SimObject*>( Sim::findObject( argv[2] ) );
|
||||
SimObject* pSimObject = dynamic_cast<SimObject*>( Sim::findObject( simObjName ) );
|
||||
|
||||
// Valid object?
|
||||
if ( pSimObject == NULL )
|
||||
|
|
@ -215,7 +216,7 @@ ConsoleMethod(FieldBrushObject, queryFields, const char*, 3, 4, "(simObject, [gr
|
|||
const AbstractClassRep::FieldList& staticFields = pSimObject->getFieldList();
|
||||
|
||||
// Did we specify a groups list?
|
||||
if ( argc < 4 )
|
||||
if (dStrcmp (groupList,"")==0 )
|
||||
{
|
||||
// No, so return all fields...
|
||||
|
||||
|
|
@ -263,7 +264,6 @@ ConsoleMethod(FieldBrushObject, queryFields, const char*, 3, 4, "(simObject, [gr
|
|||
// Group List.
|
||||
Vector<StringTableEntry> groups;
|
||||
// Yes, so fetch group list.
|
||||
const char* groupList = argv[3];
|
||||
// Yes, so calculate group Count.
|
||||
const U32 groupCount = StringUnit::getUnitCount( groupList, " \t\n" );
|
||||
|
||||
|
|
@ -366,13 +366,13 @@ ConsoleMethod(FieldBrushObject, queryFields, const char*, 3, 4, "(simObject, [gr
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copy Fields.
|
||||
//-----------------------------------------------------------------------------
|
||||
ConsoleMethod(FieldBrushObject, copyFields, void, 3, 4, "(simObject, [fieldList]) Copy selected static-fields for selected object./\n"
|
||||
DefineConsoleMethod(FieldBrushObject, copyFields, void, (const char* simObjName, const char* pFieldList), (""), "(simObject, [fieldList]) Copy selected static-fields for selected object./\n"
|
||||
"@param simObject Object to copy static-fields from.\n"
|
||||
"@param fieldList fields to filter static-fields against.\n"
|
||||
"@return No return value.")
|
||||
{
|
||||
// Fetch selected object.
|
||||
SimObject* pSimObject = dynamic_cast<SimObject*>( Sim::findObject( argv[2] ) );
|
||||
SimObject* pSimObject = dynamic_cast<SimObject*>( Sim::findObject( simObjName ) );
|
||||
|
||||
// Valid object?
|
||||
if ( pSimObject == NULL )
|
||||
|
|
@ -383,7 +383,6 @@ ConsoleMethod(FieldBrushObject, copyFields, void, 3, 4, "(simObject, [fieldList]
|
|||
}
|
||||
|
||||
// Fetch field list.
|
||||
const char* pFieldList = (argc > 3 ) ? (const char*)argv[3] : NULL;
|
||||
|
||||
// Copy Fields.
|
||||
object->copyFields( pSimObject, pFieldList );
|
||||
|
|
@ -501,12 +500,12 @@ void FieldBrushObject::copyFields( SimObject* pSimObject, const char* fieldList
|
|||
//-----------------------------------------------------------------------------
|
||||
// Paste Fields.
|
||||
//-----------------------------------------------------------------------------
|
||||
ConsoleMethod(FieldBrushObject, pasteFields, void, 3, 3, "(simObject) Paste copied static-fields to selected object./\n"
|
||||
DefineConsoleMethod(FieldBrushObject, pasteFields, void, (const char* simObjName), , "(simObject) Paste copied static-fields to selected object./\n"
|
||||
"@param simObject Object to paste static-fields to.\n"
|
||||
"@return No return value.")
|
||||
{
|
||||
// Fetch selected object.
|
||||
SimObject* pSimObject = dynamic_cast<SimObject*>( Sim::findObject( argv[2] ) );
|
||||
SimObject* pSimObject = dynamic_cast<SimObject*>( Sim::findObject( simObjName ) );
|
||||
|
||||
// Valid object?
|
||||
if ( pSimObject == NULL )
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "persistenceManager.h"
|
||||
#include "console/simSet.h"
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "core/stream/fileStream.h"
|
||||
#include "gui/core/guiTypes.h"
|
||||
#include "materials/customMaterialDefinition.h"
|
||||
|
|
@ -2189,22 +2190,22 @@ void PersistenceManager::deleteObjectsFromFile(const char* fileName)
|
|||
clearAll();
|
||||
}
|
||||
|
||||
ConsoleMethod( PersistenceManager, deleteObjectsFromFile, void, 3, 3, "( fileName )"
|
||||
DefineConsoleMethod( PersistenceManager, deleteObjectsFromFile, void, ( const char * fileName ), , "( fileName )"
|
||||
"Delete all of the objects that are created from the given file." )
|
||||
{
|
||||
// Delete Objects.
|
||||
object->deleteObjectsFromFile( argv[2] );
|
||||
object->deleteObjectsFromFile( fileName );
|
||||
}
|
||||
|
||||
ConsoleMethod( PersistenceManager, setDirty, void, 3, 4, "(SimObject object, [filename])"
|
||||
DefineConsoleMethod( PersistenceManager, setDirty, void, ( const char * objName, const char * fileName ), (""), "(SimObject object, [filename])"
|
||||
"Mark an existing SimObject as dirty (will be written out when saveDirty() is called).")
|
||||
{
|
||||
SimObject *dirtyObject = NULL;
|
||||
if (argv[2][0])
|
||||
if (dStrcmp(objName,"") != 0)
|
||||
{
|
||||
if (!Sim::findObject(argv[2], dirtyObject))
|
||||
if (!Sim::findObject(objName, dirtyObject))
|
||||
{
|
||||
Con::printf("%s(): Invalid SimObject: %s", (const char*)argv[0], (const char*)argv[2]);
|
||||
Con::printf("setDirty(): Invalid SimObject: %s", objName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -2213,28 +2214,28 @@ ConsoleMethod( PersistenceManager, setDirty, void, 3, 4, "(SimObject object, [fi
|
|||
|
||||
if( dirtyObject == Sim::getRootGroup() )
|
||||
{
|
||||
Con::errorf( "%s(): Cannot save RootGroup", (const char*)argv[ 0 ] );
|
||||
Con::errorf( "%s(): Cannot save RootGroup", objName );
|
||||
return;
|
||||
}
|
||||
|
||||
if (dirtyObject)
|
||||
{
|
||||
if (argc == 4 && argv[3][0])
|
||||
object->setDirty(dirtyObject, argv[3]);
|
||||
if (dStrcmp( fileName,"")!=0)
|
||||
object->setDirty(dirtyObject, fileName);
|
||||
else
|
||||
object->setDirty(dirtyObject);
|
||||
}
|
||||
}
|
||||
|
||||
ConsoleMethod( PersistenceManager, removeDirty, void, 3, 3, "(SimObject object)"
|
||||
DefineConsoleMethod( PersistenceManager, removeDirty, void, ( const char * objName ), , "(SimObject object)"
|
||||
"Remove a SimObject from the dirty list.")
|
||||
{
|
||||
SimObject *dirtyObject = NULL;
|
||||
if (argv[2][0])
|
||||
if (dStrcmp( objName,"")!=0)
|
||||
{
|
||||
if (!Sim::findObject(argv[2], dirtyObject))
|
||||
if (!Sim::findObject(objName, dirtyObject))
|
||||
{
|
||||
Con::printf("%s(): Invalid SimObject: %s", (const char*)argv[0], (const char*)argv[2]);
|
||||
Con::printf("%s(): Invalid SimObject: %s", object->getName(),objName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -2243,15 +2244,15 @@ ConsoleMethod( PersistenceManager, removeDirty, void, 3, 3, "(SimObject object)"
|
|||
object->removeDirty(dirtyObject);
|
||||
}
|
||||
|
||||
ConsoleMethod( PersistenceManager, isDirty, bool, 3, 3, "(SimObject object)"
|
||||
DefineConsoleMethod( PersistenceManager, isDirty, bool, ( const char * objName ), , "(SimObject object)"
|
||||
"Returns true if the SimObject is on the dirty list.")
|
||||
{
|
||||
SimObject *dirtyObject = NULL;
|
||||
if (argv[2][0])
|
||||
if (dStrcmp ( objName,"")!=0)
|
||||
{
|
||||
if (!Sim::findObject(argv[2], dirtyObject))
|
||||
if (!Sim::findObject(objName, dirtyObject))
|
||||
{
|
||||
Con::printf("%s(): Invalid SimObject: %s", (const char*)argv[0], (const char*)argv[2]);
|
||||
Con::printf("%s(): Invalid SimObject: %s", object->getName(), objName);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -2262,25 +2263,24 @@ ConsoleMethod( PersistenceManager, isDirty, bool, 3, 3, "(SimObject object)"
|
|||
return false;
|
||||
}
|
||||
|
||||
ConsoleMethod( PersistenceManager, hasDirty, bool, 2, 2, "()"
|
||||
DefineConsoleMethod( PersistenceManager, hasDirty, bool, (), , "()"
|
||||
"Returns true if the manager has dirty objects to save." )
|
||||
{
|
||||
return object->hasDirty();
|
||||
}
|
||||
|
||||
ConsoleMethod( PersistenceManager, getDirtyObjectCount, S32, 2, 2, "()"
|
||||
DefineConsoleMethod( PersistenceManager, getDirtyObjectCount, S32, (), , "()"
|
||||
"Returns the number of dirty objects." )
|
||||
{
|
||||
return object->getDirtyList().size();
|
||||
}
|
||||
|
||||
ConsoleMethod( PersistenceManager, getDirtyObject, S32, 3, 3, "( index )"
|
||||
DefineConsoleMethod( PersistenceManager, getDirtyObject, S32, (S32 index), , "( index )"
|
||||
"Returns the ith dirty object." )
|
||||
{
|
||||
const S32 index = dAtoi( argv[2] );
|
||||
if ( index < 0 || index >= object->getDirtyList().size() )
|
||||
{
|
||||
Con::warnf( "PersistenceManager::getDirtyObject() - Index (%s) out of range.", (const char*)argv[2] );
|
||||
Con::warnf( "PersistenceManager::getDirtyObject() - Index (%s) out of range.", index );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2291,7 +2291,7 @@ ConsoleMethod( PersistenceManager, getDirtyObject, S32, 3, 3, "( index )"
|
|||
return ( dirtyObject.getObject() ) ? dirtyObject.getObject()->getId() : 0;
|
||||
}
|
||||
|
||||
ConsoleMethod( PersistenceManager, listDirty, void, 2, 2, "()"
|
||||
DefineConsoleMethod( PersistenceManager, listDirty, void, (), , "()"
|
||||
"Prints the dirty list to the console.")
|
||||
{
|
||||
const PersistenceManager::DirtyList dirtyList = object->getDirtyList();
|
||||
|
|
@ -2319,21 +2319,21 @@ ConsoleMethod( PersistenceManager, listDirty, void, 2, 2, "()"
|
|||
}
|
||||
}
|
||||
|
||||
ConsoleMethod( PersistenceManager, saveDirty, bool, 2, 2, "()"
|
||||
DefineConsoleMethod( PersistenceManager, saveDirty, bool, (), , "()"
|
||||
"Saves all of the SimObject's on the dirty list to their respective files.")
|
||||
{
|
||||
return object->saveDirty();
|
||||
}
|
||||
|
||||
ConsoleMethod( PersistenceManager, saveDirtyObject, bool, 3, 3, "(SimObject object)"
|
||||
DefineConsoleMethod( PersistenceManager, saveDirtyObject, bool, (const char * objName), , "(SimObject object)"
|
||||
"Save a dirty SimObject to it's file.")
|
||||
{
|
||||
SimObject *dirtyObject = NULL;
|
||||
if (argv[2][0])
|
||||
if (dStrcmp ( objName, "")!=0)
|
||||
{
|
||||
if (!Sim::findObject(argv[2], dirtyObject))
|
||||
if (!Sim::findObject(objName, dirtyObject))
|
||||
{
|
||||
Con::printf("%s(): Invalid SimObject: %s", (const char*)argv[0], (const char*)argv[2]);
|
||||
Con::printf("%s(): Invalid SimObject: %s", object->getName(), objName);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -2343,51 +2343,51 @@ ConsoleMethod( PersistenceManager, saveDirtyObject, bool, 3, 3, "(SimObject obje
|
|||
return false;
|
||||
}
|
||||
|
||||
ConsoleMethod( PersistenceManager, clearAll, void, 2, 2, "()"
|
||||
DefineConsoleMethod( PersistenceManager, clearAll, void, (), , "()"
|
||||
"Clears all the tracked objects without saving them." )
|
||||
{
|
||||
object->clearAll();
|
||||
}
|
||||
|
||||
ConsoleMethod( PersistenceManager, removeObjectFromFile, void, 3, 4, "(SimObject object, [filename])"
|
||||
DefineConsoleMethod( PersistenceManager, removeObjectFromFile, void, (const char * objName, const char * filename),("") , "(SimObject object, [filename])"
|
||||
"Remove an existing SimObject from a file (can optionally specify a different file than \
|
||||
the one it was created in.")
|
||||
{
|
||||
SimObject *dirtyObject = NULL;
|
||||
if (argv[2][0])
|
||||
if (dStrcmp ( objName , "")!=0)
|
||||
{
|
||||
if (!Sim::findObject(argv[2], dirtyObject))
|
||||
if (!Sim::findObject(objName, dirtyObject))
|
||||
{
|
||||
Con::printf("%s(): Invalid SimObject: %s", (const char*)argv[0], (const char*)argv[2]);
|
||||
Con::printf("%s(): Invalid SimObject: %s", object->getName(), objName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (dirtyObject)
|
||||
{
|
||||
if (argc == 4 && argv[3][0])
|
||||
object->removeObjectFromFile(dirtyObject, argv[3]);
|
||||
if (dStrcmp( filename,"")!=0)
|
||||
object->removeObjectFromFile(dirtyObject, filename);
|
||||
else
|
||||
object->removeObjectFromFile(dirtyObject);
|
||||
}
|
||||
}
|
||||
|
||||
ConsoleMethod( PersistenceManager, removeField, void, 4, 4, "(SimObject object, string fieldName)"
|
||||
DefineConsoleMethod( PersistenceManager, removeField, void, (const char * objName, const char * fieldName), , "(SimObject object, string fieldName)"
|
||||
"Remove a specific field from an object declaration.")
|
||||
{
|
||||
SimObject *dirtyObject = NULL;
|
||||
if (argv[2][0])
|
||||
if (dStrcmp(objName,"")!=0)
|
||||
{
|
||||
if (!Sim::findObject(argv[2], dirtyObject))
|
||||
if (!Sim::findObject(objName, dirtyObject))
|
||||
{
|
||||
Con::printf("%s(): Invalid SimObject: %s", (const char*)argv[0], (const char*)argv[2]);
|
||||
Con::printf("%s(): Invalid SimObject: %s", object->getName(), objName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (dirtyObject)
|
||||
{
|
||||
if (argv[3][0])
|
||||
object->addRemoveField(dirtyObject, argv[3]);
|
||||
if (dStrcmp(fieldName,"") != 0)
|
||||
object->addRemoveField(dirtyObject, fieldName);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "console/console.h"
|
||||
|
||||
#include "console/engineAPI.h"
|
||||
#include "console/sim.h"
|
||||
#include "console/simEvents.h"
|
||||
#include "console/simObject.h"
|
||||
|
|
@ -86,23 +86,21 @@ namespace Sim
|
|||
|
||||
ConsoleFunctionGroupBegin ( SimFunctions, "Functions relating to Sim.");
|
||||
|
||||
ConsoleFunction(nameToID, S32, 2, 2, "nameToID(object)")
|
||||
DefineConsoleFunction( nameToID, S32, (const char * objectName), ,"nameToID(object)")
|
||||
{
|
||||
TORQUE_UNUSED(argc);
|
||||
SimObject *obj = Sim::findObject(argv[1]);
|
||||
SimObject *obj = Sim::findObject(objectName);
|
||||
if(obj)
|
||||
return obj->getId();
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
ConsoleFunction(isObject, bool, 2, 2, "isObject(object)")
|
||||
DefineConsoleFunction( isObject, bool, (const char * objectName), ,"isObject(object)")
|
||||
{
|
||||
TORQUE_UNUSED(argc);
|
||||
if (!dStrcmp(argv[1], "0") || !dStrcmp(argv[1], ""))
|
||||
if (!dStrcmp(objectName, "0") || !dStrcmp(objectName, ""))
|
||||
return false;
|
||||
else
|
||||
return (Sim::findObject(argv[1]) != NULL);
|
||||
return (Sim::findObject(objectName) != NULL);
|
||||
}
|
||||
|
||||
ConsoleDocFragment _spawnObject1(
|
||||
|
|
@ -135,23 +133,14 @@ ConsoleDocFragment _spawnObject1(
|
|||
"bool spawnObject(class [, dataBlock, name, properties, script]);"
|
||||
);
|
||||
|
||||
ConsoleFunction(spawnObject, S32, 3, 6, "spawnObject(class [, dataBlock, name, properties, script])"
|
||||
DefineConsoleFunction( spawnObject, S32, ( const char * spawnClass
|
||||
, const char * spawnDataBlock
|
||||
, const char * spawnName
|
||||
, const char * spawnProperties
|
||||
, const char * spawnScript
|
||||
),("","","","","") ,"spawnObject(class [, dataBlock, name, properties, script])"
|
||||
"@hide")
|
||||
{
|
||||
String spawnClass((const char*)argv[1]);
|
||||
String spawnDataBlock;
|
||||
String spawnName;
|
||||
String spawnProperties;
|
||||
String spawnScript;
|
||||
|
||||
if (argc >= 3)
|
||||
spawnDataBlock = (const char*)argv[2];
|
||||
if (argc >= 4)
|
||||
spawnName = (const char*)argv[3];
|
||||
if (argc >= 5)
|
||||
spawnProperties = (const char*)argv[4];
|
||||
if (argc >= 6)
|
||||
spawnScript = (const char*)argv[5];
|
||||
|
||||
SimObject* spawnObject = Sim::spawnObject(spawnClass, spawnDataBlock, spawnName, spawnProperties, spawnScript);
|
||||
|
||||
|
|
@ -161,35 +150,35 @@ ConsoleFunction(spawnObject, S32, 3, 6, "spawnObject(class [, dataBlock, name, p
|
|||
return -1;
|
||||
}
|
||||
|
||||
ConsoleFunction(cancel,void,2,2,"cancel(eventId)")
|
||||
DefineConsoleFunction( cancel, void, (S32 eventId), ,"cancel(eventId)")
|
||||
{
|
||||
Sim::cancelEvent(dAtoi(argv[1]));
|
||||
Sim::cancelEvent(eventId);
|
||||
}
|
||||
|
||||
ConsoleFunction(cancelAll,void,2,2,"cancelAll(objectId): cancel pending events on the specified object. Events will be automatically cancelled if object is deleted.")
|
||||
DefineConsoleFunction( cancelAll, void, (const char * objectId), ,"cancelAll(objectId): cancel pending events on the specified object. Events will be automatically cancelled if object is deleted.")
|
||||
{
|
||||
Sim::cancelPendingEvents(Sim::findObject(argv[1]));
|
||||
Sim::cancelPendingEvents(Sim::findObject(objectId));
|
||||
}
|
||||
|
||||
ConsoleFunction(isEventPending, bool, 2, 2, "isEventPending(%scheduleId);")
|
||||
DefineConsoleFunction( isEventPending, bool, (S32 scheduleId), ,"isEventPending(%scheduleId);")
|
||||
{
|
||||
return Sim::isEventPending(dAtoi(argv[1]));
|
||||
return Sim::isEventPending(scheduleId);
|
||||
}
|
||||
|
||||
ConsoleFunction(getEventTimeLeft, S32, 2, 2, "getEventTimeLeft(scheduleId) Get the time left in ms until this event will trigger.")
|
||||
DefineConsoleFunction( getEventTimeLeft, S32, (S32 scheduleId), ,"getEventTimeLeft(scheduleId) Get the time left in ms until this event will trigger.")
|
||||
{
|
||||
return Sim::getEventTimeLeft(dAtoi(argv[1]));
|
||||
return Sim::getEventTimeLeft(scheduleId);
|
||||
}
|
||||
|
||||
ConsoleFunction(getScheduleDuration, S32, 2, 2, "getScheduleDuration(%scheduleId);")
|
||||
DefineConsoleFunction( getScheduleDuration, S32, (S32 scheduleId), ,"getScheduleDuration(%scheduleId);" )
|
||||
{
|
||||
TORQUE_UNUSED(argc); S32 ret = Sim::getScheduleDuration(dAtoi(argv[1]));
|
||||
S32 ret = Sim::getScheduleDuration(scheduleId);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ConsoleFunction(getTimeSinceStart, S32, 2, 2, "getTimeSinceStart(%scheduleId);")
|
||||
DefineConsoleFunction( getTimeSinceStart, S32, (S32 scheduleId), ,"getTimeSinceStart(%scheduleId);" )
|
||||
{
|
||||
TORQUE_UNUSED(argc); S32 ret = Sim::getTimeSinceStart(dAtoi(argv[1]));
|
||||
S32 ret = Sim::getTimeSinceStart(scheduleId);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -214,7 +203,7 @@ ConsoleFunction(schedule, S32, 4, 0, "schedule(time, refobject|0, command, <arg1
|
|||
return ret;
|
||||
}
|
||||
|
||||
ConsoleFunction(getUniqueName, const char*, 2, 2,
|
||||
DefineConsoleFunction( getUniqueName, const char*, (const char * baseName), ,
|
||||
"( String baseName )\n"
|
||||
"@brief Returns a unique unused SimObject name based on a given base name.\n\n"
|
||||
"@baseName Name to conver to a unique string if another instance exists\n"
|
||||
|
|
@ -222,7 +211,7 @@ ConsoleFunction(getUniqueName, const char*, 2, 2,
|
|||
"@ingroup Editors\n"
|
||||
"@internal")
|
||||
{
|
||||
String outName = Sim::getUniqueName( argv[1] );
|
||||
String outName = Sim::getUniqueName( baseName );
|
||||
|
||||
if ( outName.isEmpty() )
|
||||
return NULL;
|
||||
|
|
@ -233,7 +222,7 @@ ConsoleFunction(getUniqueName, const char*, 2, 2,
|
|||
return buffer;
|
||||
}
|
||||
|
||||
ConsoleFunction(getUniqueInternalName, const char*, 4, 4,
|
||||
DefineConsoleFunction( getUniqueInternalName, const char*, (const char * baseName, const char * setString, bool searchChildren), ,
|
||||
"( String baseName, SimSet set, bool searchChildren )\n"
|
||||
"@brief Returns a unique unused internal name within the SimSet/Group based on a given base name.\n\n"
|
||||
"@note Currently only used by editors\n"
|
||||
|
|
@ -241,13 +230,13 @@ ConsoleFunction(getUniqueInternalName, const char*, 4, 4,
|
|||
"@internal")
|
||||
{
|
||||
SimSet *set;
|
||||
if ( !Sim::findObject( argv[2], set ) )
|
||||
if ( !Sim::findObject( setString, set ) )
|
||||
{
|
||||
Con::errorf( "getUniqueInternalName() - invalid parameter for SimSet." );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
String outName = Sim::getUniqueInternalName( argv[1], set, dAtob(argv[3]) );
|
||||
String outName = Sim::getUniqueInternalName( baseName, set, searchChildren );
|
||||
|
||||
if ( outName.isEmpty() )
|
||||
return NULL;
|
||||
|
|
@ -258,13 +247,12 @@ ConsoleFunction(getUniqueInternalName, const char*, 4, 4,
|
|||
return buffer;
|
||||
}
|
||||
|
||||
ConsoleFunction( isValidObjectName, bool, 2, 2, "( string name )"
|
||||
DefineConsoleFunction( isValidObjectName, bool, (const char * name), , "( string name )"
|
||||
"@brief Return true if the given name makes for a valid object name.\n\n"
|
||||
"@param name Name of object\n"
|
||||
"@return True if name is allowed, false if denied (usually because it starts with a number, _, or invalid character"
|
||||
"@ingroup Console")
|
||||
{
|
||||
const char* name = argv[ 1 ];
|
||||
return Sim::isValidObjectName( name );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "console/simPersistSet.h"
|
||||
#include "console/simPersistID.h"
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
|
||||
IMPLEMENT_CONOBJECT( SimPersistSet );
|
||||
|
|
@ -186,7 +187,7 @@ void SimPersistSet::addObject( SimObject* object )
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod( SimPersistSet, resolvePersistentIds, void, 2, 2, "() - Try to bind unresolved persistent IDs in the set." )
|
||||
DefineConsoleMethod( SimPersistSet, resolvePersistentIds, void, (), , "() - Try to bind unresolved persistent IDs in the set." )
|
||||
{
|
||||
object->resolvePIDs();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "core/stringTable.h"
|
||||
#include "console/console.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "core/stream/fileStream.h"
|
||||
#include "sim/actionMap.h"
|
||||
#include "core/fileObject.h"
|
||||
|
|
@ -950,7 +951,7 @@ DefineEngineMethod( SimSet, clear, void, (),,
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
//UNSAFE; don't want this in the new API
|
||||
ConsoleMethod( SimSet, deleteAllObjects, void, 2, 2, "() Delete all objects in the set." )
|
||||
DefineConsoleMethod( SimSet, deleteAllObjects, void, (), , "() Delete all objects in the set." )
|
||||
{
|
||||
object->deleteAllObjects();
|
||||
}
|
||||
|
|
@ -1022,7 +1023,7 @@ DEFINE_CALLIN( fnSimSet_getCountRecursive, getCountRecursive, SimSet, U32, ( Sim
|
|||
return set->sizeRecursive();
|
||||
}
|
||||
|
||||
ConsoleMethod( SimSet, getFullCount, S32, 2, 2, "() Get the number of direct and indirect child objects contained in the set.\n"
|
||||
DefineConsoleMethod( SimSet, getFullCount, S32, (), , "() Get the number of direct and indirect child objects contained in the set.\n"
|
||||
"@return The number of objects contained in the set as well as in other sets contained directly or indirectly in the set." )
|
||||
{
|
||||
return object->sizeRecursive();
|
||||
|
|
@ -1118,10 +1119,10 @@ DefineEngineMethod( SimSet, pushToBack, void, ( SimObject* obj ),,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod( SimSet, sort, void, 3, 3, "( string callbackFunction ) Sort the objects in the set using the given comparison function.\n"
|
||||
DefineConsoleMethod( SimSet, sort, void, ( const char * callbackFunction ), , "( string callbackFunction ) Sort the objects in the set using the given comparison function.\n"
|
||||
"@param callbackFunction Name of a function that takes two object arguments A and B and returns -1 if A is less, 1 if B is less, and 0 if both are equal." )
|
||||
{
|
||||
object->scriptSort( (const char*)argv[2] );
|
||||
object->scriptSort( callbackFunction );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "core/frameAllocator.h"
|
||||
#include "console/console.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "core/stringTable.h"
|
||||
#include "console/consoleInternal.h"
|
||||
#include "console/ast.h"
|
||||
|
|
@ -112,24 +113,25 @@ MODULE_END;
|
|||
// BRKCLR file line - sent when a breakpoint cannot be moved to a breakable line on the client.
|
||||
//
|
||||
|
||||
|
||||
ConsoleFunction( dbgSetParameters, void, 3, 4, "(int port, string password, bool waitForClient)"
|
||||
DefineConsoleFunction( dbgSetParameters, void, (S32 port, const char * password, bool waitForClient ), (false), "( int port, string password, bool waitForClient )"
|
||||
"Open a debug server port on the specified port, requiring the specified password, "
|
||||
"and optionally waiting for the debug client to connect.\n"
|
||||
"@internal Primarily used for Torsion and other debugging tools")
|
||||
{
|
||||
if (TelDebugger)
|
||||
TelDebugger->setDebugParameters(dAtoi(argv[1]), argv[2], argc > 3 ? dAtob(argv[3]) : false );
|
||||
{
|
||||
TelDebugger->setDebugParameters(port, password, waitForClient );
|
||||
}
|
||||
}
|
||||
|
||||
ConsoleFunction( dbgIsConnected, bool, 1, 1, "()"
|
||||
DefineConsoleFunction( dbgIsConnected, bool, (), , "()"
|
||||
"Returns true if a script debugging client is connected else return false.\n"
|
||||
"@internal Primarily used for Torsion and other debugging tools")
|
||||
{
|
||||
return TelDebugger && TelDebugger->isConnected();
|
||||
}
|
||||
|
||||
ConsoleFunction( dbgDisconnect, void, 1, 1, "()"
|
||||
DefineConsoleFunction( dbgDisconnect, void, (), , "()"
|
||||
"Forcibly disconnects any attached script debugging client.\n"
|
||||
"@internal Primarily used for Torsion and other debugging tools")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "core/strings/stringFunctions.h"
|
||||
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
|
||||
bool gLogToConsole = false;
|
||||
|
|
@ -49,14 +50,13 @@ static const char *packetTypeNames[] =
|
|||
//-----------------------------------------------------------------
|
||||
//-----------------------------------------------------------------
|
||||
//-----------------------------------------------------------------
|
||||
ConsoleFunction(DNetSetLogging, void, 2, 2, "(bool enabled)"
|
||||
DefineConsoleFunction( DNetSetLogging, void, (bool enabled), , "(bool enabled)"
|
||||
"@brief Enables logging of the connection protocols\n\n"
|
||||
"When enabled a lot of network debugging information is sent to the console.\n"
|
||||
"@param enabled True to enable, false to disable\n"
|
||||
"@ingroup Networking")
|
||||
{
|
||||
TORQUE_UNUSED(argc);
|
||||
gLogToConsole = dAtob(argv[1]);
|
||||
gLogToConsole = enabled;
|
||||
}
|
||||
|
||||
ConnectionProtocol::ConnectionProtocol()
|
||||
|
|
|
|||
|
|
@ -484,19 +484,17 @@ static ConsoleDocFragment _FileObjectwriteObject2(
|
|||
"FileObject",
|
||||
"void writeObject( SimObject* object, string prepend);");
|
||||
|
||||
ConsoleMethod( FileObject, writeObject, void, 3, 4, "FileObject.writeObject(SimObject, object prepend)"
|
||||
DefineConsoleMethod( FileObject, writeObject, void, (const char * simName, const char * objName), (""), "FileObject.writeObject(SimObject, object prepend)"
|
||||
"@hide")
|
||||
{
|
||||
SimObject* obj = Sim::findObject( argv[2] );
|
||||
SimObject* obj = Sim::findObject( simName );
|
||||
if( !obj )
|
||||
{
|
||||
Con::printf("FileObject::writeObject - Invalid Object!");
|
||||
return;
|
||||
}
|
||||
|
||||
const char *objName = NULL;
|
||||
if( argc == 4 )
|
||||
objName = (const char*)argv[3];
|
||||
if (!dStrcmp(objName,""))
|
||||
objName = NULL;
|
||||
|
||||
object->writeObject( obj, (const U8*)objName );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,16 +221,18 @@ ResourceBase ResourceManager::nextResource()
|
|||
|
||||
ConsoleFunctionGroupBegin(ResourceManagerFunctions, "Resource management functions.");
|
||||
|
||||
#ifdef TORQUE_DEBUG
|
||||
|
||||
ConsoleFunction(resourceDump, void, 1, 1, "()"
|
||||
"@brief List the currently managed resources\n\n"
|
||||
"Currently used by editors only, internal\n"
|
||||
"@ingroup Editors\n"
|
||||
"@internal")
|
||||
{
|
||||
#ifdef TORQUE_DEBUG
|
||||
ResourceManager::get().dumpToConsole();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
DefineEngineFunction( reloadResource, void, ( const char* path ),,
|
||||
"Force the resource at specified input path to be reloaded\n"
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include "core/frameAllocator.h"
|
||||
#include "core/strings/unicode.h"
|
||||
#include "core/strings/stringFunctions.h"
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
|
||||
#if defined(TORQUE_DEBUG)
|
||||
|
|
@ -47,12 +48,12 @@
|
|||
void dumpAllStrings();
|
||||
};
|
||||
|
||||
ConsoleFunction(sbmDumpStats, void, 1, 1, "")
|
||||
DefineConsoleFunction( sbmDumpStats, void, (), , "()")
|
||||
{
|
||||
StringBufferManager::getManager().dumpStats();
|
||||
}
|
||||
|
||||
ConsoleFunction(sbmDumpStrings, void, 1, 1, "")
|
||||
DefineConsoleFunction( sbmDumpStrings, void, (), , "()")
|
||||
{
|
||||
StringBufferManager::getManager().dumpAllStrings();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ namespace KeyCmp
|
|||
#include "core/util/tVector.h"
|
||||
#include "core/dataChunker.h"
|
||||
#include "console/console.h"
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
#include "math/mMathFn.h"
|
||||
|
||||
|
|
@ -476,15 +477,18 @@ static U32 sgStringMemBytes;
|
|||
/// Tracks the number of Strings which are currently instantiated.
|
||||
static U32 sgStringInstances;
|
||||
|
||||
ConsoleFunction( dumpStringMemStats, void, 1, 1, "()"
|
||||
|
||||
|
||||
#endif
|
||||
DefineConsoleFunction( dumpStringMemStats, void, (), , "()"
|
||||
"@brief Dumps information about String memory usage\n\n"
|
||||
"@ingroup Debugging\n"
|
||||
"@ingroup Strings\n")
|
||||
{
|
||||
#ifdef TORQUE_DEBUG
|
||||
Con::printf( "String Data: %i instances, %i bytes", sgStringInstances, sgStringMemBytes );
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include "environment/editors/guiMeshRoadEditorCtrl.h"
|
||||
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "environment/meshRoad.h"
|
||||
#include "renderInstance/renderPassManager.h"
|
||||
#include "collision/collision.h"
|
||||
|
|
@ -1185,125 +1186,95 @@ void GuiMeshRoadEditorCtrl::matchTerrainToRoad()
|
|||
// with the terrain underneath it.
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiMeshRoadEditorCtrl, deleteNode, void, 2, 2, "deleteNode()" )
|
||||
DefineConsoleMethod( GuiMeshRoadEditorCtrl, deleteNode, void, (), , "deleteNode()" )
|
||||
{
|
||||
object->deleteSelectedNode();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiMeshRoadEditorCtrl, getMode, const char*, 2, 2, "" )
|
||||
DefineConsoleMethod( GuiMeshRoadEditorCtrl, getMode, const char*, (), , "" )
|
||||
{
|
||||
return object->getMode();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiMeshRoadEditorCtrl, setMode, void, 3, 3, "setMode( String mode )" )
|
||||
DefineConsoleMethod( GuiMeshRoadEditorCtrl, setMode, void, (const char * mode), , "setMode( String mode )" )
|
||||
{
|
||||
String newMode = ( argv[2] );
|
||||
String newMode = ( mode );
|
||||
object->setMode( newMode );
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiMeshRoadEditorCtrl, getNodeWidth, F32, 2, 2, "" )
|
||||
DefineConsoleMethod( GuiMeshRoadEditorCtrl, getNodeWidth, F32, (), , "" )
|
||||
{
|
||||
return object->getNodeWidth();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiMeshRoadEditorCtrl, setNodeWidth, void, 3, 3, "" )
|
||||
DefineConsoleMethod( GuiMeshRoadEditorCtrl, setNodeWidth, void, ( F32 width ), , "" )
|
||||
{
|
||||
object->setNodeWidth( dAtof(argv[2]) );
|
||||
object->setNodeWidth( width );
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiMeshRoadEditorCtrl, getNodeDepth, F32, 2, 2, "" )
|
||||
DefineConsoleMethod( GuiMeshRoadEditorCtrl, getNodeDepth, F32, (), , "" )
|
||||
{
|
||||
return object->getNodeDepth();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiMeshRoadEditorCtrl, setNodeDepth, void, 3, 3, "" )
|
||||
DefineConsoleMethod( GuiMeshRoadEditorCtrl, setNodeDepth, void, ( F32 depth ), , "" )
|
||||
{
|
||||
object->setNodeDepth( dAtof(argv[2]) );
|
||||
object->setNodeDepth( depth );
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiMeshRoadEditorCtrl, getNodePosition, const char*, 2, 2, "" )
|
||||
DefineConsoleMethod( GuiMeshRoadEditorCtrl, getNodePosition, Point3F, (), , "" )
|
||||
{
|
||||
static const U32 bufSize = 256;
|
||||
char* returnBuffer = Con::getReturnBuffer(bufSize);
|
||||
|
||||
dSprintf(returnBuffer, bufSize, "%f %f %f",
|
||||
object->getNodePosition().x, object->getNodePosition().y, object->getNodePosition().z);
|
||||
|
||||
return returnBuffer;
|
||||
return object->getNodePosition();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiMeshRoadEditorCtrl, setNodePosition, void, 3, 3, "" )
|
||||
DefineConsoleMethod( GuiMeshRoadEditorCtrl, setNodePosition, void, (Point3F pos), , "" )
|
||||
{
|
||||
Point3F pos;
|
||||
|
||||
S32 count = dSscanf( argv[2], "%f %f %f",
|
||||
&pos.x, &pos.y, &pos.z);
|
||||
|
||||
if ( (count != 3) )
|
||||
{
|
||||
Con::printf("Failed to parse node information \"px py pz\" from '%s'", (const char*)argv[3]);
|
||||
return;
|
||||
}
|
||||
|
||||
object->setNodePosition( pos );
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiMeshRoadEditorCtrl, getNodeNormal, const char*, 2, 2, "" )
|
||||
DefineConsoleMethod( GuiMeshRoadEditorCtrl, getNodeNormal, Point3F, (), , "" )
|
||||
{
|
||||
static const U32 bufSize = 256;
|
||||
char* returnBuffer = Con::getReturnBuffer(bufSize);
|
||||
|
||||
dSprintf(returnBuffer, bufSize, "%f %f %f",
|
||||
object->getNodeNormal().x, object->getNodeNormal().y, object->getNodeNormal().z);
|
||||
|
||||
return returnBuffer;
|
||||
return object->getNodeNormal();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiMeshRoadEditorCtrl, setNodeNormal, void, 3, 3, "" )
|
||||
DefineConsoleMethod( GuiMeshRoadEditorCtrl, setNodeNormal, void, (Point3F normal), , "" )
|
||||
{
|
||||
VectorF normal;
|
||||
|
||||
S32 count = dSscanf( argv[2], "%f %f %f",
|
||||
&normal.x, &normal.y, &normal.z);
|
||||
|
||||
if ( (count != 3) )
|
||||
{
|
||||
Con::printf("Failed to parse node information \"px py pz\" from '%s'", (const char*)argv[3]);
|
||||
return;
|
||||
}
|
||||
|
||||
object->setNodeNormal( normal );
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiMeshRoadEditorCtrl, setSelectedRoad, void, 2, 3, "" )
|
||||
DefineConsoleMethod( GuiMeshRoadEditorCtrl, setSelectedRoad, void, (const char * objName), (""), "" )
|
||||
{
|
||||
if ( argc == 2 )
|
||||
if ( dStrcmp(objName, "" )==0)
|
||||
object->setSelectedRoad(NULL);
|
||||
else
|
||||
{
|
||||
MeshRoad *road = NULL;
|
||||
if ( Sim::findObject( argv[2], road ) )
|
||||
if ( Sim::findObject( objName, road ) )
|
||||
object->setSelectedRoad(road);
|
||||
}
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiMeshRoadEditorCtrl, getSelectedRoad, const char*, 2, 2, "" )
|
||||
DefineConsoleMethod( GuiMeshRoadEditorCtrl, getSelectedRoad, S32, (), , "" )
|
||||
{
|
||||
MeshRoad *road = object->getSelectedRoad();
|
||||
if ( !road )
|
||||
return NULL;
|
||||
|
||||
return road->getIdString();
|
||||
return road->getId();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiMeshRoadEditorCtrl, regenerate, void, 2, 2, "" )
|
||||
DefineConsoleMethod( GuiMeshRoadEditorCtrl, regenerate, void, (), , "" )
|
||||
{
|
||||
MeshRoad *road = object->getSelectedRoad();
|
||||
if ( road )
|
||||
road->regenerate();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiMeshRoadEditorCtrl, matchTerrainToRoad, void, 2, 2, "" )
|
||||
DefineConsoleMethod( GuiMeshRoadEditorCtrl, matchTerrainToRoad, void, (), , "" )
|
||||
{
|
||||
object->matchTerrainToRoad();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include "environment/editors/guiRiverEditorCtrl.h"
|
||||
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "environment/river.h"
|
||||
#include "renderInstance/renderPassManager.h"
|
||||
#include "collision/collision.h"
|
||||
|
|
@ -1392,118 +1393,87 @@ void GuiRiverEditorCtrl::_renderSelectedRiver( ObjectRenderInst *ri, SceneRender
|
|||
}
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiRiverEditorCtrl, deleteNode, void, 2, 2, "deleteNode()" )
|
||||
DefineConsoleMethod( GuiRiverEditorCtrl, deleteNode, void, (), , "deleteNode()" )
|
||||
{
|
||||
object->deleteSelectedNode();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiRiverEditorCtrl, getMode, const char*, 2, 2, "" )
|
||||
DefineConsoleMethod( GuiRiverEditorCtrl, getMode, const char*, (), , "" )
|
||||
{
|
||||
return object->getMode();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiRiverEditorCtrl, setMode, void, 3, 3, "setMode( String mode )" )
|
||||
DefineConsoleMethod( GuiRiverEditorCtrl, setMode, void, ( const char * mode ), , "setMode( String mode )" )
|
||||
{
|
||||
String newMode = ( argv[2] );
|
||||
String newMode = ( mode );
|
||||
object->setMode( newMode );
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiRiverEditorCtrl, getNodeWidth, F32, 2, 2, "" )
|
||||
DefineConsoleMethod( GuiRiverEditorCtrl, getNodeWidth, F32, (), , "" )
|
||||
{
|
||||
return object->getNodeWidth();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiRiverEditorCtrl, setNodeWidth, void, 3, 3, "" )
|
||||
DefineConsoleMethod( GuiRiverEditorCtrl, setNodeWidth, void, ( F32 width ), , "" )
|
||||
{
|
||||
object->setNodeWidth( dAtof(argv[2]) );
|
||||
object->setNodeWidth( width );
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiRiverEditorCtrl, getNodeDepth, F32, 2, 2, "" )
|
||||
DefineConsoleMethod( GuiRiverEditorCtrl, getNodeDepth, F32, (), , "" )
|
||||
{
|
||||
return object->getNodeDepth();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiRiverEditorCtrl, setNodeDepth, void, 3, 3, "" )
|
||||
DefineConsoleMethod( GuiRiverEditorCtrl, setNodeDepth, void, ( F32 depth ), , "" )
|
||||
{
|
||||
object->setNodeDepth( dAtof(argv[2]) );
|
||||
object->setNodeDepth( depth );
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiRiverEditorCtrl, getNodePosition, const char*, 2, 2, "" )
|
||||
DefineConsoleMethod( GuiRiverEditorCtrl, getNodePosition, Point3F, (), , "" )
|
||||
{
|
||||
static const U32 bufSize = 256;
|
||||
char* returnBuffer = Con::getReturnBuffer(bufSize);
|
||||
|
||||
dSprintf(returnBuffer, bufSize, "%f %f %f",
|
||||
object->getNodePosition().x, object->getNodePosition().y, object->getNodePosition().z);
|
||||
|
||||
return returnBuffer;
|
||||
return object->getNodePosition();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiRiverEditorCtrl, setNodePosition, void, 3, 3, "" )
|
||||
DefineConsoleMethod( GuiRiverEditorCtrl, setNodePosition, void, (Point3F pos), , "" )
|
||||
{
|
||||
Point3F pos;
|
||||
|
||||
S32 count = dSscanf( argv[2], "%f %f %f",
|
||||
&pos.x, &pos.y, &pos.z);
|
||||
|
||||
if ( (count != 3) )
|
||||
{
|
||||
Con::printf("Failed to parse node information \"px py pz\" from '%s'", (const char*)argv[3]);
|
||||
return;
|
||||
}
|
||||
|
||||
object->setNodePosition( pos );
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiRiverEditorCtrl, getNodeNormal, const char*, 2, 2, "" )
|
||||
DefineConsoleMethod( GuiRiverEditorCtrl, getNodeNormal, Point3F, (), , "" )
|
||||
{
|
||||
static const U32 bufSize = 256;
|
||||
char* returnBuffer = Con::getReturnBuffer(bufSize);
|
||||
|
||||
dSprintf(returnBuffer, bufSize, "%f %f %f",
|
||||
object->getNodeNormal().x, object->getNodeNormal().y, object->getNodeNormal().z);
|
||||
|
||||
return returnBuffer;
|
||||
return object->getNodeNormal();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiRiverEditorCtrl, setNodeNormal, void, 3, 3, "" )
|
||||
DefineConsoleMethod( GuiRiverEditorCtrl, setNodeNormal, void, (Point3F normal), , "" )
|
||||
{
|
||||
VectorF normal;
|
||||
|
||||
S32 count = dSscanf( argv[2], "%f %f %f",
|
||||
&normal.x, &normal.y, &normal.z);
|
||||
|
||||
if ( (count != 3) )
|
||||
{
|
||||
Con::printf("Failed to parse node information \"px py pz\" from '%s'", (const char*)argv[3]);
|
||||
return;
|
||||
}
|
||||
|
||||
object->setNodeNormal( normal );
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiRiverEditorCtrl, setSelectedRiver, void, 2, 3, "" )
|
||||
DefineConsoleMethod( GuiRiverEditorCtrl, setSelectedRiver, void, (const char * objName), (""), "" )
|
||||
{
|
||||
if ( argc == 2 )
|
||||
if (dStrcmp( objName,"" )==0)
|
||||
object->setSelectedRiver(NULL);
|
||||
else
|
||||
{
|
||||
River *river = NULL;
|
||||
if ( Sim::findObject( argv[2], river ) )
|
||||
if ( Sim::findObject( objName, river ) )
|
||||
object->setSelectedRiver(river);
|
||||
}
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiRiverEditorCtrl, getSelectedRiver, const char*, 2, 2, "" )
|
||||
DefineConsoleMethod( GuiRiverEditorCtrl, getSelectedRiver, S32, (), , "" )
|
||||
{
|
||||
River *river = object->getSelectedRiver();
|
||||
if ( !river )
|
||||
return NULL;
|
||||
|
||||
return river->getIdString();
|
||||
return river->getId();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiRiverEditorCtrl, regenerate, void, 2, 2, "" )
|
||||
DefineConsoleMethod( GuiRiverEditorCtrl, regenerate, void, (), , "" )
|
||||
{
|
||||
River *river = object->getSelectedRiver();
|
||||
if ( river )
|
||||
|
|
|
|||
|
|
@ -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,19 @@ void GuiFileTreeCtrl::recurseInsert( Item* parent, StringTableEntry path )
|
|||
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiFileTreeCtrl, getSelectedPath, const char*, 2, 2, "getSelectedPath() - returns the currently selected path in the tree")
|
||||
//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)")
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrl, addScheme, void, (U32 id, ColorI fontColor, ColorI fontColorHL, ColorI fontColorSEL), ,
|
||||
"(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 );
|
||||
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,7 +385,7 @@ 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();
|
||||
}
|
||||
|
|
@ -431,20 +393,20 @@ ConsoleMethod( GuiPopUpMenuCtrl, setEnumContent, void, 4, 4, "(string class, str
|
|||
// 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,7 +584,7 @@ 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();
|
||||
}
|
||||
|
|
@ -605,20 +592,20 @@ ConsoleMethod( GuiPopUpMenuCtrlEx, setEnumContent, void, 4, 4,
|
|||
// 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,16 +628,16 @@ 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")
|
||||
{
|
||||
|
|
@ -658,11 +645,11 @@ ConsoleMethod( GuiPopUpMenuCtrlEx, size, S32, 2, 2,
|
|||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
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);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -4605,11 +4605,28 @@ void GuiTreeViewCtrl::inspectObject( SimObject* obj, bool okToEdit )
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
S32 GuiTreeViewCtrl::insertObject( S32 parent, SimObject* obj, bool okToEdit )
|
||||
{
|
||||
mFlags.set( IsEditable, okToEdit );
|
||||
mFlags.set( IsInspector );
|
||||
|
||||
//onDefineIcons_callback();
|
||||
|
||||
GuiTreeViewCtrl::Item *item = addInspectorDataItem( getItem(parent), obj );
|
||||
return item->getID();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
S32 GuiTreeViewCtrl::findItemByName(const char *name)
|
||||
{
|
||||
for (S32 i = 0; i < mItems.size(); i++)
|
||||
{
|
||||
if( mItems[i]->mState.test( Item::InspectorData ) )
|
||||
continue;
|
||||
if (mItems[i] && dStrcmp(mItems[i]->getText(),name) == 0)
|
||||
return mItems[i]->mId;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -4619,8 +4636,12 @@ S32 GuiTreeViewCtrl::findItemByName(const char *name)
|
|||
S32 GuiTreeViewCtrl::findItemByValue(const char *name)
|
||||
{
|
||||
for (S32 i = 0; i < mItems.size(); i++)
|
||||
if (mItems[i] && dStrcmp(mItems[i]->getValue(),name) == 0)
|
||||
return mItems[i]->mId;
|
||||
{
|
||||
if( mItems[i]->mState.test( Item::InspectorData ) )
|
||||
continue;
|
||||
if (mItems[i] && dStrcmp(mItems[i]->getValue(),name) == 0)
|
||||
return mItems[i]->mId;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -4767,6 +4788,10 @@ DefineEngineMethod( GuiTreeViewCtrl, insertItem, S32, ( S32 parentId, const char
|
|||
return object->insertItem( parentId, text, value, icon, normalImage, expandedImage );
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiTreeViewCtrl, insertObject, S32, ( S32 parentId, SimObject* obj, bool OKToEdit ), (false), "Inserts object as a child to the given parent." )
|
||||
{
|
||||
return object->insertObject(parentId, obj, OKToEdit);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineMethod( GuiTreeViewCtrl, lockSelection, void, ( bool lock ), ( true ),
|
||||
|
|
@ -4831,27 +4856,24 @@ DefineEngineMethod( GuiTreeViewCtrl, addSelection, void, ( S32 id, bool isLastSe
|
|||
object->addSelection( id, isLastSelection, isLastSelection );
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, addChildSelectionByValue, void, 4, 4, "addChildSelectionByValue(TreeItemId parent, value)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, addChildSelectionByValue, void, (S32 id, const char * tableEntry), , "addChildSelectionByValue(TreeItemId parent, value)")
|
||||
{
|
||||
S32 id = dAtoi(argv[2]);
|
||||
GuiTreeViewCtrl::Item* parentItem = object->getItem(id);
|
||||
GuiTreeViewCtrl::Item* child = parentItem->findChildByValue(argv[3]);
|
||||
GuiTreeViewCtrl::Item* child = parentItem->findChildByValue(tableEntry);
|
||||
object->addSelection(child->getID());
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, removeSelection, void, 3, 3, "(deselects an item)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, removeSelection, void, (S32 id), , "(deselects an item)")
|
||||
{
|
||||
S32 id = dAtoi(argv[2]);
|
||||
object->removeSelection(id);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, removeChildSelectionByValue, void, 4, 4, "removeChildSelectionByValue(TreeItemId parent, value)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, removeChildSelectionByValue, void, (S32 id, const char * tableEntry), , "removeChildSelectionByValue(TreeItemId parent, value)")
|
||||
{
|
||||
S32 id = dAtoi(argv[2]);
|
||||
GuiTreeViewCtrl::Item* parentItem = object->getItem(id);
|
||||
if(parentItem)
|
||||
{
|
||||
GuiTreeViewCtrl::Item* child = parentItem->findChildByValue(argv[3]);
|
||||
GuiTreeViewCtrl::Item* child = parentItem->findChildByValue(tableEntry);
|
||||
if(child)
|
||||
{
|
||||
object->removeSelection(child->getID());
|
||||
|
|
@ -4859,55 +4881,38 @@ ConsoleMethod(GuiTreeViewCtrl, removeChildSelectionByValue, void, 4, 4, "removeC
|
|||
}
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, selectItem, bool, 3, 4, "(TreeItemId item, bool select=true)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, selectItem, bool, (S32 id, bool select), (true), "(TreeItemId item, bool select=true)")
|
||||
{
|
||||
S32 id = dAtoi(argv[2]);
|
||||
bool select = true;
|
||||
if(argc == 4)
|
||||
select = dAtob(argv[3]);
|
||||
|
||||
return(object->setItemSelected(id, select));
|
||||
return object->setItemSelected(id, select);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, expandItem, bool, 3, 4, "(TreeItemId item, bool expand=true)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, expandItem, bool, (S32 id, bool expand), (true), "(TreeItemId item, bool expand=true)")
|
||||
{
|
||||
S32 id = dAtoi(argv[2]);
|
||||
bool expand = true;
|
||||
if(argc == 4)
|
||||
expand = dAtob(argv[3]);
|
||||
return(object->setItemExpanded(id, expand));
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, markItem, bool, 3, 4, "(TreeItemId item, bool mark=true)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, markItem, bool, (S32 id, bool mark), (true), "(TreeItemId item, bool mark=true)")
|
||||
{
|
||||
S32 id = dAtoi(argv[2]);
|
||||
bool mark = true;
|
||||
if(argc == 4)
|
||||
mark = dAtob(argv[3]);
|
||||
return object->markItem(id, mark);
|
||||
}
|
||||
|
||||
// Make the given item visible.
|
||||
ConsoleMethod(GuiTreeViewCtrl, scrollVisible, void, 3, 3, "(TreeItemId item)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, scrollVisible, void, (S32 itemId), , "(TreeItemId item)")
|
||||
{
|
||||
object->scrollVisible(dAtoi(argv[2]));
|
||||
object->scrollVisible(itemId);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, buildIconTable, bool, 3,3, "(builds an icon table)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, buildIconTable, bool, (const char * icons), , "(builds an icon table)")
|
||||
{
|
||||
const char * icons = argv[2];
|
||||
return object->buildIconTable(icons);
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiTreeViewCtrl, open, void, 3, 4, "(SimSet obj, bool okToEdit=true) Set the root of the tree view to the specified object, or to the root set.")
|
||||
DefineConsoleMethod( GuiTreeViewCtrl, open, void, (const char * objName, bool okToEdit), (true), "(SimSet obj, bool okToEdit=true) Set the root of the tree view to the specified object, or to the root set.")
|
||||
{
|
||||
SimSet *treeRoot = NULL;
|
||||
SimObject* target = Sim::findObject(argv[2]);
|
||||
SimObject* target = Sim::findObject(objName);
|
||||
|
||||
bool okToEdit = true;
|
||||
|
||||
if (argc == 4)
|
||||
okToEdit = dAtob(argv[3]);
|
||||
|
||||
if (target)
|
||||
treeRoot = dynamic_cast<SimSet*>(target);
|
||||
|
|
@ -4918,9 +4923,8 @@ ConsoleMethod( GuiTreeViewCtrl, open, void, 3, 4, "(SimSet obj, bool okToEdit=tr
|
|||
object->inspectObject(treeRoot,okToEdit);
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiTreeViewCtrl, setItemTooltip, void, 4, 4, "( int id, string text ) - Set the tooltip to show for the given item." )
|
||||
DefineConsoleMethod( GuiTreeViewCtrl, setItemTooltip, void, ( S32 id, const char * text ), , "( int id, string text ) - Set the tooltip to show for the given item." )
|
||||
{
|
||||
S32 id = dAtoi( argv[ 2 ] );
|
||||
|
||||
GuiTreeViewCtrl::Item* item = object->getItem( id );
|
||||
if( !item )
|
||||
|
|
@ -4929,12 +4933,11 @@ ConsoleMethod( GuiTreeViewCtrl, setItemTooltip, void, 4, 4, "( int id, string te
|
|||
return;
|
||||
}
|
||||
|
||||
item->mTooltip = (const char*)argv[ 3 ];
|
||||
item->mTooltip = text;
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiTreeViewCtrl, setItemImages, void, 5, 5, "( int id, int normalImage, int expandedImage ) - Sets the normal and expanded images to show for the given item." )
|
||||
DefineConsoleMethod( GuiTreeViewCtrl, setItemImages, void, ( S32 id, S8 normalImage, S8 expandedImage ), , "( int id, int normalImage, int expandedImage ) - Sets the normal and expanded images to show for the given item." )
|
||||
{
|
||||
S32 id = dAtoi( argv[ 2 ] );
|
||||
|
||||
GuiTreeViewCtrl::Item* item = object->getItem( id );
|
||||
if( !item )
|
||||
|
|
@ -4943,13 +4946,12 @@ ConsoleMethod( GuiTreeViewCtrl, setItemImages, void, 5, 5, "( int id, int normal
|
|||
return;
|
||||
}
|
||||
|
||||
item->setNormalImage((S8)dAtoi(argv[3]));
|
||||
item->setExpandedImage((S8)dAtoi(argv[4]));
|
||||
item->setNormalImage(normalImage);
|
||||
item->setExpandedImage(expandedImage);
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiTreeViewCtrl, isParentItem, bool, 3, 3, "( int id ) - Returns true if the given item contains child items." )
|
||||
DefineConsoleMethod( GuiTreeViewCtrl, isParentItem, bool, ( S32 id ), , "( int id ) - Returns true if the given item contains child items." )
|
||||
{
|
||||
S32 id = dAtoi( argv[ 2 ] );
|
||||
if( !id && object->getItemCount() )
|
||||
return true;
|
||||
|
||||
|
|
@ -4963,90 +4965,81 @@ ConsoleMethod( GuiTreeViewCtrl, isParentItem, bool, 3, 3, "( int id ) - Returns
|
|||
return item->isParent();
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getItemText, const char *, 3, 3, "(TreeItemId item)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getItemText, const char *, (S32 index), , "(TreeItemId item)")
|
||||
{
|
||||
return(object->getItemText(dAtoi(argv[2])));
|
||||
return object->getItemText(index);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getItemValue, const char *, 3, 3, "(TreeItemId item)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getItemValue, const char *, (S32 itemId), , "(TreeItemId item)")
|
||||
{
|
||||
return(object->getItemValue(dAtoi(argv[2])));
|
||||
return object->getItemValue(itemId);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, editItem, bool, 5, 5, "(TreeItemId item, string newText, string newValue)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, editItem, bool, (S32 item, const char * newText, const char * newValue), , "(TreeItemId item, string newText, string newValue)")
|
||||
{
|
||||
return(object->editItem(dAtoi(argv[2]), argv[3], argv[4]));
|
||||
return(object->editItem(item, newText, newValue));
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, removeItem, bool, 3, 3, "(TreeItemId item)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, removeItem, bool, (S32 itemId), , "(TreeItemId item)")
|
||||
{
|
||||
return(object->removeItem(dAtoi(argv[2])));
|
||||
return(object->removeItem(itemId));
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, removeAllChildren, void, 3, 3, "removeAllChildren(TreeItemId parent)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, removeAllChildren, void, (S32 itemId), , "removeAllChildren(TreeItemId parent)")
|
||||
{
|
||||
object->removeAllChildren(dAtoi(argv[2]));
|
||||
object->removeAllChildren(itemId);
|
||||
}
|
||||
ConsoleMethod(GuiTreeViewCtrl, clear, void, 2, 2, "() - empty tree")
|
||||
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, clear, void, (), , "() - empty tree")
|
||||
{
|
||||
object->removeItem(0);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getFirstRootItem, S32, 2, 2, "Get id for root item.")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getFirstRootItem, S32, (), , "Get id for root item.")
|
||||
{
|
||||
return(object->getFirstRootItem());
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getChild, S32, 3, 3, "(TreeItemId item)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getChild, S32, (S32 itemId), , "(TreeItemId item)")
|
||||
{
|
||||
return(object->getChildItem(dAtoi(argv[2])));
|
||||
return(object->getChildItem(itemId));
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, buildVisibleTree, void, 2, 3, "Build the visible tree")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, buildVisibleTree, void, (bool forceFullUpdate), (false), "Build the visible tree")
|
||||
{
|
||||
bool forceFullUpdate = false;
|
||||
if( argc > 2 )
|
||||
forceFullUpdate = dAtob( argv[ 2 ] );
|
||||
|
||||
object->buildVisibleTree( forceFullUpdate );
|
||||
}
|
||||
|
||||
//FIXME: [rene 11/09/09 - This clashes with GuiControl.getParent(); bad thing; should be getParentItem]
|
||||
ConsoleMethod(GuiTreeViewCtrl, getParent, S32, 3, 3, "(TreeItemId item)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getParentItem, S32, (S32 itemId), , "(TreeItemId item)")
|
||||
{
|
||||
return(object->getParentItem(dAtoi(argv[2])));
|
||||
return(object->getParentItem(itemId));
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getNextSibling, S32, 3, 3, "(TreeItemId item)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getNextSibling, S32, (S32 itemId), , "(TreeItemId item)")
|
||||
{
|
||||
return(object->getNextSiblingItem(dAtoi(argv[2])));
|
||||
return(object->getNextSiblingItem(itemId));
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getPrevSibling, S32, 3, 3, "(TreeItemId item)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getPrevSibling, S32, (S32 itemId), , "(TreeItemId item)")
|
||||
{
|
||||
return(object->getPrevSiblingItem(dAtoi(argv[2])));
|
||||
return(object->getPrevSiblingItem(itemId));
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getItemCount, S32, 2, 2, "")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getItemCount, S32, (), , "")
|
||||
{
|
||||
return(object->getItemCount());
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getSelectedItem, S32, 2, 3, "( int index=0 ) - Return the selected item at the given index.")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getSelectedItem, S32, ( S32 index ), (0), "( int index=0 ) - Return the selected item at the given index.")
|
||||
{
|
||||
S32 index = 0;
|
||||
if( argc > 2 )
|
||||
index = dAtoi( argv[ 2 ] );
|
||||
|
||||
return ( object->getSelectedItem( index ) );
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getSelectedObject, S32, 2, 3, "( int index=0 ) - Return the currently selected SimObject at the given index in inspector mode or -1")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getSelectedObject, S32, ( S32 index ), (0), "( int index=0 ) - Return the currently selected SimObject at the given index in inspector mode or -1")
|
||||
{
|
||||
S32 index = 0;
|
||||
if( argc > 2 )
|
||||
index = dAtoi( argv[ 2 ] );
|
||||
|
||||
GuiTreeViewCtrl::Item *item = object->getItem( object->getSelectedItem( index ) );
|
||||
if( item != NULL && item->isInspectorData() )
|
||||
{
|
||||
|
|
@ -5058,14 +5051,14 @@ ConsoleMethod(GuiTreeViewCtrl, getSelectedObject, S32, 2, 3, "( int index=0 ) -
|
|||
return -1;
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getSelectedObjectList, const char*, 2, 2,
|
||||
"Returns a space sperated list of all selected object ids.")
|
||||
const char* GuiTreeViewCtrl::getSelectedObjectList()
|
||||
{
|
||||
static const U32 bufSize = 1024;
|
||||
char* buff = Con::getReturnBuffer(bufSize);
|
||||
dSprintf(buff,bufSize,"");
|
||||
|
||||
const Vector< GuiTreeViewCtrl::Item* > selectedItems = object->getSelectedItems();
|
||||
|
||||
const Vector< GuiTreeViewCtrl::Item* > selectedItems = this->getSelectedItems();
|
||||
for(S32 i = 0; i < selectedItems.size(); i++)
|
||||
{
|
||||
GuiTreeViewCtrl::Item *item = selectedItems[i];
|
||||
|
|
@ -5078,7 +5071,7 @@ ConsoleMethod(GuiTreeViewCtrl, getSelectedObjectList, const char*, 2, 2,
|
|||
//the start of the buffer where we want to write
|
||||
char* buffPart = buff+len;
|
||||
//the size of the remaining buffer (-1 cause dStrlen doesn't count the \0)
|
||||
S32 size = bufSize-len-1;
|
||||
S32 size = bufSize-len-1;
|
||||
//write it:
|
||||
if(size < 1)
|
||||
{
|
||||
|
|
@ -5093,46 +5086,49 @@ ConsoleMethod(GuiTreeViewCtrl, getSelectedObjectList, const char*, 2, 2,
|
|||
return buff;
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, moveItemUp, void, 3, 3, "(TreeItemId item)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getSelectedObjectList, const char*, (), ,
|
||||
"Returns a space seperated list of all selected object ids.")
|
||||
{
|
||||
object->moveItemUp( dAtoi( argv[2] ) );
|
||||
return object->getSelectedObjectList();
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getSelectedItemsCount, S32, 2, 2, "")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, moveItemUp, void, (S32 index), , "(TreeItemId item)")
|
||||
{
|
||||
object->moveItemUp( index );
|
||||
}
|
||||
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getSelectedItemsCount, S32, (), , "")
|
||||
{
|
||||
return ( object->getSelectedItemsCount() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, moveItemDown, void, 3, 3, "(TreeItemId item)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, moveItemDown, void, (S32 index), , "(TreeItemId item)")
|
||||
{
|
||||
object->moveItemDown( dAtoi( argv[2] ) );
|
||||
object->moveItemDown( index );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getTextToRoot, const char*,4,4,"(TreeItemId item,Delimiter=none) gets the text from the current node to the root, concatenating at each branch upward, with a specified delimiter optionally")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getTextToRoot, const char*, (S32 itemId, const char * delimiter), ,
|
||||
"(TreeItemId item,Delimiter=none) gets the text from the current node to the root, concatenating at each branch upward, with a specified delimiter optionally")
|
||||
{
|
||||
if ( argc < 4 )
|
||||
if (!dStrcmp(delimiter, "" ))
|
||||
{
|
||||
Con::warnf("GuiTreeViewCtrl::getTextToRoot - Invalid number of arguments!");
|
||||
return ("");
|
||||
}
|
||||
S32 itemId = dAtoi( argv[2] );
|
||||
StringTableEntry delimiter = argv[3];
|
||||
|
||||
return object->getTextToRoot( itemId, delimiter );
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiTreeViewCtrl, getSelectedItemList,const char*, 2,2,"returns a space seperated list of mulitple item ids")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, getSelectedItemList,const char*, (), ,"returns a space seperated list of mulitple item ids")
|
||||
{
|
||||
static const U32 bufSize = 1024;
|
||||
char* buff = Con::getReturnBuffer(bufSize);
|
||||
dSprintf(buff,bufSize,"");
|
||||
char* buff = Con::getReturnBuffer(1024);
|
||||
dSprintf(buff,1024,"");
|
||||
|
||||
const Vector< S32 >& selected = object->getSelected();
|
||||
for(S32 i = 0; i < selected.size(); i++)
|
||||
for(int i = 0; i < selected.size(); i++)
|
||||
{
|
||||
S32 id = selected[i];
|
||||
//get the current length of the buffer
|
||||
|
|
@ -5140,7 +5136,7 @@ ConsoleMethod(GuiTreeViewCtrl, getSelectedItemList,const char*, 2,2,"returns a s
|
|||
//the start of the buffer where we want to write
|
||||
char* buffPart = buff+len;
|
||||
//the size of the remaining buffer (-1 cause dStrlen doesn't count the \0)
|
||||
S32 size = bufSize-len-1;
|
||||
S32 size = 1024-len-1;
|
||||
//write it:
|
||||
if(size < 1)
|
||||
{
|
||||
|
|
@ -5167,13 +5163,13 @@ S32 GuiTreeViewCtrl::findItemByObjectId(S32 iObjId)
|
|||
return mItems[i]->mId;
|
||||
}
|
||||
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
ConsoleMethod(GuiTreeViewCtrl, findItemByObjectId, S32, 3, 3, "(find item by object id and returns the mId)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, findItemByObjectId, S32, ( S32 itemId ), , "(find item by object id and returns the mId)")
|
||||
{
|
||||
return(object->findItemByObjectId(dAtoi(argv[2])));
|
||||
return(object->findItemByObjectId(itemId));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -5216,30 +5212,17 @@ bool GuiTreeViewCtrl::scrollVisibleByObjectId(S32 objID)
|
|||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
ConsoleMethod(GuiTreeViewCtrl, scrollVisibleByObjectId, S32, 3, 3, "(show item by object id. returns true if sucessful.)")
|
||||
DefineConsoleMethod(GuiTreeViewCtrl, scrollVisibleByObjectId, S32, ( S32 itemId ), , "(show item by object id. returns true if sucessful.)")
|
||||
{
|
||||
return(object->scrollVisibleByObjectId(dAtoi(argv[2])));
|
||||
return(object->scrollVisibleByObjectId(itemId));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//FIXME: this clashes with SimSet.sort()
|
||||
ConsoleMethod( GuiTreeViewCtrl, sort, void, 2, 6, "( int parent, bool traverseHierarchy=false, bool parentsFirst=false, bool caseSensitive=true ) - Sorts all items of the given parent (or root). With 'hierarchy', traverses hierarchy." )
|
||||
DefineConsoleMethod( GuiTreeViewCtrl, sort, void, ( S32 parent, bool traverseHierarchy, bool parentsFirst, bool caseSensitive ), ( 0, false, false, true ),
|
||||
"( int parent, bool traverseHierarchy=false, bool parentsFirst=false, bool caseSensitive=true ) - Sorts all items of the given parent (or root). With 'hierarchy', traverses hierarchy." )
|
||||
{
|
||||
S32 parent = 0;
|
||||
if( argc >= 3 )
|
||||
parent = dAtoi( argv[ 2 ] );
|
||||
|
||||
bool traverseHierarchy = false;
|
||||
bool parentsFirst = false;
|
||||
bool caseSensitive = true;
|
||||
|
||||
if( argc >= 4 )
|
||||
traverseHierarchy = dAtob( argv[ 3 ] );
|
||||
if( argc >= 5 )
|
||||
parentsFirst = dAtob( argv[ 4 ] );
|
||||
if( argc >= 6 )
|
||||
caseSensitive = dAtob( argv[ 5 ] );
|
||||
|
||||
if( !parent )
|
||||
object->sortTree( caseSensitive, traverseHierarchy, parentsFirst );
|
||||
|
|
@ -5326,19 +5309,18 @@ void GuiTreeViewCtrl::showItemRenameCtrl( Item* item )
|
|||
}
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiTreeViewCtrl, cancelRename, void, 2, 2, "For internal use." )
|
||||
DefineConsoleMethod( GuiTreeViewCtrl, cancelRename, void, (), , "For internal use." )
|
||||
{
|
||||
object->cancelRename();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiTreeViewCtrl, onRenameValidate, void, 2, 2, "For internal use." )
|
||||
DefineConsoleMethod( GuiTreeViewCtrl, onRenameValidate, void, (), , "For internal use." )
|
||||
{
|
||||
object->onRenameValidate();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiTreeViewCtrl, showItemRenameCtrl, void, 3, 3, "( TreeItemId id ) - Show the rename text field for the given item (only one at a time)." )
|
||||
DefineConsoleMethod( GuiTreeViewCtrl, showItemRenameCtrl, void, ( S32 id ), , "( TreeItemId id ) - Show the rename text field for the given item (only one at a time)." )
|
||||
{
|
||||
S32 id = dAtoi( argv[ 2 ] );
|
||||
GuiTreeViewCtrl::Item* item = object->getItem( id );
|
||||
if( !item )
|
||||
{
|
||||
|
|
@ -5349,11 +5331,8 @@ ConsoleMethod( GuiTreeViewCtrl, showItemRenameCtrl, void, 3, 3, "( TreeItemId id
|
|||
object->showItemRenameCtrl( item );
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiTreeViewCtrl, setDebug, void, 2, 3, "( bool value=true ) - Enable/disable debug output." )
|
||||
DefineConsoleMethod( GuiTreeViewCtrl, setDebug, void, ( bool value ), (true), "( bool value=true ) - Enable/disable debug output." )
|
||||
{
|
||||
bool value = true;
|
||||
if( argc > 2 )
|
||||
value = dAtob( argv[ 2 ] );
|
||||
|
||||
object->setDebug( value );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,18 +2052,9 @@ ConsoleDocFragment _popDialog2(
|
|||
"void popDialog();"
|
||||
);
|
||||
|
||||
ConsoleMethod( GuiCanvas, popDialog, void, 2, 3, "(GuiControl ctrl=NULL)"
|
||||
DefineConsoleMethod( GuiCanvas, popDialog, void, (GuiControl * gui), , "(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);
|
||||
|
|
@ -2097,12 +2081,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 +2239,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 +2524,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 +2535,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 +2551,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 +2560,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 +2602,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 +2648,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]);
|
||||
}
|
||||
if ((argc > 6) && (dStrlen(argv[6]) > 0))
|
||||
{
|
||||
vm.refreshRate = dAtoi(argv[6]);
|
||||
vm.bitDepth = refreshRate;
|
||||
}
|
||||
|
||||
if ((argc > 7) && (dStrlen(argv[7]) > 0))
|
||||
if (refreshRate > 0)
|
||||
{
|
||||
vm.antialiasLevel = dAtoi(argv[7]);
|
||||
vm.refreshRate = refreshRate;
|
||||
}
|
||||
|
||||
if (antialiasLevel > 0)
|
||||
{
|
||||
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,12 @@ 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,
|
||||
"( Point2I p | int x, int y ) Set the width and height of the control.\n\n"
|
||||
//ConsoleMethod( GuiControl, setExtent, void, 3, 4,
|
||||
DefineConsoleMethod( GuiControl, setExtent, void, ( Point2I ext ), ,
|
||||
" Set the width and height of the control.\n\n"
|
||||
"@hide" )
|
||||
{
|
||||
if ( argc == 3 )
|
||||
{
|
||||
// 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!" );
|
||||
}
|
||||
else if ( argc == 4 )
|
||||
object->setExtent( dAtoi(argv[2]), dAtoi(argv[3]) );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -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,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,73 @@ 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, S32, (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);
|
||||
|
||||
|
||||
if(plotID > object->MaxPlots)
|
||||
{
|
||||
Con::errorf("Invalid plotID.");
|
||||
dSprintf(retBuffer, bufSize, "%d", -2);
|
||||
return retBuffer;
|
||||
return -2;
|
||||
}
|
||||
|
||||
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]));
|
||||
}
|
||||
|
||||
|
||||
dSprintf(retBuffer, bufSize, "%d", pointAdded);
|
||||
|
||||
return retBuffer;
|
||||
return object->addPlotPoint( plotID, Point2F(x, y), setAdded);
|
||||
}
|
||||
|
||||
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, S32, (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);
|
||||
const S32 index = -1;
|
||||
dSprintf(retBuffer, bufSize, "%d", index);
|
||||
return retBuffer;
|
||||
return -1;
|
||||
}
|
||||
|
||||
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);
|
||||
return retBuffer;
|
||||
return object->changePlotPoint( plotID, i, Point2F(x, y));
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, getSelectedPlot, const char*, 2, 2, "() "
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, getSelectedPlot, S32, (), , "() "
|
||||
"Gets the selected Plot (a.k.a. graph).\n"
|
||||
"@return The plot's ID.")
|
||||
{
|
||||
static const U32 bufSize = 32;
|
||||
char *retBuffer = Con::getReturnBuffer(bufSize);
|
||||
const S32 plot = object->getSelectedPlot();
|
||||
dSprintf(retBuffer, bufSize, "%d", plot);
|
||||
return retBuffer;
|
||||
return object->getSelectedPlot();
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, getSelectedPoint, const char*, 2, 2, "()"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, getSelectedPoint, S32, (), , "()"
|
||||
"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);
|
||||
const S32 point = object->getSelectedPoint();
|
||||
dSprintf(retBuffer, bufSize, "%d", point);
|
||||
return retBuffer;
|
||||
return object->getSelectedPoint();
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, isExistingPoint, const char*, 4, 4, "(int plotID, int samples)"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, isExistingPoint, bool, (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)
|
||||
{
|
||||
|
|
@ -1161,20 +1121,13 @@ ConsoleMethod(GuiParticleGraphCtrl, isExistingPoint, const char*, 4, 4, "(int pl
|
|||
{
|
||||
Con::errorf("Invalid sample.");
|
||||
}
|
||||
|
||||
static const U32 bufSize = 32;
|
||||
char *retBuffer = Con::getReturnBuffer(bufSize);
|
||||
const bool isPoint = object->isExistingPoint(plotID, samples);
|
||||
dSprintf(retBuffer, bufSize, "%d", isPoint);
|
||||
return retBuffer;
|
||||
return object->isExistingPoint(plotID, samples);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, getPlotPoint, const char*, 4, 4, "(int plotID, int samples)"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, getPlotPoint, Point2F, (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 +1138,85 @@ ConsoleMethod(GuiParticleGraphCtrl, getPlotPoint, const char*, 4, 4, "(int plotI
|
|||
Con::errorf("Invalid sample.");
|
||||
}
|
||||
|
||||
static const U32 bufSize = 64;
|
||||
char *retBuffer = Con::getReturnBuffer(bufSize);
|
||||
const Point2F &pos = object->getPlotPoint(plotID, samples);
|
||||
dSprintf(retBuffer, bufSize, "%f %f", pos.x, pos.y);
|
||||
return retBuffer;
|
||||
|
||||
return object->getPlotPoint(plotID, samples);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, getPlotIndex, const char*, 5, 5, "(int plotID, float x, float y)\n"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, getPlotIndex, S32, (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);
|
||||
const S32 &index = object->getPlotIndex(plotID, x, y);
|
||||
dSprintf(retBuffer, bufSize, "%d", index);
|
||||
return retBuffer;
|
||||
return object->getPlotIndex(plotID, x, y);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, getGraphColor, const char*, 3, 3, "(int plotID)"
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, getGraphColor, ColorF, (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);
|
||||
const ColorF &color = object->getGraphColor(plotID);
|
||||
dSprintf(retBuffer, bufSize, "%f %f %f", color.red, color.green, color.blue);
|
||||
return retBuffer;
|
||||
|
||||
return object->getGraphColor(plotID);
|
||||
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, getGraphMin, const char*, 3, 3, "(int plotID) "
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, getGraphMin, Point2F, (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);
|
||||
const Point2F graphMin = object->getGraphMin(plotID);
|
||||
dSprintf(retBuffer, bufSize, "%f %f", graphMin.x, graphMin.y);
|
||||
return retBuffer;
|
||||
return object->getGraphMin(plotID);
|
||||
}
|
||||
|
||||
ConsoleMethod(GuiParticleGraphCtrl, getGraphMax, const char*, 3, 3, "(int plotID) "
|
||||
DefineConsoleMethod(GuiParticleGraphCtrl, getGraphMax, Point2F, (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);
|
||||
const Point2F graphMax = object->getGraphMax(plotID);
|
||||
dSprintf(retBuffer, bufSize, "%f %f", graphMax.x, graphMax.y);
|
||||
return retBuffer;
|
||||
return object->getGraphMax(plotID);
|
||||
|
||||
}
|
||||
|
||||
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 +1224,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 +1240,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 +1256,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 +1272,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 +1288,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 +1304,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 +1318,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 +1370,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 );
|
||||
}
|
||||
39
Engine/source/gui/game/GuiChunkedBitmapCtrl.h
Normal file
39
Engine/source/gui/game/GuiChunkedBitmapCtrl.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#include "platform/platform.h"
|
||||
|
||||
#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);
|
||||
};
|
||||
|
|
@ -20,8 +20,6 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "platform/platform.h"
|
||||
|
||||
#include "console/console.h"
|
||||
#include "console/consoleTypes.h"
|
||||
#include "gfx/bitmap/gBitmap.h"
|
||||
|
|
@ -31,35 +29,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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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,37 +219,38 @@ void CreatorTree::sort()
|
|||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
ConsoleMethod( CreatorTree, addGroup, S32, 4, 4, "(string group, string name, string value)")
|
||||
DefineConsoleMethod( CreatorTree, addGroup, S32, (S32 group, const char * name, const char * value), , "(string group, string name, string value)")
|
||||
{
|
||||
CreatorTree::Node * grp = object->findNode(dAtoi(argv[2]));
|
||||
CreatorTree::Node * grp = object->findNode(group);
|
||||
|
||||
if(!grp || !grp->isGroup())
|
||||
return(-1);
|
||||
|
||||
// return same named group if found...
|
||||
for(U32 i = 0; i < grp->mChildren.size(); i++)
|
||||
if(!dStricmp(argv[3], grp->mChildren[i]->mName))
|
||||
if(!dStricmp(name, grp->mChildren[i]->mName))
|
||||
return(grp->mChildren[i]->mId);
|
||||
|
||||
CreatorTree::Node * node = object->createNode(argv[3], 0, true, grp);
|
||||
CreatorTree::Node * node = object->createNode(name, 0, true, grp);
|
||||
object->build();
|
||||
return(node ? node->getId() : -1);
|
||||
}
|
||||
|
||||
ConsoleMethod( CreatorTree, addItem, S32, 5, 5, "(Node group, string name, string value)")
|
||||
DefineConsoleMethod( CreatorTree, addItem, S32, (S32 group, const char * name, const char * value), , "(Node group, string name, string value)")
|
||||
{
|
||||
CreatorTree::Node * grp = object->findNode(dAtoi(argv[2]));
|
||||
CreatorTree::Node * grp = object->findNode(group);
|
||||
|
||||
if(!grp || !grp->isGroup())
|
||||
return -1;
|
||||
|
||||
CreatorTree::Node * node = object->createNode(argv[3], argv[4], false, grp);
|
||||
CreatorTree::Node * node = object->createNode(name, value, false, grp);
|
||||
object->build();
|
||||
return(node ? node->getId() : -1);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
ConsoleMethod( CreatorTree, fileNameMatch, bool, 5, 5, "(string world, string type, string filename)"){
|
||||
DefineConsoleMethod( CreatorTree, fileNameMatch, bool, (const char * world, const char * type, const char * filename), , "(string world, string type, string filename)")
|
||||
{
|
||||
// argv[2] - world short
|
||||
// argv[3] - type short
|
||||
// argv[4] - filename
|
||||
|
|
@ -256,50 +258,50 @@ ConsoleMethod( CreatorTree, fileNameMatch, bool, 5, 5, "(string world, string ty
|
|||
// interior filenames
|
||||
// 0 - world short ('b', 'x', ...)
|
||||
// 1-> - type short ('towr', 'bunk', ...)
|
||||
U32 typeLen = dStrlen(argv[3]);
|
||||
if(dStrlen(argv[4]) < (typeLen + 1))
|
||||
U32 typeLen = dStrlen(type);
|
||||
if(dStrlen(filename) < (typeLen + 1))
|
||||
return(false);
|
||||
|
||||
// world
|
||||
if(dToupper(argv[4][0]) != dToupper(argv[2][0]))
|
||||
if(dToupper(filename[0]) != dToupper(world[0]))
|
||||
return(false);
|
||||
|
||||
return(!dStrnicmp(((const char*)argv[4])+1, argv[3], typeLen));
|
||||
return(!dStrnicmp(filename+1, type, typeLen));
|
||||
}
|
||||
|
||||
ConsoleMethod( CreatorTree, getSelected, S32, 2, 2, "Return a handle to the currently selected item.")
|
||||
DefineConsoleMethod( CreatorTree, getSelected, S32, (), , "Return a handle to the currently selected item.")
|
||||
{
|
||||
return(object->getSelected());
|
||||
}
|
||||
|
||||
ConsoleMethod( CreatorTree, isGroup, bool, 3, 3, "(Group g)")
|
||||
DefineConsoleMethod( CreatorTree, isGroup, bool, (const char * group), , "(Group g)")
|
||||
{
|
||||
CreatorTree::Node * node = object->findNode(dAtoi(argv[2]));
|
||||
CreatorTree::Node * node = object->findNode(dAtoi(group));
|
||||
if(node && node->isGroup())
|
||||
return(true);
|
||||
return(false);
|
||||
}
|
||||
|
||||
ConsoleMethod( CreatorTree, getName, const char*, 3, 3, "(Node item)")
|
||||
DefineConsoleMethod( CreatorTree, getName, const char*, (const char * item), , "(Node item)")
|
||||
{
|
||||
CreatorTree::Node * node = object->findNode(dAtoi(argv[2]));
|
||||
CreatorTree::Node * node = object->findNode(dAtoi(item));
|
||||
return(node ? node->mName : 0);
|
||||
}
|
||||
|
||||
ConsoleMethod( CreatorTree, getValue, const char*, 3, 3, "(Node n)")
|
||||
DefineConsoleMethod( CreatorTree, getValue, const char*, (S32 nodeValue), , "(Node n)")
|
||||
{
|
||||
CreatorTree::Node * node = object->findNode(dAtoi(argv[2]));
|
||||
CreatorTree::Node * node = object->findNode(nodeValue);
|
||||
return(node ? node->mValue : 0);
|
||||
}
|
||||
|
||||
ConsoleMethod( CreatorTree, clear, void, 2, 2, "Clear the tree.")
|
||||
DefineConsoleMethod( CreatorTree, clear, void, (), , "Clear the tree.")
|
||||
{
|
||||
object->clear();
|
||||
}
|
||||
|
||||
ConsoleMethod( CreatorTree, getParent, S32, 3, 3, "(Node n)")
|
||||
DefineConsoleMethod( CreatorTree, getParent, S32, (S32 nodeValue), , "(Node n)")
|
||||
{
|
||||
CreatorTree::Node * node = object->findNode(dAtoi(argv[2]));
|
||||
CreatorTree::Node * node = object->findNode(nodeValue);
|
||||
if(node && node->mParent)
|
||||
return(node->mParent->getId());
|
||||
|
||||
|
|
|
|||
|
|
@ -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,45 +786,45 @@ void GuiDecalEditorCtrl::setMode( String mode, bool sourceShortcut = false )
|
|||
Con::executef( this, "paletteSync", mMode );
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiDecalEditorCtrl, deleteSelectedDecal, void, 2, 2, "deleteSelectedDecal()" )
|
||||
DefineConsoleMethod( GuiDecalEditorCtrl, deleteSelectedDecal, void, (), , "deleteSelectedDecal()" )
|
||||
{
|
||||
object->deleteSelectedDecal();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiDecalEditorCtrl, deleteDecalDatablock, void, 3, 3, "deleteSelectedDecalDatablock( String datablock )" )
|
||||
DefineConsoleMethod( GuiDecalEditorCtrl, deleteDecalDatablock, void, ( const char * datablock ), , "deleteSelectedDecalDatablock( String datablock )" )
|
||||
{
|
||||
String lookupName( (const char*)argv[2] );
|
||||
String lookupName( datablock );
|
||||
if( lookupName == String::EmptyString )
|
||||
return;
|
||||
|
||||
object->deleteDecalDatablock( lookupName );
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiDecalEditorCtrl, setMode, void, 3, 3, "setMode( String mode )()" )
|
||||
DefineConsoleMethod( GuiDecalEditorCtrl, setMode, void, ( String newMode ), , "setMode( String mode )()" )
|
||||
{
|
||||
String newMode = ( (const char*)argv[2] );
|
||||
object->setMode( newMode );
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiDecalEditorCtrl, getMode, const char*, 2, 2, "getMode()" )
|
||||
DefineConsoleMethod( GuiDecalEditorCtrl, getMode, const char*, (), , "getMode()" )
|
||||
{
|
||||
return object->mMode;
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiDecalEditorCtrl, getDecalCount, S32, 2, 2, "getDecalCount()" )
|
||||
DefineConsoleMethod( GuiDecalEditorCtrl, getDecalCount, S32, (), , "getDecalCount()" )
|
||||
{
|
||||
return gDecalManager->mDecalInstanceVec.size();
|
||||
}
|
||||
|
||||
ConsoleMethod( GuiDecalEditorCtrl, getDecalTransform, const char*, 3, 3, "getDecalTransform()" )
|
||||
DefineConsoleMethod( GuiDecalEditorCtrl, getDecalTransform, const char*, ( U32 id ), , "getDecalTransform()" )
|
||||
{
|
||||
DecalInstance *decalInstance = gDecalManager->mDecalInstanceVec[dAtoi(argv[2])];
|
||||
DecalInstance *decalInstance = gDecalManager->mDecalInstanceVec[id];
|
||||
|
||||
if( decalInstance == NULL )
|
||||
return "";
|
||||
|
||||
static const U32 bufSize = 256;
|
||||
char* returnBuffer = Con::getReturnBuffer(bufSize);
|
||||
returnBuffer[0] = 0;
|
||||
static const U32 bufSize = 256;
|
||||
char* returnBuffer = Con::getReturnBuffer(bufSize);
|
||||
|
||||
|
||||
if ( decalInstance )
|
||||
{
|
||||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "core/strings/stringUnit.h"
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/simEvents.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "sim/netConnection.h"
|
||||
#include "math/mathUtils.h"
|
||||
#include "gfx/primBuilder.h"
|
||||
|
|
@ -2401,7 +2402,7 @@ void TerrainEditor::reorderMaterial( S32 index, S32 orderPos )
|
|||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod( TerrainEditor, attachTerrain, void, 2, 3, "(TerrainBlock terrain)")
|
||||
DefineConsoleMethod( TerrainEditor, attachTerrain, void, (const char * terrain), (""), "(TerrainBlock terrain)")
|
||||
{
|
||||
SimSet * missionGroup = dynamic_cast<SimSet*>(Sim::findObject("MissionGroup"));
|
||||
if (!missionGroup)
|
||||
|
|
@ -2413,7 +2414,7 @@ ConsoleMethod( TerrainEditor, attachTerrain, void, 2, 3, "(TerrainBlock terrain)
|
|||
VectorPtr<TerrainBlock*> terrains;
|
||||
|
||||
// attach to first found terrainBlock
|
||||
if (argc == 2)
|
||||
if (dStrcmp (terrain,"")==0)
|
||||
{
|
||||
for(SimSetIterator itr(missionGroup); *itr; ++itr)
|
||||
{
|
||||
|
|
@ -2428,13 +2429,13 @@ ConsoleMethod( TerrainEditor, attachTerrain, void, 2, 3, "(TerrainBlock terrain)
|
|||
}
|
||||
else // attach to named object
|
||||
{
|
||||
TerrainBlock* terrBlock = dynamic_cast<TerrainBlock*>(Sim::findObject(argv[2]));
|
||||
TerrainBlock* terrBlock = dynamic_cast<TerrainBlock*>(Sim::findObject(terrain));
|
||||
|
||||
if (terrBlock)
|
||||
terrains.push_back(terrBlock);
|
||||
|
||||
if(terrains.size() == 0)
|
||||
Con::errorf(ConsoleLogEntry::Script, "TerrainEditor::attach: failed to attach to object '%s'", (const char*)argv[2]);
|
||||
Con::errorf(ConsoleLogEntry::Script, "TerrainEditor::attach: failed to attach to object '%s'", terrain);
|
||||
}
|
||||
|
||||
if (terrains.size() > 0)
|
||||
|
|
@ -2457,21 +2458,21 @@ ConsoleMethod( TerrainEditor, attachTerrain, void, 2, 3, "(TerrainBlock terrain)
|
|||
}
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, getTerrainBlockCount, S32, 2, 2, "()")
|
||||
DefineConsoleMethod( TerrainEditor, getTerrainBlockCount, S32, (), , "()")
|
||||
{
|
||||
return object->getTerrainBlockCount();
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, getTerrainBlock, S32, 3, 3, "(S32 index)")
|
||||
DefineConsoleMethod( TerrainEditor, getTerrainBlock, S32, (S32 index), , "(S32 index)")
|
||||
{
|
||||
TerrainBlock* tb = object->getTerrainBlock(dAtoi(argv[2]));
|
||||
TerrainBlock* tb = object->getTerrainBlock(index);
|
||||
if(!tb)
|
||||
return 0;
|
||||
else
|
||||
return tb->getId();
|
||||
}
|
||||
|
||||
ConsoleMethod(TerrainEditor, getTerrainBlocksMaterialList, const char *, 2, 2, "() gets the list of current terrain materials for all terrain blocks.")
|
||||
DefineConsoleMethod(TerrainEditor, getTerrainBlocksMaterialList, const char *, (), , "() gets the list of current terrain materials for all terrain blocks.")
|
||||
{
|
||||
Vector<StringTableEntry> list;
|
||||
object->getTerrainBlocksMaterialList(list);
|
||||
|
|
@ -2500,112 +2501,99 @@ ConsoleMethod(TerrainEditor, getTerrainBlocksMaterialList, const char *, 2, 2, "
|
|||
return ret;
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, setBrushType, void, 3, 3, "(string type)"
|
||||
DefineConsoleMethod( TerrainEditor, setBrushType, void, (String type), , "(string type)"
|
||||
"One of box, ellipse, selection.")
|
||||
{
|
||||
object->setBrushType(argv[2]);
|
||||
object->setBrushType(type);
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, getBrushType, const char*, 2, 2, "()")
|
||||
DefineConsoleMethod( TerrainEditor, getBrushType, const char*, (), , "()")
|
||||
{
|
||||
return object->getBrushType();
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, setBrushSize, void, 3, 4, "(int w [, int h])")
|
||||
DefineConsoleMethod( TerrainEditor, setBrushSize, void, ( S32 w, S32 h), (0), "(int w [, int h])")
|
||||
{
|
||||
S32 w = dAtoi(argv[2]);
|
||||
S32 h = argc > 3 ? dAtoi(argv[3]) : w;
|
||||
object->setBrushSize( w, h );
|
||||
object->setBrushSize( w, h==0?w:h );
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, getBrushSize, const char*, 2, 2, "()")
|
||||
DefineConsoleMethod( TerrainEditor, getBrushSize, const char*, (), , "()")
|
||||
{
|
||||
Point2I size = object->getBrushSize();
|
||||
|
||||
static const U32 bufSize = 32;
|
||||
char * ret = Con::getReturnBuffer(bufSize);
|
||||
dSprintf(ret, bufSize, "%d %d", size.x, size.y);
|
||||
char * ret = Con::getReturnBuffer(32);
|
||||
dSprintf(ret, 32, "%d %d", size.x, size.y);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, setBrushPressure, void, 3, 3, "(float pressure)")
|
||||
DefineConsoleMethod( TerrainEditor, setBrushPressure, void, (F32 pressure), , "(float pressure)")
|
||||
{
|
||||
object->setBrushPressure( dAtof( argv[2] ) );
|
||||
object->setBrushPressure( pressure );
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, getBrushPressure, F32, 2, 2, "()")
|
||||
DefineConsoleMethod( TerrainEditor, getBrushPressure, F32, (), , "()")
|
||||
{
|
||||
return object->getBrushPressure();
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, setBrushSoftness, void, 3, 3, "(float softness)")
|
||||
DefineConsoleMethod( TerrainEditor, setBrushSoftness, void, (F32 softness), , "(float softness)")
|
||||
{
|
||||
object->setBrushSoftness( dAtof( argv[2] ) );
|
||||
object->setBrushSoftness( softness );
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, getBrushSoftness, F32, 2, 2, "()")
|
||||
DefineConsoleMethod( TerrainEditor, getBrushSoftness, F32, (), , "()")
|
||||
{
|
||||
|
||||
return object->getBrushSoftness();
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, getBrushPos, const char*, 2, 2, "Returns a Point2I.")
|
||||
DefineConsoleMethod( TerrainEditor, getBrushPos, const char*, (), , "Returns a Point2I.")
|
||||
{
|
||||
return object->getBrushPos();
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, setBrushPos, void, 3, 4, "(int x, int y)")
|
||||
DefineConsoleMethod( TerrainEditor, setBrushPos, void, (Point2I pos), , "Location")
|
||||
{
|
||||
//
|
||||
Point2I pos;
|
||||
if(argc == 3)
|
||||
dSscanf(argv[2], "%d %d", &pos.x, &pos.y);
|
||||
else
|
||||
{
|
||||
pos.x = dAtoi(argv[2]);
|
||||
pos.y = dAtoi(argv[3]);
|
||||
}
|
||||
|
||||
object->setBrushPos(pos);
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, setAction, void, 3, 3, "(string action_name)")
|
||||
DefineConsoleMethod( TerrainEditor, setAction, void, (const char * action_name), , "(string action_name)")
|
||||
{
|
||||
object->setAction(argv[2]);
|
||||
object->setAction(action_name);
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, getActionName, const char*, 3, 3, "(int num)")
|
||||
DefineConsoleMethod( TerrainEditor, getActionName, const char*, (U32 index), , "(int num)")
|
||||
{
|
||||
return (object->getActionName(dAtoi(argv[2])));
|
||||
return (object->getActionName(index));
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, getNumActions, S32, 2, 2, "")
|
||||
DefineConsoleMethod( TerrainEditor, getNumActions, S32, (), , "")
|
||||
{
|
||||
return(object->getNumActions());
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, getCurrentAction, const char*, 2, 2, "")
|
||||
DefineConsoleMethod( TerrainEditor, getCurrentAction, const char*, (), , "")
|
||||
{
|
||||
return object->getCurrentAction();
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, resetSelWeights, void, 3, 3, "(bool clear)")
|
||||
DefineConsoleMethod( TerrainEditor, resetSelWeights, void, (bool clear), , "(bool clear)")
|
||||
{
|
||||
object->resetSelWeights(dAtob(argv[2]));
|
||||
object->resetSelWeights(clear);
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, clearSelection, void, 2, 2, "")
|
||||
DefineConsoleMethod( TerrainEditor, clearSelection, void, (), , "")
|
||||
{
|
||||
object->clearSelection();
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, processAction, void, 2, 3, "(string action=NULL)")
|
||||
DefineConsoleMethod( TerrainEditor, processAction, void, (String action), (""), "(string action=NULL)")
|
||||
{
|
||||
if(argc == 3)
|
||||
object->processAction(argv[2]);
|
||||
else object->processAction("");
|
||||
object->processAction(action);
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, getActiveTerrain, S32, 2, 2, "")
|
||||
DefineConsoleMethod( TerrainEditor, getActiveTerrain, S32, (), , "")
|
||||
{
|
||||
S32 ret = 0;
|
||||
|
||||
|
|
@ -2617,27 +2605,27 @@ ConsoleMethod( TerrainEditor, getActiveTerrain, S32, 2, 2, "")
|
|||
return ret;
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, getNumTextures, S32, 2, 2, "")
|
||||
DefineConsoleMethod( TerrainEditor, getNumTextures, S32, (), , "")
|
||||
{
|
||||
return object->getNumTextures();
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, markEmptySquares, void, 2, 2, "")
|
||||
DefineConsoleMethod( TerrainEditor, markEmptySquares, void, (), , "")
|
||||
{
|
||||
object->markEmptySquares();
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, mirrorTerrain, void, 3, 3, "")
|
||||
DefineConsoleMethod( TerrainEditor, mirrorTerrain, void, (S32 mirrorIndex), , "")
|
||||
{
|
||||
object->mirrorTerrain(dAtoi(argv[2]));
|
||||
object->mirrorTerrain(mirrorIndex);
|
||||
}
|
||||
|
||||
ConsoleMethod(TerrainEditor, setTerraformOverlay, void, 3, 3, "(bool overlayEnable) - sets the terraformer current heightmap to draw as an overlay over the current terrain.")
|
||||
DefineConsoleMethod(TerrainEditor, setTerraformOverlay, void, (bool overlayEnable), , "(bool overlayEnable) - sets the terraformer current heightmap to draw as an overlay over the current terrain.")
|
||||
{
|
||||
// XA: This one needs to be implemented :)
|
||||
}
|
||||
|
||||
ConsoleMethod(TerrainEditor, updateMaterial, bool, 4, 4,
|
||||
DefineConsoleMethod(TerrainEditor, updateMaterial, bool, ( U32 index, String matName ), ,
|
||||
"( int index, string matName )\n"
|
||||
"Changes the material name at the index." )
|
||||
{
|
||||
|
|
@ -2645,18 +2633,17 @@ ConsoleMethod(TerrainEditor, updateMaterial, bool, 4, 4,
|
|||
if ( !terr )
|
||||
return false;
|
||||
|
||||
U32 index = dAtoi( argv[2] );
|
||||
if ( index >= terr->getMaterialCount() )
|
||||
return false;
|
||||
|
||||
terr->updateMaterial( index, argv[3] );
|
||||
terr->updateMaterial( index, matName );
|
||||
|
||||
object->setDirty();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ConsoleMethod(TerrainEditor, addMaterial, S32, 3, 3,
|
||||
DefineConsoleMethod(TerrainEditor, addMaterial, S32, ( String matName ), ,
|
||||
"( string matName )\n"
|
||||
"Adds a new material." )
|
||||
{
|
||||
|
|
@ -2664,20 +2651,19 @@ ConsoleMethod(TerrainEditor, addMaterial, S32, 3, 3,
|
|||
if ( !terr )
|
||||
return false;
|
||||
|
||||
terr->addMaterial( argv[2] );
|
||||
terr->addMaterial( matName );
|
||||
|
||||
object->setDirty();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, removeMaterial, void, 3, 3, "( int index ) - Remove the material at the given index." )
|
||||
DefineConsoleMethod( TerrainEditor, removeMaterial, void, ( S32 index ), , "( int index ) - Remove the material at the given index." )
|
||||
{
|
||||
TerrainBlock *terr = object->getClientTerrain();
|
||||
if ( !terr )
|
||||
return;
|
||||
|
||||
S32 index = dAtoi( argv[ 2 ] );
|
||||
if ( index < 0 || index >= terr->getMaterialCount() )
|
||||
{
|
||||
Con::errorf( "TerrainEditor::removeMaterial - index out of range!" );
|
||||
|
|
@ -2701,7 +2687,7 @@ ConsoleMethod( TerrainEditor, removeMaterial, void, 3, 3, "( int index ) - Remov
|
|||
object->setGridUpdateMinMax();
|
||||
}
|
||||
|
||||
ConsoleMethod(TerrainEditor, getMaterialCount, S32, 2, 2,
|
||||
DefineConsoleMethod(TerrainEditor, getMaterialCount, S32, (), ,
|
||||
"Returns the current material count." )
|
||||
{
|
||||
TerrainBlock *terr = object->getClientTerrain();
|
||||
|
|
@ -2711,7 +2697,7 @@ ConsoleMethod(TerrainEditor, getMaterialCount, S32, 2, 2,
|
|||
return 0;
|
||||
}
|
||||
|
||||
ConsoleMethod(TerrainEditor, getMaterials, const char *, 2, 2, "() gets the list of current terrain materials.")
|
||||
DefineConsoleMethod(TerrainEditor, getMaterials, const char *, (), , "() gets the list of current terrain materials.")
|
||||
{
|
||||
TerrainBlock *terr = object->getClientTerrain();
|
||||
if ( !terr )
|
||||
|
|
@ -2728,13 +2714,12 @@ ConsoleMethod(TerrainEditor, getMaterials, const char *, 2, 2, "() gets the list
|
|||
return ret;
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, getMaterialName, const char*, 3, 3, "( int index ) - Returns the name of the material at the given index." )
|
||||
DefineConsoleMethod( TerrainEditor, getMaterialName, const char*, (S32 index), , "( int index ) - Returns the name of the material at the given index." )
|
||||
{
|
||||
TerrainBlock *terr = object->getClientTerrain();
|
||||
if ( !terr )
|
||||
return "";
|
||||
|
||||
S32 index = dAtoi( argv[ 2 ] );
|
||||
if( index < 0 || index >= terr->getMaterialCount() )
|
||||
{
|
||||
Con::errorf( "TerrainEditor::getMaterialName - index out of range!" );
|
||||
|
|
@ -2745,13 +2730,12 @@ ConsoleMethod( TerrainEditor, getMaterialName, const char*, 3, 3, "( int index )
|
|||
return Con::getReturnBuffer( name );
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, getMaterialIndex, S32, 3, 3, "( string name ) - Returns the index of the material with the given name or -1." )
|
||||
DefineConsoleMethod( TerrainEditor, getMaterialIndex, S32, ( String name ), , "( string name ) - Returns the index of the material with the given name or -1." )
|
||||
{
|
||||
TerrainBlock *terr = object->getClientTerrain();
|
||||
if ( !terr )
|
||||
return -1;
|
||||
|
||||
const char* name = argv[ 2 ];
|
||||
const U32 count = terr->getMaterialCount();
|
||||
|
||||
for( U32 i = 0; i < count; ++ i )
|
||||
|
|
@ -2761,13 +2745,14 @@ ConsoleMethod( TerrainEditor, getMaterialIndex, S32, 3, 3, "( string name ) - Re
|
|||
return -1;
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, reorderMaterial, void, 4, 4, "( int index, int order ) "
|
||||
DefineConsoleMethod( TerrainEditor, reorderMaterial, void, ( S32 index, S32 orderPos ), , "( int index, int order ) "
|
||||
"- Reorder material at the given index to the new position, changing the order in which it is rendered / blended." )
|
||||
{
|
||||
object->reorderMaterial( dAtoi( argv[2] ), dAtoi( argv[3] ) );
|
||||
object->reorderMaterial( index, orderPos );
|
||||
}
|
||||
|
||||
ConsoleMethod(TerrainEditor, getTerrainUnderWorldPoint, S32, 3, 5, "(x/y/z) Gets the terrain block that is located under the given world point.\n"
|
||||
DefineConsoleMethod(TerrainEditor, getTerrainUnderWorldPoint, S32, (const char * ptOrX, const char * Y, const char * Z), ("", "", ""),
|
||||
"(x/y/z) Gets the terrain block that is located under the given world point.\n"
|
||||
"@param x/y/z The world coordinates (floating point values) you wish to query at. "
|
||||
"These can be formatted as either a string (\"x y z\") or separately as (x, y, z)\n"
|
||||
"@return Returns the ID of the requested terrain block (0 if not found).\n\n")
|
||||
|
|
@ -2776,13 +2761,13 @@ ConsoleMethod(TerrainEditor, getTerrainUnderWorldPoint, S32, 3, 5, "(x/y/z) Gets
|
|||
if(tEditor == NULL)
|
||||
return 0;
|
||||
Point3F pos;
|
||||
if(argc == 3)
|
||||
dSscanf(argv[2], "%f %f %f", &pos.x, &pos.y, &pos.z);
|
||||
else if(argc == 5)
|
||||
if(ptOrX != "" && Y == "" && Z == "")
|
||||
dSscanf(ptOrX, "%f %f %f", &pos.x, &pos.y, &pos.z);
|
||||
else if(ptOrX != "" && Y != "" && Z != "")
|
||||
{
|
||||
pos.x = dAtof(argv[2]);
|
||||
pos.y = dAtof(argv[3]);
|
||||
pos.z = dAtof(argv[4]);
|
||||
pos.x = dAtof(ptOrX);
|
||||
pos.y = dAtof(Y);
|
||||
pos.z = dAtof(Z);
|
||||
}
|
||||
|
||||
else
|
||||
|
|
@ -2835,14 +2820,13 @@ void TerrainEditor::initPersistFields()
|
|||
Parent::initPersistFields();
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, getSlopeLimitMinAngle, F32, 2, 2, 0)
|
||||
DefineConsoleMethod( TerrainEditor, getSlopeLimitMinAngle, F32, (), , "")
|
||||
{
|
||||
return object->mSlopeMinAngle;
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, setSlopeLimitMinAngle, F32, 3, 3, 0)
|
||||
DefineConsoleMethod( TerrainEditor, setSlopeLimitMinAngle, F32, (F32 angle), , "")
|
||||
{
|
||||
F32 angle = dAtof( argv[2] );
|
||||
if ( angle < 0.0f )
|
||||
angle = 0.0f;
|
||||
if ( angle > object->mSlopeMaxAngle )
|
||||
|
|
@ -2852,14 +2836,13 @@ ConsoleMethod( TerrainEditor, setSlopeLimitMinAngle, F32, 3, 3, 0)
|
|||
return angle;
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, getSlopeLimitMaxAngle, F32, 2, 2, 0)
|
||||
DefineConsoleMethod( TerrainEditor, getSlopeLimitMaxAngle, F32, (), , "")
|
||||
{
|
||||
return object->mSlopeMaxAngle;
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, setSlopeLimitMaxAngle, F32, 3, 3, 0)
|
||||
DefineConsoleMethod( TerrainEditor, setSlopeLimitMaxAngle, F32, (F32 angle), , "")
|
||||
{
|
||||
F32 angle = dAtof( argv[2] );
|
||||
if ( angle > 90.0f )
|
||||
angle = 90.0f;
|
||||
if ( angle < object->mSlopeMinAngle )
|
||||
|
|
@ -2938,7 +2921,7 @@ void TerrainEditor::autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinS
|
|||
scheduleMaterialUpdate();
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, autoMaterialLayer, void, 7, 7, "(float minHeight, float maxHeight, float minSlope, float maxSlope, float coverage)")
|
||||
DefineConsoleMethod( TerrainEditor, autoMaterialLayer, void, (F32 minHeight, F32 maxHeight, F32 minSlope, F32 maxSlope, F32 coverage), , "(F32 minHeight, F32 maxHeight, F32 minSlope, F32 maxSlope , F32 coverage)")
|
||||
{
|
||||
object->autoMaterialLayer( dAtof(argv[2]), dAtof(argv[3]), dAtof(argv[4]), dAtof(argv[5]), dAtof(argv[6]));
|
||||
}
|
||||
object->autoMaterialLayer( minHeight,maxHeight, minSlope, maxSlope, coverage );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "gui/editor/inspector/field.h"
|
||||
#include "gui/editor/guiInspector.h"
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
|
||||
IMPLEMENT_CONOBJECT( MECreateUndoAction );
|
||||
|
|
@ -57,10 +58,9 @@ void MECreateUndoAction::addObject( SimObject *object )
|
|||
mObjects.last().id = object->getId();
|
||||
}
|
||||
|
||||
ConsoleMethod( MECreateUndoAction, addObject, void, 3, 3, "( SimObject obj )")
|
||||
DefineConsoleMethod( MECreateUndoAction, addObject, void, (SimObject *obj), , "( SimObject obj )")
|
||||
{
|
||||
SimObject *obj = NULL;
|
||||
if ( Sim::findObject( argv[2], obj ) && obj )
|
||||
if (obj)
|
||||
object->addObject( obj );
|
||||
}
|
||||
|
||||
|
|
@ -163,10 +163,9 @@ void MEDeleteUndoAction::deleteObject( const Vector<SimObject*> &objectList )
|
|||
deleteObject( objectList[i] );
|
||||
}
|
||||
|
||||
ConsoleMethod( MEDeleteUndoAction, deleteObject, void, 3, 3, "( SimObject obj )")
|
||||
DefineConsoleMethod( MEDeleteUndoAction, deleteObject, void, (SimObject *obj ), , "( SimObject obj )")
|
||||
{
|
||||
SimObject *obj = NULL;
|
||||
if ( Sim::findObject( argv[2], obj ) && obj )
|
||||
if (obj)
|
||||
object->deleteObject( obj );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3187,17 +3187,17 @@ ConsoleMethod( WorldEditor, ignoreObjClass, void, 3, 0, "(string class_name, ...
|
|||
object->ignoreObjClass(argc, argv);
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, clearIgnoreList, void, 2, 2, "")
|
||||
DefineConsoleMethod( WorldEditor, clearIgnoreList, void, (), , "")
|
||||
{
|
||||
object->clearIgnoreList();
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, clearSelection, void, 2, 2, "")
|
||||
DefineConsoleMethod( WorldEditor, clearSelection, void, (), , "")
|
||||
{
|
||||
object->clearSelection();
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, getActiveSelection, S32, 2, 2, "() - Return the currently active WorldEditorSelection object." )
|
||||
DefineConsoleMethod( WorldEditor, getActiveSelection, S32, (), , "() - Return the currently active WorldEditorSelection object." )
|
||||
{
|
||||
if( !object->getActiveSelectionSet() )
|
||||
return 0;
|
||||
|
|
@ -3205,43 +3205,36 @@ ConsoleMethod( WorldEditor, getActiveSelection, S32, 2, 2, "() - Return the curr
|
|||
return object->getActiveSelectionSet()->getId();
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, setActiveSelection, void, 3, 3, "( id set ) - Set the currently active WorldEditorSelection object." )
|
||||
DefineConsoleMethod( WorldEditor, setActiveSelection, void, ( WorldEditorSelection* selection), , "( id set ) - Set the currently active WorldEditorSelection object." )
|
||||
{
|
||||
WorldEditorSelection* selection;
|
||||
if( !Sim::findObject( argv[ 2 ], selection ) )
|
||||
{
|
||||
Con::errorf( "WorldEditor::setActiveSelectionSet - no selection set '%s'", (const char*)argv[ 2 ] );
|
||||
return;
|
||||
}
|
||||
|
||||
if (selection)
|
||||
object->makeActiveSelectionSet( selection );
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, selectObject, void, 3, 3, "(SimObject obj)")
|
||||
DefineConsoleMethod( WorldEditor, selectObject, void, (const char * objName), , "(SimObject obj)")
|
||||
{
|
||||
object->selectObject(argv[2]);
|
||||
object->selectObject(objName);
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, unselectObject, void, 3, 3, "(SimObject obj)")
|
||||
DefineConsoleMethod( WorldEditor, unselectObject, void, (const char * objName), , "(SimObject obj)")
|
||||
{
|
||||
object->unselectObject(argv[2]);
|
||||
object->unselectObject(objName);
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, invalidateSelectionCentroid, void, 2, 2, "")
|
||||
DefineConsoleMethod( WorldEditor, invalidateSelectionCentroid, void, (), , "")
|
||||
{
|
||||
WorldEditor::Selection* sel = object->getActiveSelectionSet();
|
||||
if(sel)
|
||||
sel->invalidateCentroid();
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, getSelectionSize, S32, 2, 2, "() - Return the number of objects currently selected in the editor.")
|
||||
DefineConsoleMethod( WorldEditor, getSelectionSize, S32, (), , "() - Return the number of objects currently selected in the editor.")
|
||||
{
|
||||
return object->getSelectionSize();
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, getSelectedObject, S32, 3, 3, "(int index)")
|
||||
DefineConsoleMethod( WorldEditor, getSelectedObject, S32, (S32 index), , "(int index)")
|
||||
{
|
||||
S32 index = dAtoi(argv[2]);
|
||||
if(index < 0 || index >= object->getSelectionSize())
|
||||
{
|
||||
Con::errorf(ConsoleLogEntry::General, "WorldEditor::getSelectedObject: invalid object index");
|
||||
|
|
@ -3251,30 +3244,23 @@ ConsoleMethod( WorldEditor, getSelectedObject, S32, 3, 3, "(int index)")
|
|||
return(object->getSelectObject(index));
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, getSelectionRadius, F32, 2, 2, "")
|
||||
DefineConsoleMethod( WorldEditor, getSelectionRadius, F32, (), , "")
|
||||
{
|
||||
return object->getSelectionRadius();
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, getSelectionCentroid, const char *, 2, 2, "")
|
||||
DefineConsoleMethod( WorldEditor, getSelectionCentroid, const char *, (), , "")
|
||||
{
|
||||
return object->getSelectionCentroidText();
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, getSelectionExtent, const char *, 2, 2, "")
|
||||
DefineConsoleMethod( WorldEditor, getSelectionExtent, Point3F, (), , "")
|
||||
{
|
||||
Point3F bounds = object->getSelectionExtent();
|
||||
static const U32 bufSize = 100;
|
||||
char * ret = Con::getReturnBuffer(bufSize);
|
||||
dSprintf(ret, bufSize, "%g %g %g", bounds.x, bounds.y, bounds.z);
|
||||
return ret;
|
||||
return object->getSelectionExtent();
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, dropSelection, void, 2, 3, "( bool skipUndo = false )")
|
||||
DefineConsoleMethod( WorldEditor, dropSelection, void, ( bool skipUndo ), (false), "( bool skipUndo = false )")
|
||||
{
|
||||
bool skipUndo = false;
|
||||
if ( argc > 2 )
|
||||
skipUndo = dAtob( argv[2] );
|
||||
|
||||
object->dropCurrentSelection( skipUndo );
|
||||
}
|
||||
|
|
@ -3289,17 +3275,17 @@ void WorldEditor::copyCurrentSelection()
|
|||
copySelection(mSelected);
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, cutSelection, void, 2, 2, "")
|
||||
DefineConsoleMethod( WorldEditor, cutSelection, void, (),, "")
|
||||
{
|
||||
object->cutCurrentSelection();
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, copySelection, void, 2, 2, "")
|
||||
DefineConsoleMethod( WorldEditor, copySelection, void, (),, "")
|
||||
{
|
||||
object->copyCurrentSelection();
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, pasteSelection, void, 2, 2, "")
|
||||
DefineConsoleMethod( WorldEditor, pasteSelection, void, (),, "")
|
||||
{
|
||||
object->pasteSelection();
|
||||
}
|
||||
|
|
@ -3309,88 +3295,86 @@ bool WorldEditor::canPasteSelection()
|
|||
return mCopyBuffer.empty() != true;
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, canPasteSelection, bool, 2, 2, "")
|
||||
DefineConsoleMethod( WorldEditor, canPasteSelection, bool, (),, "")
|
||||
{
|
||||
return object->canPasteSelection();
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, hideObject, void, 4, 4, "(Object obj, bool hide)")
|
||||
DefineConsoleMethod( WorldEditor, hideObject, void, (SceneObject *obj, bool hide), , "(Object obj, bool hide)")
|
||||
{
|
||||
SceneObject *obj;
|
||||
if ( !Sim::findObject( argv[2], obj ) )
|
||||
return;
|
||||
|
||||
object->hideObject(obj, dAtob(argv[3]));
|
||||
if (obj)
|
||||
object->hideObject(obj, hide);
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, hideSelection, void, 3, 3, "(bool hide)")
|
||||
DefineConsoleMethod( WorldEditor, hideSelection, void, (bool hide), , "(bool hide)")
|
||||
{
|
||||
object->hideSelection(dAtob(argv[2]));
|
||||
object->hideSelection(hide);
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, lockSelection, void, 3, 3, "(bool lock)")
|
||||
DefineConsoleMethod( WorldEditor, lockSelection, void, (bool lock), , "(bool lock)")
|
||||
{
|
||||
object->lockSelection(dAtob(argv[2]));
|
||||
object->lockSelection(lock);
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, alignByBounds, void, 3, 3, "(int boundsAxis)"
|
||||
DefineConsoleMethod( WorldEditor, alignByBounds, void, (S32 boundsAxis), , "(int boundsAxis)"
|
||||
"Align all selected objects against the given bounds axis.")
|
||||
{
|
||||
if(!object->alignByBounds(dAtoi(argv[2])))
|
||||
Con::warnf(ConsoleLogEntry::General, avar("worldEditor.alignByBounds: invalid bounds axis '%s'", (const char*)argv[2]));
|
||||
if(!object->alignByBounds(boundsAxis))
|
||||
Con::warnf(ConsoleLogEntry::General, avar("worldEditor.alignByBounds: invalid bounds axis '%s'", boundsAxis));
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, alignByAxis, void, 3, 3, "(int axis)"
|
||||
DefineConsoleMethod( WorldEditor, alignByAxis, void, (S32 boundsAxis), , "(int axis)"
|
||||
"Align all selected objects along the given axis.")
|
||||
{
|
||||
if(!object->alignByAxis(dAtoi(argv[2])))
|
||||
Con::warnf(ConsoleLogEntry::General, avar("worldEditor.alignByAxis: invalid axis '%s'", (const char*)argv[2]));
|
||||
if(!object->alignByAxis(boundsAxis))
|
||||
Con::warnf(ConsoleLogEntry::General, avar("worldEditor.alignByAxis: invalid axis '%s'", boundsAxis));
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, resetSelectedRotation, void, 2, 2, "")
|
||||
DefineConsoleMethod( WorldEditor, resetSelectedRotation, void, (),, "")
|
||||
{
|
||||
object->resetSelectedRotation();
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, resetSelectedScale, void, 2, 2, "")
|
||||
DefineConsoleMethod( WorldEditor, resetSelectedScale, void, (),, "")
|
||||
{
|
||||
object->resetSelectedScale();
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, redirectConsole, void, 3, 3, "( int objID )")
|
||||
DefineConsoleMethod( WorldEditor, redirectConsole, void, (S32 objID), , "( int objID )")
|
||||
{
|
||||
object->redirectConsole(dAtoi(argv[2]));
|
||||
object->redirectConsole(objID);
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, addUndoState, void, 2, 2, "")
|
||||
DefineConsoleMethod( WorldEditor, addUndoState, void, (),, "")
|
||||
{
|
||||
object->addUndoState();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod( WorldEditor, getSoftSnap, bool, 2, 2, "getSoftSnap()\n"
|
||||
DefineConsoleMethod( WorldEditor, getSoftSnap, bool, (),, "getSoftSnap()\n"
|
||||
"Is soft snapping always on?")
|
||||
{
|
||||
return object->mSoftSnap;
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, setSoftSnap, void, 3, 3, "setSoftSnap(bool)\n"
|
||||
DefineConsoleMethod( WorldEditor, setSoftSnap, void, (bool enable), , "setSoftSnap(bool)\n"
|
||||
"Allow soft snapping all of the time.")
|
||||
{
|
||||
object->mSoftSnap = dAtob(argv[2]);
|
||||
object->mSoftSnap = enable;
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, getSoftSnapSize, F32, 2, 2, "getSoftSnapSize()\n"
|
||||
DefineConsoleMethod( WorldEditor, getSoftSnapSize, F32, (),, "getSoftSnapSize()\n"
|
||||
"Get the absolute size to trigger a soft snap.")
|
||||
{
|
||||
return object->mSoftSnapSize;
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, setSoftSnapSize, void, 3, 3, "setSoftSnapSize(F32)\n"
|
||||
DefineConsoleMethod( WorldEditor, setSoftSnapSize, void, (F32 size), , "setSoftSnapSize(F32)\n"
|
||||
"Set the absolute size to trigger a soft snap.")
|
||||
{
|
||||
object->mSoftSnapSize = dAtof(argv[2]);
|
||||
object->mSoftSnapSize = size;
|
||||
}
|
||||
|
||||
DefineEngineMethod( WorldEditor, getSoftSnapAlignment, WorldEditor::AlignmentType, (),,
|
||||
|
|
@ -3405,40 +3389,40 @@ DefineEngineMethod( WorldEditor, setSoftSnapAlignment, void, ( WorldEditor::Alig
|
|||
object->mSoftSnapAlignment = type;
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, softSnapSizeByBounds, void, 3, 3, "softSnapSizeByBounds(bool)\n"
|
||||
DefineConsoleMethod( WorldEditor, softSnapSizeByBounds, void, (bool enable), , "softSnapSizeByBounds(bool)\n"
|
||||
"Use selection bounds size as soft snap bounds.")
|
||||
{
|
||||
object->mSoftSnapSizeByBounds = dAtob(argv[2]);
|
||||
object->mSoftSnapSizeByBounds = enable;
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, getSoftSnapBackfaceTolerance, F32, 2, 2, "getSoftSnapBackfaceTolerance()\n"
|
||||
DefineConsoleMethod( WorldEditor, getSoftSnapBackfaceTolerance, F32, (), , "getSoftSnapBackfaceTolerance()\n"
|
||||
"The fraction of the soft snap radius that backfaces may be included.")
|
||||
{
|
||||
return object->mSoftSnapBackfaceTolerance;
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, setSoftSnapBackfaceTolerance, void, 3, 3, "setSoftSnapBackfaceTolerance(F32 with range of 0..1)\n"
|
||||
DefineConsoleMethod( WorldEditor, setSoftSnapBackfaceTolerance, void, (F32 range), , "setSoftSnapBackfaceTolerance(F32 with range of 0..1)\n"
|
||||
"The fraction of the soft snap radius that backfaces may be included.")
|
||||
{
|
||||
object->mSoftSnapBackfaceTolerance = dAtof(argv[2]);
|
||||
object->mSoftSnapBackfaceTolerance = range;
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, softSnapRender, void, 3, 3, "softSnapRender(bool)\n"
|
||||
DefineConsoleMethod( WorldEditor, softSnapRender, void, (bool enable), , "softSnapRender(bool)\n"
|
||||
"Render the soft snapping bounds.")
|
||||
{
|
||||
object->mSoftSnapRender = dAtob(argv[2]);
|
||||
object->mSoftSnapRender = enable;
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, softSnapRenderTriangle, void, 3, 3, "softSnapRenderTriangle(bool)\n"
|
||||
DefineConsoleMethod( WorldEditor, softSnapRenderTriangle, void, (bool enable), , "softSnapRenderTriangle(bool)\n"
|
||||
"Render the soft snapped triangle.")
|
||||
{
|
||||
object->mSoftSnapRenderTriangle = dAtob(argv[2]);
|
||||
object->mSoftSnapRenderTriangle = enable;
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, softSnapDebugRender, void, 3, 3, "softSnapDebugRender(bool)\n"
|
||||
DefineConsoleMethod( WorldEditor, softSnapDebugRender, void, (bool enable), , "softSnapDebugRender(bool)\n"
|
||||
"Toggle soft snapping debug rendering.")
|
||||
{
|
||||
object->mSoftSnapDebugRender = dAtob(argv[2]);
|
||||
object->mSoftSnapDebugRender = enable;
|
||||
}
|
||||
|
||||
DefineEngineMethod( WorldEditor, getTerrainSnapAlignment, WorldEditor::AlignmentType, (),,
|
||||
|
|
@ -3453,27 +3437,22 @@ DefineEngineMethod( WorldEditor, setTerrainSnapAlignment, void, ( WorldEditor::A
|
|||
object->mTerrainSnapAlignment = alignment;
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, transformSelection, void, 13, 13, "transformSelection(...)\n"
|
||||
DefineConsoleMethod( WorldEditor, transformSelection, void,
|
||||
( bool position,
|
||||
Point3F point,
|
||||
bool relativePos,
|
||||
bool rotate,
|
||||
Point3F rotation,
|
||||
bool relativeRot,
|
||||
bool rotLocal,
|
||||
S32 scaleType,
|
||||
Point3F scale,
|
||||
bool sRelative,
|
||||
bool sLocal ), , "transformSelection(...)\n"
|
||||
"Transform selection by given parameters.")
|
||||
{
|
||||
bool position = dAtob(argv[2]);
|
||||
Point3F p(0.0f, 0.0f, 0.0f);
|
||||
dSscanf(argv[3], "%g %g %g", &p.x, &p.y, &p.z);
|
||||
bool relativePos = dAtob(argv[4]);
|
||||
|
||||
bool rotate = dAtob(argv[5]);
|
||||
EulerF r(0.0f, 0.0f, 0.0f);
|
||||
dSscanf(argv[6], "%g %g %g", &r.x, &r.y, &r.z);
|
||||
bool relativeRot = dAtob(argv[7]);
|
||||
bool rotLocal = dAtob(argv[8]);
|
||||
|
||||
S32 scaleType = dAtoi(argv[9]);
|
||||
Point3F s(1.0f, 1.0f, 1.0f);
|
||||
dSscanf(argv[10], "%g %g %g", &s.x, &s.y, &s.z);
|
||||
bool sRelative = dAtob(argv[11]);
|
||||
bool sLocal = dAtob(argv[12]);
|
||||
|
||||
object->transformSelection(position, p, relativePos, rotate, r, relativeRot, rotLocal, scaleType, s, sRelative, sLocal);
|
||||
object->transformSelection(position, point, relativePos, rotate, rotation, relativeRot, rotLocal, scaleType, scale, sRelative, sLocal);
|
||||
}
|
||||
|
||||
#include "core/strings/stringUnit.h"
|
||||
|
|
@ -3546,10 +3525,10 @@ void WorldEditor::colladaExportSelection( const String &path )
|
|||
#endif
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, colladaExportSelection, void, 3, 3,
|
||||
DefineConsoleMethod( WorldEditor, colladaExportSelection, void, (const char * path), ,
|
||||
"( String path ) - Export the combined geometry of all selected objects to the specified path in collada format." )
|
||||
{
|
||||
object->colladaExportSelection( (const char*)argv[2] );
|
||||
object->colladaExportSelection( path );
|
||||
}
|
||||
|
||||
void WorldEditor::makeSelectionPrefab( const char *filename )
|
||||
|
|
@ -3700,25 +3679,20 @@ void WorldEditor::explodeSelectedPrefab()
|
|||
setDirty();
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, makeSelectionPrefab, void, 3, 3, "( string filename ) - Save selected objects to a .prefab file and replace them in the level with a Prefab object." )
|
||||
DefineConsoleMethod( WorldEditor, makeSelectionPrefab, void, ( const char * filename ), , "( string filename ) - Save selected objects to a .prefab file and replace them in the level with a Prefab object." )
|
||||
{
|
||||
object->makeSelectionPrefab( argv[2] );
|
||||
object->makeSelectionPrefab( filename );
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, explodeSelectedPrefab, void, 2, 2, "() - Replace selected Prefab objects with a SimGroup containing all children objects defined in the .prefab." )
|
||||
DefineConsoleMethod( WorldEditor, explodeSelectedPrefab, void, (),, "() - Replace selected Prefab objects with a SimGroup containing all children objects defined in the .prefab." )
|
||||
{
|
||||
object->explodeSelectedPrefab();
|
||||
}
|
||||
|
||||
ConsoleMethod( WorldEditor, mountRelative, void, 4, 4, "( Object A, Object B )" )
|
||||
DefineConsoleMethod( WorldEditor, mountRelative, void, ( SceneObject *objA, SceneObject *objB ), , "( Object A, Object B )" )
|
||||
{
|
||||
SceneObject *objA;
|
||||
if ( !Sim::findObject( argv[2], objA ) )
|
||||
return;
|
||||
|
||||
SceneObject *objB;
|
||||
if ( !Sim::findObject( argv[3], objB ) )
|
||||
return;
|
||||
if (!objA || !objB)
|
||||
return;
|
||||
|
||||
MatrixF xfm = objB->getTransform();
|
||||
MatrixF mat = objA->getWorldTransform();
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include "core/stream/stream.h"
|
||||
#include "core/stream/fileStream.h"
|
||||
#include "console/console.h"
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
#include "i18n/i18n.h"
|
||||
#include "i18n/lang.h"
|
||||
|
|
@ -57,7 +58,7 @@ const UTF8 *getCoreString(S32 id)
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleFunction(getCoreLangTable, S32, 1, 1, "()"
|
||||
DefineConsoleFunction( getCoreLangTable, S32, (), , "()"
|
||||
"@brief Gets the primary LangTable used by the game\n\n"
|
||||
"@return ID of the core LangTable\n"
|
||||
"@ingroup Localization")
|
||||
|
|
@ -68,17 +69,20 @@ ConsoleFunction(getCoreLangTable, S32, 1, 1, "()"
|
|||
return 0;
|
||||
}
|
||||
|
||||
ConsoleFunction(setCoreLangTable, void, 2, 2, "(string LangTable)"
|
||||
DefineConsoleFunction( setCoreLangTable, void, (const char * lgTable), , "(string LangTable)"
|
||||
"@brief Sets the primary LangTable used by the game\n\n"
|
||||
"@param LangTable ID of the core LangTable\n"
|
||||
"@ingroup Localization")
|
||||
{
|
||||
LangTable *lt;
|
||||
LangTable * lt;
|
||||
|
||||
if(Sim::findObject(argv[1], lt))
|
||||
gCoreLangTable = lt;
|
||||
if(Sim::findObject(lgTable, lt))
|
||||
{ gCoreLangTable = lt; }
|
||||
else
|
||||
Con::errorf("setCoreLangTable - Unable to find LanTable '%s'", (const char*)argv[1]);
|
||||
{
|
||||
Con::errorf("setCoreLangTable - Unable to find LanTable '%s'", lgTable);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -325,7 +325,7 @@ void LangTable::setCurrentLanguage(S32 langid)
|
|||
|
||||
|
||||
|
||||
ConsoleMethod(LangTable, addLanguage, S32, 3, 4,
|
||||
DefineConsoleMethod(LangTable, addLanguage, S32, (String filename, String languageName), ("", ""),
|
||||
"(string filename, [string languageName])"
|
||||
"@brief Adds a language to the table\n\n"
|
||||
"@param filename Name and path to the language file\n"
|
||||
|
|
@ -335,11 +335,11 @@ ConsoleMethod(LangTable, addLanguage, S32, 3, 4,
|
|||
{
|
||||
UTF8 scriptFilenameBuffer[1024];
|
||||
|
||||
Con::expandScriptFilename((char*)scriptFilenameBuffer, sizeof(scriptFilenameBuffer), argv[2]);
|
||||
return object->addLanguage(scriptFilenameBuffer, argc == 4 ? (const UTF8*)argv[3] : NULL);
|
||||
Con::expandScriptFilename((char*)scriptFilenameBuffer, sizeof(scriptFilenameBuffer), filename);
|
||||
return object->addLanguage(scriptFilenameBuffer, (const UTF8*)languageName);
|
||||
}
|
||||
|
||||
ConsoleMethod(LangTable, getString, const char *, 3, 3,
|
||||
DefineConsoleMethod(LangTable, getString, const char *, (U32 id), ,
|
||||
"(string filename)"
|
||||
"@brief Grabs a string from the specified table\n\n"
|
||||
"If an invalid is passed, the function will attempt to "
|
||||
|
|
@ -347,7 +347,7 @@ ConsoleMethod(LangTable, getString, const char *, 3, 3,
|
|||
"@param filename Name of the language table to access\n\n"
|
||||
"@return Text from the specified language table, \"\" if ID was invalid and default table is not set")
|
||||
{
|
||||
const char * str = (const char*)object->getString(dAtoi(argv[2]));
|
||||
const char * str = (const char*)object->getString(id);
|
||||
if(str != NULL)
|
||||
{
|
||||
char * ret = Con::getReturnBuffer(dStrlen(str) + 1);
|
||||
|
|
@ -358,34 +358,34 @@ ConsoleMethod(LangTable, getString, const char *, 3, 3,
|
|||
return "";
|
||||
}
|
||||
|
||||
ConsoleMethod(LangTable, setDefaultLanguage, void, 3, 3, "(int language)"
|
||||
DefineConsoleMethod(LangTable, setDefaultLanguage, void, (S32 langId), , "(int language)"
|
||||
"@brief Sets the default language table\n\n"
|
||||
"@param language ID of the table\n")
|
||||
{
|
||||
object->setDefaultLanguage(dAtoi(argv[2]));
|
||||
object->setDefaultLanguage(langId);
|
||||
}
|
||||
|
||||
ConsoleMethod(LangTable, setCurrentLanguage, void, 3, 3,
|
||||
DefineConsoleMethod(LangTable, setCurrentLanguage, void, (S32 langId), ,
|
||||
"(int language)"
|
||||
"@brief Sets the current language table for grabbing text\n\n"
|
||||
"@param language ID of the table\n")
|
||||
{
|
||||
object->setCurrentLanguage(dAtoi(argv[2]));
|
||||
object->setCurrentLanguage(langId);
|
||||
}
|
||||
|
||||
ConsoleMethod(LangTable, getCurrentLanguage, S32, 2, 2, "()"
|
||||
DefineConsoleMethod(LangTable, getCurrentLanguage, S32, (), , "()"
|
||||
"@brief Get the ID of the current language table\n\n"
|
||||
"@return Numerical ID of the current language table")
|
||||
{
|
||||
return object->getCurrentLanguage();
|
||||
}
|
||||
|
||||
ConsoleMethod(LangTable, getLangName, const char *, 3, 3, "(int language)"
|
||||
DefineConsoleMethod(LangTable, getLangName, const char *, (S32 langId), , "(int language)"
|
||||
"@brief Return the readable name of the language table\n\n"
|
||||
"@param language Numerical ID of the language table to access\n\n"
|
||||
"@return String containing the name of the table, NULL if ID was invalid or name was never specified")
|
||||
{
|
||||
const char * str = (const char*)object->getLangName(dAtoi(argv[2]));
|
||||
const char * str = (const char*)object->getLangName(langId);
|
||||
if(str != NULL)
|
||||
{
|
||||
char * ret = Con::getReturnBuffer(dStrlen(str) + 1);
|
||||
|
|
@ -396,7 +396,7 @@ ConsoleMethod(LangTable, getLangName, const char *, 3, 3, "(int language)"
|
|||
return "";
|
||||
}
|
||||
|
||||
ConsoleMethod(LangTable, getNumLang, S32, 2, 2, "()"
|
||||
DefineConsoleMethod(LangTable, getNumLang, S32, (), , "()"
|
||||
"@brief Used to find out how many languages are in the table\n\n"
|
||||
"@return Size of the vector containing the languages, numerical")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include "materials/materialManager.h"
|
||||
#include "math/util/sphereMesh.h"
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "scene/sceneRenderState.h"
|
||||
#include "gfx/gfxCardProfile.h"
|
||||
#include "gfx/gfxTextureProfile.h"
|
||||
|
|
@ -645,7 +646,7 @@ LightShadowMap* AdvancedLightManager::findShadowMapForObject( SimObject *object
|
|||
return sceneLight->getLight()->getExtended<ShadowMapParams>()->getShadowMap();
|
||||
}
|
||||
|
||||
ConsoleFunction( setShadowVizLight, const char*, 2, 2, "" )
|
||||
DefineConsoleFunction( setShadowVizLight, const char*, (const char* name), (""), "")
|
||||
{
|
||||
static const String DebugTargetName( "AL_ShadowVizTexture" );
|
||||
|
||||
|
|
@ -658,7 +659,7 @@ ConsoleFunction( setShadowVizLight, const char*, 2, 2, "" )
|
|||
return 0;
|
||||
|
||||
SimObject *object;
|
||||
Sim::findObject( argv[1], object );
|
||||
Sim::findObject( name, object );
|
||||
LightShadowMap *lightShadowMap = lm->findShadowMapForObject( object );
|
||||
if ( !lightShadowMap || !lightShadowMap->getTexture() )
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "scene/sceneManager.h"
|
||||
#include "materials/materialManager.h"
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
const String ShadowManager::ManagerTypeName("ShadowManager");
|
||||
|
||||
|
|
@ -53,7 +54,7 @@ SceneManager* ShadowManager::getSceneManager()
|
|||
//------------------------------------------------------------------------------
|
||||
|
||||
// Runtime switching of shadow systems. Requires correct world to be pushed at console.
|
||||
ConsoleFunction( setShadowManager, bool, 1, 3, "string sShadowSystemName" )
|
||||
DefineConsoleFunction( setShadowManager, bool, (const char* sShadowSystemName), (""), "string sShadowSystemName")
|
||||
{
|
||||
/*
|
||||
// Make sure this new one exists
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include "materials/materialDefinition.h"
|
||||
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "math/mathTypes.h"
|
||||
#include "materials/materialManager.h"
|
||||
#include "sceneData.h"
|
||||
|
|
@ -594,55 +595,55 @@ void Material::StageData::getFeatureSet( FeatureSet *outFeatures ) const
|
|||
}
|
||||
}
|
||||
|
||||
ConsoleMethod( Material, flush, void, 2, 2,
|
||||
DefineConsoleMethod( Material, flush, void, (),,
|
||||
"Flushes all material instances that use this material." )
|
||||
{
|
||||
object->flush();
|
||||
}
|
||||
|
||||
ConsoleMethod( Material, reload, void, 2, 2,
|
||||
DefineConsoleMethod( Material, reload, void, (),,
|
||||
"Reloads all material instances that use this material." )
|
||||
{
|
||||
object->reload();
|
||||
}
|
||||
|
||||
ConsoleMethod( Material, dumpInstances, void, 2, 2,
|
||||
DefineConsoleMethod( Material, dumpInstances, void, (),,
|
||||
"Dumps a formatted list of the currently allocated material instances for this material to the console." )
|
||||
{
|
||||
MATMGR->dumpMaterialInstances( object );
|
||||
}
|
||||
|
||||
ConsoleMethod( Material, getAnimFlags, const char*, 3, 3, "" )
|
||||
DefineConsoleMethod( Material, getAnimFlags, const char*, (U32 id), , "" )
|
||||
{
|
||||
char * animFlags = Con::getReturnBuffer(512);
|
||||
|
||||
if(object->mAnimFlags[ dAtoi(argv[2]) ] & Material::Scroll)
|
||||
if(object->mAnimFlags[ id ] & Material::Scroll)
|
||||
{
|
||||
if(dStrcmp( animFlags, "" ) == 0)
|
||||
dStrcpy( animFlags, "$Scroll" );
|
||||
}
|
||||
if(object->mAnimFlags[ dAtoi(argv[2]) ] & Material::Rotate)
|
||||
if(object->mAnimFlags[ id ] & Material::Rotate)
|
||||
{
|
||||
if(dStrcmp( animFlags, "" ) == 0)
|
||||
dStrcpy( animFlags, "$Rotate" );
|
||||
else
|
||||
dStrcat( animFlags, " | $Rotate");
|
||||
}
|
||||
if(object->mAnimFlags[ dAtoi(argv[2]) ] & Material::Wave)
|
||||
if(object->mAnimFlags[ id ] & Material::Wave)
|
||||
{
|
||||
if(dStrcmp( animFlags, "" ) == 0)
|
||||
dStrcpy( animFlags, "$Wave" );
|
||||
else
|
||||
dStrcat( animFlags, " | $Wave");
|
||||
}
|
||||
if(object->mAnimFlags[ dAtoi(argv[2]) ] & Material::Scale)
|
||||
if(object->mAnimFlags[ id ] & Material::Scale)
|
||||
{
|
||||
if(dStrcmp( animFlags, "" ) == 0)
|
||||
dStrcpy( animFlags, "$Scale" );
|
||||
else
|
||||
dStrcat( animFlags, " | $Scale");
|
||||
}
|
||||
if(object->mAnimFlags[ dAtoi(argv[2]) ] & Material::Sequence)
|
||||
if(object->mAnimFlags[ id ] & Material::Sequence)
|
||||
{
|
||||
if(dStrcmp( animFlags, "" ) == 0)
|
||||
dStrcpy( animFlags, "$Sequence" );
|
||||
|
|
@ -653,20 +654,20 @@ ConsoleMethod( Material, getAnimFlags, const char*, 3, 3, "" )
|
|||
return animFlags;
|
||||
}
|
||||
|
||||
ConsoleMethod(Material, getFilename, const char*, 2, 2, "Get filename of material")
|
||||
DefineConsoleMethod(Material, getFilename, const char*, (),, "Get filename of material")
|
||||
{
|
||||
SimObject *material = static_cast<SimObject *>(object);
|
||||
return material->getFilename();
|
||||
}
|
||||
|
||||
ConsoleMethod( Material, isAutoGenerated, bool, 2, 2,
|
||||
DefineConsoleMethod( Material, isAutoGenerated, bool, (),,
|
||||
"Returns true if this Material was automatically generated by MaterialList::mapMaterials()" )
|
||||
{
|
||||
return object->isAutoGenerated();
|
||||
}
|
||||
|
||||
ConsoleMethod( Material, setAutoGenerated, void, 3, 3,
|
||||
DefineConsoleMethod( Material, setAutoGenerated, void, (bool isAutoGenerated), ,
|
||||
"setAutoGenerated(bool isAutoGenerated): Set whether or not the Material is autogenerated." )
|
||||
{
|
||||
object->setAutoGenerated(dAtob(argv[2]));
|
||||
object->setAutoGenerated(isAutoGenerated);
|
||||
}
|
||||
|
|
@ -30,6 +30,7 @@
|
|||
#include "shaderGen/shaderGen.h"
|
||||
#include "core/module.h"
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
|
||||
MODULE_BEGIN( MaterialManager )
|
||||
|
|
@ -453,14 +454,14 @@ bool MaterialManager::_handleGFXEvent( GFXDevice::GFXDeviceEventType event_ )
|
|||
return true;
|
||||
}
|
||||
|
||||
ConsoleFunction( reInitMaterials, void, 1, 1,
|
||||
DefineConsoleFunction( reInitMaterials, void, (),,
|
||||
"@brief Flushes all procedural shaders and re-initializes all active material instances.\n\n"
|
||||
"@ingroup Materials")
|
||||
{
|
||||
MATMGR->flushAndReInitInstances();
|
||||
}
|
||||
|
||||
ConsoleFunction( addMaterialMapping, void, 3, 3, "(string texName, string matName)\n"
|
||||
DefineConsoleFunction( addMaterialMapping, void, (const char * texName, const char * matName), , "(string texName, string matName)\n"
|
||||
"@brief Maps the given texture to the given material.\n\n"
|
||||
"Generates a console warning before overwriting.\n\n"
|
||||
"Material maps are used by terrain and interiors for triggering "
|
||||
|
|
@ -468,27 +469,27 @@ ConsoleFunction( addMaterialMapping, void, 3, 3, "(string texName, string matNam
|
|||
"block or interior surface using the associated texture.\n\n"
|
||||
"@ingroup Materials")
|
||||
{
|
||||
MATMGR->mapMaterial(argv[1], argv[2]);
|
||||
MATMGR->mapMaterial(texName, matName);
|
||||
}
|
||||
|
||||
ConsoleFunction( getMaterialMapping, const char*, 2, 2, "(string texName)\n"
|
||||
DefineConsoleFunction( getMaterialMapping, const char*, (const char * texName), , "(string texName)\n"
|
||||
"@brief Returns the name of the material mapped to this texture.\n\n"
|
||||
"If no materials are found, an empty string is returned.\n\n"
|
||||
"@param texName Name of the texture\n\n"
|
||||
"@ingroup Materials")
|
||||
{
|
||||
return MATMGR->getMapEntry(argv[1]).c_str();
|
||||
return MATMGR->getMapEntry(texName).c_str();
|
||||
}
|
||||
|
||||
ConsoleFunction( dumpMaterialInstances, void, 1, 1,
|
||||
DefineConsoleFunction( dumpMaterialInstances, void, (), ,
|
||||
"@brief Dumps a formatted list of currently allocated material instances to the console.\n\n"
|
||||
"@ingroup Materials")
|
||||
{
|
||||
MATMGR->dumpMaterialInstances();
|
||||
}
|
||||
|
||||
ConsoleFunction( getMapEntry, const char *, 2, 2,
|
||||
DefineConsoleFunction( getMapEntry, const char*, (const char * texName), ,
|
||||
"@hide")
|
||||
{
|
||||
return MATMGR->getMapEntry( argv[1] );
|
||||
return MATMGR->getMapEntry( String(texName) );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,14 +94,22 @@ DefineConsoleFunction( mFloor, S32, ( F32 v ),,
|
|||
return (S32)mFloor( v );
|
||||
}
|
||||
|
||||
DefineConsoleFunction( mRound, S32, ( F32 v ),,
|
||||
"Round v to the nearest integer.\n"
|
||||
"@param v Number to convert to integer."
|
||||
"@returns Number converted to integer."
|
||||
"@ingroup Math" )
|
||||
{
|
||||
return (S32)mFloor( v + 0.5f );
|
||||
}
|
||||
DefineConsoleFunction( mRound, F32, ( F32 v, S32 n ), (0),
|
||||
"Round v to the nth decimal place or the nearest whole number by default."
|
||||
"@param v Value to roundn"
|
||||
"@param n Number of decimal places to round to, 0 by defaultn"
|
||||
"@return The rounded value as a S32."
|
||||
"@ingroup Math" )
|
||||
{
|
||||
if(n <= 0)
|
||||
{
|
||||
return mRound(v);
|
||||
}
|
||||
else
|
||||
{
|
||||
return mRound(v, n);
|
||||
}
|
||||
}
|
||||
|
||||
DefineConsoleFunction( mCeil, S32, ( F32 v ),,
|
||||
"Round v up to the nearest integer.\n"
|
||||
|
|
@ -119,8 +127,9 @@ DefineConsoleFunction( mFloatLength, const char*, ( F32 v, U32 precision ),,
|
|||
"@returns Number formatted to the specified number of decimal places."
|
||||
"@ingroup Math" )
|
||||
{
|
||||
char fmtString[8] = "%.0f";
|
||||
if (precision > 9)
|
||||
char fmtString[8] = "%.9f";
|
||||
|
||||
if (precision >= 9)
|
||||
precision = 9;
|
||||
fmtString[2] = '0' + precision;
|
||||
|
||||
|
|
|
|||
|
|
@ -200,6 +200,18 @@ inline F32 mFmod(const F32 val, const F32 mod)
|
|||
return fmod(val, mod);
|
||||
}
|
||||
|
||||
inline S32 mRound(const F32 val)
|
||||
{
|
||||
return (S32)floor(val + 0.5f);
|
||||
}
|
||||
|
||||
inline F32 mRound(const F32 val, const S32 n)
|
||||
{
|
||||
S32 place = (S32) pow(10.0f, n);
|
||||
|
||||
return mFloor((val*place)+0.5)/place;
|
||||
}
|
||||
|
||||
inline S32 mAbs(const S32 val)
|
||||
{
|
||||
return abs(val);
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue