Browse Source

Updates asset importer and project importer to output to separate log files into tools/logs
Add utility console function for getting current datetime

JeffR 4 years ago
parent
commit
fda722e355

+ 41 - 3
Engine/source/T3D/assets/assetImporter.cpp

@@ -18,6 +18,7 @@
 #include "materials/materialManager.h"
 #include "materials/materialManager.h"
 
 
 #include "console/persistenceManager.h"
 #include "console/persistenceManager.h"
+#include "core/util/timeClass.h"
 
 
 ConsoleDocClass(AssetImportConfig,
 ConsoleDocClass(AssetImportConfig,
    "@brief Defines properties for an AssetImprotConfig object.\n"
    "@brief Defines properties for an AssetImprotConfig object.\n"
@@ -506,7 +507,8 @@ AssetImporter::AssetImporter() :
    isReimport(false),
    isReimport(false),
    assetHeirarchyChanged(false),
    assetHeirarchyChanged(false),
    importLogBuffer(""),
    importLogBuffer(""),
-   activeImportConfig(nullptr)
+   activeImportConfig(nullptr),
+   mDumpLogs(true)
 {
 {
 }
 }
 
 
@@ -534,6 +536,7 @@ void AssetImporter::initPersistFields()
    addField("targetModuleId", TypeRealString, Offset(targetModuleId, AssetImporter), "The Id of the module the assets are to be imported into");
    addField("targetModuleId", TypeRealString, Offset(targetModuleId, AssetImporter), "The Id of the module the assets are to be imported into");
    addField("finalImportedAssetPath", TypeRealString, Offset(finalImportedAssetPath, AssetImporter), "The Id of the module the assets are to be imported into");
    addField("finalImportedAssetPath", TypeRealString, Offset(finalImportedAssetPath, AssetImporter), "The Id of the module the assets are to be imported into");
    addField("targetPath", TypeRealString, Offset(targetPath, AssetImporter), "The path any imported assets are placed in as their destination");
    addField("targetPath", TypeRealString, Offset(targetPath, AssetImporter), "The path any imported assets are placed in as their destination");
+   addField("dumpLogs", TypeBool, Offset(mDumpLogs, AssetImporter), "Indicates if the importer always dumps its logs or not");
 }
 }
 
 
 //
 //
@@ -924,9 +927,41 @@ String AssetImporter::getActivityLogLine(U32 line)
 
 
 void AssetImporter::dumpActivityLog()
 void AssetImporter::dumpActivityLog()
 {
 {
-   for (U32 i = 0; i < activityLog.size(); i++)
+   if (!mDumpLogs)
+      return;
+
+   FileObject logFile;
+
+   //If there's nothing logged, don't bother
+   if (activityLog.size() == 0)
+      return;
+
+   Torque::Time::DateTime curTime;
+   Torque::Time::getCurrentDateTime(curTime);
+
+   String logName = String("tools/logs/AssetImportLog_") + String::ToString(curTime.year + 1900) + "-" +
+      String::ToString(curTime.month + 1) + "-" + String::ToString(curTime.day) + "_" +
+      String::ToString(curTime.hour) + "-" + String::ToString(curTime.minute) + "-" + String::ToString(curTime.second)
+      + "-" + String::ToString(curTime.microsecond) + ".log";
+
+   if (logFile.openForWrite(logName.c_str()))
    {
    {
-      Con::printf(activityLog[i].c_str());
+      for (U32 i = 0; i < activityLog.size(); i++)
+      {
+         logFile.writeLine((const U8*)activityLog[i].c_str());
+      }
+
+      logFile.close();
+
+      Con::warnf("Asset Import log file dumped to: %s", logName.c_str());
+   }
+   else
+   {
+      Con::errorf("Error: Failed to open log file for writing! Dumping log results to console!");
+      for (U32 i = 0; i < activityLog.size(); i++)
+      {
+         Con::printf(activityLog[i].c_str());
+      }
    }
    }
 }
 }
 
 
@@ -2383,6 +2418,7 @@ void AssetImporter::importAssets(AssetImportObject* assetItem)
    {
    {
       dSprintf(importLogBuffer, sizeof(importLogBuffer), "AssetImporter::importAssets - Unable to find moduleId %s", targetModuleId.c_str());
       dSprintf(importLogBuffer, sizeof(importLogBuffer), "AssetImporter::importAssets - Unable to find moduleId %s", targetModuleId.c_str());
       activityLog.push_back(importLogBuffer);
       activityLog.push_back(importLogBuffer);
+      dumpActivityLog();
       return;
       return;
    }
    }
 
 
@@ -2483,6 +2519,8 @@ void AssetImporter::importAssets(AssetImportObject* assetItem)
       //recurse if needed
       //recurse if needed
       importAssets(item);
       importAssets(item);
    }
    }
+
+   dumpActivityLog();
 }
 }
 
 
 //
 //

+ 2 - 0
Engine/source/T3D/assets/assetImporter.h

@@ -647,6 +647,8 @@ class AssetImporter : public SimObject
    /// </summary>
    /// </summary>
    String finalImportedAssetPath;
    String finalImportedAssetPath;
 
 
+   bool mDumpLogs;
+
 public:
 public:
    AssetImporter();
    AssetImporter();
    virtual ~AssetImporter();
    virtual ~AssetImporter();

+ 1 - 1
Engine/source/T3D/assets/assetImporter_ScriptBinding.h

