mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 16:25:42 +00:00
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:
parent
438e6cbb3c
commit
abf5a09bc3
12 changed files with 298 additions and 194 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 3.9 KiB |
|
|
@ -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";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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 @ "/*.*" );
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue