From 0dcd272b873300c858617bdf7d77cee92232de1a Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Sun, 31 Oct 2021 14:38:02 -0500 Subject: [PATCH 01/17] clean up more texture profile refs to kill spam --- Engine/source/gui/buttons/guiIconButtonCtrl.h | 2 +- Engine/source/gui/buttons/guiToolboxButtonCtrl.h | 6 +++--- Engine/source/gui/controls/guiTreeViewCtrl.cpp | 2 +- Engine/source/gui/core/guiTypes.cpp | 2 +- Engine/source/gui/core/guiTypes.h | 2 +- Engine/source/gui/worldEditor/editorIconRegistry.cpp | 6 +++--- Engine/source/gui/worldEditor/guiMissionArea.h | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Engine/source/gui/buttons/guiIconButtonCtrl.h b/Engine/source/gui/buttons/guiIconButtonCtrl.h index 8196fef49..081201ad8 100644 --- a/Engine/source/gui/buttons/guiIconButtonCtrl.h +++ b/Engine/source/gui/buttons/guiIconButtonCtrl.h @@ -42,7 +42,7 @@ private: protected: - DECLARE_IMAGEASSET(GuiIconButtonCtrl, Bitmap, onImageChanged, GFXTexturePersistentSRGBProfile); + DECLARE_IMAGEASSET(GuiIconButtonCtrl, Bitmap, onImageChanged, GFXDefaultGUIProfile); DECLARE_ASSET_SETGET(GuiIconButtonCtrl, Bitmap); S32 mIconLocation; diff --git a/Engine/source/gui/buttons/guiToolboxButtonCtrl.h b/Engine/source/gui/buttons/guiToolboxButtonCtrl.h index 8741cdee9..fd3e360ad 100644 --- a/Engine/source/gui/buttons/guiToolboxButtonCtrl.h +++ b/Engine/source/gui/buttons/guiToolboxButtonCtrl.h @@ -39,11 +39,11 @@ private: protected: - DECLARE_IMAGEASSET(GuiToolboxButtonCtrl, NormalBitmap, onNormalImageChanged, GFXTexturePersistentSRGBProfile); + DECLARE_IMAGEASSET(GuiToolboxButtonCtrl, NormalBitmap, onNormalImageChanged, GFXDefaultGUIProfile); DECLARE_ASSET_SETGET(GuiToolboxButtonCtrl, NormalBitmap); - DECLARE_IMAGEASSET(GuiToolboxButtonCtrl, LoweredBitmap, onLoweredImageChanged, GFXTexturePersistentSRGBProfile); + DECLARE_IMAGEASSET(GuiToolboxButtonCtrl, LoweredBitmap, onLoweredImageChanged, GFXDefaultGUIProfile); DECLARE_ASSET_SETGET(GuiToolboxButtonCtrl, LoweredBitmap); - DECLARE_IMAGEASSET(GuiToolboxButtonCtrl, HoverBitmap, onHoverImageChanged, GFXTexturePersistentSRGBProfile); + DECLARE_IMAGEASSET(GuiToolboxButtonCtrl, HoverBitmap, onHoverImageChanged, GFXDefaultGUIProfile); DECLARE_ASSET_SETGET(GuiToolboxButtonCtrl, HoverBitmap); void renderButton(GFXTexHandle &texture, Point2I &offset, const RectI& updateRect); diff --git a/Engine/source/gui/controls/guiTreeViewCtrl.cpp b/Engine/source/gui/controls/guiTreeViewCtrl.cpp index aaed67a78..ae5517a5e 100644 --- a/Engine/source/gui/controls/guiTreeViewCtrl.cpp +++ b/Engine/source/gui/controls/guiTreeViewCtrl.cpp @@ -1880,7 +1880,7 @@ bool GuiTreeViewCtrl::buildIconTable(const char * icons) dStrncpy( buf, start, getMin( sizeof( buf ) / sizeof( buf[ 0 ] ) - 1, len ) ); buf[ len ] = '\0'; - mIconTable[ numIcons ] = GFXTexHandle( buf, &GFXTexturePersistentProfile, avar( "%s() - mIconTable[%d] (line %d)", __FUNCTION__, numIcons, __LINE__ ) ); + mIconTable[ numIcons ] = GFXTexHandle( buf, &GFXDefaultGUIProfile, avar( "%s() - mIconTable[%d] (line %d)", __FUNCTION__, numIcons, __LINE__ ) ); } else mIconTable[ numIcons ] = GFXTexHandle(); diff --git a/Engine/source/gui/core/guiTypes.cpp b/Engine/source/gui/core/guiTypes.cpp index d4575d21a..85032a2ed 100644 --- a/Engine/source/gui/core/guiTypes.cpp +++ b/Engine/source/gui/core/guiTypes.cpp @@ -68,7 +68,7 @@ GFX_ImplementTextureProfile(GFXGuiCursorProfile, GFX_ImplementTextureProfile(GFXDefaultGUIProfile, GFXTextureProfile::DiffuseMap, GFXTextureProfile::PreserveSize | - GFXTextureProfile::Static | GFXTextureProfile::SRGB | + GFXTextureProfile::Static | GFXTextureProfile::KeepBitmap | GFXTextureProfile::SRGB | GFXTextureProfile::NoPadding, GFXTextureProfile::NONE); diff --git a/Engine/source/gui/core/guiTypes.h b/Engine/source/gui/core/guiTypes.h index c82c2fd50..37b77d57d 100644 --- a/Engine/source/gui/core/guiTypes.h +++ b/Engine/source/gui/core/guiTypes.h @@ -455,7 +455,7 @@ public: StringTableEntry mBitmapName; StringTableEntry mBitmapAssetId; AssetPtr mBitmapAsset; - GFXTextureProfile* mBitmapProfile = &GFXTexturePersistentSRGBProfile; + GFXTextureProfile* mBitmapProfile = &GFXDefaultGUIProfile; public: const StringTableEntry getBitmapFile() const { return mBitmapName; } void setBitmapFile(const FileName& _in) { mBitmapName = StringTable->insert(_in.c_str()); } diff --git a/Engine/source/gui/worldEditor/editorIconRegistry.cpp b/Engine/source/gui/worldEditor/editorIconRegistry.cpp index b75a28335..97a75c6ba 100644 --- a/Engine/source/gui/worldEditor/editorIconRegistry.cpp +++ b/Engine/source/gui/worldEditor/editorIconRegistry.cpp @@ -25,7 +25,7 @@ #include "console/engineAPI.h" #include "console/simBase.h" - +#include "gui/core/guiTypes.h" EditorIconRegistry gEditorIcons; @@ -60,7 +60,7 @@ void EditorIconRegistry::loadFromPath( const String &path, bool overwrite ) String defaultIconFile = path + "default"; mDefaultIcon.set( defaultIconFile, - &GFXTexturePersistentSRGBProfile, + &GFXDefaultGUIProfile, avar("%s() - mIcons[] (line %d)", __FUNCTION__, __LINE__) ); } @@ -68,7 +68,7 @@ void EditorIconRegistry::loadFromPath( const String &path, bool overwrite ) void EditorIconRegistry::add( const String &className, const String &imageFile, bool overwrite ) { // First see if we can load the image. - GFXTexHandle icon( imageFile, &GFXTexturePersistentSRGBProfile, + GFXTexHandle icon( imageFile, &GFXDefaultGUIProfile, avar("%s() - mIcons[] (line %d)", __FUNCTION__, __LINE__) ); if ( icon.isNull() ) return; diff --git a/Engine/source/gui/worldEditor/guiMissionArea.h b/Engine/source/gui/worldEditor/guiMissionArea.h index 32d68ecc7..947cd5a8c 100644 --- a/Engine/source/gui/worldEditor/guiMissionArea.h +++ b/Engine/source/gui/worldEditor/guiMissionArea.h @@ -63,7 +63,7 @@ protected: GFXStateBlockRef mBlendStateBlock; GFXStateBlockRef mSolidStateBlock; - DECLARE_IMAGEASSET(GuiMissionAreaCtrl, HandleBitmap, onHandleBitmapChanged, GFXTexturePersistentSRGBProfile); + DECLARE_IMAGEASSET(GuiMissionAreaCtrl, HandleBitmap, onHandleBitmapChanged, GFXDefaultGUIProfile); DECLARE_ASSET_SETGET(GuiMissionAreaCtrl, HandleBitmap); Point2I mHandleTextureSize; From 724e4f423c0573c40b27e5949ab36713f7569ddd Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Tue, 2 Nov 2021 08:16:54 -0400 Subject: [PATCH 02/17] * BugFix: Correct an ASAN reported memory access error when calling updateHeight on GuiGameListMenuCtrl when an invalid profile is initially set. --- Engine/source/gui/controls/guiGameListMenuCtrl.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Engine/source/gui/controls/guiGameListMenuCtrl.cpp b/Engine/source/gui/controls/guiGameListMenuCtrl.cpp index 33efb32d8..7a9951087 100644 --- a/Engine/source/gui/controls/guiGameListMenuCtrl.cpp +++ b/Engine/source/gui/controls/guiGameListMenuCtrl.cpp @@ -543,7 +543,8 @@ Point2I GuiGameListMenuCtrl::getMinExtent() const { Point2I parentMin = Parent::getMinExtent(); - GuiGameListMenuProfile * profile = (GuiGameListMenuProfile *) mProfile; + GuiGameListMenuProfile * profile = dynamic_cast(mProfile); + AssertFatal(profile, "Invalid profile for GuiGameListMenuCtrl!"); S32 minHeight = 0; S32 rowHeight = profile->getRowHeight(); @@ -632,10 +633,13 @@ void GuiGameListMenuCtrl::enforceConstraints() void GuiGameListMenuCtrl::updateHeight() { - S32 minHeight = getMinExtent().y; - if (getHeight() < minHeight) + if (hasValidProfile()) { - setHeight(minHeight); + S32 minHeight = getMinExtent().y; + if (getHeight() < minHeight) + { + setHeight(minHeight); + } } } From 2eefb4972fc74a1bd2992292cec71d4b06852297 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Tue, 2 Nov 2021 09:11:25 -0400 Subject: [PATCH 03/17] * BugFix: Correct an ASAN memory access error in TSShapeEdit caused by reading a reference from the same vector we are pushing to at the same time. --- Engine/source/ts/tsShapeEdit.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Engine/source/ts/tsShapeEdit.cpp b/Engine/source/ts/tsShapeEdit.cpp index 6c5db7814..601b4ad87 100644 --- a/Engine/source/ts/tsShapeEdit.cpp +++ b/Engine/source/ts/tsShapeEdit.cpp @@ -1584,7 +1584,8 @@ bool TSShape::addSequence(const Torque::Path& path, const String& fromSeq, offset = srcShape->groundTranslations.size() - 1; } - groundTranslations.push_back(srcShape->groundTranslations[offset]); + const Point3F pointValueToCopy = srcShape->groundTranslations[offset]; + groundTranslations.push_back(pointValueToCopy); S32 offset2 = groundBase + i; if (offset2 >= srcShape->groundRotations.size()) @@ -1593,7 +1594,8 @@ bool TSShape::addSequence(const Torque::Path& path, const String& fromSeq, offset2 = srcShape->groundRotations.size() - 1; } - groundRotations.push_back(srcShape->groundRotations[offset2]); + const Quat16 quatValueToCopy = srcShape->groundRotations[offset2]; + groundRotations.push_back(quatValueToCopy); } // Add triggers From 2b53c065ce99d03c9efbaa46cf32a61a9865edca Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Tue, 2 Nov 2021 13:55:57 -0400 Subject: [PATCH 04/17] * BugFix: Correct an invalid memory access error caused by the tab autocomplete in the console when attempting to tab complete at the start of the input while there is text to the right. --- Engine/source/console/console.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Engine/source/console/console.cpp b/Engine/source/console/console.cpp index 750db2a17..14e75f0f8 100644 --- a/Engine/source/console/console.cpp +++ b/Engine/source/console/console.cpp @@ -485,6 +485,13 @@ U32 tabComplete(char* inputBuffer, U32 cursorPos, U32 maxResultLength, bool forw } completionBaseStart = p; completionBaseLen = cursorPos - p; + + // Bail if we end up at start of string + if (p == 0) + { + return cursorPos; + } + // Is this function being invoked on an object? if (inputBuffer[p - 1] == '.') { From 215a93e9af9ce0c3b100bca0561e7f9e78507578 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Tue, 2 Nov 2021 17:36:22 -0400 Subject: [PATCH 05/17] * BugFix: Correction for compiling on x86 Unix devices. --- Engine/source/platformX86UNIX/x86UNIXFileio.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Engine/source/platformX86UNIX/x86UNIXFileio.cpp b/Engine/source/platformX86UNIX/x86UNIXFileio.cpp index 591b28f1c..d702d6417 100644 --- a/Engine/source/platformX86UNIX/x86UNIXFileio.cpp +++ b/Engine/source/platformX86UNIX/x86UNIXFileio.cpp @@ -76,6 +76,7 @@ extern int x86UNIXClose(int fd); extern ssize_t x86UNIXRead(int fd, void *buf, size_t nbytes); extern ssize_t x86UNIXWrite(int fd, const void *buf, size_t nbytes); + extern bool ResolvePathCaseInsensitive(char* pathName, S32 pathNameSize, bool requiredAbsolute); const int MaxPath = PATH_MAX; From 2311d7d683219de14dcd5d8f7d0c29714758be79 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Tue, 2 Nov 2021 18:11:42 -0400 Subject: [PATCH 06/17] * BugFix: Correct an ASAN reported memory error caused by incorrect usage of __sync_fetch_and_add. --- Engine/source/platform/platformIntrinsics.gcc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/platform/platformIntrinsics.gcc.h b/Engine/source/platform/platformIntrinsics.gcc.h index 5d5c39794..1acc8245e 100644 --- a/Engine/source/platform/platformIntrinsics.gcc.h +++ b/Engine/source/platform/platformIntrinsics.gcc.h @@ -79,7 +79,7 @@ inline bool dCompareAndSwap( volatile U64& ref, U64 oldVal, U64 newVal ) inline U32 dAtomicRead( volatile U32 &ref ) { #if !defined(TORQUE_OS_MAC) - return __sync_fetch_and_add( ( volatile long* ) &ref, 0 ); + return __sync_fetch_and_add( &ref, 0 ); #else return OSAtomicAdd32( 0, (int32_t* ) &ref); #endif From 38e7bb9232bd8eb112f6a68266fc7f271186ffe4 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Tue, 2 Nov 2021 18:52:54 -0400 Subject: [PATCH 07/17] * BugFix: Correct the possibility of the Sim module being deinitialized after the Scene module despite the Sim module being dependentant on the Scene module. --- Engine/source/T3D/gameFunctions.cpp | 2 +- Engine/source/scene/sceneManager.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/T3D/gameFunctions.cpp b/Engine/source/T3D/gameFunctions.cpp index c546bf83b..aa6ea80e3 100644 --- a/Engine/source/T3D/gameFunctions.cpp +++ b/Engine/source/T3D/gameFunctions.cpp @@ -46,7 +46,7 @@ MODULE_BEGIN( 3D ) MODULE_SHUTDOWN_BEFORE( Process ) MODULE_SHUTDOWN_BEFORE( Sim ) - MODULE_SHUTDOWN_AFTER( Scene ) + MODULE_SHUTDOWN_BEFORE( Scene ) MODULE_INIT { diff --git a/Engine/source/scene/sceneManager.cpp b/Engine/source/scene/sceneManager.cpp index 5e1d97cb0..83ab66f2e 100644 --- a/Engine/source/scene/sceneManager.cpp +++ b/Engine/source/scene/sceneManager.cpp @@ -49,7 +49,7 @@ extern bool gEditingMission; MODULE_BEGIN( Scene ) MODULE_INIT_AFTER( Sim ) - MODULE_SHUTDOWN_BEFORE( Sim ) + MODULE_SHUTDOWN_AFTER( Sim ) MODULE_INIT { From fda722e355f59d0f24de72a96462dd78eaf819c0 Mon Sep 17 00:00:00 2001 From: JeffR Date: Wed, 3 Nov 2021 00:13:00 -0500 Subject: [PATCH 08/17] Updates asset importer and project importer to output to separate log files into tools/logs Add utility console function for getting current datetime --- Engine/source/T3D/assets/assetImporter.cpp | 44 ++++- Engine/source/T3D/assets/assetImporter.h | 2 + .../T3D/assets/assetImporter_ScriptBinding.h | 2 +- Engine/source/console/consoleFunctions.cpp | 18 ++ .../game/tools/projectImporter/main.tscript | 1 + .../pre40/T3Dpre4ProjectImporter.tscript | 48 ++--- .../scripts/projectImporter.tscript | 180 +++++++++++------- 7 files changed, 195 insertions(+), 100 deletions(-) diff --git a/Engine/source/T3D/assets/assetImporter.cpp b/Engine/source/T3D/assets/assetImporter.cpp index 8dc898dae..65c18d664 100644 --- a/Engine/source/T3D/assets/assetImporter.cpp +++ b/Engine/source/T3D/assets/assetImporter.cpp @@ -18,6 +18,7 @@ #include "materials/materialManager.h" #include "console/persistenceManager.h" +#include "core/util/timeClass.h" ConsoleDocClass(AssetImportConfig, "@brief Defines properties for an AssetImprotConfig object.\n" @@ -506,7 +507,8 @@ AssetImporter::AssetImporter() : isReimport(false), assetHeirarchyChanged(false), 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("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("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() { - 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()); activityLog.push_back(importLogBuffer); + dumpActivityLog(); return; } @@ -2483,6 +2519,8 @@ void AssetImporter::importAssets(AssetImportObject* assetItem) //recurse if needed importAssets(item); } + + dumpActivityLog(); } // diff --git a/Engine/source/T3D/assets/assetImporter.h b/Engine/source/T3D/assets/assetImporter.h index 9505d00b1..327b38dca 100644 --- a/Engine/source/T3D/assets/assetImporter.h +++ b/Engine/source/T3D/assets/assetImporter.h @@ -647,6 +647,8 @@ class AssetImporter : public SimObject /// String finalImportedAssetPath; + bool mDumpLogs; + public: AssetImporter(); virtual ~AssetImporter(); diff --git a/Engine/source/T3D/assets/assetImporter_ScriptBinding.h b/Engine/source/T3D/assets/assetImporter_ScriptBinding.h index 88125760a..e52da2c52 100644 --- a/Engine/source/T3D/assets/assetImporter_ScriptBinding.h +++ b/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" "@return The bool result of calling exec") { - return object->getActivityLogLine(0); + return object->getActivityLogLine(i); } DefineEngineMethod(AssetImporter, autoImportFile, String, (String path, String typeHint), ("", ""), diff --git a/Engine/source/console/consoleFunctions.cpp b/Engine/source/console/consoleFunctions.cpp index ceac8de6d..a4b50cfcc 100644 --- a/Engine/source/console/consoleFunctions.cpp +++ b/Engine/source/console/consoleFunctions.cpp @@ -2841,3 +2841,21 @@ DefineEngineFunction( getStringHash, S32, (const char* _inString, bool _sensitiv else 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; +} diff --git a/Templates/BaseGame/game/tools/projectImporter/main.tscript b/Templates/BaseGame/game/tools/projectImporter/main.tscript index 2766b4bad..da7fd3a3b 100644 --- a/Templates/BaseGame/game/tools/projectImporter/main.tscript +++ b/Templates/BaseGame/game/tools/projectImporter/main.tscript @@ -41,6 +41,7 @@ function initializeProjectImporter() //Input::GetEventManager().subscribe( ProjectImportCtrl, "EndDropFiles" ); $ProjectImporter::importer = new AssetImporter(); + $ProjectImporter::importer.dumpLogs = false; //we'll handle the log files ourselves %importConfig = new AssetImportConfig(); %importConfig.loadImportConfig(AssetImportSettings, "LegacyProjectImport"); diff --git a/Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript b/Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript index 82d11595e..0eb5f4360 100644 --- a/Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript +++ b/Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript @@ -2,7 +2,7 @@ function T3Dpre4ProjectImporter::setupModule(%this) { %newModuleName = $ProjectImporter::moduleName; - echo("Creating a new Module named: " @ %newModuleName); + $ProjectImporter::log.add("Creating a new Module named: " @ %newModuleName); %moduleFilePath = "data/" @ %newModuleName; %moduleDefinitionFilePath = %moduleFilePath @ "/" @ %newModuleName @ ".module"; @@ -40,7 +40,7 @@ function T3Dpre4ProjectImporter::setupModule(%this) %line = strreplace( %line, "@@", %newModuleName ); %file.writeline(%line); - echo(%line); + //$ProjectImporter::log.add(%line); } %file.close(); @@ -51,7 +51,7 @@ function T3Dpre4ProjectImporter::setupModule(%this) %file.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 @@ -126,7 +126,7 @@ function T3Dpre4ProjectImporter::copyFiles(%this) 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 @ "/*.*" ); @@ -206,7 +206,7 @@ function T3Dpre4ProjectImporter::beginMaterialFilesImport(%this) %objectClassStack = 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 while( %file !$= "" ) @@ -225,7 +225,7 @@ function T3Dpre4ProjectImporter::beginMaterialFilesImport(%this) 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; while ( !$ProjectImporter::fileObject.isEOF() ) { @@ -376,7 +376,7 @@ function T3Dpre4ProjectImporter::beginMaterialFilesImport(%this) } 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) @@ -399,7 +399,7 @@ function T3Dpre4ProjectImporter::beginMaterialFilesImport(%this) %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(); %objectClassStack.delete(); @@ -418,7 +418,7 @@ function T3Dpre4ProjectImporter::beginCodeFilesImport(%this) %objectClassStack = 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 while( %file !$= "" ) @@ -454,7 +454,7 @@ function T3Dpre4ProjectImporter::beginCodeFilesImport(%this) 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; while ( !$ProjectImporter::fileObject.isEOF() ) { @@ -702,7 +702,7 @@ function T3Dpre4ProjectImporter::beginCodeFilesImport(%this) } 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) @@ -725,7 +725,7 @@ function T3Dpre4ProjectImporter::beginCodeFilesImport(%this) %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 @@ -747,7 +747,7 @@ function T3Dpre4ProjectImporter::processScriptExtensions(%this) else %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 while( %file !$= "" ) @@ -767,13 +767,13 @@ function T3Dpre4ProjectImporter::processScriptExtensions(%this) %targetFilePath = %filePath @ "/" @ %fileBase @ "." @ $TorqueScriptFileExtension; 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 { 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); 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 @@ -986,7 +986,7 @@ function T3Dpre4ProjectImporter::processMaterialObject(%this, %file, %objectName 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; } @@ -1042,7 +1042,7 @@ function T3Dpre4ProjectImporter::processTerrainMaterialObject(%this, %file, %obj 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; } @@ -1098,7 +1098,7 @@ function T3Dpre4ProjectImporter::processSFXProfileObject(%this, %file, %objectNa //Throw a warn that this file's already been claimed and move on 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."); } @@ -1112,7 +1112,7 @@ function T3Dpre4ProjectImporter::processSFXProfileObject(%this, %file, %objectNa 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; } @@ -1274,7 +1274,7 @@ function processGuiBitmapButtonCtrlField(%line, %originalFieldName, %newFieldNam 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, "#")) { @@ -1287,7 +1287,7 @@ function processGuiBitmapButtonCtrlField(%line, %originalFieldName, %newFieldNam //If we still have nothing, then we fail it out 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; } @@ -1296,7 +1296,7 @@ function processGuiBitmapButtonCtrlField(%line, %originalFieldName, %newFieldNam if(%foundAssets != 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)) @@ -1310,7 +1310,7 @@ function processGuiBitmapButtonCtrlField(%line, %originalFieldName, %newFieldNam 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; } else diff --git a/Templates/BaseGame/game/tools/projectImporter/scripts/projectImporter.tscript b/Templates/BaseGame/game/tools/projectImporter/scripts/projectImporter.tscript index cfdd7c8bf..f00941776 100644 --- a/Templates/BaseGame/game/tools/projectImporter/scripts/projectImporter.tscript +++ b/Templates/BaseGame/game/tools/projectImporter/scripts/projectImporter.tscript @@ -10,6 +10,11 @@ function ProjectImportWindow::onWake(%this) if(!isObject($ProjectImporter::fileObject)) $ProjectImporter::fileObject = new FileObject(); + if(!isObject($ProjectImporter::log)) + $ProjectImporter::log = new ArrayObject(); + else + $ProjectImporter::log.empty(); + %this.importStepNumber = 0; %this-->stepsList.clear(); %this-->stepsList.addRow(0, "Welcome"); @@ -352,16 +357,33 @@ function ProjectImportWizardPage6::processPage(%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() { - echo("==========================================="); - echo("Beginning Project Import"); - echo("==========================================="); + $ProjectImporter::log.add("==========================================="); + $ProjectImporter::log.add("Beginning Project Import"); + $ProjectImporter::log.add("==========================================="); $ProjectImporter::assetQuery = new AssetQuery(); $ProjectImporter::importer = new AssetImporter(); + $ProjectImporter::importer.dumpLogs = false; //we handle the log dump outselves here $ProjectImporter::persistMgr = new PersistenceManager(); //beginMaterialImport(); @@ -388,9 +410,9 @@ function beginProjectImport() $ProjectImporter::importer.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 } @@ -538,7 +560,7 @@ function processLegacyField(%line, %originalFieldName, %newFieldName) 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, "#")) { @@ -580,7 +602,7 @@ function processLegacyField(%line, %originalFieldName, %newFieldName) } 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; } } @@ -597,7 +619,7 @@ function processLegacyField(%line, %originalFieldName, %newFieldName) 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 if(!strIsMatchExpr("*\"*\"*", %originalValue)) @@ -612,7 +634,7 @@ function processLegacyField(%line, %originalFieldName, %newFieldName) 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; } else @@ -650,7 +672,7 @@ function processLegacyShapeConstructorField(%line) if(%foundAssets != 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)) @@ -663,7 +685,7 @@ function processLegacyShapeConstructorField(%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; } else @@ -849,7 +871,7 @@ function findObjectInFiles(%objectName) } else { - error("findObjectInFiles() - File not able to be opened: " @ %file); + $ProjectImporter::log.add("findObjectInFiles() - File not able to be opened: " @ %file); } %file = findNextFileMultiExpr( "*.*" ); @@ -864,9 +886,9 @@ function findObjectInFiles(%objectName) //============================================================================== 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 //get us shape assets, material assets image, assets and animation assets. %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 - warn("Importing 3D Shape file: " @ %file); + $ProjectImporter::log.add("Importing 3D Shape file: " @ %file); %assetId = $ProjectImporter::importer.autoImportFile(%file); + getImporterLogs(); 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 @ "/*.*" ); } - 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() { - 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 //get us image assets, and if the import config deigns, material assets. %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 - warn("Importing Image file: " @ %file); + $ProjectImporter::log.add("Importing Image file: " @ %file); %assetId = $ProjectImporter::importer.autoImportFile(%file); + getImporterLogs(); 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 @ "/*.*" ); } - 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() { - echo("==========================================="); - echo("Importing Terrain files"); - echo("==========================================="); + $ProjectImporter::log.add("==========================================="); + $ProjectImporter::log.add("Importing Terrain files"); + $ProjectImporter::log.add("==========================================="); %currentAddress = $ProjectImporter::modulePath; @@ -1015,7 +1041,7 @@ function beginTerrainImport() ProjectImportWizardPage5-->processingText.setText("Processing Terrain Asset file: " @ %file); Canvas.repaint(); - warn("Importing Terrain file: " @ %file); + $ProjectImporter::log.add("Importing Terrain file: " @ %file); %moduleDef = AssetBrowser.dirHandler.getModuleFromAddress(%file); %moduleName = %moduleDef.ModuleID; @@ -1039,7 +1065,8 @@ function beginTerrainImport() { 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 @ "/*.*" ); } - 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() { - echo("==========================================="); - echo("Importing GUIs"); - echo("==========================================="); + $ProjectImporter::log.add("==========================================="); + $ProjectImporter::log.add("Importing GUIs"); + $ProjectImporter::log.add("==========================================="); %currentAddress = $ProjectImporter::modulePath; @@ -1128,14 +1155,14 @@ function beginGUIImport() %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) { - warn("Processing GUI into asset: " @ %guiName @ ", file: " @ %file); + $ProjectImporter::log.add("Processing GUI into asset: " @ %guiName @ ", file: " @ %file); %filePath = filePath(%file); %fileName = fileBase(%file); @@ -1182,9 +1209,9 @@ function processGUIntoAsset(%guiName, %file) //============================================================================== function beginPostFXImport() { - echo("==========================================="); - echo("Importing PostFXs"); - echo("==========================================="); + $ProjectImporter::log.add("==========================================="); + $ProjectImporter::log.add("Importing PostFXs"); + $ProjectImporter::log.add("==========================================="); %count = PostFXManager.Count(); for(%i=0; %i < %count; %i++) @@ -1193,7 +1220,7 @@ function beginPostFXImport() if(isObject(%postEffect)) { - echo("Processing import of PostFX: " @ %postEffect.getName()); + $ProjectImporter::log.add("Processing import of PostFX: " @ %postEffect.getName()); //$ProjectImporter::persistMgr.setDirty(%gui); } @@ -1201,9 +1228,9 @@ function beginPostFXImport() //$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() { - echo("==========================================="); - echo("Importing Level files"); - echo("==========================================="); + $ProjectImporter::log.add("==========================================="); + $ProjectImporter::log.add("Importing Level files"); + $ProjectImporter::log.add("==========================================="); %currentAddress = $ProjectImporter::modulePath; @@ -1239,7 +1266,7 @@ function beginLevelImport() ProjectImportWizardPage5-->processingText.setText("Processing Level Asset file: " @ %file); Canvas.repaint(); - warn("Importing Level file: " @ %file); + $ProjectImporter::log.add("Importing Level file: " @ %file); %moduleName = AssetBrowser.dirHandler.getModuleFromAddress(%file).ModuleId; @@ -1249,7 +1276,7 @@ function beginLevelImport() 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; } @@ -1329,9 +1356,9 @@ function beginLevelImport() %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() { - echo("==========================================="); - echo("Deleting Asset Definitions"); - echo("==========================================="); + $ProjectImporter::log.add("==========================================="); + $ProjectImporter::log.add("Deleting Asset Definitions"); + $ProjectImporter::log.add("==========================================="); %currentAddress = $deleteAssetDefsTargetFolder; @@ -1388,27 +1415,27 @@ function doDeleteAssetDefinitions() { if(fileDelete(%file)) { - echo("File: " @ %file @ " deleted successfully."); + $ProjectImporter::log.add("File: " @ %file @ " deleted successfully."); } else { - error("File: " @ %file @ " failed to delete."); + $ProjectImporter::log.add("File: " @ %file @ " failed to delete."); } } %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) { - 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 %file = findFirstFileMultiExpr( "*/*.*", true); @@ -1452,12 +1479,21 @@ function scanForDuplicateFiles(%toTestFile) if(%moduleName !$= "" && %testModuleName !$= "" && %moduleName $= %testModuleName) { //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( "*/*.*" ); } +} + +function getImporterLogs() +{ + %lineCount = $ProjectImporter::importer.getActivityLogLineCount(); + for(%i=0; %i < %lineCount; %i++) + { + $ProjectImporter::log.add($ProjectImporter::importer.getActivityLogLine(%i)); + } } \ No newline at end of file From e45b959d7d5b056719538ecc1fa845bcfc837729 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Wed, 3 Nov 2021 12:30:52 -0500 Subject: [PATCH 09/17] correct imageassetarrays having a singular texture profile as oposed to a type per. while that certainly works for most cases it falls apart when dealing with postfx where it's an unnamed array of variable types of inputs. shifted the profile assignment to #define INIT_IMAGEASSET_ARRAY(name, profile, index) so there's still a really obvious point where you can see the default setting, even if it's not in the more desireable OG definition spot for postfx in particular, given we can swap that, provided an example of how to do just that --- Engine/source/T3D/assets/ImageAsset.h | 15 +++++++++--- Engine/source/T3D/fx/splash.cpp | 2 +- Engine/source/T3D/fx/splash.h | 2 +- Engine/source/environment/basicClouds.cpp | 3 +++ Engine/source/environment/basicClouds.h | 4 ++-- Engine/source/gfx/sim/cubemapData.cpp | 2 +- Engine/source/gfx/sim/cubemapData.h | 2 +- Engine/source/gui/controls/guiPopUpCtrl.cpp | 4 ++-- Engine/source/gui/controls/guiPopUpCtrl.h | 2 +- Engine/source/gui/controls/guiPopUpCtrlEx.cpp | 4 ++-- Engine/source/gui/controls/guiPopUpCtrlEx.h | 2 +- .../source/materials/materialDefinition.cpp | 24 +++++++++---------- Engine/source/materials/materialDefinition.h | 24 +++++++++---------- Engine/source/postFx/postEffect.cpp | 22 ++++++++++------- Engine/source/postFx/postEffect.h | 2 +- 15 files changed, 66 insertions(+), 48 deletions(-) diff --git a/Engine/source/T3D/assets/ImageAsset.h b/Engine/source/T3D/assets/ImageAsset.h index d4de538f7..f53cb4fa0 100644 --- a/Engine/source/T3D/assets/ImageAsset.h +++ b/Engine/source/T3D/assets/ImageAsset.h @@ -304,13 +304,13 @@ if (m##name##AssetId != StringTable->EmptyString())\ #pragma region Arrayed Asset Macros //Arrayed Assets -#define DECLARE_IMAGEASSET_ARRAY(className, name, profile, max) public: \ +#define DECLARE_IMAGEASSET_ARRAY(className, name, max) public: \ static const U32 sm##name##Count = max;\ GFXTexHandle m##name[max];\ StringTableEntry m##name##Name[max]; \ StringTableEntry m##name##AssetId[max];\ AssetPtr m##name##Asset[max];\ - GFXTextureProfile * m##name##Profile = &profile;\ + GFXTextureProfile * m##name##Profile[max];\ public: \ const StringTableEntry get##name##File(const U32& index) const { return m##name##Name[index]; }\ void set##name##File(const FileName &_in, const U32& index) { m##name##Name[index] = StringTable->insert(_in.c_str());}\ @@ -374,7 +374,7 @@ public: \ }\ if (get##name(index) != StringTable->EmptyString() && m##name##Name[index] != StringTable->insert("texhandle"))\ {\ - m##name[index].set(get##name(index), m##name##Profile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__));\ + m##name[index].set(get##name(index), m##name##Profile[index], avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__));\ }\ else\ {\ @@ -445,6 +445,15 @@ public: \ return ret;\ } +#define INIT_IMAGEASSET_ARRAY(name, profile, index) \ +{\ + m##name##Name[index] = StringTable->EmptyString(); \ + m##name##AssetId[index] = StringTable->EmptyString(); \ + m##name##Asset[index] = NULL;\ + m##name[index] = NULL;\ + m##name##Profile[index] = &profile;\ +} + #define DEF_IMAGEASSET_ARRAY_BINDS(className,name)\ DefineEngineMethod(className, get##name, const char*, (S32 index), , "get name")\ {\ diff --git a/Engine/source/T3D/fx/splash.cpp b/Engine/source/T3D/fx/splash.cpp index 3ae7e54b4..7cc835c93 100644 --- a/Engine/source/T3D/fx/splash.cpp +++ b/Engine/source/T3D/fx/splash.cpp @@ -98,7 +98,7 @@ SplashData::SplashData() U32 i; for (i = 0; i < NUM_TEX; i++) { - INIT_ASSET_ARRAY(Texture, i); + INIT_IMAGEASSET_ARRAY(Texture, GFXStaticTextureSRGBProfile, i); } for( i=0; i Date: Wed, 3 Nov 2021 18:27:26 -0400 Subject: [PATCH 10/17] * [TAML] BugFix: Correct a delete and new[] mismatch in tamlWriteNode reported by ASAN. --- Engine/source/persistence/taml/tamlWriteNode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/persistence/taml/tamlWriteNode.cpp b/Engine/source/persistence/taml/tamlWriteNode.cpp index 7baa138b2..25aaf4515 100644 --- a/Engine/source/persistence/taml/tamlWriteNode.cpp +++ b/Engine/source/persistence/taml/tamlWriteNode.cpp @@ -35,7 +35,7 @@ void TamlWriteNode::resetNode( void ) // Clear fields. for( Vector::iterator itr = mFields.begin(); itr != mFields.end(); ++itr ) { - delete (*itr)->mpValue; + delete[] (*itr)->mpValue; } mFields.clear(); From 19e4643707c7bc101c6f6f514b50ab55259cd2dd Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Wed, 3 Nov 2021 21:15:00 -0500 Subject: [PATCH 11/17] new method tsstatic.getNodeTransform used to look up a given node's transform by explicit name in a tsstatic object --- Engine/source/T3D/tsStatic.cpp | 29 +++++++++++++++++++++++++++++ Engine/source/T3D/tsStatic.h | 1 + 2 files changed, 30 insertions(+) diff --git a/Engine/source/T3D/tsStatic.cpp b/Engine/source/T3D/tsStatic.cpp index 169e6d806..8e090ef9f 100644 --- a/Engine/source/T3D/tsStatic.cpp +++ b/Engine/source/T3D/tsStatic.cpp @@ -54,6 +54,7 @@ #include "materials/materialFeatureTypes.h" #include "console/engineAPI.h" #include "T3D/accumulationVolume.h" +#include "math/mTransform.h" #include "gui/editor/inspector/group.h" #include "console/typeValidators.h" @@ -1863,3 +1864,31 @@ void TSStatic::setSelectionFlags(U8 flags) } } +void TSStatic::getNodeTransform(const char *nodeName, const MatrixF &xfm, MatrixF *outMat) +{ + + S32 nodeIDx = getShapeResource()->findNode(nodeName); + + MatrixF mountTransform = mShapeInstance->mNodeTransforms[nodeIDx]; + mountTransform.mul(xfm); + const Point3F &scale = getScale(); + // The position of the mount point needs to be scaled. + Point3F position = mountTransform.getPosition(); + position.convolve(scale); + mountTransform.setPosition(position); + // Also we would like the object to be scaled to the model. + outMat->mul(mObjToWorld, mountTransform); + return; +} + + +DefineEngineMethod(TSStatic, getNodeTransform, TransformF, (const char *nodeName), , + "@brief Get the world transform of the specified mount slot.\n\n" + + "@param slot Image slot to query\n" + "@return the mount transform\n\n") +{ + MatrixF xf(true); + object->getNodeTransform(nodeName, MatrixF::Identity, &xf); + return xf; +} diff --git a/Engine/source/T3D/tsStatic.h b/Engine/source/T3D/tsStatic.h index 03c74c651..835310c3d 100644 --- a/Engine/source/T3D/tsStatic.h +++ b/Engine/source/T3D/tsStatic.h @@ -276,6 +276,7 @@ public: void updateMaterials(); bool isAnimated() { return mPlayAmbient; } + void getNodeTransform(const char *nodeName, const MatrixF &xfm, MatrixF *outMat); virtual void getUtilizedAssets(Vector* usedAssetsList); From e211f502e8f229b9110e087e8a18f4f949d3aeb1 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Thu, 4 Nov 2021 15:44:43 -0500 Subject: [PATCH 12/17] better handle old style references to named texture targets --- Engine/source/T3D/assets/ImageAsset.h | 7 ++++++- Engine/source/postFx/postEffect.cpp | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Engine/source/T3D/assets/ImageAsset.h b/Engine/source/T3D/assets/ImageAsset.h index f53cb4fa0..927d8e03e 100644 --- a/Engine/source/T3D/assets/ImageAsset.h +++ b/Engine/source/T3D/assets/ImageAsset.h @@ -405,7 +405,12 @@ public: \ else if (m##name##AssetId[index] != StringTable->EmptyString())\ return m##name##AssetId[index];\ else if (m##name##Name[index] != StringTable->EmptyString())\ - return StringTable->insert(Platform::makeRelativePathName(m##name##Name[index], Platform::getMainDotCsDir()));\ + {\ + if (String(m##name##Name[index]).startsWith("#") || String(m##name##Name[index]).startsWith("$"))\ + return StringTable->insert(m##name##Name[index]);\ + else\ + return StringTable->insert(Platform::makeRelativePathName(m##name##Name[index], Platform::getMainDotCsDir()));\ + }\ else\ return StringTable->EmptyString();\ }\ diff --git a/Engine/source/postFx/postEffect.cpp b/Engine/source/postFx/postEffect.cpp index fd6da0612..ca6baeb89 100644 --- a/Engine/source/postFx/postEffect.cpp +++ b/Engine/source/postFx/postEffect.cpp @@ -1122,7 +1122,7 @@ void PostEffect::_setupConstants( const SceneRenderState *state ) void PostEffect::_setupTexture( U32 stage, GFXTexHandle &inputTex, const RectI *inTexViewport ) { - const String &texFilename = mTextureName[ stage ]; + const String &texFilename = getTexture( stage ); GFXTexHandle theTex; NamedTexTarget *namedTarget = NULL; From b3cd08520e89f6757096dd2df6198a152b83090c Mon Sep 17 00:00:00 2001 From: JeffR Date: Fri, 5 Nov 2021 17:49:48 -0500 Subject: [PATCH 13/17] Disables generation of the materials script files by the internal shape import processor. Material script files are now only generated by the AssetImporter as part of the shape injest process. Renames validateImportingAssets to hasImportIssues for AssetImporter console method for clarity Updated console method documentation for AssetImporter methods Fixed logical error for material asset generation if the import config was set to use existing materials but one was not found. Fixed logical error when a shapeFile has a material with a texture mapped to it is not in the same directory as the shape, it would not correctly find the texture Adjusts AssetImport window logic so it will display the window in the event of import issues being detected, or the asset is being re-imported. Updates the AssetImport window activity log to use the new AssetImporter's log for consistency. --- Engine/source/T3D/assets/assetImporter.cpp | 34 +++--- .../T3D/assets/assetImporter_ScriptBinding.h | 101 ++++++++---------- Engine/source/ts/assimp/assimpShapeLoader.cpp | 1 + .../source/ts/collada/colladaShapeLoader.cpp | 2 + .../assetBrowser/scripts/assetImport.tscript | 13 +-- .../scripts/assetImportConfig.tscript | 12 --- 6 files changed, 64 insertions(+), 99 deletions(-) diff --git a/Engine/source/T3D/assets/assetImporter.cpp b/Engine/source/T3D/assets/assetImporter.cpp index 65c18d664..2b284f5a5 100644 --- a/Engine/source/T3D/assets/assetImporter.cpp +++ b/Engine/source/T3D/assets/assetImporter.cpp @@ -1617,6 +1617,7 @@ void AssetImporter::processMaterialAsset(AssetImportObject* assetItem) } } + bool foundExistingMaterial = false; if (activeImportConfig->UseExistingMaterials) { //So if the material already exists, we should just use that. So first, let's find out if it already exists @@ -1651,9 +1652,11 @@ void AssetImporter::processMaterialAsset(AssetImportObject* assetItem) { //We found a match, so just modify our asset item's info to point against it. This will create the asset definition, but otherwise leave the material definition as-is. assetItem->filePath = (Torque::Path)(mat->getFilename()); + foundExistingMaterial = true; } } - else + + if(!foundExistingMaterial) { if (activeImportConfig->AlwaysAddMaterialSuffix) //we only opt to force on the suffix if we're not obligating using the original material defs { @@ -1811,19 +1814,6 @@ void AssetImporter::processMaterialAsset(AssetImportObject* assetItem) } } } - - /*for (U32 i = 0; i < assetItem->childAssetItems.size(); i++) - { - AssetImportObject* childAssetItem = assetItem->childAssetItems[i]; - - if (childAssetItem->skip || childAssetItem->processed || childAssetItem->assetType != String("ImageAsset")) - continue; - - if (childAssetItem->imageSuffixType == String("Albedo")) - { - assetItem->diffuseImageAsset = % childAssetItem; - } - }*/ } } @@ -1963,7 +1953,7 @@ void AssetImporter::processShapeMaterialInfo(AssetImportObject* assetItem, S32 m else { Torque::Path filePath = materialItemValue; - String fullFilePath = filePath.getFullFileName().c_str(); + String fullFilePath = filePath.getFullPath().c_str(); String shapePathBase = assetItem->filePath.getRootAndPath(); if (fullFilePath.isNotEmpty()) @@ -1977,24 +1967,26 @@ void AssetImporter::processShapeMaterialInfo(AssetImportObject* assetItem, S32 m fullFilePath = fullFilePath.replace(" (Not Found)", ""); fullFilePath = fullFilePath.replace(" (not found)", ""); - String testFileName = shapePathBase + "/" + fullFilePath; - if (Platform::isFile(testFileName.c_str())) + if(filePath.getPath().isEmpty()) + fullFilePath = shapePathBase + "/" + fullFilePath; + + if (Platform::isFile(fullFilePath.c_str())) { - filePath = testFileName; + filePath = Torque::Path(fullFilePath); } else { //Hmm, didn't find it. It could be that the in-model filename could be different by virtue of //image extension. Some files have source content files like psd's, but the mesh was exported to use //a dds or png, etc - Torque::Path testFilePath = testFileName; + Torque::Path testFilePath = fullFilePath; String imgFileName = AssetImporter::findImagePath(testFilePath.getPath() + "/" + testFilePath.getFileName()); if (imgFileName.isNotEmpty()) filePath = imgFileName; } } - matAssetItem = addImportingAsset("MaterialAsset", shapePathBase + "/", assetItem, matName); + matAssetItem = addImportingAsset("MaterialAsset", shapePathBase + "/" + matName, assetItem, matName); AssetImportObject* imageAssetItem = addImportingAsset("ImageAsset", filePath, matAssetItem, ""); String suffixType; @@ -2831,7 +2823,7 @@ Torque::Path AssetImporter::importMaterialAsset(AssetImportObject* assetItem) } assetFieldName = mapFieldName + "Asset"; - mapFieldName += "[0]"; + assetFieldName += "[0]"; //String path = childItem->filePath.getFullFileName(); //dSprintf(lineBuffer, 1024, " %s = \"%s\";", mapFieldName.c_str(), path.c_str()); diff --git a/Engine/source/T3D/assets/assetImporter_ScriptBinding.h b/Engine/source/T3D/assets/assetImporter_ScriptBinding.h index e52da2c52..aa50c82de 100644 --- a/Engine/source/T3D/assets/assetImporter_ScriptBinding.h +++ b/Engine/source/T3D/assets/assetImporter_ScriptBinding.h @@ -6,113 +6,114 @@ //Console Functions DefineEngineMethod(AssetImportConfig, loadImportConfig, void, (Settings* configSettings, String configName), (nullAsType(), ""), - "Creates a new script asset using the targetFilePath.\n" - "@return The bool result of calling exec") + "Loads the provided import config to the importer.\n" + "@param configSettings A Settings object containing the import configs.\n" + "@param configName The specific name of the config to be used.") { return object->loadImportConfig(configSettings, configName); } DefineEngineMethod(AssetImporter, setTargetPath, void, (String path), (""), - "Creates a new script asset using the targetFilePath.\n" - "@return The bool result of calling exec") + "Sets the target path the importing assets will be put into.\n" + "@param A string of the target path.") { return object->setTargetPath(path); } DefineEngineMethod(AssetImporter, resetImportSession, void, (bool forceResetSession), (false), - "Creates a new script asset using the targetFilePath.\n" - "@return The bool result of calling exec") + "Resets the importer's import session. All existing import items, logs, etc will be cleared.") { return object->resetImportSession(forceResetSession); } DefineEngineMethod(AssetImporter, dumpActivityLog, void, (), , - "Creates a new script asset using the targetFilePath.\n" - "@return The bool result of calling exec") + "Dumps the import activity log. If the importer is set to, it will save to file, otherwise dump to console.") { return object->dumpActivityLog(); } DefineEngineMethod(AssetImporter, getActivityLogLineCount, S32, (),, - "Creates a new script asset using the targetFilePath.\n" - "@return The bool result of calling exec") + "Gets the number of lines in the import activity log.\n" + "@return The number of lines in the import activity log.") { return object->getActivityLogLineCount(); } -DefineEngineMethod(AssetImporter, getActivityLogLine, String, (S32 i), (0), - "Creates a new script asset using the targetFilePath.\n" - "@return The bool result of calling exec") +DefineEngineMethod(AssetImporter, getActivityLogLine, String, (S32 index), (0), + "Gets a specific line in the import activity log.\n" + "@param index The index of the line to be returned.\n" + "@return The string of the requested line of the activity log") { - return object->getActivityLogLine(i); + return object->getActivityLogLine(index); } DefineEngineMethod(AssetImporter, autoImportFile, String, (String path, String typeHint), ("", ""), - "Creates a new script asset using the targetFilePath.\n" - "@return The bool result of calling exec") + "Run the full import process on a specific file.\n" + "@return If import is successful, the assetId of the new asset. If it failed, an empty string.") { return object->autoImportFile(path, typeHint); } DefineEngineMethod(AssetImporter, addImportingFile, AssetImportObject*, (String path), (""), - "Creates a new script asset using the targetFilePath.\n" - "@return The bool result of calling exec") + "Adds a filepath to the current importing session.\n" + "@param path The path to the file to be imported.\n" + "@return The AssetImportObject from the import session.") { return object->addImportingFile(path); } DefineEngineMethod(AssetImporter, addImportingAssetItem, void, (AssetImportObject* assetItem, AssetImportObject* parentItem), (nullAsType< AssetImportObject*>(), nullAsType< AssetImportObject*>()), - "Creates a new script asset using the targetFilePath.\n" - "@return The bool result of calling exec") + "Adds an existing AssetImportObject to the current improting session.\n" + "@param assetItem The AssetImportObject to be added to the import session.\n" + "@param parentItem An AssetImportObject that to act as the parent of the item being added.") { return object->addImportingAssetItem(assetItem, parentItem); } DefineEngineMethod(AssetImporter, processImportingAssets, void, (), , - "Creates a new script asset using the targetFilePath.\n" - "@return The bool result of calling exec") + "Processes the importing assets.") { return object->processImportAssets(); } -DefineEngineMethod(AssetImporter, validateImportingAssets, bool, (), , - "Creates a new script asset using the targetFilePath.\n" - "@return The bool result of calling exec") +DefineEngineMethod(AssetImporter, hasImportIssues, bool, (), , + "Validates the status of the importing items.\n" + "@return False if there are no issues, true if there are importing issues") { return object->validateAssets(); } DefineEngineMethod(AssetImporter, resolveAssetItemIssues, void, (AssetImportObject* assetItem), (nullAsType< AssetImportObject*>()), - "Creates a new script asset using the targetFilePath.\n" - "@return The bool result of calling exec") + "Runs the issue resolver to attempt to correct any simple issues, such as utilizing the config's settings to resolve collisions.") { object->resolveAssetItemIssues(assetItem); } DefineEngineMethod(AssetImporter, importAssets, void, (),, - "Creates a new script asset using the targetFilePath.\n" - "@return The bool result of calling exec") + "Runs the actual import action on the items.") { return object->importAssets(); } DefineEngineMethod(AssetImporter, getAssetItemCount, S32, (),, - "Creates a new script asset using the targetFilePath.\n" - "@return The bool result of calling exec") + "Gets the number of importing asset items.\n" + "@return The number of importing asset items") { return object->getAssetItemCount(); } DefineEngineMethod(AssetImporter, getAssetItem, AssetImportObject*, (S32 index), (0), - "Creates a new script asset using the targetFilePath.\n" - "@return The bool result of calling exec") + "Gets a specific import asset item.\n" + "@param index The index of the AssetImportObject to be returned.\n" + "@return AssetImportObject") { return object->getAssetItem(index); } DefineEngineMethod(AssetImporter, getAssetItemChildCount, S32, (AssetImportObject* assetItem), (nullAsType< AssetImportObject*>()), - "Creates a new script asset using the targetFilePath.\n" - "@return The bool result of calling exec") + "Gets number of child items for a given importing asset item.\n" + "@param assetItem The AssetImportObject to get the number of children of.\n" + "@return The number of child items") { if (assetItem == nullptr) return 0; @@ -121,8 +122,10 @@ DefineEngineMethod(AssetImporter, getAssetItemChildCount, S32, (AssetImportObjec } DefineEngineMethod(AssetImporter, getAssetItemChild, AssetImportObject*, (AssetImportObject* assetItem, S32 index), (nullAsType< AssetImportObject*>(), 0), - "Creates a new script asset using the targetFilePath.\n" - "@return The bool result of calling exec") + "Gets a specific child item of a given importing asset item.\n" + "@param assetItem The AssetImportObject to get the child from.\n" + "@param index The index of the child to get.\n" + "@return The child AssetImportObect") { if (assetItem == nullptr) return nullptr; @@ -131,31 +134,15 @@ DefineEngineMethod(AssetImporter, getAssetItemChild, AssetImportObject*, (AssetI } DefineEngineMethod(AssetImporter, deleteImportingAsset, void, (AssetImportObject* assetItem), (nullAsType< AssetImportObject*>()), - "Creates a new script asset using the targetFilePath.\n" - "@return The bool result of calling exec") + "Deletes an importing AssetImportObject from the import session.\n" + "@param assetItem The AssetImportObject to delete.") { return object->deleteImportingAsset(assetItem); } DefineEngineMethod(AssetImporter, setImportConfig, void, (AssetImportConfig* importConfig), (nullAsType< AssetImportConfig*>()), - "Creates a new script asset using the targetFilePath.\n" - "@return The bool result of calling exec") + "Sets the import config to be used via a AssetImportConfig object.\n" + "@param importConfig The AssetImportConfig object to use.") { return object->setImportConfig(importConfig); } - - -/*DefineEngineFunction(enumColladaForImport, bool, (const char* shapePath, const char* ctrl, bool loadCachedDts), ("", "", true), - "(string shapePath, GuiTreeViewCtrl ctrl) Collect scene information from " - "a COLLADA file and store it in a GuiTreeView control. This function is " - "used by the COLLADA import gui to show a preview of the scene contents " - "prior to import, and is probably not much use for anything else.\n" - "@param shapePath COLLADA filename\n" - "@param ctrl GuiTreeView control to add elements to\n" - "@param loadCachedDts dictates if it should try and load the cached dts file if it exists" - "@return true if successful, false otherwise\n" - "@ingroup Editors\n" - "@internal") -{ - return enumColladaForImport(shapePath, ctrl, loadCachedDts); -}*/ diff --git a/Engine/source/ts/assimp/assimpShapeLoader.cpp b/Engine/source/ts/assimp/assimpShapeLoader.cpp index 17b0a970b..6659f1092 100644 --- a/Engine/source/ts/assimp/assimpShapeLoader.cpp +++ b/Engine/source/ts/assimp/assimpShapeLoader.cpp @@ -425,6 +425,7 @@ bool AssimpShapeLoader::fillGuiTreeView(const char* sourceShapePath, GuiTreeView void AssimpShapeLoader::updateMaterialsScript(const Torque::Path &path) { + return; Torque::Path scriptPath(path); scriptPath.setFileName("materials"); scriptPath.setExtension(TORQUE_SCRIPT_EXTENSION); diff --git a/Engine/source/ts/collada/colladaShapeLoader.cpp b/Engine/source/ts/collada/colladaShapeLoader.cpp index 8021d25f1..7884e1a63 100644 --- a/Engine/source/ts/collada/colladaShapeLoader.cpp +++ b/Engine/source/ts/collada/colladaShapeLoader.cpp @@ -461,6 +461,8 @@ void updateMaterialsScript(const Torque::Path &path, bool copyTextures = false) return; #endif + return; + Torque::Path scriptPath(path); scriptPath.setFileName("materials"); scriptPath.setExtension(TORQUE_SCRIPT_EXTENSION); diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.tscript index 1b42f482f..14023d9b2 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.tscript @@ -85,8 +85,6 @@ function ImportAssetWindow::onWake(%this) %this.importer.targetPath = AssetImportTargetAddress.getText(); %this.importer.targetModuleId = AssetImportTargetModule.getText(); - ImportActivityLog.empty(); - %this.refresh(); } @@ -519,7 +517,8 @@ function ImportAssetWindow::doRefresh(%this) if(ImportAssetWindow.importConfigsList.count() != 0 && EditorSettings.value("Assets/AssetImporDefaultConfig") !$= "" && EditorSettings.value("Assets/AutoImport", false) == true - && ImportAssetWindow.hasImportIssues == false + && ImportAssetWindow.hasImportIssues() == false + && AssetBrowser.isAssetReImport == false && ImportAssetWindow.allowAutoImport) { AssetImportCtrl.setHidden(true); @@ -722,11 +721,7 @@ function NewAssetsPanelInputs::onRightMouseDown(%this) // function ImportAssetWindow::removeImportingAsset(%this) { - ImportActivityLog.add("Removing Asset from Import"); - %this.importer.deleteImportingAsset(ImportAssetActions.assetItem); - - //ImportAssetWindow.refresh(); } function ImportAssetWindow::addNewImportingAsset(%this, %filterType) @@ -924,9 +919,9 @@ function ImportAssetWindow::toggleLogWindow() } ImportLogTextList.clear(); - for(%i=0; %i < ImportActivityLog.count(); %i++) + for(%i=0; %i < ImportAssetWindow.importer.getActivityLogLineCount(); %i++) { - ImportLogTextList.addRow(%i, ImportActivityLog.getKey(%i)); + ImportLogTextList.addRow(%i,ImportAssetWindow.importer.getActivityLogLine(%i)); } } // diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.tscript index 44be3b3ce..39ed541db 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.tscript @@ -3,12 +3,6 @@ function ImportAssetConfigList::onSelect( %this, %id, %text ) //Apply our settings to the assets echo("Changed our import config!"); - if(ImportActivityLog.count() != 0) - ImportActivityLog.add(""); - - ImportActivityLog.add("Asset Import Configs set to " @ %text); - ImportActivityLog.add(""); - ImportAssetWindow.activeImportConfigIndex = %id; //ImportAssetWindow.activeImportConfig = ImportAssetWindow.importConfigsList.getKey(%id); @@ -236,12 +230,6 @@ function ImportAssetOptionsWindow::saveAssetOptions(%this) { %success = AssetImportSettings.write(); - if(ImportActivityLog.count() != 0) - ImportActivityLog.add(""); - - ImportActivityLog.add("Asset Import Configs saved, refreshing Import session"); - ImportActivityLog.add(""); - ImportAssetWindow.refresh(); ImportAssetOptionsWindow.setVisible(0); } From a6a7d6e1a1768bb4ef9f37652d218af36e06bf92 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Sat, 6 Nov 2021 20:34:12 -0400 Subject: [PATCH 14/17] * [Tokenizer] BugFix: Correct a malloc/delete mismatch in the tokenizer programming. --- Engine/source/core/tokenizer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Engine/source/core/tokenizer.cpp b/Engine/source/core/tokenizer.cpp index 6d155d18a..e34c35819 100644 --- a/Engine/source/core/tokenizer.cpp +++ b/Engine/source/core/tokenizer.cpp @@ -109,7 +109,10 @@ void Tokenizer::setBuffer(const char* buffer, U32 bufferSize) void Tokenizer::setSingleTokens(const char* singleTokens) { if (mSingleTokens) - SAFE_DELETE(mSingleTokens); + { + free(mSingleTokens); + mSingleTokens = NULL; + } if (singleTokens) mSingleTokens = dStrdup(singleTokens); From 3fdd7266e340f87b6c1e97ec78de7c9f65fd2265 Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Sat, 6 Nov 2021 22:56:05 -0400 Subject: [PATCH 15/17] Better Architecture detection strategy if compiling on Apple Silicon --- Tools/CMake/torque3d.cmake | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Tools/CMake/torque3d.cmake b/Tools/CMake/torque3d.cmake index 0629e944a..eadc2673a 100644 --- a/Tools/CMake/torque3d.cmake +++ b/Tools/CMake/torque3d.cmake @@ -745,14 +745,13 @@ if (APPLE AND NOT IOS) set(ARCHITECTURE_STRING_APPLE "x86_64;arm64") set(DEPLOYMENT_TARGET_APPLE "10.13") else() - check_c_compiler_flag("-arch arm64" armSupportedApple) - if(armSupportedApple) + if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm64") set(ARCHITECTURE_STRING_APPLE "arm64") set(DEPLOYMENT_TARGET_APPLE "11.0") else() set(ARCHITECTURE_STRING_APPLE "x86_64") set(DEPLOYMENT_TARGET_APPLE "10.9") - endif() + endif() endif() set(CMAKE_OSX_ARCHITECTURES ${ARCHITECTURE_STRING_APPLE} CACHE STRING "OSX Architecture" FORCE) From 733b71ccad97827a88b076a59728c4b13d7e923e Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Sun, 7 Nov 2021 14:52:25 -0600 Subject: [PATCH 16/17] fill out a %this variable for trigger callbacks --- Engine/source/T3D/trigger.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Engine/source/T3D/trigger.cpp b/Engine/source/T3D/trigger.cpp index e6b1d2027..1d075d7c3 100644 --- a/Engine/source/T3D/trigger.cpp +++ b/Engine/source/T3D/trigger.cpp @@ -731,7 +731,8 @@ void Trigger::potentialEnterObject(GameBase* enter) if(evalCmD(&mEnterCommand)) { - String command = String("%obj = ") + enter->getIdString() + ";" + mEnterCommand; + String command = String("%obj = ") + enter->getIdString() + ";"; + command = command + String("%this = ") + getIdString() + ";" + mEnterCommand; Con::evaluate(command.c_str()); } @@ -779,7 +780,8 @@ void Trigger::processTick(const Move* move) if (evalCmD(&mLeaveCommand)) { - String command = String("%obj = ") + remove->getIdString() + ";" + mLeaveCommand; + String command = String("%obj = ") + remove->getIdString() + ";"; + command = command + String("%this = ") + getIdString() + ";" + mLeaveCommand; Con::evaluate(command.c_str()); } if (testTrippable() && testCondition()) From a8116bbaf5abac5e2181af8026fddba7debc58c6 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Mon, 8 Nov 2021 15:31:07 -0500 Subject: [PATCH 17/17] * [AssetImporter] BugFix: Correct ASAN reported out of bounds reads in the asset import programming. --- Engine/source/T3D/assets/assetImporter.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Engine/source/T3D/assets/assetImporter.cpp b/Engine/source/T3D/assets/assetImporter.cpp index 65c18d664..c168e77f0 100644 --- a/Engine/source/T3D/assets/assetImporter.cpp +++ b/Engine/source/T3D/assets/assetImporter.cpp @@ -721,27 +721,27 @@ String AssetImporter::parseImageSuffixes(String assetName, String* suffixType) { case 0: suffixList = activeImportConfig->DiffuseTypeSuffixes; - suffixType->insert(0, "Albedo", 10); + suffixType->insert(0, "Albedo", 6); break; case 1: suffixList = activeImportConfig->NormalTypeSuffixes; - suffixType->insert(0, "Normal", 10); + suffixType->insert(0, "Normal", 6); break; case 2: suffixList = activeImportConfig->RoughnessTypeSuffixes; - suffixType->insert(0, "Roughness", 10); + suffixType->insert(0, "Roughness", 9); break; case 3: suffixList = activeImportConfig->AOTypeSuffixes; - suffixType->insert(0, "AO", 10); + suffixType->insert(0, "AO", 2); break; case 4: suffixList = activeImportConfig->MetalnessTypeSuffixes; - suffixType->insert(0, "Metalness", 10); + suffixType->insert(0, "Metalness", 9); break; case 5: suffixList = activeImportConfig->PBRTypeSuffixes; - suffixType->insert(0, "ORMConfig", 10); + suffixType->insert(0, "ORMConfig", 9); break; default: suffixList = "";