Merge branch 'development' into style-cleanup

Conflicts:
	Engine/source/console/astNodes.cpp
	Engine/source/console/codeBlock.cpp
	Engine/source/console/compiledEval.cpp
	Engine/source/ts/collada/colladaAppMesh.cpp
	Engine/source/ts/tsShape.cpp
	Engine/source/ts/tsShapeConstruct.cpp
This commit is contained in:
Daniel Buckmaster 2014-12-15 12:15:55 +11:00
commit 33ff180593
2053 changed files with 172002 additions and 69530 deletions

View file

@ -126,6 +126,7 @@ namespace
desc.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
GFX->setStateBlockByDesc( desc );
GFX->setupGenericShaders();
GFX->drawPrimitive( GFXTriangleStrip, 0, 2 );
}
}

View file

@ -353,9 +353,7 @@ void GuiColorPickerCtrl::onRender(Point2I offset, const RectI& updateRect)
Point2I resolution = getRoot()->getExtent();
U32 buf_x = offset.x + mSelectorPos.x + 1;
U32 buf_y = ( extent.y - ( offset.y + mSelectorPos.y + 1 ) );
if(GFX->getAdapterType() != OpenGL)
buf_y = resolution.y - buf_y;
U32 buf_y = resolution.y - ( extent.y - ( offset.y + mSelectorPos.y + 1 ) );
GFXTexHandle bb( resolution.x,
resolution.y,
@ -528,10 +526,11 @@ void GuiColorPickerCtrl::setScriptValue(const char *value)
ConsoleMethod(GuiColorPickerCtrl, getSelectorPos, const char*, 2, 2, "Gets the current position of the selector")
{
char *temp = Con::getReturnBuffer(256);
static const U32 bufSize = 256;
char *temp = Con::getReturnBuffer(bufSize);
Point2I pos;
pos = object->getSelectorPos();
dSprintf(temp,256,"%d %d",pos.x, pos.y);
dSprintf(temp,bufSize,"%d %d",pos.x, pos.y);
return temp;
}

View file

@ -169,17 +169,18 @@ DefineEngineMethod( GuiDirectoryFileListCtrl, getSelectedFiles, const char*, (),
return StringTable->insert( "" );
// Get an adequate buffer
char itemBuffer[256];
dMemset( itemBuffer, 0, 256 );
static const U32 itemBufSize = 256;
char itemBuffer[itemBufSize];
char* returnBuffer = Con::getReturnBuffer( ItemVector.size() * 64 );
dMemset( returnBuffer, 0, ItemVector.size() * 64 );
static const U32 bufSize = ItemVector.size() * 64;
char* returnBuffer = Con::getReturnBuffer( bufSize );
dMemset( returnBuffer, 0, bufSize );
// Fetch the first entry
StringTableEntry itemText = object->getItemText( ItemVector[0] );
if( !itemText )
return StringTable->lookup("");
dSprintf( returnBuffer, ItemVector.size() * 64, "%s", itemText );
dSprintf( returnBuffer, bufSize, "%s", itemText );
// If only one entry, return it.
if( ItemVector.size() == 1 )
@ -192,8 +193,8 @@ DefineEngineMethod( GuiDirectoryFileListCtrl, getSelectedFiles, const char*, (),
if( !itemText )
continue;
dMemset( itemBuffer, 0, 256 );
dSprintf( itemBuffer, 256, " %s", itemText );
dMemset( itemBuffer, 0, itemBufSize );
dSprintf( itemBuffer, itemBufSize, " %s", itemText );
dStrcat( returnBuffer, itemBuffer );
}

View file

@ -736,7 +736,7 @@ bool GuiGameListMenuProfile::onAdd()
// We can't call enforceConstraints() here because incRefCount initializes
// some of the things to enforce. Do a basic sanity check here instead.
if( !dStrlen(mBitmapName) )
if( !mBitmapName || !dStrlen(mBitmapName) )
{
Con::errorf( "GuiGameListMenuProfile: %s can't be created without a bitmap. Please add a 'Bitmap' property to the object definition.", getName() );
return false;

View file

@ -89,8 +89,9 @@ bool GuiGradientSwatchCtrl::onWake()
if ( !Parent::onWake() )
return false;
char* altCommand = Con::getReturnBuffer(512);
dSprintf( altCommand, 512, "%s(%i.color, \"%i.setColor\");", mColorFunction, getId(), getId() );
static const U32 bufSize = 512;
char* altCommand = Con::getReturnBuffer(bufSize);
dSprintf( altCommand, bufSize, "%s(%i.color, \"%i.setColor\");", mColorFunction, getId(), getId() );
setField( "altCommand", altCommand );
return true;
@ -616,10 +617,11 @@ ConsoleMethod(GuiGradientCtrl, getColor, const char*, 3, 3, "Get color value")
{
if ( idx >= 0 && idx < object->mColorRange.size() )
{
char* rColor = Con::getReturnBuffer(256);
static const U32 bufSize = 256;
char* rColor = Con::getReturnBuffer(bufSize);
rColor[0] = 0;
dSprintf(rColor, 256, "%f %f %f %f",
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,
@ -632,10 +634,11 @@ ConsoleMethod(GuiGradientCtrl, getColor, const char*, 3, 3, "Get color value")
{
if ( idx >= 0 && idx < object->mAlphaRange.size() )
{
char* rColor = Con::getReturnBuffer(256);
static const U32 bufSize = 256;
char* rColor = Con::getReturnBuffer(bufSize);
rColor[0] = 0;
dSprintf(rColor, 256, "%f %f %f %f",
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,

View file

@ -450,8 +450,9 @@ DefineEngineMethod( GuiListBoxCtrl, getSelectedItems, const char*, (),,
if( selItems.empty() )
return StringTable->lookup("-1");
UTF8 *retBuffer = Con::getReturnBuffer( selItems.size() * 4 );
dMemset( retBuffer, 0, selItems.size() * 4 );
static const U32 bufSize = selItems.size() * 4;
UTF8 *retBuffer = Con::getReturnBuffer( bufSize );
dMemset( retBuffer, 0, bufSize );
Vector<S32>::iterator i = selItems.begin();
for( ; i != selItems.end(); i++ )
{

View file

@ -169,5 +169,5 @@ void GuiMaterialCtrl::onRender( Point2I offset, const RectI &updateRect )
ConsoleMethod( GuiMaterialCtrl, setMaterial, bool, 3, 3, "( string materialName )"
"Set the material to be displayed in the control." )
{
return object->setMaterial( argv[2] );
return object->setMaterial( (const char*)argv[2] );
}

View file

@ -431,7 +431,7 @@ ConsoleMethod( GuiPopUpMenuCtrl, setEnumContent, void, 4, 4, "(string class, str
// get it?
if(!classRep)
{
Con::warnf(ConsoleLogEntry::General, "failed to locate class rep for '%s'", argv[2]);
Con::warnf(ConsoleLogEntry::General, "failed to locate class rep for '%s'", (const char*)argv[2]);
return;
}
@ -444,7 +444,7 @@ ConsoleMethod( GuiPopUpMenuCtrl, setEnumContent, void, 4, 4, "(string class, str
// found it?
if(i == classRep->mFieldList.size())
{
Con::warnf(ConsoleLogEntry::General, "failed to locate field '%s' for class '%s'", argv[3], argv[2]);
Con::warnf(ConsoleLogEntry::General, "failed to locate field '%s' for class '%s'", (const char*)argv[3], (const char*)argv[2]);
return;
}
@ -454,7 +454,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'", argv[3], argv[2]);
Con::warnf(ConsoleLogEntry::General, "field '%s' is not an enumeration for class '%s'", (const char*)argv[3], (const char*)argv[2]);
return;
}
@ -1011,8 +1011,8 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
{
// We're making use of a bitmap border, so take into account the
// right cap of the border.
RectI* mBitmapBounds = mProfile->mBitmapArrayRects.address();
localStart.x = getWidth() - mBitmapBounds[2].extent.x - txt_w;
RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
localStart.x = getWidth() - bitmapBounds[2].extent.x - txt_w;
}
else
{
@ -1024,8 +1024,8 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
{
// We're making use of a bitmap border, so take into account the
// right cap of the border.
RectI* mBitmapBounds = mProfile->mBitmapArrayRects.address();
localStart.x = (getWidth() - mBitmapBounds[2].extent.x - txt_w) / 2;
RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
localStart.x = (getWidth() - bitmapBounds[2].extent.x - txt_w) / 2;
} else
{
@ -1043,8 +1043,8 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
{
// We're making use of a bitmap border, so take into account the
// right cap of the border.
RectI* mBitmapBounds = mProfile->mBitmapArrayRects.address();
localStart.x = getWidth() - mBitmapBounds[2].extent.x - txt_w;
RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
localStart.x = getWidth() - bitmapBounds[2].extent.x - txt_w;
}
else
{
@ -1095,8 +1095,8 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
{
// We're making use of a bitmap border, so take into account the
// right cap of the border.
RectI* mBitmapBounds = mProfile->mBitmapArrayRects.address();
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - mBitmapBounds[2].extent.x, localStart.y ) );
RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - bitmapBounds[2].extent.x, localStart.y ) );
GFX->getDrawUtil()->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
} else

View file

@ -579,8 +579,9 @@ ConsoleMethod( GuiPopUpMenuCtrlEx, getColorById, const char*, 3, 3,
ColorI color;
object->getColoredBox(color, dAtoi(argv[2]));
char *strBuffer = Con::getReturnBuffer(512);
dSprintf(strBuffer, 512, "%d %d %d %d", color.red, color.green, color.blue, color.alpha);
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;
}
@ -604,7 +605,7 @@ ConsoleMethod( GuiPopUpMenuCtrlEx, setEnumContent, void, 4, 4,
// get it?
if(!classRep)
{
Con::warnf(ConsoleLogEntry::General, "failed to locate class rep for '%s'", argv[2]);
Con::warnf(ConsoleLogEntry::General, "failed to locate class rep for '%s'", (const char*)argv[2]);
return;
}
@ -617,7 +618,7 @@ ConsoleMethod( GuiPopUpMenuCtrlEx, setEnumContent, void, 4, 4,
// found it?
if(i == classRep->mFieldList.size())
{
Con::warnf(ConsoleLogEntry::General, "failed to locate field '%s' for class '%s'", argv[3], argv[2]);
Con::warnf(ConsoleLogEntry::General, "failed to locate field '%s' for class '%s'", (const char*)argv[3], (const char*)argv[2]);
return;
}
@ -627,7 +628,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'", argv[3], argv[2]);
Con::warnf(ConsoleLogEntry::General, "field '%s' is not an enumeration for class '%s'", (const char*)argv[3], (const char*)argv[2]);
return;
}
@ -1167,8 +1168,8 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
{
// We're making use of a bitmap border, so take into account the
// right cap of the border.
RectI* mBitmapBounds = mProfile->mBitmapArrayRects.address();
localStart.x = getWidth() - mBitmapBounds[2].extent.x - txt_w;
RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
localStart.x = getWidth() - bitmapBounds[2].extent.x - txt_w;
}
else
{
@ -1180,8 +1181,8 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
{
// We're making use of a bitmap border, so take into account the
// right cap of the border.
RectI* mBitmapBounds = mProfile->mBitmapArrayRects.address();
localStart.x = (getWidth() - mBitmapBounds[2].extent.x - txt_w) / 2;
RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
localStart.x = (getWidth() - bitmapBounds[2].extent.x - txt_w) / 2;
} else
{
@ -1199,8 +1200,8 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
{
// We're making use of a bitmap border, so take into account the
// right cap of the border.
RectI* mBitmapBounds = mProfile->mBitmapArrayRects.address();
localStart.x = getWidth() - mBitmapBounds[2].extent.x - txt_w;
RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
localStart.x = getWidth() - bitmapBounds[2].extent.x - txt_w;
}
else
{
@ -1251,8 +1252,8 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
{
// We're making use of a bitmap border, so take into account the
// right cap of the border.
RectI* mBitmapBounds = mProfile->mBitmapArrayRects.address();
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - mBitmapBounds[2].extent.x, localStart.y ) );
RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - bitmapBounds[2].extent.x, localStart.y ) );
GFX->getDrawUtil()->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
} else

View file

@ -394,6 +394,7 @@ void GuiTextEditSliderCtrl::onRender(Point2I offset, const RectI &updateRect)
verts.unlock();
GFX->setVertexBuffer( verts );
GFX->setupGenericShaders();
GFX->drawPrimitive( GFXTriangleList, 0, 2 );
}

View file

@ -3583,7 +3583,7 @@ void GuiTreeViewCtrl::onMiddleMouseDown(const GuiEvent & event)
for (S32 j = 0; j < mSelected.size(); j++) {
Con::printf("%d", mSelected[j]);
}
S32 mCurrentDragCell = mMouseOverCell.y;
mCurrentDragCell = mMouseOverCell.y;
S32 midpCell = (mCurrentDragCell) * mItemHeight + (mItemHeight/2);
S32 currentY = pt.y;
S32 yDiff = currentY-midpCell;
@ -3648,7 +3648,7 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event)
break;
}
}
S32 mCurrentDragCell = mMouseOverCell.y;
mCurrentDragCell = mMouseOverCell.y;
if (mVisibleItems[firstSelectedIndex] != firstItem )
{
/*
@ -4929,7 +4929,7 @@ ConsoleMethod( GuiTreeViewCtrl, setItemTooltip, void, 4, 4, "( int id, string te
return;
}
item->mTooltip = argv[ 3 ];
item->mTooltip = (const char*)argv[ 3 ];
}
ConsoleMethod( GuiTreeViewCtrl, setItemImages, void, 5, 5, "( int id, int normalImage, int expandedImage ) - Sets the normal and expanded images to show for the given item." )
@ -5061,8 +5061,9 @@ ConsoleMethod(GuiTreeViewCtrl, getSelectedObject, S32, 2, 3, "( int index=0 ) -
ConsoleMethod(GuiTreeViewCtrl, getSelectedObjectList, const char*, 2, 2,
"Returns a space sperated list of all selected object ids.")
{
char* buff = Con::getReturnBuffer(1024);
dSprintf(buff,1024,"");
static const U32 bufSize = 1024;
char* buff = Con::getReturnBuffer(bufSize);
dSprintf(buff,bufSize,"");
const Vector< GuiTreeViewCtrl::Item* > selectedItems = object->getSelectedItems();
for(S32 i = 0; i < selectedItems.size(); i++)
@ -5077,7 +5078,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 = 1024-len-1;
S32 size = bufSize-len-1;
//write it:
if(size < 1)
{
@ -5126,8 +5127,9 @@ ConsoleMethod(GuiTreeViewCtrl, getTextToRoot, const char*,4,4,"(TreeItemId item,
ConsoleMethod(GuiTreeViewCtrl, getSelectedItemList,const char*, 2,2,"returns a space seperated list of mulitple item ids")
{
char* buff = Con::getReturnBuffer(1024);
dSprintf(buff,1024,"");
static const U32 bufSize = 1024;
char* buff = Con::getReturnBuffer(bufSize);
dSprintf(buff,bufSize,"");
const Vector< S32 >& selected = object->getSelected();
for(S32 i = 0; i < selected.size(); i++)
@ -5138,7 +5140,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 = 1024-len-1;
S32 size = bufSize-len-1;
//write it:
if(size < 1)
{

View file

@ -121,7 +121,8 @@ GuiCanvas::GuiCanvas(): GuiControl(),
mMiddleMouseLast(false),
mRightMouseLast(false),
mPlatformWindow(NULL),
mLastRenderMs(0)
mLastRenderMs(0),
mDisplayWindow(true)
{
setBounds(0, 0, 640, 480);
mAwake = true;
@ -176,6 +177,8 @@ void GuiCanvas::initPersistFields()
addGroup("Canvas Rendering");
addProtectedField( "numFences", TypeS32, Offset( mNumFences, GuiCanvas ), &setProtectedNumFences, &defaultProtectedGetFn, "The number of GFX fences to use." );
addField("displayWindow", TypeBool, Offset(mDisplayWindow, GuiCanvas), "Controls if the canvas window is rendered or not." );
endGroup("Canvas Rendering");
Parent::initPersistFields();
@ -252,6 +255,19 @@ bool GuiCanvas::onAdd()
// Make sure we're able to render.
newDevice->setAllowRender( true );
if(mDisplayWindow)
{
getPlatformWindow()->show();
WindowManager->setDisplayWindow(true);
getPlatformWindow()->setDisplayWindow(true);
}
else
{
getPlatformWindow()->hide();
WindowManager->setDisplayWindow(false);
getPlatformWindow()->setDisplayWindow(false);
}
// Propagate add to parents.
// CodeReview - if GuiCanvas fails to add for whatever reason, what happens to
// all the event registration above?
@ -2006,7 +2022,7 @@ ConsoleMethod( GuiCanvas, pushDialog, void, 3, 5, "(GuiControl ctrl, int layer=0
if (! Sim::findObject(argv[2], gui))
{
Con::printf("%s(): Invalid control: %s", argv[0], argv[2]);
Con::printf("%s(): Invalid control: %s", (const char*)argv[0], (const char*)argv[2]);
return;
}
@ -2051,7 +2067,7 @@ ConsoleMethod( GuiCanvas, popDialog, void, 2, 3, "(GuiControl ctrl=NULL)"
{
if (!Sim::findObject(argv[2], gui))
{
Con::printf("%s(): Invalid control: %s", argv[0], argv[2]);
Con::printf("%s(): Invalid control: %s", (const char*)argv[0], (const char*)argv[2]);
return;
}
}
@ -2209,7 +2225,10 @@ DefineEngineMethod( GuiCanvas, reset, void, (),,
}
DefineEngineMethod( GuiCanvas, getCursorPos, Point2I, (),,
"@brief Get the current position of the cursor.\n\n"
"@brief Get the current position of the cursor in screen-space. Note that this position"
" might be outside the Torque window. If you want to get the position within the Canvas,"
" call screenToClient on the result.\n\n"
"@see Canvas::screenToClient()\n\n"
"@param param Description\n\n"
"@tsexample\n"
"%cursorPos = Canvas.getCursorPos();\n"
@ -2683,3 +2702,23 @@ ConsoleMethod( GuiCanvas, setVideoMode, void, 5, 8,
// Store the new mode into a pref.
Con::setVariable( "$pref::Video::mode", vm.toString() );
}
ConsoleMethod( GuiCanvas, showWindow, void, 2, 2, "" )
{
if (!object->getPlatformWindow())
return;
object->getPlatformWindow()->show();
WindowManager->setDisplayWindow(true);
object->getPlatformWindow()->setDisplayWindow(true);
}
ConsoleMethod( GuiCanvas, hideWindow, void, 2, 2, "" )
{
if (!object->getPlatformWindow())
return;
object->getPlatformWindow()->hide();
WindowManager->setDisplayWindow(false);
object->getPlatformWindow()->setDisplayWindow(false);
}

View file

@ -108,6 +108,8 @@ protected:
bool mClampTorqueCursor;
bool mAlwaysHandleMouseButtons;
bool mDisplayWindow;
/// @}
/// @name Mouse Input

View file

@ -307,7 +307,7 @@ void GuiControl::initPersistFields()
//-----------------------------------------------------------------------------
bool GuiControl::processArguments(S32 argc, const char **argv)
bool GuiControl::processArguments(S32 argc, ConsoleValueRef *argv)
{
// argv[0] - The GuiGroup to add this control to when it's created.
// this is an optional parameter that may be specified at
@ -1427,6 +1427,7 @@ bool GuiControl::cursorInControl()
if (! root) return false;
Point2I pt = root->getCursorPos();
pt = root->getPlatformWindow() ? root->getPlatformWindow()->screenToClient(pt) : pt;
Point2I extent = getExtent();
Point2I offset = localToGlobalCoord(Point2I(0, 0));
if (pt.x >= offset.x && pt.y >= offset.y &&

View file

@ -327,7 +327,7 @@ class GuiControl : public SimGroup
GuiControl();
virtual ~GuiControl();
virtual bool processArguments(S32 argc, const char **argv);
virtual bool processArguments(S32 argc, ConsoleValueRef *argv);
static void initPersistFields();
static void consoleInit();

View file

@ -719,8 +719,9 @@ ImplementConsoleTypeCasters( TypeRectSpacingI, RectSpacingI )
ConsoleGetType( TypeRectSpacingI )
{
RectSpacingI *rect = (RectSpacingI *) dptr;
char* returnBuffer = Con::getReturnBuffer(256);
dSprintf(returnBuffer, 256, "%d %d %d %d", rect->top, rect->bottom,
static const U32 bufSize = 256;
char* returnBuffer = Con::getReturnBuffer(bufSize);
dSprintf(returnBuffer, bufSize, "%d %d %d %d", rect->top, rect->bottom,
rect->left, rect->right);
return returnBuffer;
}

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

@ -2540,7 +2540,7 @@ ConsoleMethod( GuiEditCtrl, setCurrentAddSet, void, 3, 3, "(GuiControl ctrl)")
if (!Sim::findObject(argv[2], addSet))
{
Con::printf("%s(): Invalid control: %s", argv[0], argv[2]);
Con::printf("%s(): Invalid control: %s", (const char*)argv[0], (const char*)argv[2]);
return;
}
object->setCurrentAddSet(addSet);
@ -2700,7 +2700,7 @@ ConsoleMethod( GuiEditCtrl, readGuides, void, 3, 4, "( GuiControl ctrl [, int ax
GuiControl* ctrl;
if( !Sim::findObject( argv[ 2 ], ctrl ) )
{
Con::errorf( "GuiEditCtrl::readGuides - no control '%s'", argv[ 2 ] );
Con::errorf( "GuiEditCtrl::readGuides - no control '%s'", (const char*)argv[ 2 ] );
return;
}
@ -2711,7 +2711,7 @@ ConsoleMethod( GuiEditCtrl, readGuides, void, 3, 4, "( GuiControl ctrl [, int ax
S32 axis = dAtoi( argv[ 3 ] );
if( axis < 0 || axis > 1 )
{
Con::errorf( "GuiEditCtrl::readGuides - invalid axis '%s'", argv[ 3 ] );
Con::errorf( "GuiEditCtrl::readGuides - invalid axis '%s'", (const char*)argv[ 3 ] );
return;
}
@ -2733,7 +2733,7 @@ ConsoleMethod( GuiEditCtrl, writeGuides, void, 3, 4, "( GuiControl ctrl [, int a
GuiControl* ctrl;
if( !Sim::findObject( argv[ 2 ], ctrl ) )
{
Con::errorf( "GuiEditCtrl::writeGuides - no control '%i'", argv[ 2 ] );
Con::errorf( "GuiEditCtrl::writeGuides - no control '%i'", (const char*)argv[ 2 ] );
return;
}
@ -2744,7 +2744,7 @@ ConsoleMethod( GuiEditCtrl, writeGuides, void, 3, 4, "( GuiControl ctrl [, int a
S32 axis = dAtoi( argv[ 3 ] );
if( axis < 0 || axis > 1 )
{
Con::errorf( "GuiEditCtrl::writeGuides - invalid axis '%s'", argv[ 3 ] );
Con::errorf( "GuiEditCtrl::writeGuides - invalid axis '%s'", (const char*)argv[ 3 ] );
return;
}

View file

@ -83,10 +83,9 @@ ConsoleMethod( GuiFilterCtrl, setValue, void, 3, 20, "(f1, f2, ...)"
{
Filter filter;
argc -= 2;
argv += 2;
StringStackWrapper args(argc - 2, argv + 2);
filter.set(argc, argv);
filter.set(args.count(), args);
object->set(filter);
}

View file

@ -777,7 +777,7 @@ ConsoleMethod( GuiInspector, inspect, void, 3, 3, "Inspect(Object)")
if(!target)
{
if(dAtoi(argv[2]) > 0)
Con::warnf("%s::inspect(): invalid object: %s", argv[0], argv[2]);
Con::warnf("%s::inspect(): invalid object: %s", (const char*)argv[0], (const char*)argv[2]);
object->clearInspectObjects();
return;
@ -793,7 +793,7 @@ ConsoleMethod( GuiInspector, addInspect, void, 3, 4, "( id object, (bool autoSyn
SimObject* obj;
if( !Sim::findObject( argv[ 2 ], obj ) )
{
Con::errorf( "%s::addInspect(): invalid object: %s", argv[ 0 ], argv[ 2 ] );
Con::errorf( "%s::addInspect(): invalid object: %s", (const char*)argv[ 0 ], (const char*)argv[ 2 ] );
return;
}
@ -810,7 +810,7 @@ ConsoleMethod( GuiInspector, removeInspect, void, 3, 3, "( id object ) - Remove
SimObject* obj;
if( !Sim::findObject( argv[ 2 ], obj ) )
{
Con::errorf( "%s::removeInspect(): invalid object: %s", argv[ 0 ], argv[ 2 ] );
Con::errorf( "%s::removeInspect(): invalid object: %s", (const char*)argv[ 0 ], (const char*)argv[ 2 ] );
return;
}

View file

@ -571,7 +571,7 @@ void GuiInspectorTypeFileName::updateValue()
ConsoleMethod( GuiInspectorTypeFileName, apply, void, 3,3, "apply(newValue);" )
{
String path( argv[2] );
String path( (const char*)argv[2] );
if ( path.isNotEmpty() )
path = Platform::makeRelativePathName( path, Platform::getMainDotCsDir() );
@ -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

View file

@ -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

@ -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

@ -455,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

View file

@ -158,8 +158,9 @@ void GuiProgressBitmapCtrl::setBitmap( const char* name )
const char* GuiProgressBitmapCtrl::getScriptValue()
{
char * ret = Con::getReturnBuffer(64);
dSprintf(ret, 64, "%g", mProgress);
static const U32 bufSize = 64;
char * ret = Con::getReturnBuffer(bufSize);
dSprintf(ret, bufSize, "%g", mProgress);
return ret;
}

View file

@ -59,8 +59,9 @@ GuiProgressCtrl::GuiProgressCtrl()
const char* GuiProgressCtrl::getScriptValue()
{
char * ret = Con::getReturnBuffer(64);
dSprintf(ret, 64, "%g", mProgress);
static const U32 bufSize = 64;
char * ret = Con::getReturnBuffer(bufSize);
dSprintf(ret, bufSize, "%g", mProgress);
return ret;
}

View file

@ -264,7 +264,7 @@ ConsoleMethod( CreatorTree, fileNameMatch, bool, 5, 5, "(string world, string ty
if(dToupper(argv[4][0]) != dToupper(argv[2][0]))
return(false);
return(!dStrnicmp(argv[4]+1, argv[3], typeLen));
return(!dStrnicmp(((const char*)argv[4])+1, argv[3], typeLen));
}
ConsoleMethod( CreatorTree, getSelected, S32, 2, 2, "Return a handle to the currently selected item.")

View file

@ -212,7 +212,7 @@ ConsoleStaticMethod( EditorIconRegistry, findIconBySimObject, const char*, 2, 2,
SimObject *obj = NULL;
if ( !Sim::findObject( argv[1], obj ) )
{
Con::warnf( "EditorIconRegistry::findIcon, parameter %d was not a SimObject!", argv[1] );
Con::warnf( "EditorIconRegistry::findIcon, parameter %d was not a SimObject!", (const char*)argv[1] );
return NULL;
}

View file

@ -792,7 +792,7 @@ ConsoleMethod( GuiDecalEditorCtrl, deleteSelectedDecal, void, 2, 2, "deleteSelec
ConsoleMethod( GuiDecalEditorCtrl, deleteDecalDatablock, void, 3, 3, "deleteSelectedDecalDatablock( String datablock )" )
{
String lookupName( argv[2] );
String lookupName( (const char*)argv[2] );
if( lookupName == String::EmptyString )
return;
@ -801,7 +801,7 @@ ConsoleMethod( GuiDecalEditorCtrl, deleteDecalDatablock, void, 3, 3, "deleteSele
ConsoleMethod( GuiDecalEditorCtrl, setMode, void, 3, 3, "setMode( String mode )()" )
{
String newMode = ( argv[2] );
String newMode = ( (const char*)argv[2] );
object->setMode( newMode );
}
@ -821,12 +821,13 @@ ConsoleMethod( GuiDecalEditorCtrl, getDecalTransform, const char*, 3, 3, "getDec
if( decalInstance == NULL )
return "";
char* returnBuffer = Con::getReturnBuffer(256);
static const U32 bufSize = 256;
char* returnBuffer = Con::getReturnBuffer(bufSize);
returnBuffer[0] = 0;
if ( decalInstance )
{
dSprintf(returnBuffer, 256, "%f %f %f %f %f %f %f",
dSprintf(returnBuffer, bufSize, "%f %f %f %f %f %f %f",
decalInstance->mPosition.x, decalInstance->mPosition.y, decalInstance->mPosition.z,
decalInstance->mTangent.x, decalInstance->mTangent.y, decalInstance->mTangent.z,
decalInstance->mSize);
@ -868,7 +869,7 @@ ConsoleMethod( GuiDecalEditorCtrl, editDecalDetails, void, 4, 4, "editDecalDetai
if ( (count != 7) )
{
Con::printf("Failed to parse decal information \"px py pz tx ty tz s\" from '%s'", argv[3]);
Con::printf("Failed to parse decal information \"px py pz tx ty tz s\" from '%s'", (const char*)argv[3]);
return;
}
@ -1253,4 +1254,4 @@ void DBRetargetUndoAction::redo()
if ( mEditor->isMethod( "rebuildInstanceTree" ) )
Con::executef( mEditor, "rebuildInstanceTree" );
}
#endif
#endif

View file

@ -245,7 +245,7 @@ void GuiTerrPreviewCtrl::onRender(Point2I offset, const RectI &updateRect)
for(U32 i = 0; i < GFX->getNumSamplers(); i++)
GFX->setTexture(i, NULL);
GFX->disableShaders();
GFX->setupGenericShaders(GFXDevice::GSModColorTexture);
Point2F terrPos(terrBlock->getPosition().x, terrBlock->getPosition().y);

View file

@ -2111,8 +2111,9 @@ const char* TerrainEditor::getBrushPos()
AssertFatal(mMouseBrush!=NULL, "TerrainEditor::getBrushPos: no mouse brush!");
Point2I pos = mMouseBrush->getPosition();
char * ret = Con::getReturnBuffer(32);
dSprintf(ret, 32, "%d %d", pos.x, pos.y);
static const U32 bufSize = 32;
char * ret = Con::getReturnBuffer(bufSize);
dSprintf(ret, bufSize, "%d %d", pos.x, pos.y);
return(ret);
}
@ -2433,7 +2434,7 @@ ConsoleMethod( TerrainEditor, attachTerrain, void, 2, 3, "(TerrainBlock terrain)
terrains.push_back(terrBlock);
if(terrains.size() == 0)
Con::errorf(ConsoleLogEntry::Script, "TerrainEditor::attach: failed to attach to object '%s'", argv[2]);
Con::errorf(ConsoleLogEntry::Script, "TerrainEditor::attach: failed to attach to object '%s'", (const char*)argv[2]);
}
if (terrains.size() > 0)
@ -2521,8 +2522,9 @@ ConsoleMethod( TerrainEditor, getBrushSize, const char*, 2, 2, "()")
{
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;
}
@ -2868,7 +2870,7 @@ ConsoleMethod( TerrainEditor, setSlopeLimitMaxAngle, F32, 3, 3, 0)
}
//------------------------------------------------------------------------------
void TerrainEditor::autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinSlope, F32 mMaxSlope )
void TerrainEditor::autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinSlope, F32 mMaxSlope, F32 mCoverage )
{
if (!mActiveTerrain)
return;
@ -2894,6 +2896,9 @@ void TerrainEditor::autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinS
if (gi.mMaterial == mat)
continue;
if (mRandI(0, 100) > mCoverage)
continue;
Point3F wp;
gridToWorld(gp, wp);
@ -2933,7 +2938,7 @@ void TerrainEditor::autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinS
scheduleMaterialUpdate();
}
ConsoleMethod( TerrainEditor, autoMaterialLayer, void, 6, 6, "(float minHeight, float maxHeight, float minSlope, float maxSlope)")
ConsoleMethod( TerrainEditor, autoMaterialLayer, void, 7, 7, "(float minHeight, float maxHeight, float minSlope, float maxSlope, float coverage)")
{
object->autoMaterialLayer( dAtof(argv[2]), dAtof(argv[3]), dAtof(argv[4]), dAtof(argv[5]) );
object->autoMaterialLayer( dAtof(argv[2]), dAtof(argv[3]), dAtof(argv[4]), dAtof(argv[5]), dAtof(argv[6]));
}

View file

@ -230,7 +230,7 @@ class TerrainEditor : public EditTSCtrl
void submitMaterialUndo( String actionName );
void onMaterialUndo( TerrainBlock *terr );
void autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinSlope, F32 mMaxSlope );
void autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinSlope, F32 mMaxSlope, F32 mCoverage );
private:

View file

@ -1471,7 +1471,7 @@ void WorldEditor::renderSplinePath(SimPath::Path *path)
}
GFX->setStateBlock(mSplineSB);
GFX->setupGenericShaders();
if (path->isLooping())
{
@ -2760,7 +2760,7 @@ void WorldEditor::initPersistFields()
//------------------------------------------------------------------------------
// These methods are needed for the console interfaces.
void WorldEditor::ignoreObjClass( U32 argc, const char **argv )
void WorldEditor::ignoreObjClass( U32 argc, ConsoleValueRef *argv )
{
for(S32 i = 2; i < argc; i++)
{
@ -2882,8 +2882,9 @@ const Point3F& WorldEditor::getSelectionCentroid()
const char* WorldEditor::getSelectionCentroidText()
{
const Point3F & centroid = getSelectionCentroid();
char * ret = Con::getReturnBuffer(100);
dSprintf(ret, 100, "%g %g %g", centroid.x, centroid.y, centroid.z);
static const U32 bufSize = 100;
char * ret = Con::getReturnBuffer(bufSize);
dSprintf(ret, bufSize, "%g %g %g", centroid.x, centroid.y, centroid.z);
return ret;
}
@ -3209,7 +3210,7 @@ ConsoleMethod( WorldEditor, setActiveSelection, void, 3, 3, "( id set ) - Set th
WorldEditorSelection* selection;
if( !Sim::findObject( argv[ 2 ], selection ) )
{
Con::errorf( "WorldEditor::setActiveSelectionSet - no selection set '%s'", argv[ 2 ] );
Con::errorf( "WorldEditor::setActiveSelectionSet - no selection set '%s'", (const char*)argv[ 2 ] );
return;
}
@ -3263,8 +3264,9 @@ ConsoleMethod( WorldEditor, getSelectionCentroid, const char *, 2, 2, "")
ConsoleMethod( WorldEditor, getSelectionExtent, const char *, 2, 2, "")
{
Point3F bounds = object->getSelectionExtent();
char * ret = Con::getReturnBuffer(100);
dSprintf(ret, 100, "%g %g %g", bounds.x, bounds.y, bounds.z);
static const U32 bufSize = 100;
char * ret = Con::getReturnBuffer(bufSize);
dSprintf(ret, bufSize, "%g %g %g", bounds.x, bounds.y, bounds.z);
return ret;
}
@ -3335,14 +3337,14 @@ ConsoleMethod( WorldEditor, alignByBounds, void, 3, 3, "(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'", argv[2]));
Con::warnf(ConsoleLogEntry::General, avar("worldEditor.alignByBounds: invalid bounds axis '%s'", (const char*)argv[2]));
}
ConsoleMethod( WorldEditor, alignByAxis, void, 3, 3, "(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'", argv[2]));
Con::warnf(ConsoleLogEntry::General, avar("worldEditor.alignByAxis: invalid axis '%s'", (const char*)argv[2]));
}
ConsoleMethod( WorldEditor, resetSelectedRotation, void, 2, 2, "")
@ -3547,7 +3549,7 @@ void WorldEditor::colladaExportSelection( const String &path )
ConsoleMethod( WorldEditor, colladaExportSelection, void, 3, 3,
"( String path ) - Export the combined geometry of all selected objects to the specified path in collada format." )
{
object->colladaExportSelection( argv[2] );
object->colladaExportSelection( (const char*)argv[2] );
}
void WorldEditor::makeSelectionPrefab( const char *filename )

View file

@ -76,7 +76,7 @@ class WorldEditor : public EditTSCtrl
Point3F p2;
};
void ignoreObjClass(U32 argc, const char** argv);
void ignoreObjClass(U32 argc, ConsoleValueRef* argv);
void clearIgnoreList();
static bool setObjectsUseBoxCenter( void *object, const char *index, const char *data ) { static_cast<WorldEditor*>(object)->setObjectsUseBoxCenter( dAtob( data ) ); return false; };

View file

@ -642,10 +642,11 @@ ConsoleMethod( WorldEditorSelection, containsGlobalBounds, bool, 2, 2, "() - Tru
ConsoleMethod( WorldEditorSelection, getCentroid, const char*, 2, 2, "() - Return the median of all object positions in the selection." )
{
char* buffer = Con::getReturnBuffer( 256 );
static const U32 bufSize = 256;
char* buffer = Con::getReturnBuffer( bufSize );
const Point3F& centroid = object->getCentroid();
dSprintf( buffer, 256, "%g %g %g", centroid.x, centroid.y, centroid.z );
dSprintf( buffer, bufSize, "%g %g %g", centroid.x, centroid.y, centroid.z );
return buffer;
}
@ -653,10 +654,11 @@ ConsoleMethod( WorldEditorSelection, getCentroid, const char*, 2, 2, "() - Retur
ConsoleMethod( WorldEditorSelection, getBoxCentroid, const char*, 2, 2, "() - Return the center of the bounding box around the selection." )
{
char* buffer = Con::getReturnBuffer( 256 );
static const U32 bufSize = 256;
char* buffer = Con::getReturnBuffer( bufSize );
const Point3F& boxCentroid = object->getBoxCentroid();
dSprintf( buffer, 256, "%g %g %g", boxCentroid.x, boxCentroid.y, boxCentroid.z );
dSprintf( buffer, bufSize, "%g %g %g", boxCentroid.x, boxCentroid.y, boxCentroid.z );
return buffer;
}
@ -682,7 +684,7 @@ ConsoleMethod( WorldEditorSelection, union, void, 3, 3, "( SimSet set ) - Add al
SimSet* selection;
if( !Sim::findObject( argv[ 2 ], selection ) )
{
Con::errorf( "WorldEditorSelection::union - no SimSet '%s'", argv[ 2 ] );
Con::errorf( "WorldEditorSelection::union - no SimSet '%s'", (const char*)argv[ 2 ] );
return;
}
@ -698,7 +700,7 @@ ConsoleMethod( WorldEditorSelection, subtract, void, 3, 3, "( SimSet ) - Remove
SimSet* selection;
if( !Sim::findObject( argv[ 2 ], selection ) )
{
Con::errorf( "WorldEditorSelection::subtract - no SimSet '%s'", argv[ 2 ] );
Con::errorf( "WorldEditorSelection::subtract - no SimSet '%s'", (const char*)argv[ 2 ] );
return;
}