@@ -44,7 +44,7 @@ DefineEngineMethod(AssetImporter, getActivityLogLine, String, (S32 i), (0),
    "Creates a new script asset using the targetFilePath.\n"
    "Creates a new script asset using the targetFilePath.\n"
    "@return The bool result of calling exec")
    "@return The bool result of calling exec")
 {
 {
-   return object->getActivityLogLine(0);
+   return object->getActivityLogLine(i);
 }
 }
 
 
 DefineEngineMethod(AssetImporter, autoImportFile, String, (String path, String typeHint), ("", ""),
 DefineEngineMethod(AssetImporter, autoImportFile, String, (String path, String typeHint), ("", ""),

+ 18 - 0
Engine/source/console/consoleFunctions.cpp

@@ -2841,3 +2841,21 @@ DefineEngineFunction( getStringHash, S32, (const char* _inString, bool _sensitiv
    else
    else
       return S32(String(_inString).getHashCaseInsensitive());
       return S32(String(_inString).getHashCaseInsensitive());
 }
 }
+
+//-----------------------------------------------------------------------------
+
+DefineEngineFunction(getTimestamp, const char*, (), ,
+   "Gets datetime string.\n\n"
+   "@return YYYY-mm-DD_hh-MM-ss formatted date time string.")
+{
+   Torque::Time::DateTime curTime;
+   Torque::Time::getCurrentDateTime(curTime);
+
+   String timestampStr = String::ToString(curTime.year + 1900) + "-" +
+      String::ToString(curTime.month + 1) + "-" + String::ToString(curTime.day) + "_" +
+      String::ToString(curTime.hour) + "-" + String::ToString(curTime.minute) + "-" + String::ToString(curTime.second);
+
+   const char* returnBuffer = Con::getReturnBuffer(timestampStr);
+
+   return returnBuffer;
+}

+ 1 - 0
Templates/BaseGame/game/tools/projectImporter/main.tscript

@@ -41,6 +41,7 @@ function initializeProjectImporter()
    //Input::GetEventManager().subscribe( ProjectImportCtrl, "EndDropFiles" );
    //Input::GetEventManager().subscribe( ProjectImportCtrl, "EndDropFiles" );
    
    
    $ProjectImporter::importer = new AssetImporter();
    $ProjectImporter::importer = new AssetImporter();
+   $ProjectImporter::importer.dumpLogs = false; //we'll handle the log files ourselves
    
    
    %importConfig = new AssetImportConfig();
    %importConfig = new AssetImportConfig();
    %importConfig.loadImportConfig(AssetImportSettings, "LegacyProjectImport");
    %importConfig.loadImportConfig(AssetImportSettings, "LegacyProjectImport");

+ 24 - 24
Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript

@@ -2,7 +2,7 @@ function T3Dpre4ProjectImporter::setupModule(%this)
 {
 {
    %newModuleName = $ProjectImporter::moduleName;
    %newModuleName = $ProjectImporter::moduleName;
       
       
-   echo("Creating a new Module named: " @ %newModuleName);
+   $ProjectImporter::log.add("Creating a new Module named: " @ %newModuleName);
    
    
    %moduleFilePath = "data/" @ %newModuleName;
    %moduleFilePath = "data/" @ %newModuleName;
    %moduleDefinitionFilePath = %moduleFilePath @ "/" @ %newModuleName @ ".module";
    %moduleDefinitionFilePath = %moduleFilePath @ "/" @ %newModuleName @ ".module";
@@ -40,7 +40,7 @@ function T3Dpre4ProjectImporter::setupModule(%this)
          %line = strreplace( %line, "@@", %newModuleName );
          %line = strreplace( %line, "@@", %newModuleName );
          
          
          %file.writeline(%line);
          %file.writeline(%line);
-         echo(%line);
+         //$ProjectImporter::log.add(%line);
       }
       }
       
       
       %file.close();
       %file.close();
@@ -51,7 +51,7 @@ function T3Dpre4ProjectImporter::setupModule(%this)
       %file.close();
       %file.close();
       %templateFile.close();
       %templateFile.close();
       
       
-      warnf("CreateNewModule - Something went wrong and we couldn't write the script file!");
+      $ProjectImporter::log.add("CreateNewModule - Something went wrong and we couldn't write the script file!");
    }
    }
    
    
    //force a refresh of our modules list
    //force a refresh of our modules list
@@ -126,7 +126,7 @@ function T3Dpre4ProjectImporter::copyFiles(%this)
       
       
       if(!pathCopy(%file, %targetFilePath, false))
       if(!pathCopy(%file, %targetFilePath, false))
       {
       {
-         error("Legacy Project Importer, failed to copy file: " @ %file @ " to destination: " @ %targetFilePath);
+         $ProjectImporter::log.add("Legacy Project Importer, failed to copy file: " @ %file @ " to destination: " @ %targetFilePath);
       }
       }
       
       
       %file = findNextFileMultiExpr( $ProjectImporter::sourceContentFolder @ "/*.*" );
       %file = findNextFileMultiExpr( $ProjectImporter::sourceContentFolder @ "/*.*" );
@@ -206,7 +206,7 @@ function T3Dpre4ProjectImporter::beginMaterialFilesImport(%this)
    %objectClassStack = new ArrayObject();
    %objectClassStack = new ArrayObject();
    %fileOutputLines = new ArrayObject();
    %fileOutputLines = new ArrayObject();
    
    
-   echo("Legacy Project Importer - Beginning processing of imported code files");
+   $ProjectImporter::log.add("Legacy Project Importer - Beginning processing of imported code files");
    
    
    //Walk through and process all code files to update references
    //Walk through and process all code files to update references
    while( %file !$= "" )
    while( %file !$= "" )
@@ -225,7 +225,7 @@ function T3Dpre4ProjectImporter::beginMaterialFilesImport(%this)
       
       
       if ( $ProjectImporter::fileObject.openForRead( %file ) ) 
       if ( $ProjectImporter::fileObject.openForRead( %file ) ) 
       {
       {
-         echo("Legacy Project Importer - Beginning process of file: " @ %file);
+         $ProjectImporter::log.add("Legacy Project Importer - Beginning process of file: " @ %file);
          %lineNum = 0;
          %lineNum = 0;
          while ( !$ProjectImporter::fileObject.isEOF() ) 
          while ( !$ProjectImporter::fileObject.isEOF() ) 
          {
          {
@@ -376,7 +376,7 @@ function T3Dpre4ProjectImporter::beginMaterialFilesImport(%this)
       }
       }
       else
       else
       {
       {
-         error("Legacy Project Importer - File not able to be opened: " @ %file);  
+         $ProjectImporter::log.add("Legacy Project Importer - File not able to be opened: " @ %file);  
       }
       }
       
       
       if(%fileWasChanged)
       if(%fileWasChanged)
@@ -399,7 +399,7 @@ function T3Dpre4ProjectImporter::beginMaterialFilesImport(%this)
       %file = findNextFileMultiExpr( $ProjectImporter::modulePath @ "/*/materials.*" );
       %file = findNextFileMultiExpr( $ProjectImporter::modulePath @ "/*/materials.*" );
    }
    }
    
    
-   echo("Legacy Project Importer - Processing of imported code files done!");
+   $ProjectImporter::log.add("Legacy Project Importer - Processing of imported code files done!");
    
    
    %fileOutputLines.delete();
    %fileOutputLines.delete();
    %objectClassStack.delete();
    %objectClassStack.delete();
@@ -418,7 +418,7 @@ function T3Dpre4ProjectImporter::beginCodeFilesImport(%this)
    %objectClassStack = new ArrayObject();
    %objectClassStack = new ArrayObject();
    %fileOutputLines = new ArrayObject();
    %fileOutputLines = new ArrayObject();
    
    
-   echo("Legacy Project Importer - Beginning processing of imported code files");
+   $ProjectImporter::log.add("Legacy Project Importer - Beginning processing of imported code files");
    
    
    //Walk through and process all code files to update references
    //Walk through and process all code files to update references
    while( %file !$= "" )
    while( %file !$= "" )
@@ -454,7 +454,7 @@ function T3Dpre4ProjectImporter::beginCodeFilesImport(%this)
       
       
       if ( $ProjectImporter::fileObject.openForRead( %file ) ) 
       if ( $ProjectImporter::fileObject.openForRead( %file ) ) 
       {
       {
-         echo("Legacy Project Importer - Beginning process of file: " @ %file);
+         $ProjectImporter::log.add("Legacy Project Importer - Beginning process of file: " @ %file);
          %lineNum = 0;
          %lineNum = 0;
          while ( !$ProjectImporter::fileObject.isEOF() ) 
          while ( !$ProjectImporter::fileObject.isEOF() ) 
          {
          {
@@ -702,7 +702,7 @@ function T3Dpre4ProjectImporter::beginCodeFilesImport(%this)
       }
       }
       else
       else
       {
       {
-         error("Legacy Project Importer - File not able to be opened: " @ %file);  
+         $ProjectImporter::log.add("Legacy Project Importer - File not able to be opened: " @ %file);  
       }
       }
       
       
       if(%fileWasChanged)
       if(%fileWasChanged)
@@ -725,7 +725,7 @@ function T3Dpre4ProjectImporter::beginCodeFilesImport(%this)
       %file = findNextFileMultiExpr( $ProjectImporter::modulePath @ "/*.*" );
       %file = findNextFileMultiExpr( $ProjectImporter::modulePath @ "/*.*" );
    }
    }
    
    
-   echo("Legacy Project Importer - Processing of imported code files done!");
+   $ProjectImporter::log.add("Legacy Project Importer - Processing of imported code files done!");
    
    
    //exec common loader files, process the remainder into assets
    //exec common loader files, process the remainder into assets
    
    
@@ -747,7 +747,7 @@ function T3Dpre4ProjectImporter::processScriptExtensions(%this)
    else
    else
       %file = findFirstFileMultiExpr( $ProjectImporter::modulePath @ "/*/*.tscript", true);
       %file = findFirstFileMultiExpr( $ProjectImporter::modulePath @ "/*/*.tscript", true);
    
    
-   echo("Legacy Project Importer - Beginning processing of script files that utilize extensions other than: " @ $TorqueScriptFileExtension);
+   $ProjectImporter::log.add("Legacy Project Importer - Beginning processing of script files that utilize extensions other than: " @ $TorqueScriptFileExtension);
    
    
    //Walk through and process all code files to update references
    //Walk through and process all code files to update references
    while( %file !$= "" )
    while( %file !$= "" )
@@ -767,13 +767,13 @@ function T3Dpre4ProjectImporter::processScriptExtensions(%this)
       %targetFilePath = %filePath @ "/" @ %fileBase @ "." @ $TorqueScriptFileExtension;
       %targetFilePath = %filePath @ "/" @ %fileBase @ "." @ $TorqueScriptFileExtension;
       if(!pathCopy(%file, %targetFilePath))
       if(!pathCopy(%file, %targetFilePath))
       {
       {
-         error("T3Dpre4ProjectImporter::processScriptExtensions() - Failed to create renamed script file for file: " @ %file);
+         $ProjectImporter::log.add("T3Dpre4ProjectImporter::processScriptExtensions() - Failed to create renamed script file for file: " @ %file);
       }
       }
       else
       else
       {
       {
          if(!fileDelete(%file))
          if(!fileDelete(%file))
          {
          {
-            error("T3Dpre4ProjectImporter::processScriptExtensions() - Failed to remove old script file for rename: " @ %file);
+            $ProjectImporter::log.add("T3Dpre4ProjectImporter::processScriptExtensions() - Failed to remove old script file for rename: " @ %file);
          }         
          }         
       }
       }
       
       
@@ -789,7 +789,7 @@ function T3Dpre4ProjectImporter::processScriptExtensions(%this)
    ProjectImportWindow-->nextButton.setActive(true);
    ProjectImportWindow-->nextButton.setActive(true);
    Canvas.repaint();
    Canvas.repaint();
    
    
