mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 00:05:40 +00:00
Merge remote-tracking branch 'Winterleaf/Development-Console' into defineconsolemethod
Conflicts: Engine/source/T3D/missionMarker.cpp
This commit is contained in:
commit
9396ae7176
146 changed files with 1713 additions and 2122 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue