mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-12 19:31:41 +00:00
Merge branch 'development' of https://github.com/GarageGames/Torque3D into memberMess
# Conflicts: # Engine/source/console/consoleFunctions.cpp
This commit is contained in:
commit
28e509af1a
158 changed files with 2954 additions and 709 deletions
|
|
@ -218,9 +218,9 @@ bool GuiFormCtrl::resize(const Point2I &newPosition, const Point2I &newExtent)
|
|||
S32 strlen = dStrlen((const char*)mCaption);
|
||||
for(S32 i=strlen; i>=0; --i)
|
||||
{
|
||||
dStrcpy(buf, "");
|
||||
dStrncat(buf, (const char*)mCaption, i);
|
||||
dStrcat(buf, "...");
|
||||
dStrcpy(buf, "", i);
|
||||
dStrcat(buf, (const char*)mCaption, i);
|
||||
dStrcat(buf, "...", i);
|
||||
|
||||
textWidth = mProfile->mFont->getStrWidth(buf);
|
||||
|
||||
|
|
|
|||
|
|
@ -167,8 +167,9 @@ bool guiAnimBitmapCtrl::ptSetFrameRanges(void *object, const char *index, const
|
|||
pData->mCurFrameIndex = pData->mNumFrames;
|
||||
return true;
|
||||
}
|
||||
char* tokCopy = new char[dStrlen(data) + 1];
|
||||
dStrcpy(tokCopy, data);
|
||||
dsize_t tokLen = dStrlen(data) + 1;
|
||||
char* tokCopy = new char[tokLen];
|
||||
dStrcpy(tokCopy, data, tokLen);
|
||||
|
||||
char* currTok = dStrtok(tokCopy, " \t");
|
||||
while (currTok != NULL)
|
||||
|
|
@ -291,4 +292,4 @@ void guiAnimBitmapCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
}
|
||||
|
||||
renderChildControls(offset, updateRect);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,12 @@ IMPLEMENT_CALLBACK( GuiConsole, onMessageSelected, void, ( ConsoleLogEntry::Leve
|
|||
"@param level Diagnostic level of the message.\n"
|
||||
"@param message Message text.\n" );
|
||||
|
||||
IMPLEMENT_CALLBACK(GuiConsole, onNewMessage, void, (U32 errorCount, U32 warnCount, U32 normalCount), (errorCount, warnCount, normalCount),
|
||||
"Called when a new message is logged.\n\n"
|
||||
"@param errorCount The number of error messages logged.\n"
|
||||
"@param warnCount The number of warning messages logged.\n"
|
||||
"@param normalCount The number of normal messages logged.\n");
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -58,6 +64,11 @@ GuiConsole::GuiConsole()
|
|||
setExtent(64, 64);
|
||||
mCellSize.set(1, 1);
|
||||
mSize.set(1, 0);
|
||||
|
||||
mDisplayErrors = true;
|
||||
mDisplayWarnings = true;
|
||||
mDisplayNormalMessages = true;
|
||||
mFiltersDirty = true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -81,56 +92,98 @@ S32 GuiConsole::getMaxWidth(S32 startIndex, S32 endIndex)
|
|||
U32 size;
|
||||
ConsoleLogEntry *log;
|
||||
|
||||
Con::getLockLog(log, size);
|
||||
|
||||
if(startIndex < 0 || (U32)endIndex >= size || startIndex > endIndex)
|
||||
if (startIndex < 0 || (U32)endIndex >= mFilteredLog.size() || startIndex > endIndex)
|
||||
return 0;
|
||||
|
||||
S32 result = 0;
|
||||
for(S32 i = startIndex; i <= endIndex; i++)
|
||||
result = getMax(result, (S32)(mFont->getStrWidth((const UTF8 *)log[i].mString)));
|
||||
|
||||
Con::unlockLog();
|
||||
result = getMax(result, (S32)(mFont->getStrWidth((const UTF8 *)mFilteredLog[i].mString)));
|
||||
|
||||
return(result + 6);
|
||||
}
|
||||
|
||||
void GuiConsole::refreshLogText()
|
||||
{
|
||||
U32 size;
|
||||
ConsoleLogEntry *log;
|
||||
|
||||
Con::getLockLog(log, size);
|
||||
|
||||
if (mFilteredLog.size() != size || mFiltersDirty)
|
||||
{
|
||||
mFilteredLog.clear();
|
||||
|
||||
U32 errorCount = 0;
|
||||
U32 warnCount = 0;
|
||||
U32 normalCount = 0;
|
||||
|
||||
//Filter the log if needed
|
||||
for (U32 i = 0; i < size; ++i)
|
||||
{
|
||||
ConsoleLogEntry &entry = log[i];
|
||||
|
||||
if (entry.mLevel == ConsoleLogEntry::Error)
|
||||
{
|
||||
errorCount++;
|
||||
if (mDisplayErrors)
|
||||
{
|
||||
mFilteredLog.push_back(entry);
|
||||
}
|
||||
}
|
||||
else if (entry.mLevel == ConsoleLogEntry::Warning)
|
||||
{
|
||||
warnCount++;
|
||||
if (mDisplayWarnings)
|
||||
{
|
||||
mFilteredLog.push_back(entry);
|
||||
}
|
||||
}
|
||||
else if (entry.mLevel == ConsoleLogEntry::Normal)
|
||||
{
|
||||
normalCount++;
|
||||
if (mDisplayNormalMessages)
|
||||
{
|
||||
mFilteredLog.push_back(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onNewMessage_callback(errorCount, warnCount, normalCount);
|
||||
}
|
||||
|
||||
Con::unlockLog();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void GuiConsole::onPreRender()
|
||||
{
|
||||
//see if the size has changed
|
||||
U32 prevSize = getHeight() / mCellSize.y;
|
||||
U32 size;
|
||||
ConsoleLogEntry *log;
|
||||
|
||||
Con::getLockLog(log, size);
|
||||
Con::unlockLog(); // we unlock immediately because we only use size here, not log.
|
||||
refreshLogText();
|
||||
|
||||
if(size != prevSize)
|
||||
{
|
||||
//first, find out if the console was scrolled up
|
||||
bool scrolled = false;
|
||||
GuiScrollCtrl *parent = dynamic_cast<GuiScrollCtrl*>(getParent());
|
||||
//first, find out if the console was scrolled up
|
||||
bool scrolled = false;
|
||||
GuiScrollCtrl *parent = dynamic_cast<GuiScrollCtrl*>(getParent());
|
||||
|
||||
if(parent)
|
||||
scrolled = parent->isScrolledToBottom();
|
||||
if(parent)
|
||||
scrolled = parent->isScrolledToBottom();
|
||||
|
||||
//find the max cell width for the new entries
|
||||
S32 newMax = getMaxWidth(prevSize, size - 1);
|
||||
if(newMax > mCellSize.x)
|
||||
mCellSize.set(newMax, mFont->getHeight());
|
||||
//find the max cell width for the new entries
|
||||
S32 newMax = getMaxWidth(prevSize, mFilteredLog.size() - 1);
|
||||
if(newMax > mCellSize.x)
|
||||
mCellSize.set(newMax, mFont->getHeight());
|
||||
|
||||
//set the array size
|
||||
mSize.set(1, size);
|
||||
//set the array size
|
||||
mSize.set(1, mFilteredLog.size());
|
||||
|
||||
//resize the control
|
||||
setExtent( Point2I(mCellSize.x, mCellSize.y * size));
|
||||
//resize the control
|
||||
setExtent(Point2I(mCellSize.x, mCellSize.y * mFilteredLog.size()));
|
||||
|
||||
//if the console was not scrolled, make the last entry visible
|
||||
if (scrolled)
|
||||
scrollCellVisible(Point2I(0,mSize.y - 1));
|
||||
}
|
||||
//if the console was not scrolled, make the last entry visible
|
||||
if (scrolled)
|
||||
scrollCellVisible(Point2I(0,mSize.y - 1));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -139,10 +192,8 @@ void GuiConsole::onRenderCell(Point2I offset, Point2I cell, bool /*selected*/, b
|
|||
{
|
||||
U32 size;
|
||||
ConsoleLogEntry *log;
|
||||
|
||||
Con::getLockLog(log, size);
|
||||
|
||||
ConsoleLogEntry &entry = log[cell.y];
|
||||
|
||||
ConsoleLogEntry &entry = mFilteredLog[cell.y];
|
||||
switch (entry.mLevel)
|
||||
{
|
||||
case ConsoleLogEntry::Normal: GFX->getDrawUtil()->setBitmapModulation(mProfile->mFontColor); break;
|
||||
|
|
@ -151,8 +202,6 @@ void GuiConsole::onRenderCell(Point2I offset, Point2I cell, bool /*selected*/, b
|
|||
default: AssertFatal(false, "GuiConsole::onRenderCell - Unrecognized ConsoleLogEntry type, update this.");
|
||||
}
|
||||
GFX->getDrawUtil()->drawText(mFont, Point2I(offset.x + 3, offset.y), entry.mString, mProfile->mFontColors);
|
||||
|
||||
Con::unlockLog();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -164,10 +213,81 @@ void GuiConsole::onCellSelected( Point2I cell )
|
|||
U32 size;
|
||||
ConsoleLogEntry* log;
|
||||
|
||||
Con::getLockLog(log, size);
|
||||
|
||||
ConsoleLogEntry& entry = log[ cell.y ];
|
||||
ConsoleLogEntry& entry = mFilteredLog[cell.y];
|
||||
onMessageSelected_callback( entry.mLevel, entry.mString );
|
||||
|
||||
Con::unlockLog();
|
||||
}
|
||||
|
||||
void GuiConsole::setDisplayFilters(bool errors, bool warns, bool normal)
|
||||
{
|
||||
mDisplayErrors = errors;
|
||||
mDisplayWarnings = warns;
|
||||
mDisplayNormalMessages = normal;
|
||||
mFiltersDirty = true;
|
||||
|
||||
refreshLogText();
|
||||
|
||||
//find the max cell width for the new entries
|
||||
S32 newMax = getMaxWidth(0, mFilteredLog.size() - 1);
|
||||
mCellSize.set(newMax, mFont->getHeight());
|
||||
|
||||
//set the array size
|
||||
mSize.set(1, mFilteredLog.size());
|
||||
|
||||
//resize the control
|
||||
setExtent(Point2I(mCellSize.x, mCellSize.y * mFilteredLog.size()));
|
||||
|
||||
scrollCellVisible(Point2I(0, mSize.y - 1));
|
||||
|
||||
mFiltersDirty = false;
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiConsole, setDisplayFilters, void, (bool errors, bool warns, bool normal), (true, true, true),
|
||||
"Sets the current display filters for the console gui. Allows you to indicate if it should display errors, warns and/or normal messages.\n\n"
|
||||
"@param errors If true, the console gui will display any error messages that were emitted.\n\n"
|
||||
"@param warns If true, the console gui will display any warning messages that were emitted.\n\n"
|
||||
"@param normal If true, the console gui will display any regular messages that were emitted.\n\n")
|
||||
{
|
||||
object->setDisplayFilters(errors, warns, normal);
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiConsole, getErrorFilter, bool, (), ,
|
||||
"Returns if the error filter is on or not.")
|
||||
{
|
||||
return object->getErrorFilter();
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiConsole, getWarnFilter, bool, (), ,
|
||||
"Returns if the warning filter is on or not.")
|
||||
{
|
||||
return object->getWarnFilter();
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiConsole, getNormalFilter, bool, (), ,
|
||||
"Returns if the normal message filter is on or not.")
|
||||
{
|
||||
return object->getNormalFilter();
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiConsole, toggleErrorFilter, void, (), ,
|
||||
"Toggles the error filter.")
|
||||
{
|
||||
object->toggleErrorFilter();
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiConsole, toggleWarnFilter, void, (), ,
|
||||
"Toggles the warning filter.")
|
||||
{
|
||||
object->toggleWarnFilter();
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiConsole, toggleNormalFilter, void, (), ,
|
||||
"Toggles the normal messages filter.")
|
||||
{
|
||||
object->toggleNormalFilter();
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiConsole, refresh, void, (), ,
|
||||
"Refreshes the displayed messages.")
|
||||
{
|
||||
object->refresh();
|
||||
}
|
||||
|
|
@ -39,14 +39,22 @@ class GuiConsole : public GuiArrayCtrl
|
|||
|
||||
Resource<GFont> mFont;
|
||||
|
||||
bool mDisplayErrors;
|
||||
bool mDisplayWarnings;
|
||||
bool mDisplayNormalMessages;
|
||||
bool mFiltersDirty;
|
||||
|
||||
S32 getMaxWidth(S32 startIndex, S32 endIndex);
|
||||
|
||||
Vector<ConsoleLogEntry> mFilteredLog;
|
||||
|
||||
protected:
|
||||
|
||||
/// @name Callbacks
|
||||
/// @{
|
||||
|
||||
DECLARE_CALLBACK( void, onMessageSelected, ( ConsoleLogEntry::Level level, const char* message ) );
|
||||
DECLARE_CALLBACK(void, onNewMessage, (U32 errorCount, U32 warnCount, U32 normalCount));
|
||||
|
||||
/// @}
|
||||
|
||||
|
|
@ -63,6 +71,30 @@ class GuiConsole : public GuiArrayCtrl
|
|||
virtual bool onWake();
|
||||
virtual void onPreRender();
|
||||
virtual void onRenderCell(Point2I offset, Point2I cell, bool selected, bool mouseOver);
|
||||
|
||||
void setDisplayFilters(bool errors, bool warns, bool normal);
|
||||
bool getErrorFilter() { return mDisplayErrors; }
|
||||
bool getWarnFilter() { return mDisplayWarnings; }
|
||||
bool getNormalFilter() { return mDisplayNormalMessages; }
|
||||
|
||||
void toggleErrorFilter()
|
||||
{
|
||||
setDisplayFilters(!mDisplayErrors, mDisplayWarnings, mDisplayNormalMessages);
|
||||
}
|
||||
void toggleWarnFilter()
|
||||
{
|
||||
setDisplayFilters(mDisplayErrors, !mDisplayWarnings, mDisplayNormalMessages);
|
||||
}
|
||||
void toggleNormalFilter()
|
||||
{
|
||||
setDisplayFilters(mDisplayErrors, mDisplayWarnings, !mDisplayNormalMessages);
|
||||
}
|
||||
void refresh()
|
||||
{
|
||||
setDisplayFilters(mDisplayErrors, mDisplayWarnings, mDisplayNormalMessages);
|
||||
}
|
||||
|
||||
void refreshLogText();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ DefineEngineMethod( GuiDirectoryFileListCtrl, getSelectedFiles, const char*, (),
|
|||
|
||||
dMemset( itemBuffer, 0, itemBufSize );
|
||||
dSprintf( itemBuffer, itemBufSize, " %s", itemText );
|
||||
dStrcat( returnBuffer, itemBuffer );
|
||||
dStrcat( returnBuffer, itemBuffer, itemBufSize );
|
||||
}
|
||||
|
||||
return returnBuffer;
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ void GuiFileTreeCtrl::recurseInsert( Item* parent, StringTableEntry path )
|
|||
|
||||
char szPathCopy [ 1024 ];
|
||||
dMemset( szPathCopy, 0, 1024 );
|
||||
dStrcpy( szPathCopy, path );
|
||||
dStrcpy( szPathCopy, path, 1024 );
|
||||
|
||||
// Jump over the first character if it's a root /
|
||||
char *curPos = szPathCopy;
|
||||
|
|
|
|||
|
|
@ -458,7 +458,7 @@ DefineEngineMethod( GuiListBoxCtrl, getSelectedItems, const char*, (),,
|
|||
{
|
||||
UTF8 retFormat[12];
|
||||
dSprintf( retFormat, 12, "%d ", (*i) );
|
||||
dStrcat( retBuffer, retFormat );
|
||||
dStrcat( retBuffer, retFormat, 12 );
|
||||
}
|
||||
|
||||
return retBuffer;
|
||||
|
|
|
|||
|
|
@ -566,13 +566,14 @@ void GuiPopUpMenuCtrl::setBitmap( const char *name )
|
|||
{
|
||||
char buffer[1024];
|
||||
char *p;
|
||||
dStrcpy(buffer, name);
|
||||
dStrcpy(buffer, name, 1024);
|
||||
p = buffer + dStrlen(buffer);
|
||||
S32 pLen = 1024 - dStrlen(buffer);
|
||||
|
||||
dStrcpy(p, "_n");
|
||||
dStrcpy(p, "_n", pLen);
|
||||
mTextureNormal = GFXTexHandle( (StringTableEntry)buffer, &GFXDefaultGUIProfile, avar("%s() - mTextureNormal (line %d)", __FUNCTION__, __LINE__) );
|
||||
|
||||
dStrcpy(p, "_d");
|
||||
dStrcpy(p, "_d", pLen);
|
||||
mTextureDepressed = GFXTexHandle( (StringTableEntry)buffer, &GFXDefaultGUIProfile, avar("%s() - mTextureDepressed (line %d)", __FUNCTION__, __LINE__) );
|
||||
if ( !mTextureDepressed )
|
||||
mTextureDepressed = mTextureNormal;
|
||||
|
|
@ -637,7 +638,7 @@ void GuiPopUpMenuCtrl::addEntry( const char *buf, S32 id, U32 scheme )
|
|||
mIdMax = id;
|
||||
|
||||
Entry e;
|
||||
dStrcpy( e.buf, buf );
|
||||
dStrcpy( e.buf, buf, 256 );
|
||||
e.id = id;
|
||||
e.scheme = scheme;
|
||||
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ DefineEngineMethod( GuiPopUpMenuCtrlEx, addScheme, void, (S32 id, ColorI fontCol
|
|||
U32 r, g, b;
|
||||
char buf[64];
|
||||
|
||||
dStrcpy( buf, argv[3] );
|
||||
dStrcpy( buf, argv[3], 64 );
|
||||
char* temp = dStrtok( buf, " \0" );
|
||||
r = temp ? dAtoi( temp ) : 0;
|
||||
temp = dStrtok( NULL, " \0" );
|
||||
|
|
@ -399,7 +399,7 @@ DefineEngineMethod( GuiPopUpMenuCtrlEx, addScheme, void, (S32 id, ColorI fontCol
|
|||
b = temp ? dAtoi( temp ) : 0;
|
||||
fontColor.set( r, g, b );
|
||||
|
||||
dStrcpy( buf, argv[4] );
|
||||
dStrcpy( buf, argv[4], 64 );
|
||||
temp = dStrtok( buf, " \0" );
|
||||
r = temp ? dAtoi( temp ) : 0;
|
||||
temp = dStrtok( NULL, " \0" );
|
||||
|
|
@ -408,7 +408,7 @@ DefineEngineMethod( GuiPopUpMenuCtrlEx, addScheme, void, (S32 id, ColorI fontCol
|
|||
b = temp ? dAtoi( temp ) : 0;
|
||||
fontColorHL.set( r, g, b );
|
||||
|
||||
dStrcpy( buf, argv[5] );
|
||||
dStrcpy( buf, argv[5], 64 );
|
||||
temp = dStrtok( buf, " \0" );
|
||||
r = temp ? dAtoi( temp ) : 0;
|
||||
temp = dStrtok( NULL, " \0" );
|
||||
|
|
@ -426,7 +426,7 @@ DefineEngineMethod( GuiPopUpMenuCtrlEx, addScheme, void, (S32 id, ColorI fontCol
|
|||
// U32 r, g, b;
|
||||
// char buf[64];
|
||||
//
|
||||
// dStrcpy( buf, argv[3] );
|
||||
// dStrcpy( buf, argv[3], 64 );
|
||||
// char* temp = dStrtok( buf, " \0" );
|
||||
// r = temp ? dAtoi( temp ) : 0;
|
||||
// temp = dStrtok( NULL, " \0" );
|
||||
|
|
@ -435,7 +435,7 @@ DefineEngineMethod( GuiPopUpMenuCtrlEx, addScheme, void, (S32 id, ColorI fontCol
|
|||
// b = temp ? dAtoi( temp ) : 0;
|
||||
// fontColor.set( r, g, b );
|
||||
//
|
||||
// dStrcpy( buf, argv[4] );
|
||||
// dStrcpy( buf, argv[4], 64 );
|
||||
// temp = dStrtok( buf, " \0" );
|
||||
// r = temp ? dAtoi( temp ) : 0;
|
||||
// temp = dStrtok( NULL, " \0" );
|
||||
|
|
@ -444,7 +444,7 @@ DefineEngineMethod( GuiPopUpMenuCtrlEx, addScheme, void, (S32 id, ColorI fontCol
|
|||
// b = temp ? dAtoi( temp ) : 0;
|
||||
// fontColorHL.set( r, g, b );
|
||||
//
|
||||
// dStrcpy( buf, argv[5] );
|
||||
// dStrcpy( buf, argv[5], 64 );
|
||||
// temp = dStrtok( buf, " \0" );
|
||||
// r = temp ? dAtoi( temp ) : 0;
|
||||
// temp = dStrtok( NULL, " \0" );
|
||||
|
|
@ -771,13 +771,14 @@ void GuiPopUpMenuCtrlEx::setBitmap(const char *name)
|
|||
{
|
||||
char buffer[1024];
|
||||
char *p;
|
||||
dStrcpy(buffer, name);
|
||||
dStrcpy(buffer, name, 1024);
|
||||
p = buffer + dStrlen(buffer);
|
||||
S32 pLen = 1024 - dStrlen(buffer);
|
||||
|
||||
dStrcpy(p, "_n");
|
||||
dStrcpy(p, "_n", pLen);
|
||||
mTextureNormal = GFXTexHandle( (StringTableEntry)buffer, &GFXDefaultGUIProfile, avar("%s() - mTextureNormal (line %d)", __FUNCTION__, __LINE__) );
|
||||
|
||||
dStrcpy(p, "_d");
|
||||
dStrcpy(p, "_d", pLen);
|
||||
mTextureDepressed = GFXTexHandle( (StringTableEntry)buffer, &GFXDefaultGUIProfile, avar("%s() - mTextureDepressed (line %d)", __FUNCTION__, __LINE__) );
|
||||
if ( !mTextureDepressed )
|
||||
mTextureDepressed = mTextureNormal;
|
||||
|
|
@ -840,7 +841,7 @@ void GuiPopUpMenuCtrlEx::addEntry(const char *buf, S32 id, U32 scheme)
|
|||
mIdMax = id;
|
||||
|
||||
Entry e;
|
||||
dStrcpy( e.buf, buf );
|
||||
dStrcpy( e.buf, buf, 256 );
|
||||
e.id = id;
|
||||
e.scheme = scheme;
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ GuiTabPageCtrl::GuiTabPageCtrl(void)
|
|||
{
|
||||
setExtent(Point2I(100, 200));
|
||||
mFitBook = false;
|
||||
dStrcpy(mText,(UTF8*)"TabPage");
|
||||
dStrcpy(mText,(UTF8*)"TabPage", MAX_STRING_LENGTH);
|
||||
mActive = true;
|
||||
mIsContainer = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4750,15 +4750,15 @@ StringTableEntry GuiTreeViewCtrl::getTextToRoot( S32 itemId, const char * delimi
|
|||
dMemset( bufferOne, 0, sizeof(bufferOne) );
|
||||
dMemset( bufferTwo, 0, sizeof(bufferTwo) );
|
||||
|
||||
dStrcpy( bufferOne, item->getText() );
|
||||
dStrcpy( bufferOne, item->getText(), 1024 );
|
||||
|
||||
Item *prevNode = item->mParent;
|
||||
while ( prevNode )
|
||||
{
|
||||
dMemset( bufferNodeText, 0, sizeof(bufferNodeText) );
|
||||
dStrcpy( bufferNodeText, prevNode->getText() );
|
||||
dStrcpy( bufferNodeText, prevNode->getText(), 128 );
|
||||
dSprintf( bufferTwo, 1024, "%s%s%s",bufferNodeText, delimiter, bufferOne );
|
||||
dStrcpy( bufferOne, bufferTwo );
|
||||
dStrcpy( bufferOne, bufferTwo, 1024 );
|
||||
dMemset( bufferTwo, 0, sizeof(bufferTwo) );
|
||||
prevNode = prevNode->mParent;
|
||||
}
|
||||
|
|
@ -5566,4 +5566,4 @@ DefineEngineMethod(GuiTreeViewCtrl, getItemAtPosition, S32, (Point2I position),
|
|||
"@return The id of the item under the position.")
|
||||
{
|
||||
return object->getItemAtPosition(position);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2570,7 +2570,7 @@ DefineEngineMethod( GuiControl, findHitControls, const char*, ( S32 x, S32 y, S3
|
|||
return "";
|
||||
|
||||
char* buffer = Con::getReturnBuffer( s.size() );
|
||||
dStrcpy( buffer, s.c_str() );
|
||||
dStrcpy( buffer, s.c_str(), s.size() );
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -431,7 +431,7 @@ bool DbgFileView::findMouseOverVariable()
|
|||
{
|
||||
S32 stringPosition = pt.x - gFileXOffset;
|
||||
char tempBuf[256], *varNamePtr = &tempBuf[1];
|
||||
dStrcpy(tempBuf, mFileView[cell.y].text);
|
||||
dStrcpy(tempBuf, mFileView[cell.y].text, 256);
|
||||
|
||||
//find the current mouse over char
|
||||
S32 charNum = findMouseOverChar(mFileView[cell.y].text, stringPosition);
|
||||
|
|
@ -526,7 +526,7 @@ void DbgFileView::onPreRender()
|
|||
{
|
||||
setUpdate();
|
||||
char oldVar[256];
|
||||
dStrcpy(oldVar, mMouseOverVariable);
|
||||
dStrcpy(oldVar, mMouseOverVariable, 256);
|
||||
bool found = findMouseOverVariable();
|
||||
if (found && mPCCurrentLine >= 0)
|
||||
{
|
||||
|
|
@ -685,7 +685,7 @@ void DbgFileView::onRenderCell(Point2I offset, Point2I cell, bool selected, bool
|
|||
{
|
||||
S32 startPos, endPos;
|
||||
char tempBuf[256];
|
||||
dStrcpy(tempBuf, mFileView[cell.y].text);
|
||||
dStrcpy(tempBuf, mFileView[cell.y].text, 256);
|
||||
|
||||
//get the end coord
|
||||
tempBuf[mBlockEnd] = '\0';
|
||||
|
|
|
|||
|
|
@ -2625,8 +2625,8 @@ DefineConsoleMethod( GuiEditCtrl, getSelectionGlobalBounds, const char*, (), , "
|
|||
RectI bounds = object->getSelectionGlobalBounds();
|
||||
String str = String::ToString( "%i %i %i %i", bounds.point.x, bounds.point.y, bounds.extent.x, bounds.extent.y );
|
||||
|
||||
char* buffer = Con::getReturnBuffer( str.length() );
|
||||
dStrcpy( buffer, str.c_str() );
|
||||
char* buffer = Con::getReturnBuffer( str.size() );
|
||||
dStrcpy( buffer, str.c_str(), str.size() );
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,8 +70,8 @@ DefineConsoleMethod( GuiFilterCtrl, getValue, const char*, (), , "Return a tuple
|
|||
for (U32 i=0; i < filter->size(); i++)
|
||||
{
|
||||
char value[32];
|
||||
dSprintf(value, 31, "%1.5f ", *(filter->begin()+i) );
|
||||
dStrcat(buffer, value);
|
||||
dSprintf(value, 32, "%1.5f ", *(filter->begin()+i) );
|
||||
dStrcat(buffer, value, 32);
|
||||
}
|
||||
|
||||
return buffer;
|
||||
|
|
@ -239,7 +239,7 @@ void Filter::set(S32 argc, const char *argv[])
|
|||
if (argc == 1)
|
||||
{ // in the form of one string "1.0 1.0 1.0"
|
||||
char list[1024];
|
||||
dStrcpy(list, *argv); // strtok modifies the string so we need to copy it
|
||||
dStrcpy(list, *argv, 1024); // strtok modifies the string so we need to copy it
|
||||
char *value = dStrtok(list, " ");
|
||||
while (value)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -500,7 +500,7 @@ void MessageVector::insertLine(const U32 position,
|
|||
|
||||
U32 len = dStrlen(newMessage) + 1;
|
||||
char* copy = new char[len];
|
||||
dStrcpy(copy, newMessage);
|
||||
dStrcpy(copy, newMessage, len);
|
||||
|
||||
mMessageLines.insert(position);
|
||||
mMessageLines[position].message = copy;
|
||||
|
|
|
|||
|
|
@ -2495,8 +2495,8 @@ DefineConsoleMethod(TerrainEditor, getTerrainBlocksMaterialList, const char *, (
|
|||
ret[0] = 0;
|
||||
for(U32 i = 0; i < list.size(); ++i)
|
||||
{
|
||||
dStrcat( ret, list[i] );
|
||||
dStrcat( ret, "\n" );
|
||||
dStrcat( ret, list[i], size );
|
||||
dStrcat( ret, "\n", size );
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
@ -2709,8 +2709,8 @@ DefineConsoleMethod(TerrainEditor, getMaterials, const char *, (), , "() gets th
|
|||
ret[0] = 0;
|
||||
for(U32 i = 0; i < terr->getMaterialCount(); i++)
|
||||
{
|
||||
dStrcat( ret, terr->getMaterialName(i) );
|
||||
dStrcat( ret, "\n" );
|
||||
dStrcat( ret, terr->getMaterialName(i), 4096 );
|
||||
dStrcat( ret, "\n", 4096 );
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -3927,15 +3927,38 @@ void WorldEditor::makeSelectionAMesh(const char *filename)
|
|||
OptimizedPolyList polyList;
|
||||
polyList.setBaseTransform(orientation);
|
||||
|
||||
ColladaUtils::ExportData exportData;
|
||||
|
||||
for (S32 i = 0; i < objectList.size(); i++)
|
||||
{
|
||||
SceneObject *pObj = objectList[i];
|
||||
if (!pObj->buildPolyList(PLC_Export, &polyList, pObj->getWorldBox(), pObj->getWorldSphere()))
|
||||
if (!pObj->buildExportPolyList(&exportData, pObj->getWorldBox(), pObj->getWorldSphere()))
|
||||
Con::warnf("colladaExportObjectList() - object %i returned no geometry.", pObj->getId());
|
||||
}
|
||||
|
||||
//Now that we have all of our mesh data, process it so we can correctly collapse everything.
|
||||
exportData.processData();
|
||||
|
||||
//recenter generated visual mesh results
|
||||
for (U32 dl = 0; dl < exportData.colMeshes.size(); dl++)
|
||||
{
|
||||
for (U32 pnt = 0; pnt < exportData.colMeshes[dl].mesh.mPoints.size(); pnt++)
|
||||
{
|
||||
exportData.colMeshes[dl].mesh.mPoints[pnt] -= centroid;
|
||||
}
|
||||
}
|
||||
|
||||
//recenter generated collision mesh results
|
||||
for (U32 dl = 0; dl < exportData.detailLevels.size(); dl++)
|
||||
{
|
||||
for (U32 pnt = 0; pnt < exportData.detailLevels[dl].mesh.mPoints.size(); pnt++)
|
||||
{
|
||||
exportData.detailLevels[dl].mesh.mPoints[pnt] -= centroid;
|
||||
}
|
||||
}
|
||||
|
||||
// Use a ColladaUtils function to do the actual export to a Collada file
|
||||
ColladaUtils::exportToCollada(filename, polyList);
|
||||
ColladaUtils::exportToCollada(filename, exportData);
|
||||
//
|
||||
|
||||
// Allocate TSStatic object and add to level.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue