Fixes after feedback from Luis.

* Made use of dStrIsEmpty in more locations (and fixed it :P)
 * Removed commented-out code
 * Corrected default params
 * Fixed some console warning formats
 * Removed tabs
 * Corrected setExtent API
This commit is contained in:
Daniel Buckmaster 2014-12-23 18:20:47 +11:00
parent 04ff04a95f
commit 3ab048c5b0
30 changed files with 130 additions and 110 deletions

View file

@ -379,7 +379,6 @@ void GuiFileTreeCtrl::recurseInsert( Item* parent, StringTableEntry path )
}
//ConsoleMethod( GuiFileTreeCtrl, getSelectedPath, const char*, 2, 2, "getSelectedPath() - returns the currently selected path in the tree")
DefineConsoleMethod( GuiFileTreeCtrl, getSelectedPath, const char*, (), , "getSelectedPath() - returns the currently selected path in the tree")
{
const String& path = object->getSelectedPath();

View file

@ -5124,8 +5124,9 @@ DefineConsoleMethod(GuiTreeViewCtrl, getTextToRoot, const char*, (S32 itemId, co
DefineConsoleMethod(GuiTreeViewCtrl, getSelectedItemList,const char*, (), ,"returns a space seperated list of mulitple item ids")
{
char* buff = Con::getReturnBuffer(1024);
dSprintf(buff,1024,"");
const U32 bufSize = 1024;
char* buff = Con::getReturnBuffer(bufSize);
dSprintf(buff, bufSize, "");
const Vector< S32 >& selected = object->getSelected();
for(int i = 0; i < selected.size(); i++)
@ -5163,7 +5164,7 @@ S32 GuiTreeViewCtrl::findItemByObjectId(S32 iObjId)
return mItems[i]->mId;
}
return 0;
return -1;
}
//------------------------------------------------------------------------------

View file

@ -2052,10 +2052,9 @@ ConsoleDocFragment _popDialog2(
"void popDialog();"
);
DefineConsoleMethod( GuiCanvas, popDialog, void, (GuiControl * gui), , "(GuiControl ctrl=NULL)"
DefineConsoleMethod( GuiCanvas, popDialog, void, (GuiControl * gui), (NULL), "(GuiControl ctrl=NULL)"
"@hide")
{
if (gui)
object->popDialogControl(gui);
else

View file

@ -2810,12 +2810,19 @@ static ConsoleDocFragment _sGuiControlSetExtent2(
"GuiControl", // The class to place the method in; use NULL for functions.
"void setExtent( Point2I p );" ); // The definition string.
//ConsoleMethod( GuiControl, setExtent, void, 3, 4,
DefineConsoleMethod( GuiControl, setExtent, void, ( Point2I ext ), ,
" Set the width and height of the control.\n\n"
DefineConsoleMethod( GuiControl, setExtent, void, ( const char* extOrX, const char* y ), (""),
"( Point2I p | int x, int y ) Set the width and height of the control.\n\n"
"@hide" )
{
object->setExtent( (S32)ext.x, (S32)ext.y );
Point2I extent;
if(!dStrIsEmpty(extOrX) && dStrIsEmpty(y))
dSscanf(extOrX, "%f %f", &extent.x, &extent.y);
else if(!dStrIsEmpty(extOrX) && !dStrIsEmpty(y))
{
extent.x = dAtof(extOrX);
extent.y = dAtof(y);
}
object->setExtent( extent );
}
//-----------------------------------------------------------------------------

View file

@ -804,8 +804,8 @@ DefineConsoleMethod( GuiInspector, addInspect, void, (const char * className, bo
DefineConsoleMethod( GuiInspector, removeInspect, void, (SimObject* obj), , "( id object ) - Remove the object from the list of objects being inspected." )
{
if (object)
object->removeInspectObject( obj );
if (obj)
object->removeInspectObject( obj );
}
//-----------------------------------------------------------------------------

View file

@ -1205,9 +1205,10 @@ DefineConsoleMethod(GuiParticleGraphCtrl, getGraphName, const char*, (S32 plotID
Con::errorf("Invalid plotID.");
}
char *retBuffer = Con::getReturnBuffer(64);
const U32 bufSize = 64;
char *retBuffer = Con::getReturnBuffer(bufSize);
const StringTableEntry graphName = object->getGraphName(plotID);
dSprintf(retBuffer, 64, "%s", graphName);
dSprintf(retBuffer, bufSize, "%s", graphName);
return retBuffer;
}

View file

@ -637,7 +637,7 @@ DefineConsoleMethod( GuiInspectorField, getInspectedFieldType, const char*, (),
//-----------------------------------------------------------------------------
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." )
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." )
{
object->setData( newValue, callbacks );
}

View file

@ -823,8 +823,9 @@ DefineConsoleMethod( GuiDecalEditorCtrl, getDecalTransform, const char*, ( U32 i
return "";
static const U32 bufSize = 256;
char* returnBuffer = Con::getReturnBuffer(bufSize);
char* returnBuffer = Con::getReturnBuffer(bufSize);
returnBuffer[0] = 0;
if ( decalInstance )
{

View file

@ -2521,8 +2521,9 @@ DefineConsoleMethod( TerrainEditor, getBrushSize, const char*, (), , "()")
{
Point2I size = object->getBrushSize();
char * ret = Con::getReturnBuffer(32);
dSprintf(ret, 32, "%d %d", size.x, size.y);
static const U32 bufSize = 32;
char * ret = Con::getReturnBuffer(bufSize);
dSprintf(ret, bufSize, "%d %d", size.x, size.y);
return ret;
}

View file

@ -3448,10 +3448,10 @@ DefineConsoleMethod( WorldEditor, transformSelection, void,
S32 scaleType,
Point3F scale,
bool sRelative,
bool sLocal ), , "transformSelection(...)\n"
bool sLocal ), ,
"transformSelection(...)\n"
"Transform selection by given parameters.")
{
object->transformSelection(position, point, relativePos, rotate, rotation, relativeRot, rotLocal, scaleType, scale, sRelative, sLocal);
}