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()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

View file

@ -424,7 +424,7 @@ new GuiControlProfile( ToolsGuiCheckBoxProfile )
fontColorNA = EditorSettings.value("Theme/fieldTextSELColor");
fixedExtent = true;
justify = "left";
bitmapAsset = "./images/checkbox";
bitmapAsset = "ToolsModule:checkbox_image";
hasBitmapArray = true;
category = "Tools";
};

View file

@ -135,6 +135,29 @@
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiBitmapButtonCtrl() {
canSaveDynamicFields = "0";
internalName = AssetBrowserBtn;
Enabled = "1";
isContainer = "0";
Profile = "ToolsGuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "98 3";
Extent = "29 27";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
Command = "AssetBrowser.ShowDialog();";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Asset Browser";
hovertime = "750";
bitmap = "tools/gui/images/stencilIcons/menuGrid";
bitmapMode = "Stretched";
buttonType = "PushButton";
groupNum = "0";
useMouseEvents = "0";
};
new GuiBitmapCtrl() {
bitmapAsset = "ToolsModule:separator_h_image";
wrap = "0";
@ -142,7 +165,7 @@
profile = "ToolsGuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "98 3";
position = "130 3";
extent = "2 26";
minExtent = "1 1";
canSave = "1";
@ -157,7 +180,7 @@
profile = "ToolsGuiDefaultProfile";
horizSizing = "width";
vertSizing = "bottom";
position = "99 0";
position = "131 0";
extent = "723 32";
minExtent = "8 2";
canSave = "1";

View file

@ -185,7 +185,6 @@ function T3Dpre4ProjectImporter::beginMaterialFilesImport(%this)
//First, wipe out any files inside the folder first
%file = findFirstFileMultiExpr( $ProjectImporter::modulePath @ "/*/materials.*", true);
%fileObj = new FileObject();
%objectClassStack = new ArrayObject();
%fileOutputLines = new ArrayObject();
@ -206,27 +205,25 @@ function T3Dpre4ProjectImporter::beginMaterialFilesImport(%this)
%currentPage-->processingText.setText("Processing material script file: " @ %file);
Canvas.repaint();
if ( %fileObj.openForRead( %file ) )
if(%file $= "data/FPSGameplay/art/terrains/materials.tscript")
{
%agafdgadfgsdfg = true;
}
if ( $ProjectImporter::fileObject.openForRead( %file ) )
{
echo("Legacy Project Importer - Beginning process of file: " @ %file);
%lineNum = 0;
while ( !%fileObj.isEOF() )
while ( !$ProjectImporter::fileObject.isEOF() )
{
%line = %fileObj.readLine();
%line = $ProjectImporter::fileObject.readLine();
%trimmedLine = trim(%line);
if(strIsMatchExpr("*new*(*)*", %line))
{
//we have a new object, add it to the stack
//substr to peel the class name
%start = strpos(%line, "new ");
%end = strpos(%line, "(", %start);
%className = findObjectClass(%line, "new");
if(%start != -1 && %end != -1)
{
%className = getSubStr(%line, %start + 4, %end-%start-4);
if(%className !$= "Material" && %className !$= "CustomMaterial")
if(%className !$= "Material" && %className !$= "CustomMaterial" && %className !$= "TerrainMaterial")
{
%lineNum++;
%fileOutputLines.push_back(%line);
@ -234,28 +231,30 @@ function T3Dpre4ProjectImporter::beginMaterialFilesImport(%this)
}
%objectClassStack.push_back(%className);
}
%nameEnd = strpos(%line, ")", %end);
%objectName = findObjectName(%line, "new");
%objectName = getSubStr(%line, %end+1, %nameEnd-%end-1);
if(%objectName !$= "")
if(%objectName $= "" && %className $= "TerrainMaterial")
{
%intName = findObjectField("internalName");
%objectName = %intName @ "_terrainMat";
%line = strReplace(%line, "()", "(" @ %intName @ ")");
%fileWasChanged = true;
}
else if(%objectName $= "" && %className $= "Material")
{
if(strpos(%objectName, ":") != -1)
{
%objectName = getSubStr(%objectName, 0, strpos(%objectName, ":"));
}
%mapToName = findObjectField("mapTo");
%objectName = %mapToName @ "_mat";
%line = strReplace(%line, "()", "(" @ %mapToName @ ")");
if(strpos(%objectName, ",") != -1)
{
%objectName = getSubStr(%objectName, 0, strpos(%objectName, ","));
}
%objectName = trim(%objectName);
%fileWasChanged = true;
}
if(%objectClassStack.count() == 1)
{
%currentObjClass = %objectClassStack.getKey(%objectClassStack.count()-1);
//we only process top-level objects directly
%inheritanceList = getClassHierarchy(%currentObjClass);
for (%classDepth =0; %classDepth<getWordCount(%inheritanceList); %classDepth++)
@ -269,19 +268,11 @@ function T3Dpre4ProjectImporter::beginMaterialFilesImport(%this)
}
}
}
}
else if(strIsMatchExpr("*singleton*(*)*", %line))
{
//we have a new object, add it to the stack
//substr to peel the class name
%start = strpos(%line, "singleton ");
%end = strpos(%line, "(", %start);
%className = findObjectClass(%line, "singleton");
if(%start != -1 && %end != -1)
{
%className = getSubStr(%line, %start + 10, %end-%start-10);
if(%className !$= "Material" && %className !$= "CustomMaterial")
if(%className !$= "Material" && %className !$= "CustomMaterial" && %className !$= "TerrainMaterial")
{
%lineNum++;
%fileOutputLines.push_back(%line);
@ -289,28 +280,13 @@ function T3Dpre4ProjectImporter::beginMaterialFilesImport(%this)
}
%objectClassStack.push_back(%className);
}
%nameEnd = strpos(%line, ")", %end);
%objectName = getSubStr(%line, %end+1, %nameEnd-%end-1);
if(%objectName !$= "")
{
if(strpos(%objectName, ":") != -1)
{
%objectName = getSubStr(%objectName, 0, strpos(%objectName, ":"));
}
if(strpos(%objectName, ",") != -1)
{
%objectName = getSubStr(%objectName, 0, strpos(%objectName, ","));
}
%objectName = trim(%objectName);
%objectName = findObjectName(%line, "singleton");
if(%objectClassStack.count() == 1)
{
%currentObjClass = %objectClassStack.getKey(%objectClassStack.count()-1);
//we only process top-level objects directly
%inheritanceList = getClassHierarchy(%currentObjClass);
for (%classDepth =0; %classDepth<getWordCount(%inheritanceList); %classDepth++)
@ -324,7 +300,6 @@ function T3Dpre4ProjectImporter::beginMaterialFilesImport(%this)
}
}
}
}
else if(strIsMatchExpr("*};*", %line))
{
//hit the end of an object, pop our object stack
@ -359,7 +334,7 @@ function T3Dpre4ProjectImporter::beginMaterialFilesImport(%this)
%fileOutputLines.push_back(%line);
}
%fileObj.close();
$ProjectImporter::fileObject.close();
}
else
{
@ -368,16 +343,16 @@ function T3Dpre4ProjectImporter::beginMaterialFilesImport(%this)
if(%fileWasChanged)
{
%fileObj.openForWrite(%file);
$ProjectImporter::fileObject.openForWrite(%file);
for(%l = 0; %l < %fileOutputLines.count(); %l++)
{
%outLine = %fileOutputLines.getKey(%l);
%fileObj.writeline(%outLine);
$ProjectImporter::fileObject.writeline(%outLine);
}
%fileObj.close();
$ProjectImporter::fileObject.close();
}
%fileOutputLines.empty();
@ -390,7 +365,6 @@ function T3Dpre4ProjectImporter::beginMaterialFilesImport(%this)
%fileOutputLines.delete();
%objectClassStack.delete();
%fileObj.delete();
//now exec the materials
loadModuleMaterials("Game");
@ -403,7 +377,6 @@ function T3Dpre4ProjectImporter::beginCodeFilesImport(%this)
//First, wipe out any files inside the folder first
%file = findFirstFileMultiExpr( $ProjectImporter::modulePath @ "/*.*", true);
%fileObj = new FileObject();
%objectClassStack = new ArrayObject();
%fileOutputLines = new ArrayObject();
@ -441,49 +414,26 @@ function T3Dpre4ProjectImporter::beginCodeFilesImport(%this)
%currentPage-->processingText.setText("Processing file: " @ %file);
Canvas.repaint();
if ( %fileObj.openForRead( %file ) )
if ( $ProjectImporter::fileObject.openForRead( %file ) )
{
echo("Legacy Project Importer - Beginning process of file: " @ %file);
%lineNum = 0;
while ( !%fileObj.isEOF() )
while ( !$ProjectImporter::fileObject.isEOF() )
{
%line = %fileObj.readLine();
%line = $ProjectImporter::fileObject.readLine();
%trimmedLine = trim(%line);
if(strIsMatchExpr("*new*(*)*", %line))
{
//we have a new object, add it to the stack
//substr to peel the class name
%start = strpos(%line, "new ");
%end = strpos(%line, "(", %start);
if(%start != -1 && %end != -1)
{
%className = getSubStr(%line, %start + 4, %end-%start-4);
%objectClassStack.push_back(%className);
}
%nameEnd = strpos(%line, ")", %end);
%objectName = getSubStr(%line, %end+1, %nameEnd-%end-1);
%className = findObjectClass(%line, "new");
%objectName = findObjectName(%line, "new");
if(%objectName !$= "")
{
if(strpos(%objectName, ":") != -1)
{
%objectName = getSubStr(%objectName, 0, strpos(%objectName, ":"));
}
if(strpos(%objectName, ",") != -1)
{
%objectName = getSubStr(%objectName, 0, strpos(%objectName, ","));
}
%objectName = trim(%objectName);
if(%objectClassStack.count() == 1)
{
%currentObjClass = %objectClassStack.getKey(%objectClassStack.count()-1);
//we only process top-level objects directly
%inheritanceList = getClassHierarchy(%currentObjClass);
for (%classDepth =0; %classDepth<getWordCount(%inheritanceList); %classDepth++)
@ -531,38 +481,15 @@ function T3Dpre4ProjectImporter::beginCodeFilesImport(%this)
}
else if(strIsMatchExpr("*singleton*(*)*", %line))
{
//we have a new object, add it to the stack
//substr to peel the class name
%start = strpos(%line, "singleton ");
%end = strpos(%line, "(", %start);
if(%start != -1 && %end != -1)
{
%className = getSubStr(%line, %start + 10, %end-%start-10);
%objectClassStack.push_back(%className);
}
%nameEnd = strpos(%line, ")", %end);
%objectName = getSubStr(%line, %end+1, %nameEnd-%end-1);
%className = findObjectClass(%line, "singleton");
%objectName = findObjectName(%line, "singleton");
if(%objectName !$= "")
{
if(strpos(%objectName, ":") != -1)
{
%objectName = getSubStr(%objectName, 0, strpos(%objectName, ":"));
}
if(strpos(%objectName, ",") != -1)
{
%objectName = getSubStr(%objectName, 0, strpos(%objectName, ","));
}
%objectName = trim(%objectName);
if(%objectClassStack.count() == 1)
{
%currentObjClass = %objectClassStack.getKey(%objectClassStack.count()-1);
//we only process top-level objects directly
%inheritanceList = getClassHierarchy(%currentObjClass);
for (%classDepth =0; %classDepth<getWordCount(%inheritanceList); %classDepth++)
@ -579,38 +506,15 @@ function T3Dpre4ProjectImporter::beginCodeFilesImport(%this)
}
else if(strIsMatchExpr("*datablock*(*)*", %line))
{
//we have a new object, add it to the stack
//substr to peel the class name
%start = strpos(%line, "datablock ");
%end = strpos(%line, "(", %start);
if(%start != -1 && %end != -1)
{
%className = getSubStr(%line, %start + 10, %end-%start-10);
%objectClassStack.push_back(%className);
}
%nameEnd = strpos(%line, ")", %end);
%objectName = getSubStr(%line, %end+1, %nameEnd-%end-1);
%className = findObjectClass(%line, "datablock");
%objectName = findObjectName(%line, "datablock");
if(%objectName !$= "")
{
if(strpos(%objectName, ":") != -1)
{
%objectName = getSubStr(%objectName, 0, strpos(%objectName, ":"));
}
if(strpos(%objectName, ",") != -1)
{
%objectName = getSubStr(%objectName, 0, strpos(%objectName, ","));
}
%objectName = trim(%objectName);
if(%objectClassStack.count() == 1)
{
%currentObjClass = %objectClassStack.getKey(%objectClassStack.count()-1);
//we only process top-level objects directly
%inheritanceList = getClassHierarchy(%currentObjClass);
for (%classDepth =0; %classDepth<getWordCount(%inheritanceList); %classDepth++)
@ -636,6 +540,18 @@ function T3Dpre4ProjectImporter::beginCodeFilesImport(%this)
%scriptExtRemovedLine = strReplace(%scriptExtRemovedLine, ".tscript", "");
%line = %scriptExtRemovedLine;
}
else if(strIsMatchExpr("*queueexec(*.cs*)*", %line) || strIsMatchExpr("*queueexec(*.tscript*)*", %line))
{
%scriptExtRemovedLine = strReplace(%line, ".cs", "");
%scriptExtRemovedLine = strReplace(%scriptExtRemovedLine, ".tscript", "");
%line = %scriptExtRemovedLine;
}
else if(strIsMatchExpr("*registerDatablock(*.cs*)*", %line) || strIsMatchExpr("*registerDatablock(*.tscript*)*", %line))
{
%scriptExtRemovedLine = strReplace(%line, ".cs", "");
%scriptExtRemovedLine = strReplace(%scriptExtRemovedLine, ".tscript", "");
%line = %scriptExtRemovedLine;
}
else
{
if(%objectClassStack.count() != 0)
@ -665,7 +581,7 @@ function T3Dpre4ProjectImporter::beginCodeFilesImport(%this)
%fileOutputLines.push_back(%line);
}
%fileObj.close();
$ProjectImporter::fileObject.close();
}
else
{
@ -674,16 +590,16 @@ function T3Dpre4ProjectImporter::beginCodeFilesImport(%this)
if(%fileWasChanged)
{
%fileObj.openForWrite(%file);
$ProjectImporter::fileObject.openForWrite(%file);
for(%l = 0; %l < %fileOutputLines.count(); %l++)
{
%outLine = %fileOutputLines.getKey(%l);
%fileObj.writeline(%outLine);
$ProjectImporter::fileObject.writeline(%outLine);
}
%fileObj.close();
$ProjectImporter::fileObject.close();
}
%fileOutputLines.empty();
@ -703,7 +619,6 @@ function T3Dpre4ProjectImporter::beginCodeFilesImport(%this)
%fileOutputLines.delete();
%objectClassStack.delete();
%fileObj.delete();
}
function T3Dpre4ProjectImporter::processScriptExtensions(%this)
@ -789,6 +704,7 @@ function T3Dpre4ProjectImporter::genProcessor(%classType, %conversionMap)
eval(%stryng);
}
T3Dpre4ProjectImporter::genProcessor("TSShapeConstructor", "baseShape baseShapeAsset shapeName shapeAsset");
T3Dpre4ProjectImporter::genProcessor("BasicClouds", "texture textureAsset");
T3Dpre4ProjectImporter::genProcessor("CloudLayer", "texture textureAsset");
T3Dpre4ProjectImporter::genProcessor("DecalRoad", "material materialAsset");
@ -805,9 +721,7 @@ T3Dpre4ProjectImporter::genProcessor("GroundCover", "material materialAsset shap
T3Dpre4ProjectImporter::genProcessor("GroundPlane", "material materialAsset");
T3Dpre4ProjectImporter::genProcessor("LevelInfo", "accuTexture accuTextureAsset");
T3Dpre4ProjectImporter::genProcessor("TSStatic", "shape shapeAsset shapeName shapeAsset");
T3Dpre4ProjectImporter::genProcessor("ForestItemData", "shape shapeAsset shapeName shapeAsset");
//T3Dpre4ProjectImporter::genProcessor("TerrainBlock", "terrainFile terrainFileAsset");
T3Dpre4ProjectImporter::genProcessor("TSForestItemData", "shape shapeAsset shapeName shapeAsset");
//==============================================================================
// Levels
//==============================================================================
@ -964,7 +878,7 @@ function T3Dpre4ProjectImporter::processTerrainMaterialObject(%this, %file, %obj
{
%matAsset = TerrainMaterialAsset::getAssetIdByMaterialName(%objectName);
if(%matAsset $= "")
if(%matAsset $= "" || %matAsset $= "Core_Rendering:noMaterial")
{
%assetName = %objectName;
@ -985,7 +899,7 @@ function T3Dpre4ProjectImporter::processTerrainMaterialObject(%this, %file, %obj
AssetName = %assetName;
versionId = 1;
shaderData = "";
materialDefinitionName = %assetName;
materialDefinitionName = %objectName;
scriptFile = fileName(%file);
};

View file

@ -7,6 +7,9 @@ function ProjectImporter::beginProjectImport()
function ProjectImportWindow::onWake(%this)
{
if(!isObject($ProjectImporter::fileObject))
$ProjectImporter::fileObject = new FileObject();
%this.importStepNumber = 0;
%this-->stepsList.clear();
%this-->stepsList.addRow(0, "Welcome");
@ -465,11 +468,14 @@ function processLegacyField(%line, %originalFieldName, %newFieldName)
if(%assetId !$= "" && AssetDatabase.isDeclaredAsset(%assetId))
{
//if (%assetId.getStatusString() $= "Ok")
%outLine = strReplace(%outLine, %value, %assetId);
//else
// error("Asset assignment failure:", %assetId, getStatusString());
}
}
if((%outLine !$= %line)&&(%assetId.getStatusString() !$= "BadFileReference")&&(%assetId.getStatusString() !$= "Failed"))
if(%outLine !$= %line)
{
echo("Legacy Project Importer - processing of legacy line: " @ %line @ " has been updated to: " @ %outLine);
return %outLine;
@ -480,6 +486,98 @@ function processLegacyField(%line, %originalFieldName, %newFieldName)
}
}
function findObjectClass(%line, %createWord)
{
//we have a new object, add it to the stack
//substr to peel the class name
%start = strpos(%line, %createWord @ " ");
%end = strpos(%line, "(", %start);
%createLen = strlen(%createWord @ " ");
if(%start != -1 && %end != -1)
{
%className = getSubStr(%line, %start + %createLen, %end-%start-%createLen);
%className = trim(%className);
return %className;
}
return "";
}
function findObjectName(%line, %createWord)
{
//we have a new object, add it to the stack
//substr to peel the class name
%start = strpos(%line, %createWord @ " ");
%end = strpos(%line, "(", %start);
%nameEnd = strpos(%line, ")", %end);
%objectName = getSubStr(%line, %end+1, %nameEnd-%end-1);
if(%objectName !$= "")
{
if(strpos(%objectName, ":") != -1)
{
%objectName = getSubStr(%objectName, 0, strpos(%objectName, ":"));
}
if(strpos(%objectName, ",") != -1)
{
%objectName = getSubStr(%objectName, 0, strpos(%objectName, ","));
}
%objectName = trim(%objectName);
}
return %objectName;
}
function findObjectField(%fieldName)
{
%value = "";
%peekLineOffset = 0;
%peekLine = $ProjectImporter::fileObject.peekLine(%peekLineOffset);
while(!strIsMatchExpr("*};*", %peekLine) &&
!strIsMatchExpr("*singleton*(*)*", %peekLine) &&
!strIsMatchExpr("*new*(*)*", %peekLine) &&
!strIsMatchExpr("*datablock*(*)*", %peekLine)&&
!strIsMatchExpr("\n", %peekLine) &&
!strIsMatchExpr("\r", %peekLine))
{
if(strpos(%peekLine, %fieldName) != -1)
{
%value = "";
%pos = strpos(%peekLine, "= \"");
if(%pos != -1)
{
%endPos = strpos(%peekLine, "\";", %pos);
%value = getSubStr(%peekLine, %pos+3, %endPos-%pos-3);
break;
}
else
{
%pos = strpos(%peekLine, "=\"");
if(%pos != -1)
{
%endPos = strpos(%peekLine, "\";", %pos);
%value = getSubStr(%peekLine, %pos+2, %endPos-%pos-2);
break;
}
}
}
%peekLineOffset++;
%peekLine = $ProjectImporter::fileObject.peekLine(%peekLineOffset);
}
return %value;
}
//==============================================================================
//Shape Importing
//==============================================================================
@ -516,6 +614,7 @@ function beginShapeImport()
if(isShapeFormat(%fileExt))
{
$ProjectImporter::assetQuery.clear();
%assetsFound = AssetDatabase.findAssetLooseFile($ProjectImporter::assetQuery, %file);
if(%assetsFound == 0)
{
@ -566,6 +665,7 @@ function beginImageImport()
if(isImageFormat(%fileExt))
{
$ProjectImporter::assetQuery.clear();
%assetsFound = AssetDatabase.findAssetLooseFile($ProjectImporter::assetQuery, %file);
if(%assetsFound == 0)
{
@ -614,6 +714,7 @@ function beginTerrainImport()
%filePath = filePath(%file);
if(%fileExt $= ".ter")
{
$ProjectImporter::assetQuery.clear();
%assetsFound = AssetDatabase.findAssetLooseFile($ProjectImporter::assetQuery, %file);
if(%assetsFound == 0)
{
@ -685,18 +786,18 @@ function beginGUIImport()
%filePath = filePath(%file);
if(%fileExt $= ".gui")
{
$ProjectImporter::assetQuery.clear();
%assetsFound = AssetDatabase.findAssetLooseFile($ProjectImporter::assetQuery, %file);
if(%assetsFound == 0)
{
ProjectImportWizardPage5-->processingText.setText("Processing GUI Asset file: " @ %file);
Canvas.repaint();
%fileObj = new FileObject();
if ( %fileObj.openForRead( %file ) )
if ( $ProjectImporter::fileObject.openForRead( %file ) )
{
while ( !%fileObj.isEOF() )
while ( !$ProjectImporter::fileObject.isEOF() )
{
%line = %fileObj.readLine();
%line = $ProjectImporter::fileObject.readLine();
if(strIsMatchExpr("*new*(*)*", %line))
{
@ -726,8 +827,7 @@ function beginGUIImport()
}
}
%fileObj.close();
%fileObj.delete();
$ProjectImporter::fileObject.close();
}
}
@ -835,6 +935,9 @@ function beginLevelImport()
if(%fileExt $= ".mis")
{
%newAsset = false;
$ProjectImporter::assetQuery.clear();
%assetsFound = AssetDatabase.findAssetLooseFile($ProjectImporter::assetQuery, %file);
if(%assetsFound == 0)
{
@ -866,6 +969,16 @@ function beginLevelImport()
levelName = %assetName;
};
%newAsset = true;
}
else
{
%assetId = $ProjectImporter::assetQuery.getAsset(0);
%asset = AssetDatabase.acquireAsset(%assetId);
%tamlpath = AssetDatabase.getAssetFilePath(%assetId);
}
//Time to process the associated files
if(isFile(%filePath @ "/" @ %fileBase @ ".decal"))
{
%asset.decalsFile = %fileBase @ ".decal";
@ -884,32 +997,38 @@ function beginLevelImport()
}
if(isFile(%filePath @ "/" @ %fileBase @ ".png"))
{
%previewImageAsset = ImageAsset::getAssetIdByFilename(%filePath @ "/" @ %fileBase @ ".png");
%asset.addAssetDependencyField(previewImageAsset, %previewImageAsset);
}
else if(isFile(%filePath @ "/" @ %fileBase @ "_preview.png"))
%previewImageAsset = ImageAsset::getAssetIdByFilename(%filePath @ "/" @ %fileBase @ "_preview.png");
else if(isFile(%filePath @ "/" @ %fileBase @ ".dds"))
{
%previewImageAsset = ImageAsset::getAssetIdByFilename(%filePath @ "/" @ %fileBase @ ".dds");
%asset.addAssetDependencyField(previewImageAsset, %previewImageAsset);
}
else if(isFile(%filePath @ "/" @ %fileBase @ "_preview.dds"))
%previewImageAsset = ImageAsset::getAssetIdByFilename(%filePath @ "/" @ %fileBase @ "_preview.dds");
else if(isFile(%filePath @ "/" @ %fileBase @ ".jpg"))
{
%previewImageAsset = ImageAsset::getAssetIdByFilename(%filePath @ "/" @ %fileBase @ ".jpg");
%asset.addAssetDependencyField(previewImageAsset, %previewImageAsset);
}
else if(isFile(%filePath @ "/" @ %fileBase @ "_preview.jpg"))
%previewImageAsset = ImageAsset::getAssetIdByFilename(%filePath @ "/" @ %fileBase @ "_preview.jpg");
else if(isFile(%filePath @ "/" @ %fileBase @ ".jpeg"))
{
%previewImageAsset = ImageAsset::getAssetIdByFilename(%filePath @ "/" @ %fileBase @ ".jpeg");
else if(isFile(%filePath @ "/" @ %fileBase @ "_preview.jpeg"))
%previewImageAsset = ImageAsset::getAssetIdByFilename(%filePath @ "/" @ %fileBase @ "_preview.jpeg");
if(%previewImageAsset !$= "")
{
%asset.addAssetDependencyField(previewImageAsset, %previewImageAsset);
}
TamlWrite(%asset, %tamlpath);
if(%newAsset)
{
%moduleDef = ModuleDatabase.findModule(%moduleName, 1);
%success = AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
}
else
{
%asset.refreshAsset();
}
}
%file = findNextFileMultiExpr( %currentAddress @ "/*.*" );

View file

@ -164,7 +164,7 @@
canSaveDynamicFields = "0";
new GuiBitmapCtrl() {
bitmap = "core/gui/images/separator-v";
bitmap = "ToolsModule:separator_v_image";
color = "White";
wrap = "0";
position = "1 0";

View file

@ -409,10 +409,10 @@ function TerrainMaterialDlg::setActiveMaterial( %this, %mat )
//
%imgPath = %mat.getDiffuseMap();
%this-->baseTexCtrl.setBitmap( %mat.diffuseMap );
if(%imgPath $= "")
%imgPath = $TerrainMaterialEditor::emptyMaterialImage;
%this-->texBaseMap.setBitmapAsset( %imgPath );
%this-->texBaseMap.setBitmap( %imgPath );
if(%imgPath !$= $TerrainMaterialEditor::emptyMaterialImage)
{
@ -423,7 +423,7 @@ function TerrainMaterialDlg::setActiveMaterial( %this, %mat )
}
else
{
%this-->normalMapAssetId.setText( "None" );
%this-->diffuseMapAssetId.setText( "None" );
}
//
@ -431,7 +431,7 @@ function TerrainMaterialDlg::setActiveMaterial( %this, %mat )
if(%imgPath $= "")
%imgPath = $TerrainMaterialEditor::emptyMaterialImage;
%this-->texNormalMap.setBitmapAsset( %imgPath );
%this-->texNormalMap.setBitmap( %imgPath );
if(%imgPath !$= $TerrainMaterialEditor::emptyMaterialImage)
{
@ -450,7 +450,7 @@ function TerrainMaterialDlg::setActiveMaterial( %this, %mat )
if(%imgPath $= "")
%imgPath = $TerrainMaterialEditor::emptyMaterialImage;
%this-->texORMConfigMap.setBitmapAsset( %imgPath );
%this-->texORMConfigMap.setBitmap( %imgPath );
if(%imgPath !$= $TerrainMaterialEditor::emptyMaterialImage)
{
@ -461,7 +461,7 @@ function TerrainMaterialDlg::setActiveMaterial( %this, %mat )
}
else
{
%this-->normalMapAssetId.setText( "None" );
%this-->ORMMapAssetId.setText( "None" );
}
//
@ -469,7 +469,7 @@ function TerrainMaterialDlg::setActiveMaterial( %this, %mat )
if(%imgPath $= "")
%imgPath = $TerrainMaterialEditor::emptyMaterialImage;
%this-->texDetailMap.setBitmapAsset( %imgPath );
%this-->texDetailMap.setBitmap( %imgPath );
if(%imgPath !$= $TerrainMaterialEditor::emptyMaterialImage)
{
@ -480,7 +480,7 @@ function TerrainMaterialDlg::setActiveMaterial( %this, %mat )
}
else
{
%this-->normalMapAssetId.setText( "None" );
%this-->detailMapAssetId.setText( "None" );
}
//
@ -488,7 +488,7 @@ function TerrainMaterialDlg::setActiveMaterial( %this, %mat )
if(%imgPath $= "")
%imgPath = $TerrainMaterialEditor::emptyMaterialImage;
%this-->texMacroMap.setBitmapAsset( %imgPath );
%this-->texMacroMap.setBitmap( %imgPath );
if(%imgPath !$= $TerrainMaterialEditor::emptyMaterialImage)
{
@ -499,7 +499,7 @@ function TerrainMaterialDlg::setActiveMaterial( %this, %mat )
}
else
{
%this-->normalMapAssetId.setText( "None" );
%this-->macroMapAssetId.setText( "None" );
}
%this-->detSizeCtrl.setText( %mat.detailSize );