-   echo("Legacy Project Importer - Beginning processing of script files extensions complete");
+   $ProjectImporter::log.add("Legacy Project Importer - Beginning processing of script files extensions complete");
 }
 }
 
 
 //To implement a custom class to have it's fields processed, just utilize this template function
 //To implement a custom class to have it's fields processed, just utilize this template function
@@ -986,7 +986,7 @@ function T3Dpre4ProjectImporter::processMaterialObject(%this, %file, %objectName
       
       
       if(isFile(%tamlpath))
       if(isFile(%tamlpath))
       {
       {
-         error("T3Dpre4ProjectImporter::processMaterialObject() - Failed to create as taml file already exists: " @ %file);
+         $ProjectImporter::log.add("T3Dpre4ProjectImporter::processMaterialObject() - Failed to create as taml file already exists: " @ %file);
          return false;
          return false;
       }
       }
       
       
@@ -1042,7 +1042,7 @@ function T3Dpre4ProjectImporter::processTerrainMaterialObject(%this, %file, %obj
       
       
       if(isFile(%tamlpath))
       if(isFile(%tamlpath))
       {
       {
-         error("T3Dpre4ProjectImporter::processTerrainMaterialObject() - Failed to create as taml file already exists: " @ %file);
+         $ProjectImporter::log.add("T3Dpre4ProjectImporter::processTerrainMaterialObject() - Failed to create as taml file already exists: " @ %file);
          return false;
          return false;
       }
       }
       
       
@@ -1098,7 +1098,7 @@ function T3Dpre4ProjectImporter::processSFXProfileObject(%this, %file, %objectNa
    //Throw a warn that this file's already been claimed and move on
    //Throw a warn that this file's already been claimed and move on
    if(%soundAsset !$= "")
    if(%soundAsset !$= "")
    {
    {
-      warn("T3Dpre4ProjectImporter::processSFXProfileObject() - attempting to process SFXProfile " @ %objectName 
+      $ProjectImporter::log.add("T3Dpre4ProjectImporter::processSFXProfileObject() - attempting to process SFXProfile " @ %objectName 
                @ " but its filename is already associated to another sound asset. Continuing, but be aware.");
                @ " but its filename is already associated to another sound asset. Continuing, but be aware.");
    }  
    }  
 
 
@@ -1112,7 +1112,7 @@ function T3Dpre4ProjectImporter::processSFXProfileObject(%this, %file, %objectNa
       
       
       if(isFile(%tamlpath))
       if(isFile(%tamlpath))
       {
       {
-         error("T3Dpre4ProjectImporter::processSFXProfileObject() - Failed to create as taml file already exists: " @ %soundFilename);
+         $ProjectImporter::log.add("T3Dpre4ProjectImporter::processSFXProfileObject() - Failed to create as taml file already exists: " @ %soundFilename);
          return false;
          return false;
       }
       }
       
       
@@ -1274,7 +1274,7 @@ function processGuiBitmapButtonCtrlField(%line, %originalFieldName, %newFieldNam
    
    
    if(%outLine !$= %line && %pos != -1 && %endPos != -1 && %value !$= "")
    if(%outLine !$= %line && %pos != -1 && %endPos != -1 && %value !$= "")
    {
    {
-      echo("Legacy Project Importer - processing legacy field line: " @ %line);
+      $ProjectImporter::log.add("Legacy Project Importer - processing legacy field line: " @ %line);
       
       
       if(startsWith(%value, "$") || startsWith(%value, "#"))
       if(startsWith(%value, "$") || startsWith(%value, "#"))
       {
       {
@@ -1287,7 +1287,7 @@ function processGuiBitmapButtonCtrlField(%line, %originalFieldName, %newFieldNam
       //If we still have nothing, then we fail it out
       //If we still have nothing, then we fail it out
       if(!isFile(%targetFilename))
       if(!isFile(%targetFilename))
       {
       {
-         error("Legacy Project Importer - file described in line could not be found/is not valid");
+         $ProjectImporter::log.add("Legacy Project Importer - file described in line could not be found/is not valid");
          return %line;
          return %line;
       }
       }
       
       
@@ -1296,7 +1296,7 @@ function processGuiBitmapButtonCtrlField(%line, %originalFieldName, %newFieldNam
       if(%foundAssets != 0)
       if(%foundAssets != 0)
       {
       {
          %assetId = $ProjectImporter::assetQuery.getAsset(0);
          %assetId = $ProjectImporter::assetQuery.getAsset(0);
-         echo("Legacy Project Importer - processing of legacy field line's value: " @ %value @ " has found a matching AssetId: " @ %assetId);
+         $ProjectImporter::log.add("Legacy Project Importer - processing of legacy field line's value: " @ %value @ " has found a matching AssetId: " @ %assetId);
       }
       }
      
      
       if(%assetId !$= "" && AssetDatabase.isDeclaredAsset(%assetId))
       if(%assetId !$= "" && AssetDatabase.isDeclaredAsset(%assetId))
@@ -1310,7 +1310,7 @@ function processGuiBitmapButtonCtrlField(%line, %originalFieldName, %newFieldNam
    
    
    if(%outLine !$= %line)
    if(%outLine !$= %line)
    {
    {
-      echo("Legacy Project Importer - processing of legacy line: " @ %line @ " has been updated to: " @ %outLine);
+      $ProjectImporter::log.add("Legacy Project Importer - processing of legacy line: " @ %line @ " has been updated to: " @ %outLine);
       return %outLine;  
       return %outLine;  
    }
    }
    else
    else

+ 108 - 72
Templates/BaseGame/game/tools/projectImporter/scripts/projectImporter.tscript

@@ -10,6 +10,11 @@ function ProjectImportWindow::onWake(%this)
    if(!isObject($ProjectImporter::fileObject))
    if(!isObject($ProjectImporter::fileObject))
       $ProjectImporter::fileObject = new FileObject();
       $ProjectImporter::fileObject = new FileObject();
       
       
+   if(!isObject($ProjectImporter::log))
+      $ProjectImporter::log = new ArrayObject();
+   else
+      $ProjectImporter::log.empty();
+      
    %this.importStepNumber = 0;
    %this.importStepNumber = 0;
    %this-->stepsList.clear();
    %this-->stepsList.clear();
    %this-->stepsList.addRow(0, "Welcome");  
    %this-->stepsList.addRow(0, "Welcome");  
@@ -352,16 +357,33 @@ function ProjectImportWizardPage6::processPage(%this)
 
 
 function ProjectImportWizardPage7::openPage(%this)
 function ProjectImportWizardPage7::openPage(%this)
 {
 {
+   //writing console log
+   %logFileObj = new FileObject();
+   
+   %logFileName = "tools/logs/LegacyProjectImport_" @ getTimestamp() @ ".log";
+   
+   if(%logFileObj.openForWrite(%logFileName))
+   {
+      for(%i=0; %i < $ProjectImporter::log.count(); %i++)
+      {
+         %logFileObj.writeLine($ProjectImporter::log.getKey(%i));
+      }
+      
+      %logFileObj.close();
+   }
+   
+   %logFileObj.delete();
 }
 }
 
 
 function beginProjectImport()
 function beginProjectImport()
 {
 {
-   echo("===========================================");
-   echo("Beginning Project Import");
-   echo("===========================================");
+   $ProjectImporter::log.add("===========================================");
+   $ProjectImporter::log.add("Beginning Project Import");
+   $ProjectImporter::log.add("===========================================");
    
    
    $ProjectImporter::assetQuery = new AssetQuery();
    $ProjectImporter::assetQuery = new AssetQuery();
    $ProjectImporter::importer = new AssetImporter();
    $ProjectImporter::importer = new AssetImporter();
+   $ProjectImporter::importer.dumpLogs = false; //we handle the log dump outselves here
    $ProjectImporter::persistMgr = new PersistenceManager();
    $ProjectImporter::persistMgr = new PersistenceManager();
    
    
    //beginMaterialImport();
    //beginMaterialImport();
@@ -388,9 +410,9 @@ function beginProjectImport()
    $ProjectImporter::importer.delete();
    $ProjectImporter::importer.delete();
    $ProjectImporter::persistMgr.delete();
    $ProjectImporter::persistMgr.delete();
    
    
-   echo("===========================================");
-   echo("Finished Project Import");
-   echo("===========================================");
+   $ProjectImporter::log.add("===========================================");
+   $ProjectImporter::log.add("Finished Project Import");
+   $ProjectImporter::log.add("===========================================");
    
    
    AssetBrowser.refresh(); //update the AB just in case
    AssetBrowser.refresh(); //update the AB just in case
 }
 }
@@ -538,7 +560,7 @@ function processLegacyField(%line, %originalFieldName, %newFieldName)
    
    
    if(%outLine !$= %line && %pos != -1 && %endPos != -1 && %value !$= "")
    if(%outLine !$= %line && %pos != -1 && %endPos != -1 && %value !$= "")
    {
    {
-      echo("Legacy Project Importer - processing legacy field line: " @ %line);
+      $ProjectImporter::log.add("Legacy Project Importer - processing legacy field line: " @ %line);
       
       
       if(startsWith(%value, "$") || startsWith(%value, "#"))
       if(startsWith(%value, "$") || startsWith(%value, "#"))
       {
       {
@@ -580,7 +602,7 @@ function processLegacyField(%line, %originalFieldName, %newFieldName)
             }
             }
             else
             else
             {
             {
-               error("Legacy Project Importer - file described in line could not be found/is not valid");
+               $ProjectImporter::log.add("Legacy Project Importer - file described in line could not be found/is not valid");
                return %line;
                return %line;
             }
             }
          }
          }
@@ -597,7 +619,7 @@ function processLegacyField(%line, %originalFieldName, %newFieldName)
      
      
       if(%assetId !$= "" && AssetDatabase.isDeclaredAsset(%assetId))
       if(%assetId !$= "" && AssetDatabase.isDeclaredAsset(%assetId))
       {
       {
-         echo("Legacy Project Importer - processing of legacy field line's value: " @ %value @ " has found a matching AssetId: " @ %assetId);
+         $ProjectImporter::log.add("Legacy Project Importer - processing of legacy field line's value: " @ %value @ " has found a matching AssetId: " @ %assetId);
          
          
          //double check if this already had the quotes around the value or not
          //double check if this already had the quotes around the value or not
          if(!strIsMatchExpr("*\"*\"*", %originalValue))
          if(!strIsMatchExpr("*\"*\"*", %originalValue))
@@ -612,7 +634,7 @@ function processLegacyField(%line, %originalFieldName, %newFieldName)
    
    
    if(%outLine !$= %line)
    if(%outLine !$= %line)
    {
    {
-      echo("Legacy Project Importer - processing of legacy line: " @ %line @ " has been updated to: " @ %outLine);
+      $ProjectImporter::log.add("Legacy Project Importer - processing of legacy line: " @ %line @ " has been updated to: " @ %outLine);
       return %outLine;  
       return %outLine;  
    }
    }
    else
    else
@@ -650,7 +672,7 @@ function processLegacyShapeConstructorField(%line)
    if(%foundAssets != 0)
    if(%foundAssets != 0)
    {
    {
       %assetId = $ProjectImporter::assetQuery.getAsset(0);
       %assetId = $ProjectImporter::assetQuery.getAsset(0);
-      echo("Legacy Project Importer - processing of legacy shape constructor addSequence line's value: " @ %animSourcePath @ " has found a matching AssetId: " @ %assetId);
+      $ProjectImporter::log.add("Legacy Project Importer - processing of legacy shape constructor addSequence line's value: " @ %animSourcePath @ " has found a matching AssetId: " @ %assetId);
    }
    }
   
   
    if(%assetId !$= "" && AssetDatabase.isDeclaredAsset(%assetId))
    if(%assetId !$= "" && AssetDatabase.isDeclaredAsset(%assetId))
@@ -663,7 +685,7 @@ function processLegacyShapeConstructorField(%line)
    
    
    if(%outLine !$= %line)
    if(%outLine !$= %line)
    {
    {
-      echo("Legacy Project Importer - processing of legacy shape constructor addSequence line: " @ %line @ " has been updated to: " @ %outLine);
+      $ProjectImporter::log.add("Legacy Project Importer - processing of legacy shape constructor addSequence line: " @ %line @ " has been updated to: " @ %outLine);
       return %outLine;  
       return %outLine;  
    }
    }
    else
    else
@@ -849,7 +871,7 @@ function findObjectInFiles(%objectName)
       }
       }
       else
       else
       {
       {
-         error("findObjectInFiles() - File not able to be opened: " @ %file);  
+         $ProjectImporter::log.add("findObjectInFiles() - File not able to be opened: " @ %file);  
       }
       }
       
       
       %file = findNextFileMultiExpr( "*.*" );
       %file = findNextFileMultiExpr( "*.*" );
@@ -864,9 +886,9 @@ function findObjectInFiles(%objectName)
 //==============================================================================
 //==============================================================================
 function beginShapeImport()
 function beginShapeImport()
 {
 {
-   echo("===========================================");
-   echo("Importing 3D Shape files");
-   echo("===========================================");
+   $ProjectImporter::log.add("===========================================");
+   $ProjectImporter::log.add("Importing 3D Shape files");
+   $ProjectImporter::log.add("===========================================");
    //First, we need to go through and process all loose shape files. This will
    //First, we need to go through and process all loose shape files. This will
    //get us shape assets, material assets image, assets and animation assets.
    //get us shape assets, material assets image, assets and animation assets.
    %currentAddress = $ProjectImporter::modulePath;
    %currentAddress = $ProjectImporter::modulePath;
@@ -904,12 +926,14 @@ function beginShapeImport()
             
             
             //No asset found associated to this fileas far as we can determine, so time to import it
             //No asset found associated to this fileas far as we can determine, so time to import it
             
             
-            warn("Importing 3D Shape file: " @ %file);
+            $ProjectImporter::log.add("Importing 3D Shape file: " @ %file);
             %assetId = $ProjectImporter::importer.autoImportFile(%file);  
             %assetId = $ProjectImporter::importer.autoImportFile(%file);  
+            getImporterLogs();
             
             
             if(%assetId !$= "")
             if(%assetId !$= "")
             {
             {
-               warn("Finished importing 3D Shape file, resulting in asset with an id of: " @ %assetId);
+               $ProjectImporter::log.add("Finished importing 3D Shape file, resulting in asset with an id of: " @ %assetId);
+               $ProjectImporter::log.add("");
             }
             }
          }
          }
       }
       }
@@ -917,9 +941,9 @@ function beginShapeImport()
       %file = findNextFileMultiExpr( %currentAddress @ "/*.*" );
       %file = findNextFileMultiExpr( %currentAddress @ "/*.*" );
    }
    }
    
    
-   echo("===========================================");
-   echo("Finished Importing 3D Shape files");
-   echo("===========================================");
+   $ProjectImporter::log.add("===========================================");
+   $ProjectImporter::log.add("Finished Importing 3D Shape files");
+   $ProjectImporter::log.add("===========================================");
 }
 }
 //==============================================================================
 //==============================================================================
 
 
@@ -928,9 +952,9 @@ function beginShapeImport()
 //==============================================================================
 //==============================================================================
 function beginImageImport()
 function beginImageImport()
 {
 {
-   echo("===========================================");
-   echo("Importing Image files");
-   echo("===========================================");
+   $ProjectImporter::log.add("===========================================");
+   $ProjectImporter::log.add("Importing Image files");
+   $ProjectImporter::log.add("===========================================");
    //First, we need to go through and process all loose image files. This will
    //First, we need to go through and process all loose image files. This will
    //get us image assets, and if the import config deigns, material assets.
    //get us image assets, and if the import config deigns, material assets.
    %currentAddress = $ProjectImporter::modulePath;
    %currentAddress = $ProjectImporter::modulePath;
@@ -960,12 +984,14 @@ function beginImageImport()
       
       
             //No asset found associated to this fileas far as we can determine, so time to import it
             //No asset found associated to this fileas far as we can determine, so time to import it
             
             
-            warn("Importing Image file: " @ %file);
+            $ProjectImporter::log.add("Importing Image file: " @ %file);
             %assetId = $ProjectImporter::importer.autoImportFile(%file);  
             %assetId = $ProjectImporter::importer.autoImportFile(%file);  
+            getImporterLogs();
             
             
             if(%assetId !$= "")
             if(%assetId !$= "")
             {
             {
-               warn("Finished importing Image file, resulting in asset with an id of: " @ %assetId);
+               $ProjectImporter::log.add("Finished importing Image file, resulting in asset with an id of: " @ %assetId);
+               $ProjectImporter::log.add("");
             }
             }
          }
          }
       }
       }
@@ -973,9 +999,9 @@ function beginImageImport()
       %file = findNextFileMultiExpr( %currentAddress @ "/*.*" );
       %file = findNextFileMultiExpr( %currentAddress @ "/*.*" );
    }
    }
    
    
-   echo("===========================================");
-   echo("Finished Importing Image files");
-   echo("===========================================");
+   $ProjectImporter::log.add("===========================================");
+   $ProjectImporter::log.add("Finished Importing Image files");
+   $ProjectImporter::log.add("===========================================");
 }
 }
 //==============================================================================
 //==============================================================================
 
 
@@ -984,9 +1010,9 @@ function beginImageImport()
 //==============================================================================
 //==============================================================================
 function beginTerrainImport()
 function beginTerrainImport()
 {
 {
-   echo("===========================================");
-   echo("Importing Terrain files");
-   echo("===========================================");
+   $ProjectImporter::log.add("===========================================");
+   $ProjectImporter::log.add("Importing Terrain files");
+   $ProjectImporter::log.add("===========================================");
 
 
    %currentAddress = $ProjectImporter::modulePath;
    %currentAddress = $ProjectImporter::modulePath;
    
    
@@ -1015,7 +1041,7 @@ function beginTerrainImport()
             ProjectImportWizardPage5-->processingText.setText("Processing Terrain Asset file: " @ %file);
             ProjectImportWizardPage5-->processingText.setText("Processing Terrain Asset file: " @ %file);
             Canvas.repaint();
             Canvas.repaint();
             
             
-            warn("Importing Terrain file: " @ %file);
+            $ProjectImporter::log.add("Importing Terrain file: " @ %file);
             
             
             %moduleDef = AssetBrowser.dirHandler.getModuleFromAddress(%file);
             %moduleDef = AssetBrowser.dirHandler.getModuleFromAddress(%file);
             %moduleName = %moduleDef.ModuleID;
             %moduleName = %moduleDef.ModuleID;
@@ -1039,7 +1065,8 @@ function beginTerrainImport()
             {
             {
                AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
                AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
                
                
-               warn("Finished importing Terrain file, resulting in asset with an id of: " @ %moduleName @ ":" @ %assetName);
+               $ProjectImporter::log.add("Finished importing Terrain file, resulting in asset with an id of: " @ %moduleName @ ":" @ %assetName);
+               $ProjectImporter::log.add("");
             }
             }
          }
          }
       }
       }
@@ -1047,9 +1074,9 @@ function beginTerrainImport()
       %file = findNextFileMultiExpr( %currentAddress @ "/*.*" );
       %file = findNextFileMultiExpr( %currentAddress @ "/*.*" );
    }
    }
    
    
-   echo("===========================================");
-   echo("Finished Importing Terrain files");
-   echo("===========================================");
+   $ProjectImporter::log.add("===========================================");
+   $ProjectImporter::log.add("Finished Importing Terrain files");
+   $ProjectImporter::log.add("===========================================");
 }
 }
 //==============================================================================
 //==============================================================================
 
 
@@ -1064,9 +1091,9 @@ function beginTerrainImport()
 //==============================================================================
 //==============================================================================
 function beginGUIImport()
 function beginGUIImport()
 {
 {
-   echo("===========================================");
-   echo("Importing GUIs");
-   echo("===========================================");
+   $ProjectImporter::log.add("===========================================");
+   $ProjectImporter::log.add("Importing GUIs");
+   $ProjectImporter::log.add("===========================================");
    
    
    %currentAddress = $ProjectImporter::modulePath;
    %currentAddress = $ProjectImporter::modulePath;
    
    
@@ -1128,14 +1155,14 @@ function beginGUIImport()
       %file = findNextFileMultiExpr( %currentAddress @ "/*.*" );
       %file = findNextFileMultiExpr( %currentAddress @ "/*.*" );
    }
    }
 
 
