Merge branch 'master' into console-func-refactor

Conflicts:
	Engine/source/app/net/net.cpp
	Engine/source/console/astNodes.cpp
	Engine/source/console/compiledEval.cpp
	Engine/source/console/console.h
	Engine/source/console/consoleInternal.h
	Engine/source/console/engineAPI.h
This commit is contained in:
Daniel Buckmaster 2014-10-14 14:40:17 +11:00
commit b507dc9555
6487 changed files with 315149 additions and 609761 deletions

View file

@ -78,8 +78,9 @@ ConsoleMethod(DbgFileView, getCurrentLine, const char *, 2, 2, "()"
{
S32 lineNum;
const char *file = object->getCurrentLine(lineNum);
char* ret = Con::getReturnBuffer(256);
dSprintf(ret, sizeof(ret), "%s\t%d", file, lineNum);
static const U32 bufSize = 256;
char* ret = Con::getReturnBuffer(bufSize);
dSprintf(ret, bufSize, "%s\t%d", file, lineNum);
return ret;
}

View file

@ -97,7 +97,7 @@ void GuiEaseViewCtrl::onRender(Point2I offset, const RectI &updateRect)
// Draw curve.
for( int i = 1; i <= numPoints; ++ i )
for( S32 i = 1; i <= numPoints; ++ i )
{
F32 x = ( F32 ) i / ( F32 ) numPoints;
F32 y = mEase.getValue( x, 0, 1, 1 );

View file

@ -274,7 +274,7 @@ void GuiGraphCtrl::addDatum(S32 plotID, F32 v)
//-----------------------------------------------------------------------------
float GuiGraphCtrl::getDatum( int plotID, int sample)
F32 GuiGraphCtrl::getDatum( S32 plotID, S32 sample)
{
AssertFatal(plotID > -1 && plotID < MaxPlots, "Invalid plot specified!");
AssertFatal(sample > -1 && sample < MaxDataPoints, "Invalid sample specified!");

View file

@ -182,7 +182,7 @@ DefineEngineMethod( GuiImageList, count, S32, (),,
return object->Count();
}
DefineEngineMethod( GuiImageList, remove, bool, (int index),,
DefineEngineMethod( GuiImageList, remove, bool, (S32 index),,
"@brief Removes an image from the list by index.\n\n"
"@param index Image index to remove.\n"
"@tsexample\n"

View file

@ -764,8 +764,7 @@ GuiControl* GuiInspectorTypeShapeFilename::constructEditControl()
// Change filespec
char szBuffer[512];
dSprintf( szBuffer, sizeof(szBuffer), "getLoadFilename(\"%s\", \"%d.apply\", %d.getData());",
"DTS Files (*.dts)|*.dts|COLLADA Files (*.dae)|*.dae|(All Files (*.*)|*.*|", getId(), getId() );
dSprintf( szBuffer, sizeof(szBuffer), "getLoadFormatFilename(\"%d.apply\", %d.getData());", getId(), getId() );
mBrowseButton->setField( "Command", szBuffer );
// Create "Open in ShapeEditor" button
@ -1538,7 +1537,7 @@ GuiControl* GuiInspectorTypeBitMask32Helper::constructEditControl()
mButton->setField( "Command", szBuffer );
mButton->setField( "buttonType", "ToggleButton" );
mButton->setDataField( StringTable->insert("Profile"), NULL, "GuiInspectorButtonProfile" );
mButton->setBitmap( "core/art/gui/images/arrowBtn" );
mButton->setBitmap( "tools/gui/images/arrowBtn" );
mButton->setStateOn( true );
mButton->setExtent( 16, 16 );
mButton->registerObject();

View file

@ -193,7 +193,7 @@ DefineEngineMethod( GuiMenuBar, setMenuMargins, void, (S32 horizontalMargin, S32
object->mBitmapMargin = bitmapToTextSpacing;
}
DefineEngineMethod(GuiMenuBar, addMenu, void, (const char* menuText, int menuId),,
DefineEngineMethod(GuiMenuBar, addMenu, void, (const char* menuText, S32 menuId),,
"@brief Adds a new menu to the menu bar.\n\n"
"@param menuText Text to display for the new menu item.\n"
"@param menuId ID for the new menu item.\n"
@ -215,7 +215,7 @@ DefineEngineMethod(GuiMenuBar, addMenu, void, (const char* menuText, int menuId)
object->addMenu(menuText, menuId);
}
DefineEngineMethod(GuiMenuBar, addMenuItem, void, (const char* targetMenu, const char* menuItemText, int menuItemId, const char* accelerator, int checkGroup),
DefineEngineMethod(GuiMenuBar, addMenuItem, void, (const char* targetMenu, const char* menuItemText, S32 menuItemId, const char* accelerator, int checkGroup),
("","",0,NULL,-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"
@ -496,7 +496,7 @@ DefineEngineMethod(GuiMenuBar, setMenuItemVisible, void, (const char* menuTarget
menuItem->visible = isVisible;
}
DefineEngineMethod(GuiMenuBar, setMenuItemBitmap, void, (const char* menuTarget, const char* menuItemTarget, int bitmapIndex),,
DefineEngineMethod(GuiMenuBar, setMenuItemBitmap, void, (const char* menuTarget, const char* menuItemTarget, S32 bitmapIndex),,
"@brief Sets the specified menu item bitmap index in the bitmap array. Setting the item's index to -1 will remove any bitmap.\n\n"
"@param menuTarget Menu to affect the menuItem in\n"
"@param menuItem Menu item to affect\n"

View file

@ -40,7 +40,7 @@ ConsoleDocClass( GuiParticleGraphCtrl,
GuiParticleGraphCtrl::GuiParticleGraphCtrl()
{
for(int i = 0; i < MaxPlots; i++)
for(S32 i = 0; i < MaxPlots; i++)
{
mPlots[i].mGraphColor = ColorF(1.0, 1.0, 1.0);
VECTOR_SET_ASSOCIATION(mPlots[i].mGraphData);
@ -140,7 +140,7 @@ void GuiParticleGraphCtrl::onRender(Point2I offset, const RectI &updateRect)
ColorF color(1.0f, 1.0f, 1.0f, 0.5f);
pDrawUtil->drawRectFill(updateRect, color);
for (int k = 0; k < MaxPlots; k++)
for (S32 k = 0; k < MaxPlots; k++)
{
// Nothing to graph
if ((mPlots[k].mGraphData.size() == 0) || (mPlots[k].mHidden == true))
@ -1060,12 +1060,13 @@ ConsoleMethod(GuiParticleGraphCtrl, addPlotPoint, const char*, 5, 6, "(int plotI
{
S32 plotID = dAtoi(argv[2]);
S32 pointAdded = 0;
char *retBuffer = Con::getReturnBuffer(32);
static const U32 bufSize = 32;
char *retBuffer = Con::getReturnBuffer(bufSize);
if(plotID > object->MaxPlots)
{
Con::errorf("Invalid plotID.");
dSprintf(retBuffer, 32, "%d", -2);
dSprintf(retBuffer, bufSize, "%d", -2);
return retBuffer;
}
@ -1078,7 +1079,7 @@ ConsoleMethod(GuiParticleGraphCtrl, addPlotPoint, const char*, 5, 6, "(int plotI
}
dSprintf(retBuffer, 32, "%d", pointAdded);
dSprintf(retBuffer, bufSize, "%d", pointAdded);
return retBuffer;
}
@ -1107,19 +1108,20 @@ ConsoleMethod(GuiParticleGraphCtrl, changePlotPoint, const char*, 6, 6, "(int pl
"@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(64);
char *retBuffer = Con::getReturnBuffer(bufSize);
const S32 index = -1;
dSprintf(retBuffer, 64, "%d", index);
dSprintf(retBuffer, bufSize, "%d", index);
return retBuffer;
}
char *retBuffer = Con::getReturnBuffer(64);
char *retBuffer = Con::getReturnBuffer(bufSize);
const S32 index = object->changePlotPoint( plotID, dAtoi(argv[3]), Point2F(dAtof(argv[4]), dAtof(argv[5])));
dSprintf(retBuffer, 64, "%d", index);
dSprintf(retBuffer, bufSize, "%d", index);
return retBuffer;
}
@ -1127,9 +1129,10 @@ ConsoleMethod(GuiParticleGraphCtrl, getSelectedPlot, const char*, 2, 2, "() "
"Gets the selected Plot (a.k.a. graph).\n"
"@return The plot's ID.")
{
char *retBuffer = Con::getReturnBuffer(32);
static const U32 bufSize = 32;
char *retBuffer = Con::getReturnBuffer(bufSize);
const S32 plot = object->getSelectedPlot();
dSprintf(retBuffer, 32, "%d", plot);
dSprintf(retBuffer, bufSize, "%d", plot);
return retBuffer;
}
@ -1137,9 +1140,10 @@ ConsoleMethod(GuiParticleGraphCtrl, getSelectedPoint, const char*, 2, 2, "()"
"Gets the selected Point on the Plot (a.k.a. graph)."
"@return The last selected point ID")
{
char *retBuffer = Con::getReturnBuffer(32);
static const U32 bufSize = 32;
char *retBuffer = Con::getReturnBuffer(bufSize);
const S32 point = object->getSelectedPoint();
dSprintf(retBuffer, 32, "%d", point);
dSprintf(retBuffer, bufSize, "%d", point);
return retBuffer;
}
@ -1158,9 +1162,10 @@ ConsoleMethod(GuiParticleGraphCtrl, isExistingPoint, const char*, 4, 4, "(int pl
Con::errorf("Invalid sample.");
}
char *retBuffer = Con::getReturnBuffer(32);
static const U32 bufSize = 32;
char *retBuffer = Con::getReturnBuffer(bufSize);
const bool isPoint = object->isExistingPoint(plotID, samples);
dSprintf(retBuffer, 32, "%d", isPoint);
dSprintf(retBuffer, bufSize, "%d", isPoint);
return retBuffer;
}
@ -1180,9 +1185,10 @@ ConsoleMethod(GuiParticleGraphCtrl, getPlotPoint, const char*, 4, 4, "(int plotI
Con::errorf("Invalid sample.");
}
char *retBuffer = Con::getReturnBuffer(64);
static const U32 bufSize = 64;
char *retBuffer = Con::getReturnBuffer(bufSize);
const Point2F &pos = object->getPlotPoint(plotID, samples);
dSprintf(retBuffer, 64, "%f %f", pos.x, pos.y);
dSprintf(retBuffer, bufSize, "%f %f", pos.x, pos.y);
return retBuffer;
}
@ -1201,9 +1207,10 @@ ConsoleMethod(GuiParticleGraphCtrl, getPlotIndex, const char*, 5, 5, "(int plotI
Con::errorf("Invalid plotID.");
}
char *retBuffer = Con::getReturnBuffer(32);
static const U32 bufSize = 32;
char *retBuffer = Con::getReturnBuffer(bufSize);
const S32 &index = object->getPlotIndex(plotID, x, y);
dSprintf(retBuffer, 32, "%d", index);
dSprintf(retBuffer, bufSize, "%d", index);
return retBuffer;
}
@ -1218,9 +1225,10 @@ ConsoleMethod(GuiParticleGraphCtrl, getGraphColor, const char*, 3, 3, "(int plot
Con::errorf("Invalid plotID.");
}
char *retBuffer = Con::getReturnBuffer(64);
static const U32 bufSize = 64;
char *retBuffer = Con::getReturnBuffer(bufSize);
const ColorF &color = object->getGraphColor(plotID);
dSprintf(retBuffer, 64, "%f %f %f", color.red, color.green, color.blue);
dSprintf(retBuffer, bufSize, "%f %f %f", color.red, color.green, color.blue);
return retBuffer;
}
@ -1235,9 +1243,10 @@ ConsoleMethod(GuiParticleGraphCtrl, getGraphMin, const char*, 3, 3, "(int plotID
Con::errorf("Invalid plotID.");
}
char *retBuffer = Con::getReturnBuffer(64);
static const U32 bufSize = 64;
char *retBuffer = Con::getReturnBuffer(bufSize);
const Point2F graphMin = object->getGraphMin(plotID);
dSprintf(retBuffer, 64, "%f %f", graphMin.x, graphMin.y);
dSprintf(retBuffer, bufSize, "%f %f", graphMin.x, graphMin.y);
return retBuffer;
}
@ -1252,9 +1261,10 @@ ConsoleMethod(GuiParticleGraphCtrl, getGraphMax, const char*, 3, 3, "(int plotID
Con::errorf("Invalid plotID.");
}
char *retBuffer = Con::getReturnBuffer(64);
static const U32 bufSize = 64;
char *retBuffer = Con::getReturnBuffer(bufSize);
const Point2F graphMax = object->getGraphMax(plotID);
dSprintf(retBuffer, 64, "%f %f", graphMax.x, graphMax.y);
dSprintf(retBuffer, bufSize, "%f %f", graphMax.x, graphMax.y);
return retBuffer;
}
@ -1269,9 +1279,10 @@ ConsoleMethod(GuiParticleGraphCtrl, getGraphName, const char*, 3, 3, "(int plotI
Con::errorf("Invalid plotID.");
}
char *retBuffer = Con::getReturnBuffer(64);
static 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

@ -42,7 +42,7 @@
static const F32 sMoveScaler = 50.0f;
static const F32 sZoomScaler = 200.0f;
static const int sNodeRectSize = 16;
static const S32 sNodeRectSize = 16;
IMPLEMENT_CONOBJECT( GuiShapeEdPreview );

View file

@ -98,6 +98,9 @@ static S32 QSORT_CALLBACK compareEntries(const void* a,const void* b)
//-----------------------------------------------------------------------------
bool GuiInspectorDynamicGroup::inspectGroup()
{
if( !mParent )
return false;
// clear the first responder if it's set
mStack->clearFirstResponder();

View file

@ -58,7 +58,7 @@ GuiInspectorField::GuiInspectorField( GuiInspector* inspector,
setCanSave( false );
setBounds(0,0,100,18);
if( field )
if( field != NULL )
_setFieldDocs( field->pFieldDocs );
}
@ -378,8 +378,9 @@ void GuiInspectorField::setInspectorField( AbstractClassRep::Field *field, Strin
mCaption = getFieldName();
else
mCaption = caption;
_setFieldDocs( mField->pFieldDocs );
if ( mField != NULL )
_setFieldDocs( mField->pFieldDocs );
}
//-----------------------------------------------------------------------------
@ -454,7 +455,7 @@ void GuiInspectorField::setInspectorProfile()
{
GuiControlProfile *profile = NULL;
if( mInspector->getNumInspectObjects() > 1 )
if( mInspector && (mInspector->getNumInspectObjects() > 1) )
{
if( !hasSameValueInAllObjects() )
Sim::findObject( "GuiInspectorMultiFieldDifferentProfile", profile );

View file

@ -230,7 +230,7 @@ void GuiInspectorGroup::clearFields()
bool GuiInspectorGroup::inspectGroup()
{
// We can't inspect a group without a target!
if( !mParent->getNumInspectObjects() )
if( !mParent || !mParent->getNumInspectObjects() )
return false;
// to prevent crazy resizing, we'll just freeze our stack for a sec..

View file

@ -50,6 +50,12 @@ GuiInspectorVariableField::~GuiInspectorVariableField()
bool GuiInspectorVariableField::onAdd()
{
if( !mInspector )
{
Con::errorf("GuiInspectorVariableField::onAdd - Fail - No inspector");
return false;
}
setInspectorProfile();
// Hack: skip our immediate parent