Removed duplicate checkbox image

Added asset import conflict resolution option to prepend folder name
Cleanups of Project Importer and fixed importing of material and terrain materials, specifically, fallbacks in the event they are unnamed to utilize the mapTo and internalName fields, respectively
Fixed typos in guiTerrainMaterialDlg
Added AssetBrowser button to GuiEditor
Improved FileObject's PeekLine function to be able to peek forward further via an optional lineOffset argument
This commit is contained in:
Areloch 2021-07-28 09:26:13 -05:00
parent 438e6cbb3c
commit abf5a09bc3
12 changed files with 298 additions and 194 deletions

View file

@ -132,7 +132,7 @@ void AssetImportConfig::initPersistFields()
Parent::initPersistFields();
addGroup("General");
addField("DuplicatAutoResolution", TypeRealString, Offset(DuplicatAutoResolution, AssetImportConfig), "Duplicate Asset Auto-Resolution Action. Options are None, AutoPrune, AutoRename");
addField("DuplicatAutoResolution", TypeRealString, Offset(DuplicatAutoResolution, AssetImportConfig), "Duplicate Asset Auto-Resolution Action. Options are None, AutoPrune, AutoRename, FolderPrefix");
addField("WarningsAsErrors", TypeBool, Offset(WarningsAsErrors, AssetImportConfig), "Indicates if warnings should be treated as errors");
addField("PreventImportWithErrors", TypeBool, Offset(PreventImportWithErrors, AssetImportConfig), "Indicates if importing should be prevented from completing if any errors are detected at all");
addField("AutomaticallyPromptMissingFiles", TypeBool, Offset(AutomaticallyPromptMissingFiles, AssetImportConfig), "Should the importer automatically prompt to find missing files if they are not detected automatically by the importer");
@ -2379,6 +2379,27 @@ void AssetImporter::resolveAssetItemIssues(AssetImportObject* assetItem)
{
}
else if (activeImportConfig->DuplicatAutoResolution == String("FolderPrefix"))
{
//Set trailing number
String renamedAssetName = assetItem->assetName;
String owningFolder = assetItem->filePath.getDirectory(assetItem->filePath.getDirectoryCount() - 1);
renamedAssetName = owningFolder + "_" + renamedAssetName;
//Log it's renaming
dSprintf(importLogBuffer, sizeof(importLogBuffer), "Asset %s was renamed due to %s as part of the Import Configuration", assetItem->assetName.c_str(), humanReadableReason.c_str());
activityLog.push_back(importLogBuffer);
dSprintf(importLogBuffer, sizeof(importLogBuffer), "Asset %s was renamed to %s", assetItem->assetName.c_str(), renamedAssetName.c_str());
activityLog.push_back(importLogBuffer);
assetItem->assetName = renamedAssetName;
//Whatever status we had prior is no longer relevent, so reset the status
resetAssetValidationStatus(assetItem);
importIssues = false;
}
}
else if (assetItem->statusType == String("MissingFile"))
{

View file

@ -177,7 +177,7 @@ const U8 *FileObject::readLine()
return mFileBuffer + tokPos;
}
void FileObject::peekLine( U8* line, S32 length )
void FileObject::peekLine( S32 peekLineOffset, U8* line, S32 length )
{
if(!mFileBuffer)
{
@ -189,6 +189,31 @@ void FileObject::peekLine( U8* line, S32 length )
// we can't modify the file buffer.
S32 i = 0;
U32 tokPos = mCurPos;
S32 lineOffset = 0;
//Lets push our tokPos up until we've offset the requested number of lines
while (lineOffset < peekLineOffset && tokPos <= mBufferSize)
{
if (mFileBuffer[tokPos] == '\r')
{
tokPos++;
if (mFileBuffer[tokPos] == '\n')
tokPos++;
lineOffset++;
continue;
}
if (mFileBuffer[tokPos] == '\n')
{
tokPos++;
lineOffset++;
continue;
}
tokPos++;
}
//now peek that line, then return the results
while( ( tokPos != mBufferSize ) && ( mFileBuffer[tokPos] != '\r' ) && ( mFileBuffer[tokPos] != '\n' ) && ( i < ( length - 1 ) ) )
line[i++] = mFileBuffer[tokPos++];
@ -317,7 +342,7 @@ DefineEngineMethod( FileObject, readLine, const char*, (),,
return (const char *) object->readLine();
}
DefineEngineMethod( FileObject, peekLine, const char*, (),,
DefineEngineMethod( FileObject, peekLine, const char*, (S32 peekOffset), (0),
"@brief Read a line from the file without moving the stream position.\n\n"
"Emphasis on *line*, as in you cannot parse individual characters or chunks of data. "
@ -345,7 +370,7 @@ DefineEngineMethod( FileObject, peekLine, const char*, (),,
{
static const U32 bufSize = 512;
char *line = Con::getReturnBuffer( bufSize );
object->peekLine( (U8*)line, bufSize );
object->peekLine(peekOffset, (U8*)line, bufSize );
return line;
}

View file

@ -46,7 +46,7 @@ public:
bool readMemory(const char *fileName);
const U8 *buffer() { return mFileBuffer; }
const U8 *readLine();
void peekLine(U8 *line, S32 length);
void peekLine(S32 peekLineOffset, U8 *line, S32 length);
bool isEOF();
void writeLine(const U8 *line);
void close();

View file

@ -151,6 +151,8 @@ GuiTextEditCtrl::GuiTextEditCtrl()
mPasswordMask = StringTable->insert( "*" );
#endif
Sim::findObject( "InputDeniedSound", mDeniedSound );
mValidateCommand = "";
}
GuiTextEditCtrl::~GuiTextEditCtrl()