-   echo("===========================================");
-   echo("Finished Importing GUIs");
-   echo("===========================================");
+   $ProjectImporter::log.add("===========================================");
+   $ProjectImporter::log.add("Finished Importing GUIs");
+   $ProjectImporter::log.add("===========================================");
 }
 }
 
 
 function processGUIntoAsset(%guiName, %file)
 function processGUIntoAsset(%guiName, %file)
 {
 {
-   warn("Processing GUI into asset: " @ %guiName @ ", file: " @ %file);
+   $ProjectImporter::log.add("Processing GUI into asset: " @ %guiName @ ", file: " @ %file);
    
    
    %filePath = filePath(%file);
    %filePath = filePath(%file);
    %fileName = fileBase(%file);
    %fileName = fileBase(%file);
@@ -1182,9 +1209,9 @@ function processGUIntoAsset(%guiName, %file)
 //==============================================================================
 //==============================================================================
 function beginPostFXImport()
 function beginPostFXImport()
 {
 {
-   echo("===========================================");
-   echo("Importing PostFXs");
-   echo("===========================================");
+   $ProjectImporter::log.add("===========================================");
+   $ProjectImporter::log.add("Importing PostFXs");
+   $ProjectImporter::log.add("===========================================");
    
    
    %count = PostFXManager.Count();
    %count = PostFXManager.Count();
    for(%i=0; %i < %count; %i++)
    for(%i=0; %i < %count; %i++)
@@ -1193,7 +1220,7 @@ function beginPostFXImport()
       
       
       if(isObject(%postEffect))
       if(isObject(%postEffect))
       {     
       {     
-         echo("Processing import of PostFX: " @ %postEffect.getName());
+         $ProjectImporter::log.add("Processing import of PostFX: " @ %postEffect.getName());
          
          
          //$ProjectImporter::persistMgr.setDirty(%gui);
          //$ProjectImporter::persistMgr.setDirty(%gui);
       }
       }
@@ -1201,9 +1228,9 @@ function beginPostFXImport()
    
    
    //$ProjectImporter::persistMgr.saveDirty();
    //$ProjectImporter::persistMgr.saveDirty();
 
 
-   echo("===========================================");
-   echo("Finished Importing PostFXs");
-   echo("===========================================");
+   $ProjectImporter::log.add("===========================================");
+   $ProjectImporter::log.add("Finished Importing PostFXs");
+   $ProjectImporter::log.add("===========================================");
 }
 }
 //==============================================================================
 //==============================================================================
 
 
@@ -1212,9 +1239,9 @@ function beginPostFXImport()
 //==============================================================================
 //==============================================================================
 function beginLevelImport()
 function beginLevelImport()
 {
 {
-   echo("===========================================");
-   echo("Importing Level files");
-   echo("===========================================");
+   $ProjectImporter::log.add("===========================================");
+   $ProjectImporter::log.add("Importing Level files");
+   $ProjectImporter::log.add("===========================================");
 
 
    %currentAddress = $ProjectImporter::modulePath;
    %currentAddress = $ProjectImporter::modulePath;
    
    
@@ -1239,7 +1266,7 @@ function beginLevelImport()
             ProjectImportWizardPage5-->processingText.setText("Processing Level Asset file: " @ %file);
             ProjectImportWizardPage5-->processingText.setText("Processing Level Asset file: " @ %file);
             Canvas.repaint();
             Canvas.repaint();
             
             
-            warn("Importing Level file: " @ %file);
+            $ProjectImporter::log.add("Importing Level file: " @ %file);
             
             
             %moduleName = AssetBrowser.dirHandler.getModuleFromAddress(%file).ModuleId;
             %moduleName = AssetBrowser.dirHandler.getModuleFromAddress(%file).ModuleId;
 
 
@@ -1249,7 +1276,7 @@ function beginLevelImport()
             
             
             if(AssetDatabase.isDeclaredAsset(%moduleName @ ":" @ %assetName))
             if(AssetDatabase.isDeclaredAsset(%moduleName @ ":" @ %assetName))
             {
             {
-               warn("Legacy Project Importer - trying to process a level into an asset that already exists");
+               $ProjectImporter::log.add("Legacy Project Importer - trying to process a level into an asset that already exists");
                return false;  
                return false;  
             }
             }
             
             
@@ -1329,9 +1356,9 @@ function beginLevelImport()
       %file = findNextFileMultiExpr( %currentAddress @ "/*.*" );
       %file = findNextFileMultiExpr( %currentAddress @ "/*.*" );
    }
    }
    
    
-   echo("===========================================");
-   echo("Finished Importing Level files");
-   echo("===========================================");
+   $ProjectImporter::log.add("===========================================");
+   $ProjectImporter::log.add("Finished Importing Level files");
+   $ProjectImporter::log.add("===========================================");
 }
 }
 //==============================================================================
 //==============================================================================
 
 
