diff --git a/Engine/source/T3D/assets/ImageAsset.h b/Engine/source/T3D/assets/ImageAsset.h index d4de538f7..927d8e03e 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\ {\ @@ -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();\ }\ @@ -445,6 +450,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/assets/assetImporter.cpp b/Engine/source/T3D/assets/assetImporter.cpp index 8dc898dae..c28882fe8 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"); } // @@ -718,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 = ""; @@ -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()); + } } } @@ -1582,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 @@ -1616,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 { @@ -1776,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; - } - }*/ } } @@ -1928,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()) @@ -1942,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; @@ -2383,6 +2410,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 +2511,8 @@ void AssetImporter::importAssets(AssetImportObject* assetItem) //recurse if needed importAssets(item); } + + dumpActivityLog(); } // @@ -2793,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.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..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(0); + 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/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; igetIdString() + ";" + 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()) 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); 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] == '.') { 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/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); diff --git a/Engine/source/environment/basicClouds.cpp b/Engine/source/environment/basicClouds.cpp index 462bf573f..f6d6d8bdb 100644 --- a/Engine/source/environment/basicClouds.cpp +++ b/Engine/source/environment/basicClouds.cpp @@ -98,6 +98,9 @@ BasicClouds::BasicClouds() mTexOffset[0].set( 0.5f, 0.5f ); mTexOffset[1].set( 0.5f, 0.5f ); mTexOffset[2].set( 0.5f, 0.5f ); + + for (U32 i=0; i< TEX_COUNT;i++) + INIT_IMAGEASSET_ARRAY(Texture, GFXStaticTextureSRGBProfile, i); } IMPLEMENT_CO_NETOBJECT_V1( BasicClouds ); diff --git a/Engine/source/environment/basicClouds.h b/Engine/source/environment/basicClouds.h index 03b31af19..a9f6f874e 100644 --- a/Engine/source/environment/basicClouds.h +++ b/Engine/source/environment/basicClouds.h @@ -93,7 +93,7 @@ protected: static U32 smVertCount; static U32 smTriangleCount; - DECLARE_IMAGEASSET_ARRAY(BasicClouds, Texture, GFXStaticTextureSRGBProfile, TEX_COUNT); + DECLARE_IMAGEASSET_ARRAY(BasicClouds, Texture, TEX_COUNT); DECLARE_IMAGEASSET_ARRAY_NET_SETGET(BasicClouds, Texture, -1); GFXStateBlockRef mStateblock; @@ -122,4 +122,4 @@ protected: }; -#endif // _BASICCLOUDS_H_ \ No newline at end of file +#endif // _BASICCLOUDS_H_ diff --git a/Engine/source/gfx/sim/cubemapData.cpp b/Engine/source/gfx/sim/cubemapData.cpp index 3fbaf4afb..618e1842f 100644 --- a/Engine/source/gfx/sim/cubemapData.cpp +++ b/Engine/source/gfx/sim/cubemapData.cpp @@ -44,7 +44,7 @@ CubemapData::CubemapData() for (U32 i = 0; i < 6; i++) { - INIT_ASSET_ARRAY(CubeMapFace, i); + INIT_IMAGEASSET_ARRAY(CubeMapFace, GFXStaticTextureSRGBProfile, i); } INIT_ASSET(CubeMap); diff --git a/Engine/source/gfx/sim/cubemapData.h b/Engine/source/gfx/sim/cubemapData.h index c33cf7021..b6f97a2f9 100644 --- a/Engine/source/gfx/sim/cubemapData.h +++ b/Engine/source/gfx/sim/cubemapData.h @@ -76,7 +76,7 @@ protected: DECLARE_IMAGEASSET(CubemapData, CubeMap, onCubemapChanged, GFXStaticTextureSRGBProfile); DECLARE_ASSET_SETGET(CubemapData, CubeMap); - DECLARE_IMAGEASSET_ARRAY(CubemapData, CubeMapFace, GFXStaticTextureSRGBProfile, 6); + DECLARE_IMAGEASSET_ARRAY(CubemapData, CubeMapFace, 6); DECLARE_IMAGEASSET_ARRAY_SETGET(CubemapData, CubeMapFace); GFXTexHandle mDepthBuff; 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/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); + } } } diff --git a/Engine/source/gui/controls/guiPopUpCtrl.cpp b/Engine/source/gui/controls/guiPopUpCtrl.cpp index 8e9eb5c24..2e0f022b5 100644 --- a/Engine/source/gui/controls/guiPopUpCtrl.cpp +++ b/Engine/source/gui/controls/guiPopUpCtrl.cpp @@ -278,8 +278,8 @@ GuiPopUpMenuCtrl::GuiPopUpMenuCtrl(void) mBackgroundCancel = false; // Added mReverseTextList = false; // Added - Don't reverse text list if displaying up - INIT_ASSET_ARRAY(Bitmap, 0); - INIT_ASSET_ARRAY(Bitmap, 1); + INIT_IMAGEASSET_ARRAY(Bitmap, GFXDefaultGUIProfile, 0); + INIT_IMAGEASSET_ARRAY(Bitmap, GFXDefaultGUIProfile, 1); mBitmapBounds.set(16, 16); // Added mIdMax = -1; diff --git a/Engine/source/gui/controls/guiPopUpCtrl.h b/Engine/source/gui/controls/guiPopUpCtrl.h index 4ebc31794..d208fbfd2 100644 --- a/Engine/source/gui/controls/guiPopUpCtrl.h +++ b/Engine/source/gui/controls/guiPopUpCtrl.h @@ -126,7 +126,7 @@ protected: NumBitmapModes = 2 }; - DECLARE_IMAGEASSET_ARRAY(GuiPopUpMenuCtrl, Bitmap, GFXDefaultGUIProfile, NumBitmapModes); + DECLARE_IMAGEASSET_ARRAY(GuiPopUpMenuCtrl, Bitmap, NumBitmapModes); DECLARE_IMAGEASSET_ARRAY_SETGET(GuiPopUpMenuCtrl, Bitmap); Point2I mBitmapBounds; // Added diff --git a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp index 0a10d870c..fe9b20fa0 100644 --- a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp +++ b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp @@ -329,8 +329,8 @@ GuiPopUpMenuCtrlEx::GuiPopUpMenuCtrlEx(void) mBackgroundCancel = false; // Added mReverseTextList = false; // Added - Don't reverse text list if displaying up - INIT_ASSET_ARRAY(Bitmap, Normal); - INIT_ASSET_ARRAY(Bitmap, Depressed); + INIT_IMAGEASSET_ARRAY(Bitmap, GFXDefaultGUIProfile, Normal); + INIT_IMAGEASSET_ARRAY(Bitmap, GFXDefaultGUIProfile, Depressed); mBitmapBounds.set(16, 16); // Added mHotTrackItems = false; diff --git a/Engine/source/gui/controls/guiPopUpCtrlEx.h b/Engine/source/gui/controls/guiPopUpCtrlEx.h index c3f193156..d3018819e 100644 --- a/Engine/source/gui/controls/guiPopUpCtrlEx.h +++ b/Engine/source/gui/controls/guiPopUpCtrlEx.h @@ -127,7 +127,7 @@ class GuiPopUpMenuCtrlEx : public GuiTextCtrl NumBitmapModes = 2 }; - DECLARE_IMAGEASSET_ARRAY(GuiPopUpMenuCtrlEx, Bitmap, GFXDefaultGUIProfile, NumBitmapModes); + DECLARE_IMAGEASSET_ARRAY(GuiPopUpMenuCtrlEx, Bitmap, NumBitmapModes); DECLARE_IMAGEASSET_ARRAY_SETGET(GuiPopUpMenuCtrlEx, Bitmap); Point2I mBitmapBounds; // Added 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; diff --git a/Engine/source/materials/materialDefinition.cpp b/Engine/source/materials/materialDefinition.cpp index 34a26a617..5d009004a 100644 --- a/Engine/source/materials/materialDefinition.cpp +++ b/Engine/source/materials/materialDefinition.cpp @@ -142,18 +142,18 @@ Material::Material() mAccuCoverage[i] = 0.9f; mAccuSpecular[i] = 16.0f; - INIT_ASSET_ARRAY(DiffuseMap, i); - INIT_ASSET_ARRAY(OverlayMap, i); - INIT_ASSET_ARRAY(LightMap, i); - INIT_ASSET_ARRAY(ToneMap, i); - INIT_ASSET_ARRAY(DetailMap, i); - INIT_ASSET_ARRAY(NormalMap, i); - INIT_ASSET_ARRAY(ORMConfigMap, i); - INIT_ASSET_ARRAY(RoughMap, i); - INIT_ASSET_ARRAY(AOMap, i); - INIT_ASSET_ARRAY(MetalMap, i); - INIT_ASSET_ARRAY(GlowMap, i); - INIT_ASSET_ARRAY(DetailNormalMap, i); + INIT_IMAGEASSET_ARRAY(DiffuseMap, GFXStaticTextureSRGBProfile, i); + INIT_IMAGEASSET_ARRAY(OverlayMap, GFXStaticTextureProfile, i); + INIT_IMAGEASSET_ARRAY(LightMap, GFXStaticTextureProfile, i); + INIT_IMAGEASSET_ARRAY(ToneMap, GFXStaticTextureProfile, i); + INIT_IMAGEASSET_ARRAY(DetailMap, GFXStaticTextureProfile, i); + INIT_IMAGEASSET_ARRAY(NormalMap, GFXNormalMapProfile, i); + INIT_IMAGEASSET_ARRAY(ORMConfigMap, GFXStaticTextureProfile, i); + INIT_IMAGEASSET_ARRAY(RoughMap, GFXStaticTextureProfile, i); + INIT_IMAGEASSET_ARRAY(AOMap, GFXStaticTextureProfile, i); + INIT_IMAGEASSET_ARRAY(MetalMap, GFXStaticTextureProfile, i); + INIT_IMAGEASSET_ARRAY(GlowMap, GFXStaticTextureProfile, i); + INIT_IMAGEASSET_ARRAY(DetailNormalMap, GFXNormalMapProfile, i); mParallaxScale[i] = 0.0f; diff --git a/Engine/source/materials/materialDefinition.h b/Engine/source/materials/materialDefinition.h index e29f53695..d087a698a 100644 --- a/Engine/source/materials/materialDefinition.h +++ b/Engine/source/materials/materialDefinition.h @@ -207,49 +207,49 @@ public: //----------------------------------------------------------------------- // Data //----------------------------------------------------------------------- - DECLARE_IMAGEASSET_ARRAY(Material, DiffuseMap, GFXStaticTextureSRGBProfile, MAX_STAGES); + DECLARE_IMAGEASSET_ARRAY(Material, DiffuseMap, MAX_STAGES); DECLARE_IMAGEASSET_ARRAY_SETGET(Material, DiffuseMap); bool mDiffuseMapSRGB[MAX_STAGES]; // SRGB diffuse - DECLARE_IMAGEASSET_ARRAY(Material, OverlayMap, GFXStaticTextureProfile, MAX_STAGES); + DECLARE_IMAGEASSET_ARRAY(Material, OverlayMap, MAX_STAGES); DECLARE_IMAGEASSET_ARRAY_SETGET(Material, OverlayMap); - DECLARE_IMAGEASSET_ARRAY(Material, LightMap, GFXStaticTextureProfile, MAX_STAGES); + DECLARE_IMAGEASSET_ARRAY(Material, LightMap, MAX_STAGES); DECLARE_IMAGEASSET_ARRAY_SETGET(Material, LightMap); - DECLARE_IMAGEASSET_ARRAY(Material, ToneMap, GFXStaticTextureProfile, MAX_STAGES); + DECLARE_IMAGEASSET_ARRAY(Material, ToneMap, MAX_STAGES); DECLARE_IMAGEASSET_ARRAY_SETGET(Material, ToneMap); - DECLARE_IMAGEASSET_ARRAY(Material, DetailMap, GFXStaticTextureProfile, MAX_STAGES); + DECLARE_IMAGEASSET_ARRAY(Material, DetailMap, MAX_STAGES); DECLARE_IMAGEASSET_ARRAY_SETGET(Material, DetailMap); - DECLARE_IMAGEASSET_ARRAY(Material, NormalMap, GFXNormalMapProfile, MAX_STAGES); + DECLARE_IMAGEASSET_ARRAY(Material, NormalMap, MAX_STAGES); DECLARE_IMAGEASSET_ARRAY_SETGET(Material, NormalMap); - DECLARE_IMAGEASSET_ARRAY(Material, ORMConfigMap, GFXStaticTextureProfile, MAX_STAGES); + DECLARE_IMAGEASSET_ARRAY(Material, ORMConfigMap, MAX_STAGES); DECLARE_IMAGEASSET_ARRAY_SETGET(Material, ORMConfigMap); bool mIsSRGb[MAX_STAGES]; - DECLARE_IMAGEASSET_ARRAY(Material, RoughMap, GFXStaticTextureProfile, MAX_STAGES); + DECLARE_IMAGEASSET_ARRAY(Material, RoughMap, MAX_STAGES); DECLARE_IMAGEASSET_ARRAY_SETGET(Material, RoughMap); bool mInvertRoughness[MAX_STAGES]; F32 mRoughnessChan[MAX_STAGES]; - DECLARE_IMAGEASSET_ARRAY(Material, AOMap, GFXStaticTextureProfile, MAX_STAGES); + DECLARE_IMAGEASSET_ARRAY(Material, AOMap, MAX_STAGES); DECLARE_IMAGEASSET_ARRAY_SETGET(Material, AOMap); F32 mAOChan[MAX_STAGES]; - DECLARE_IMAGEASSET_ARRAY(Material, MetalMap, GFXStaticTextureProfile, MAX_STAGES); + DECLARE_IMAGEASSET_ARRAY(Material, MetalMap, MAX_STAGES); DECLARE_IMAGEASSET_ARRAY_SETGET(Material, MetalMap); F32 mMetalChan[MAX_STAGES]; - DECLARE_IMAGEASSET_ARRAY(Material, GlowMap, GFXStaticTextureProfile, MAX_STAGES); + DECLARE_IMAGEASSET_ARRAY(Material, GlowMap, MAX_STAGES); DECLARE_IMAGEASSET_ARRAY_SETGET(Material, GlowMap); F32 mGlowMul[MAX_STAGES]; /// A second normal map which repeats at the detail map /// scale and blended with the base normal map. - DECLARE_IMAGEASSET_ARRAY(Material, DetailNormalMap, GFXNormalMapProfile, MAX_STAGES); + DECLARE_IMAGEASSET_ARRAY(Material, DetailNormalMap, MAX_STAGES); DECLARE_IMAGEASSET_ARRAY_SETGET(Material, DetailNormalMap); /// The strength scalar for the detail normal map. 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(); 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 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; diff --git a/Engine/source/postFx/postEffect.cpp b/Engine/source/postFx/postEffect.cpp index 2f87ffa67..ca6baeb89 100644 --- a/Engine/source/postFx/postEffect.cpp +++ b/Engine/source/postFx/postEffect.cpp @@ -508,7 +508,7 @@ PostEffect::PostEffect() for (U32 i = 0; i < NumTextures; i++) { - INIT_ASSET_ARRAY(Texture, i); + INIT_IMAGEASSET_ARRAY(Texture, PostFxTextureProfile, i); } } @@ -602,9 +602,19 @@ bool PostEffect::onAdd() scriptPath.setExtension( String::EmptyString ); // Find additional textures - for( S32 i = 0; i < NumTextures; i++ ) + for (S32 i = 0; i < NumTextures; i++) { mTextureType[i] = NormalTextureType; + String texFilename = getTexture(i); + + // Skip empty stages or ones with variable or target names. + if (texFilename.isEmpty() || + texFilename[0] == '$' || + texFilename[0] == '#') + continue; + + mTextureProfile[i] = (mTexSRGB[i]) ? &PostFxTextureSRGBProfile : &PostFxTextureProfile; + _setTexture(texFilename, i); } // Is the target a named target? @@ -1112,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; @@ -1625,12 +1635,8 @@ void PostEffect::setTexture( U32 index, const String &texFilePath ) texFilePath[0] == '#' ) return; - GFXTextureProfile* profile = &PostFxTextureProfile; - if (mTexSRGB[index]) - profile = &PostFxTextureSRGBProfile; - - // Try to load the texture. - mTexture[index].set( texFilePath, profile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ) ); + mTextureProfile[index] = (mTexSRGB[index])? &PostFxTextureSRGBProfile : &PostFxTextureProfile; + _setTexture(texFilePath, index); mTextureType[index] = NormalTextureType; } diff --git a/Engine/source/postFx/postEffect.h b/Engine/source/postFx/postEffect.h index 287048100..94b457339 100644 --- a/Engine/source/postFx/postEffect.h +++ b/Engine/source/postFx/postEffect.h @@ -90,7 +90,7 @@ public: protected: - DECLARE_IMAGEASSET_ARRAY(PostEffect, Texture, PostFxTextureProfile, NumTextures); + DECLARE_IMAGEASSET_ARRAY(PostEffect, Texture, NumTextures); DECLARE_IMAGEASSET_ARRAY_SETGET(PostEffect, Texture); bool mTexSRGB[NumTextures]; 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 { 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/Engine/source/ts/tsShapeEdit.cpp b/Engine/source/ts/tsShapeEdit.cpp index 86583fef4..601b4ad87 100644 --- a/Engine/source/ts/tsShapeEdit.cpp +++ b/Engine/source/ts/tsShapeEdit.cpp @@ -1583,7 +1583,9 @@ bool TSShape::addSequence(const Torque::Path& path, const String& fromSeq, Con::errorf("%s groundTranslations out of bounds! [%i/%i] ", path.getFullPath().c_str(), groundBase + i, srcShape->groundTranslations.size()); 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()) @@ -1591,7 +1593,9 @@ bool TSShape::addSequence(const Torque::Path& path, const String& fromSeq, Con::errorf("%s groundRotations out of bounds! [%i/%i] ", path.getFullPath().c_str(), groundBase + i, srcShape->groundRotations.size()); offset2 = srcShape->groundRotations.size() - 1; } - groundRotations.push_back(srcShape->groundRotations[offset2]); + + const Quat16 quatValueToCopy = srcShape->groundRotations[offset2]; + groundRotations.push_back(quatValueToCopy); } // Add triggers 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); } 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 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)