@@ -1370,9 +1397,9 @@ function ProjectImporter::deleteAssetDefinitions(%targetFolder)
 
 
 function doDeleteAssetDefinitions()
 function doDeleteAssetDefinitions()
 {
 {
-   echo("===========================================");
-   echo("Deleting Asset Definitions");
-   echo("===========================================");
+   $ProjectImporter::log.add("===========================================");
+   $ProjectImporter::log.add("Deleting Asset Definitions");
+   $ProjectImporter::log.add("===========================================");
    
    
    %currentAddress = $deleteAssetDefsTargetFolder;
    %currentAddress = $deleteAssetDefsTargetFolder;
    
    
@@ -1388,27 +1415,27 @@ function doDeleteAssetDefinitions()
       {
       {
          if(fileDelete(%file))
          if(fileDelete(%file))
          {
          {
-            echo("File: " @ %file @ " deleted successfully.");  
+            $ProjectImporter::log.add("File: " @ %file @ " deleted successfully.");  
          }
          }
          else
          else
          {
          {
-            error("File: " @ %file @ " failed to delete.");  
+            $ProjectImporter::log.add("File: " @ %file @ " failed to delete.");  
          }
          }
       }
       }
       
       
       %file = findNextFileMultiExpr( %currentAddress @ "/*.asset.taml" );
       %file = findNextFileMultiExpr( %currentAddress @ "/*.asset.taml" );
    }
    }
 
 
-   echo("===========================================");
-   echo("Finished Deleting Asset Definitions");
-   echo("===========================================");
+   $ProjectImporter::log.add("===========================================");
+   $ProjectImporter::log.add("Finished Deleting Asset Definitions");
+   $ProjectImporter::log.add("===========================================");
 }
 }
 
 
 function scanForDuplicateFiles(%toTestFile)
 function scanForDuplicateFiles(%toTestFile)
 {
 {
-   echo("===========================================");
-   echo("Scanning for duplicate files!");
-   echo("===========================================");
+   $ProjectImporter::log.add("===========================================");
+   $ProjectImporter::log.add("Scanning for duplicate files!");
+   $ProjectImporter::log.add("===========================================");
    
    
    //First, wipe out any files inside the folder first
    //First, wipe out any files inside the folder first
    %file = findFirstFileMultiExpr( "*/*.*", true);
    %file = findFirstFileMultiExpr( "*/*.*", true);
@@ -1452,12 +1479,21 @@ function scanForDuplicateFiles(%toTestFile)
             if(%moduleName !$= "" && %testModuleName !$= "" && %moduleName $= %testModuleName)
             if(%moduleName !$= "" && %testModuleName !$= "" && %moduleName $= %testModuleName)
             {
             {
                //report the probable duplicate
                //report the probable duplicate
-               error("Probable duplicate asset detected!");
-               error("Files: " @ %file @ " and " @ %toTestFile @ " have matching names and exist within the same module!");
+               $ProjectImporter::log.add("Probable duplicate asset detected!");
+               $ProjectImporter::log.add("Files: " @ %file @ " and " @ %toTestFile @ " have matching names and exist within the same module!");
             }
             }
          }
          }
       }
       }
       
       
       %file = findNextFileMultiExpr( "*/*.*" );
       %file = findNextFileMultiExpr( "*/*.*" );
    }
    }
+}
+
+function getImporterLogs()
+{
+   %lineCount = $ProjectImporter::importer.getActivityLogLineCount();
+   for(%i=0; %i < %lineCount; %i++)
+   {
+      $ProjectImporter::log.add($ProjectImporter::importer.getActivityLogLine(%i));
+   }
 }
 }