From c7711f633b11781101f878a727f6ca850d8d0add Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Mon, 10 May 2021 21:08:23 -0400 Subject: [PATCH 01/17] some font changes for the macos platform. --- Engine/source/platformMac/macFont.mm | 66 ++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 18 deletions(-) diff --git a/Engine/source/platformMac/macFont.mm b/Engine/source/platformMac/macFont.mm index 9433c53d1..f4649c901 100644 --- a/Engine/source/platformMac/macFont.mm +++ b/Engine/source/platformMac/macFont.mm @@ -83,9 +83,34 @@ bool OSXFont::create( const char* name, dsize_t size, U32 charset ) { // Sanity! AssertFatal( name != NULL, "Cannot create a NULL font name." ); - + + bool doBold = false; + bool doItalic = false; + + String nameStr = name; + nameStr = nameStr.trim(); + + bool haveModifier; + do + { + haveModifier = false; + if( nameStr.compare( "Bold", 4, String::NoCase | String::Right ) == 0 ) + { + doBold = true; + nameStr = nameStr.substr( 0, nameStr.length() - 4 ).trim(); + haveModifier = true; + } + if( nameStr.compare( "Italic", 6, String::NoCase | String::Right ) == 0 ) + { + doItalic = true; + nameStr = nameStr.substr( 0, nameStr.length() - 6 ).trim(); + haveModifier = true; + } + } + while( haveModifier ); + // Generate compatible font name. - CFStringRef fontName = CFStringCreateWithCString( kCFAllocatorDefault, name, kCFStringEncodingUTF8 ); + NSString* fontName = [NSString stringWithUTF8String: nameStr.utf8()]; // Sanity! if ( !fontName ) @@ -94,12 +119,22 @@ bool OSXFont::create( const char* name, dsize_t size, U32 charset ) return false; } - // Use Windows as a baseline (96 DPI) and adjust accordingly. - F32 scaledSize = size * (72.0f/96.0f); - scaledSize = mRound(scaledSize); + NSMutableDictionary* fontAttributes = [NSMutableDictionary dictionaryWithObjectsAndKeys: + fontName, (NSString*)kCTFontFamilyNameAttribute, + [NSNumber numberWithFloat: (float)size], (NSString*)kCTFontSizeAttribute, + nil]; - // Create the font reference. - mFontRef = CTFontCreateWithName( fontName, scaledSize, NULL ); + CTFontSymbolicTraits traits = 0x0; + if (doBold) + traits |= kCTFontBoldTrait; + if (doItalic) + traits |= kCTFontItalicTrait; + + CTFontDescriptorRef descriptor = + CTFontDescriptorCreateWithAttributes((CFDictionaryRef)fontAttributes); + + mFontRef = CTFontCreateWithFontDescriptor(descriptor, 0.0, NULL); + CFRelease(descriptor); // Sanity! if ( !mFontRef ) @@ -108,6 +143,10 @@ bool OSXFont::create( const char* name, dsize_t size, U32 charset ) return false; } + // Apply font traits if we have any by creating a copy of the font + if (traits != 0x0) + mFontRef = CTFontCreateCopyWithSymbolicTraits(mFontRef, (float)size, NULL, traits, traits); + // Fetch font metrics. CGFloat ascent = CTFontGetAscent( mFontRef ); CGFloat descent = CTFontGetDescent( mFontRef ); @@ -227,17 +266,8 @@ PlatformFont::CharInfo& OSXFont::getCharInfo(const UTF16 character) const CGPoint renderOrigin; renderOrigin.x = -characterInfo.xOrigin; renderOrigin.y = -characterInfo.yOrigin; - -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 + CTFontDrawGlyphs( mFontRef, &characterGlyph, &renderOrigin, 1, bitmapContext ); -#else - CGFontRef cgFont = CTFontCopyGraphicsFont(mFontRef, NULL); - CGContextSetFont(bitmapContext, cgFont); - CGContextSetFontSize(bitmapContext, CTFontGetSize(mFontRef)); - CGContextShowGlyphsAtPositions(bitmapContext, &characterGlyph, &renderOrigin, 1); - CFRelease(cgFont); -#endif - #if 0 Con::printf("Width:%f, Height:%f, OriginX:%f, OriginY:%f", @@ -255,4 +285,4 @@ PlatformFont::CharInfo& OSXFont::getCharInfo(const UTF16 character) const // Return character information. return characterInfo; -} \ No newline at end of file +} From eca3fbfa67540507ee0484f1aef647132ffd3501 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Sat, 14 Aug 2021 17:44:17 -0400 Subject: [PATCH 02/17] * [UUID] BugFix: Correct a memory mismanagement error in UUID programming due to the way xuuid_t is utilized. --- Engine/source/console/consoleTypes.cpp | 13 ++++++++----- Engine/source/core/util/uuid.cpp | 19 +------------------ Engine/source/core/util/uuid.h | 22 +++++++++++++++++++++- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/Engine/source/console/consoleTypes.cpp b/Engine/source/console/consoleTypes.cpp index beaffe6c8..283cd0351 100644 --- a/Engine/source/console/consoleTypes.cpp +++ b/Engine/source/console/consoleTypes.cpp @@ -975,13 +975,16 @@ ConsoleSetType( TypePID ) else { Torque::UUID uuid; - if( !uuid.fromString( argv[ 0 ] ) ) - { + + if( !uuid.fromString( argv[ 0 ] ) ) + { Con::errorf( "Error parsing UUID in PID: '%s'", argv[ 0 ] ); *pid = NULL; - } - else - *pid = SimPersistID::findOrCreate( uuid ); + } + else + { + *pid = SimPersistID::findOrCreate(uuid); + } } } else diff --git a/Engine/source/core/util/uuid.cpp b/Engine/source/core/util/uuid.cpp index 795a5a7f2..e55325db7 100644 --- a/Engine/source/core/util/uuid.cpp +++ b/Engine/source/core/util/uuid.cpp @@ -68,32 +68,15 @@ #include #include "core/util/md5.h" +#include "core/util/uuid.h" #include "console/enginePrimitives.h" -#if defined (TORQUE_OS_MAC) && (defined(TORQUE_CPU_X64) || defined(TORQUE_CPU_ARM64)) -typedef unsigned int unsigned32; -#else -typedef unsigned long unsigned32; -#endif -typedef unsigned short unsigned16; -typedef unsigned char unsigned8; - typedef struct { char nodeID[6]; } uuid_node_t; #undef xuuid_t -typedef struct _uuid_t -{ - unsigned32 time_low; - unsigned16 time_mid; - unsigned16 time_hi_and_version; - unsigned8 clock_seq_hi_and_reserved; - unsigned8 clock_seq_low; - unsigned8 node[6]; -} xuuid_t; - /* data type for UUID generator persistent state */ typedef struct { diff --git a/Engine/source/core/util/uuid.h b/Engine/source/core/util/uuid.h index e902c3002..20ff16d69 100644 --- a/Engine/source/core/util/uuid.h +++ b/Engine/source/core/util/uuid.h @@ -28,11 +28,31 @@ #endif #include "console/engineTypeInfo.h" +#if defined (TORQUE_OS_MAC) && (defined(TORQUE_CPU_X64) || defined(TORQUE_CPU_ARM64)) +typedef unsigned int unsigned32; +#else +typedef unsigned long unsigned32; +#endif +typedef unsigned short unsigned16; +typedef unsigned char unsigned8; + +class xuuid_t +{ +public: + unsigned32 time_low; + unsigned16 time_mid; + unsigned16 time_hi_and_version; + unsigned8 clock_seq_hi_and_reserved; + unsigned8 clock_seq_low; + unsigned8 node[6]; +}; namespace Torque { + + /// A universally unique identifier. - class UUID + class UUID : public xuuid_t { friend class UUIDEngineExport; public: From 3f34c9020e7c300d8ccf7b6f9d5e67527ff7e321 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Sat, 14 Aug 2021 18:22:30 -0400 Subject: [PATCH 03/17] * [ParticleEmitter] BugFix: Make GCC happy by removing the inline specification on updateKeyData. --- Engine/source/T3D/fx/particleEmitter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/T3D/fx/particleEmitter.h b/Engine/source/T3D/fx/particleEmitter.h index 571dd2c8b..32bf5beca 100644 --- a/Engine/source/T3D/fx/particleEmitter.h +++ b/Engine/source/T3D/fx/particleEmitter.h @@ -278,7 +278,7 @@ class ParticleEmitter : public GameBase // code to expose the necessary members and methods. void update( U32 ms ); protected: - inline void updateKeyData( Particle *part ); + void updateKeyData( Particle *part ); private: From 68fee78744c2d4bbc6585a4c78b236af537650ad Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Tue, 17 Aug 2021 14:41:09 -0500 Subject: [PATCH 04/17] prefab safeties --- Engine/source/T3D/prefab.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Engine/source/T3D/prefab.cpp b/Engine/source/T3D/prefab.cpp index 9c30963c0..38934062f 100644 --- a/Engine/source/T3D/prefab.cpp +++ b/Engine/source/T3D/prefab.cpp @@ -71,6 +71,8 @@ Prefab::Prefab() mNetFlags.clear(Ghostable); mTypeMask |= StaticObjectType; + + mFilename = StringTable->EmptyString(); } Prefab::~Prefab() @@ -558,6 +560,7 @@ bool Prefab::buildExportPolyList(ColladaUtils::ExportData* exportData, const Box void Prefab::getUtilizedAssets(Vector* usedAssetsList) { + if (!mChildGroup) return; Vector foundObjects; mChildGroup->findObjectByType(foundObjects); From 0bf97ad2c8c4c1e006561f35989a3a92ed93e60c Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Tue, 17 Aug 2021 15:27:23 -0500 Subject: [PATCH 05/17] decal safeties via if (mMaterialAsset.notNull() && mMaterialAsset->getStatus() == MaterialAsset::Ok) --- Engine/source/T3D/decal/decalData.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Engine/source/T3D/decal/decalData.cpp b/Engine/source/T3D/decal/decalData.cpp index 6951d76e3..7c033b7f6 100644 --- a/Engine/source/T3D/decal/decalData.cpp +++ b/Engine/source/T3D/decal/decalData.cpp @@ -202,7 +202,7 @@ void DecalData::initPersistFields() "grid; use #textureCoords to manually specify UV coordinates for " "irregular sized frames." ); - addField( "textureCoords", TypeRectF, Offset( texRect, DecalData ), MAX_TEXCOORD_COUNT, + addField( "textureCoords", TypeRectUV, Offset( texRect, DecalData ), MAX_TEXCOORD_COUNT, "@brief An array of RectFs (topleft.x topleft.y extent.x extent.y) " "representing the UV coordinates for each frame in the imagemap.\n\n" "@note This field should only be set if the imagemap frames are " @@ -313,7 +313,9 @@ void DecalData::_initMaterial() { SAFE_DELETE( matInst ); - if (mMaterialAsset.notNull()) + _setMaterial(getMaterial()); + + if (mMaterialAsset.notNull() && mMaterialAsset->getStatus() == MaterialAsset::Ok) { matInst = getMaterialResource()->createMatInstance(); } From 69abcb862c4e510c3621a2e4f518e93142dd83c8 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Tue, 17 Aug 2021 15:32:05 -0500 Subject: [PATCH 06/17] assetbase crashes: test (most) cases for mpAssetDefinition existing before returning values. return empty if it doesn't. --- Engine/source/T3D/assets/LevelAsset.cpp | 4 +--- Engine/source/assets/assetBase.h | 10 +++++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Engine/source/T3D/assets/LevelAsset.cpp b/Engine/source/T3D/assets/LevelAsset.cpp index 0b5415ea8..edbc1243b 100644 --- a/Engine/source/T3D/assets/LevelAsset.cpp +++ b/Engine/source/T3D/assets/LevelAsset.cpp @@ -172,9 +172,7 @@ void LevelAsset::loadAsset() if (previewImageAssetId != StringTable->EmptyString()) { mPreviewImageAssetId = previewImageAssetId; - - AssetPtr previewImgAsset = mPreviewImageAssetId; - mPreviewImageAsset = previewImgAsset; + mPreviewImageAsset = mPreviewImageAssetId; } } diff --git a/Engine/source/assets/assetBase.h b/Engine/source/assets/assetBase.h index 352efa1f1..7d1918857 100644 --- a/Engine/source/assets/assetBase.h +++ b/Engine/source/assets/assetBase.h @@ -98,23 +98,23 @@ public: /// Asset configuration. inline void setAssetName(const char* pAssetName) { if (mpOwningAssetManager == NULL) mpAssetDefinition->mAssetName = StringTable->insert(pAssetName); } - inline StringTableEntry getAssetName(void) const { return mpAssetDefinition->mAssetName; } + inline StringTableEntry getAssetName(void) const { return mpAssetDefinition ? mpAssetDefinition->mAssetName : StringTable->EmptyString(); } void setAssetDescription(const char* pAssetDescription); - inline StringTableEntry getAssetDescription(void) const { return mpAssetDefinition->mAssetDescription; } + inline StringTableEntry getAssetDescription(void) const { return mpAssetDefinition ? mpAssetDefinition->mAssetDescription : StringTable->EmptyString(); } void setAssetCategory(const char* pAssetCategory); - inline StringTableEntry getAssetCategory(void) const { return mpAssetDefinition->mAssetCategory; } + inline StringTableEntry getAssetCategory(void) const { return mpAssetDefinition ? mpAssetDefinition->mAssetCategory : StringTable->EmptyString(); } void setAssetAutoUnload(const bool autoUnload); inline bool getAssetAutoUnload(void) const { return mpAssetDefinition->mAssetAutoUnload; } void setAssetInternal(const bool assetInternal); inline bool getAssetInternal(void) const { return mpAssetDefinition->mAssetInternal; } inline bool getAssetPrivate(void) const { return mpAssetDefinition->mAssetPrivate; } - inline StringTableEntry getAssetType(void) const { return mpAssetDefinition->mAssetType; } + inline StringTableEntry getAssetType(void) const { return mpAssetDefinition ? mpAssetDefinition->mAssetType: StringTable->EmptyString(); } inline S32 getAcquiredReferenceCount(void) const { return mAcquireReferenceCount; } inline bool getOwned(void) const { return mpOwningAssetManager != NULL; } // Asset Id is only available once registered with the asset manager. - inline StringTableEntry getAssetId(void) const { return mpAssetDefinition->mAssetId; } + inline StringTableEntry getAssetId(void) const { return mpAssetDefinition ? mpAssetDefinition->mAssetId : StringTable->EmptyString(); } /// Expanding/Collapsing asset paths is only available once registered with the asset manager. StringTableEntry expandAssetFilePath(const char* pAssetFilePath) const; From 19ba408354f1b2154df0af1408ebac75f7c5e8d6 Mon Sep 17 00:00:00 2001 From: Areloch Date: Wed, 18 Aug 2021 00:48:30 -0500 Subject: [PATCH 07/17] Fixes new emitter button bitmap to proper fieldname --- .../BaseGame/game/tools/particleEditor/ParticleEditor.ed.gui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Templates/BaseGame/game/tools/particleEditor/ParticleEditor.ed.gui b/Templates/BaseGame/game/tools/particleEditor/ParticleEditor.ed.gui index 7864a7f00..d2b932abd 100644 --- a/Templates/BaseGame/game/tools/particleEditor/ParticleEditor.ed.gui +++ b/Templates/BaseGame/game/tools/particleEditor/ParticleEditor.ed.gui @@ -214,7 +214,7 @@ $PE_guielement_ext_colorpicker = "18 18"; groupNum = "-1"; buttonType = "PushButton"; useMouseEvents = "0"; - bitmap = "ToolsModule:new_image"; + bitmapAsset = "ToolsModule:new_image"; tooltip = "Create New Emitter"; }; new GuiBitmapButtonCtrl() { From 3ecdf292d7ff60b65850d1c9596faabe510f5a6e Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Fri, 20 Aug 2021 22:53:45 -0400 Subject: [PATCH 08/17] * Adjustment: Remove some unnecessary ifdef logic in UUID headers. --- Engine/source/core/util/uuid.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Engine/source/core/util/uuid.h b/Engine/source/core/util/uuid.h index 20ff16d69..28cc984e8 100644 --- a/Engine/source/core/util/uuid.h +++ b/Engine/source/core/util/uuid.h @@ -28,11 +28,7 @@ #endif #include "console/engineTypeInfo.h" -#if defined (TORQUE_OS_MAC) && (defined(TORQUE_CPU_X64) || defined(TORQUE_CPU_ARM64)) typedef unsigned int unsigned32; -#else -typedef unsigned long unsigned32; -#endif typedef unsigned short unsigned16; typedef unsigned char unsigned8; From 3c79aace747745ce91cdcd1c4f50e5a55f50e642 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Sat, 21 Aug 2021 17:13:57 -0500 Subject: [PATCH 09/17] tooltip work --- .../scripts/assetTypes/datablockObjects.tscript | 5 +++-- .../assetBrowser/scripts/assetTypes/gameObject.tscript | 2 +- .../game/tools/assetBrowser/scripts/assetTypes/gui.tscript | 2 +- .../tools/assetBrowser/scripts/assetTypes/material.tscript | 7 ++++--- .../tools/assetBrowser/scripts/assetTypes/postFX.tscript | 2 +- .../tools/assetBrowser/scripts/assetTypes/script.tscript | 2 +- .../assetBrowser/scripts/assetTypes/shapeAnimation.tscript | 2 +- .../tools/assetBrowser/scripts/assetTypes/sound.tscript | 2 +- .../tools/assetBrowser/scripts/assetTypes/terrain.tscript | 7 ++++--- 9 files changed, 17 insertions(+), 14 deletions(-) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/datablockObjects.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/datablockObjects.tscript index b13b0b470..ea77f8b1a 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/datablockObjects.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/datablockObjects.tscript @@ -59,8 +59,9 @@ function AssetBrowser::buildDatablockPreview(%this, %assetDef, %previewData) //%previewData.assetFriendlyName = %assetDef.assetName; %previewData.assetDesc = %assetDef; - %previewData.tooltip = "Datablock Name: " @ %assetDef @ "\n" @ - "Datablock Type: " @ %assetDef.getClassName(); + %previewData.tooltip = "\nDatablock Name: " @ %assetDef @ + "\nDatablock Type: " @ %assetDef.getClassName() @ + "\nDefinition Path: " @ %assetDef.getFilename(); %previewData.doubleClickCommand = "AssetBrowser.schedule(10, \"spawnDatablockObject\",\""@ %assetDef @"\");";//browseTo %assetDef.dirPath / %assetDef.assetName } diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gameObject.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gameObject.tscript index 90d9a4a0e..944342421 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gameObject.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gameObject.tscript @@ -269,7 +269,7 @@ function AssetBrowser::buildGameObjectAssetPreview(%this, %assetDef, %previewDat %previewData.assetFriendlyName = %assetDef.gameObjectName; %previewData.assetDesc = %assetDef.description; - %previewData.tooltip = %assetDef.gameObjectName; + %previewData.tooltip = = "Asset Name: " @ %assetDef.gameObjectName @ "\nDefinition Path: " @ %assetDef.getFilename(); } function GuiInspectorTypeGameObjectAssetPtr::onClick( %this, %fieldName ) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gui.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gui.tscript index f30b42483..4660d56fc 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gui.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gui.tscript @@ -175,5 +175,5 @@ function AssetBrowser::buildGUIAssetPreview(%this, %assetDef, %previewData) %previewData.assetFriendlyName = %assetDef.assetName; %previewData.assetDesc = %assetDef.description; - %previewData.tooltip = %assetDef.assetName; + %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\nDefinition Path: " @ %assetDef.getScriptPath(); } diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.tscript index a61bd4d2d..37e874fb4 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.tscript @@ -494,9 +494,10 @@ function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData) else %previewData.doubleClickCommand = "AssetBrowser.editAsset( "@%assetDef@" );"; - %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\n" @ - "Asset Type: Material Asset\n" @ - "Asset Definition ID: " @ %assetDef; + %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ + "\nAsset Type: Material Asset" @ + "\nAsset Definition ID: " @ %assetDef @ + "\nDefinition Path: " @ %assetDef.getScriptPath(); } function AssetBrowser::onMaterialAssetEditorDropped(%this, %assetDef, %position) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/postFX.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/postFX.tscript index f5f8a3af7..8964114f9 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/postFX.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/postFX.tscript @@ -165,5 +165,5 @@ function AssetBrowser::buildPostEffectAssetPreview(%this, %assetDef, %previewDat %previewData.assetFriendlyName = %assetDef.assetName; %previewData.assetDesc = %assetDef.description; - %previewData.tooltip = %assetDef.assetName; + %previewData.tooltip = = "Asset Name: " @ %assetDef.assetName @ "\nDefinition Path: " @ %assetDef.getFilename(); } \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/script.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/script.tscript index c3b978318..7cf471ffb 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/script.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/script.tscript @@ -103,7 +103,7 @@ function AssetBrowser::buildTScriptPreview(%this, %assetDef, %previewData) %previewData.assetFriendlyName = %assetDef.assetName; %previewData.assetDesc = %assetDef.description; - %previewData.tooltip = %assetDef.assetName; + %previewData.tooltip = = "Asset Name: " @ %assetDef.assetName @ "\nDefinition Path: " @ %assetDef.getFilename(); } function GuiInspectorTypeScriptAssetPtr::onClick( %this, %fieldName ) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shapeAnimation.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shapeAnimation.tscript index 2c72ce8c7..5e43c126e 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shapeAnimation.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shapeAnimation.tscript @@ -51,5 +51,5 @@ function AssetBrowser::buildShapeAnimationAssetPreview(%this, %assetDef, %previe %previewData.assetFriendlyName = %assetDef.assetName; %previewData.assetDesc = %assetDef.description; - %previewData.tooltip = %assetDef.friendlyName @ "\n" @ %assetDef; + %previewData.tooltip = %assetDef.friendlyName @ "\n" @ %assetDef @ "\nShape File path: " @ %assetDef.getShapeFile(); } \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/sound.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/sound.tscript index a3132d213..c32222568 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/sound.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/sound.tscript @@ -13,7 +13,7 @@ function AssetBrowser::buildSoundAssetPreview(%this, %assetDef, %previewData) %previewData.assetFriendlyName = %assetDef.assetName; %previewData.assetDesc = %assetDef.description; - %previewData.tooltip = %assetDef.assetName; + %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\nDefinition Path: " @ %assetDef.getFilename(); } function AssetBrowser::onSoundAssetEditorDropped(%this, %assetDef, %position) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrain.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrain.tscript index 64e0eb7c6..85a9cd9c2 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrain.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrain.tscript @@ -166,9 +166,10 @@ function AssetBrowser::buildTerrainAssetPreview(%this, %assetDef, %previewData) %previewData.assetFriendlyName = %assetDef.gameObjectName; %previewData.assetDesc = %assetDef.description; - %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\n" @ - "Asset Type: Terrain Asset\n" @ - "Asset Definition ID: " @ %assetDef; + %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ + "\nAsset Type: Terrain Asset" @ + "\nAsset Definition ID: " @ %assetDef @ + "\nDefinition Path: " @ %assetPath @ %assetDef.getTerrainFilePath(); } function GuiInspectorTypeTerrainAssetPtr::onClick( %this, %fieldName ) From 37dc8626f5a88ec2b5180126bf96859476043efa Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Sat, 21 Aug 2021 20:48:26 -0400 Subject: [PATCH 10/17] MacOS fixes This fixes an issue where Con::getVariable can't be used in the global scope before the console system is initialized. I'm honestly surprised this error didn't happen on any other platform. --- Engine/source/T3D/assets/ImageAsset.cpp | 4 +++- Engine/source/T3D/assets/MaterialAsset.cpp | 4 +++- Engine/source/T3D/assets/ShapeAsset.cpp | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Engine/source/T3D/assets/ImageAsset.cpp b/Engine/source/T3D/assets/ImageAsset.cpp index f1dfa97e0..709dc6d00 100644 --- a/Engine/source/T3D/assets/ImageAsset.cpp +++ b/Engine/source/T3D/assets/ImageAsset.cpp @@ -52,7 +52,7 @@ //----------------------------------------------------------------------------- -StringTableEntry ImageAsset::smNoImageAssetFallback(StringTable->insert(Con::getVariable("$Core::NoImageAssetFallback"))); +StringTableEntry ImageAsset::smNoImageAssetFallback = NULL; //----------------------------------------------------------------------------- @@ -147,6 +147,8 @@ void ImageAsset::consoleInit() Con::addVariable("$Core::NoImageAssetFallback", TypeString, &smNoImageAssetFallback, "The assetId of the texture to display when the requested image asset is missing.\n" "@ingroup GFX\n"); + + smNoImageAssetFallback = StringTable->insert(Con::getVariable("$Core::NoImageAssetFallback")); } //----------------------------------------------------------------------------- diff --git a/Engine/source/T3D/assets/MaterialAsset.cpp b/Engine/source/T3D/assets/MaterialAsset.cpp index 94b1d48ea..3ac612c50 100644 --- a/Engine/source/T3D/assets/MaterialAsset.cpp +++ b/Engine/source/T3D/assets/MaterialAsset.cpp @@ -43,7 +43,7 @@ #include "T3D/assets/assetImporter.h" -StringTableEntry MaterialAsset::smNoMaterialAssetFallback(StringTable->insert(Con::getVariable("$Core::NoMaterialAssetFallback"))); +StringTableEntry MaterialAsset::smNoMaterialAssetFallback = NULL; //----------------------------------------------------------------------------- @@ -145,6 +145,8 @@ void MaterialAsset::consoleInit() Con::addVariable("$Core::NoMaterialAssetFallback", TypeString, &smNoMaterialAssetFallback, "The assetId of the material to display when the requested material asset is missing.\n" "@ingroup GFX\n"); + + smNoMaterialAssetFallback = StringTable->insert(Con::getVariable("$Core::NoMaterialAssetFallback")); } void MaterialAsset::initPersistFields() diff --git a/Engine/source/T3D/assets/ShapeAsset.cpp b/Engine/source/T3D/assets/ShapeAsset.cpp index 61b76d006..a32c6a815 100644 --- a/Engine/source/T3D/assets/ShapeAsset.cpp +++ b/Engine/source/T3D/assets/ShapeAsset.cpp @@ -50,7 +50,7 @@ #include "ts/tsLastDetail.h" #endif -StringTableEntry ShapeAsset::smNoShapeAssetFallback(StringTable->insert(Con::getVariable("$Core::NoShapeAssetFallback"))); +StringTableEntry ShapeAsset::smNoShapeAssetFallback = NULL; //----------------------------------------------------------------------------- @@ -146,6 +146,8 @@ void ShapeAsset::consoleInit() Con::addVariable("$Core::NoShapeAssetFallback", TypeString, &smNoShapeAssetFallback, "The assetId of the shape to display when the requested shape asset is missing.\n" "@ingroup GFX\n"); + + smNoShapeAssetFallback = StringTable->insert(Con::getVariable("$Core::NoShapeAssetFallback")); } //----------------------------------------------------------------------------- From cfe122f714136ad7a9b0effcd73b7669184dfedf Mon Sep 17 00:00:00 2001 From: Areloch Date: Sat, 21 Aug 2021 23:12:37 -0500 Subject: [PATCH 11/17] Enforces filename string case sensitivity for assets' internal filenames, which avoids the stringtable messing with the case preventing file name case sensitivity issues. --- Engine/source/T3D/assets/CppAsset.cpp | 6 +-- Engine/source/T3D/assets/CubemapAsset.cpp | 19 ++++++---- Engine/source/T3D/assets/CubemapAsset.h | 1 + Engine/source/T3D/assets/GUIAsset.cpp | 16 ++++---- Engine/source/T3D/assets/GameObjectAsset.cpp | 6 +-- Engine/source/T3D/assets/ImageAsset.cpp | 17 ++++----- Engine/source/T3D/assets/LevelAsset.cpp | 38 +++++++++---------- Engine/source/T3D/assets/MaterialAsset.cpp | 2 +- Engine/source/T3D/assets/MaterialAsset.h | 6 ++- Engine/source/T3D/assets/PostEffectAsset.cpp | 24 ++++++------ Engine/source/T3D/assets/ScriptAsset.cpp | 8 ++-- .../source/T3D/assets/ShapeAnimationAsset.cpp | 6 +-- Engine/source/T3D/assets/ShapeAsset.cpp | 13 +++---- Engine/source/T3D/assets/SoundAsset.cpp | 10 ++--- Engine/source/T3D/assets/TerrainAsset.cpp | 15 +++++--- .../T3D/assets/TerrainMaterialAsset.cpp | 13 ++++--- .../source/T3D/assets/stateMachineAsset.cpp | 9 ++--- Engine/source/assets/assetFieldTypes.cpp | 2 +- 18 files changed, 109 insertions(+), 102 deletions(-) diff --git a/Engine/source/T3D/assets/CppAsset.cpp b/Engine/source/T3D/assets/CppAsset.cpp index bb644c2de..b78b9e025 100644 --- a/Engine/source/T3D/assets/CppAsset.cpp +++ b/Engine/source/T3D/assets/CppAsset.cpp @@ -132,14 +132,14 @@ void CppAsset::setCppFile(const char* pCppFile) AssertFatal(pCppFile != NULL, "Cannot use a NULL code file."); // Fetch image file. - pCppFile = StringTable->insert(pCppFile); + pCppFile = StringTable->insert(pCppFile, true); // Ignore no change, if (pCppFile == mCodeFile) return; // Update. - mCodeFile = /*getOwned() ? expandAssetFilePath(pCppFile) : */StringTable->insert(pCppFile); + mCodeFile = getOwned() ? expandAssetFilePath(pCppFile) : pCppFile; // Refresh the asset. refreshAsset(); @@ -158,7 +158,7 @@ void CppAsset::setHeaderFile(const char* pHeaderFile) return; // Update. - mHeaderFile = /*getOwned() ? expandAssetFilePath(pHeaderFile) :*/ StringTable->insert(pHeaderFile); + mHeaderFile = getOwned() ? expandAssetFilePath(pHeaderFile) : pHeaderFile; // Refresh the asset. refreshAsset(); diff --git a/Engine/source/T3D/assets/CubemapAsset.cpp b/Engine/source/T3D/assets/CubemapAsset.cpp index db2c7c213..8c132ea74 100644 --- a/Engine/source/T3D/assets/CubemapAsset.cpp +++ b/Engine/source/T3D/assets/CubemapAsset.cpp @@ -134,18 +134,21 @@ void CubemapAsset::copyTo(SimObject* object) void CubemapAsset::initializeAsset() { - mScriptFile = expandAssetFilePath(mScriptFile); + // Call parent. + Parent::initializeAsset(); - if(Torque::FS::IsScriptFile(mScriptFile)) - Con::executeFile(mScriptFile, false, false); + mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath; + + if (Torque::FS::IsScriptFile(mScriptPath)) + Con::executeFile(mScriptPath, false, false); } void CubemapAsset::onAssetRefresh() { - mScriptFile = expandAssetFilePath(mScriptFile); + mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath; - if (Torque::FS::IsScriptFile(mScriptFile)) - Con::executeFile(mScriptFile, false, false); + if (Torque::FS::IsScriptFile(mScriptPath)) + Con::executeFile(mScriptPath, false, false); } void CubemapAsset::setScriptFile(const char* pScriptFile) @@ -154,14 +157,14 @@ void CubemapAsset::setScriptFile(const char* pScriptFile) AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file."); // Fetch image file. - pScriptFile = StringTable->insert(pScriptFile); + pScriptFile = StringTable->insert(pScriptFile, true); // Ignore no change, if (pScriptFile == mScriptFile) return; // Update. - mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : StringTable->insert(pScriptFile); + mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile; // Refresh the asset. refreshAsset(); diff --git a/Engine/source/T3D/assets/CubemapAsset.h b/Engine/source/T3D/assets/CubemapAsset.h index 0cd956aa9..e922d4f8b 100644 --- a/Engine/source/T3D/assets/CubemapAsset.h +++ b/Engine/source/T3D/assets/CubemapAsset.h @@ -53,6 +53,7 @@ class CubemapAsset : public AssetBase StringTableEntry mDescription; StringTableEntry mScriptFile; + StringTableEntry mScriptPath; public: CubemapAsset(); diff --git a/Engine/source/T3D/assets/GUIAsset.cpp b/Engine/source/T3D/assets/GUIAsset.cpp index aa3268d85..781cabc9e 100644 --- a/Engine/source/T3D/assets/GUIAsset.cpp +++ b/Engine/source/T3D/assets/GUIAsset.cpp @@ -117,12 +117,12 @@ void GUIAsset::copyTo(SimObject* object) void GUIAsset::initializeAsset() { - mGUIPath = expandAssetFilePath(mGUIFile); + mGUIPath = getOwned() ? expandAssetFilePath(mGUIFile) : mGUIPath; if (Torque::FS::IsScriptFile(mGUIPath)) Con::executeFile(mGUIPath, false, false); - mScriptPath = expandAssetFilePath(mScriptFile); + mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath; if (Torque::FS::IsScriptFile(mScriptPath)) Con::executeFile(mScriptPath, false, false); @@ -130,12 +130,12 @@ void GUIAsset::initializeAsset() void GUIAsset::onAssetRefresh() { - mGUIPath = expandAssetFilePath(mGUIFile); + mGUIPath = getOwned() ? expandAssetFilePath(mGUIFile) : mGUIPath; if (Torque::FS::IsScriptFile(mGUIPath)) Con::executeFile(mGUIPath, false, false); - mScriptPath = expandAssetFilePath(mScriptFile); + mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath; if (Torque::FS::IsScriptFile(mScriptPath)) Con::executeFile(mScriptPath, false, false); @@ -147,14 +147,14 @@ void GUIAsset::setGUIFile(const char* pScriptFile) AssertFatal(pScriptFile != NULL, "Cannot use a NULL gui file."); // Fetch image file. - pScriptFile = StringTable->insert(pScriptFile); + pScriptFile = StringTable->insert(pScriptFile, true); // Ignore no change, if (pScriptFile == mGUIFile) return; // Update. - mGUIFile = StringTable->insert(pScriptFile); + mGUIFile = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile; // Refresh the asset. refreshAsset(); @@ -166,14 +166,14 @@ void GUIAsset::setScriptFile(const char* pScriptFile) AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file."); // Fetch image file. - pScriptFile = StringTable->insert(pScriptFile); + pScriptFile = StringTable->insert(pScriptFile, true); // Ignore no change, if (pScriptFile == mScriptFile) return; // Update. - mScriptFile = StringTable->insert(pScriptFile); + mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile; // Refresh the asset. refreshAsset(); diff --git a/Engine/source/T3D/assets/GameObjectAsset.cpp b/Engine/source/T3D/assets/GameObjectAsset.cpp index 17b067f3b..559b83f9a 100644 --- a/Engine/source/T3D/assets/GameObjectAsset.cpp +++ b/Engine/source/T3D/assets/GameObjectAsset.cpp @@ -156,10 +156,10 @@ void GameObjectAsset::setScriptFile(const char* pScriptFile) AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file."); // Fetch image file. - pScriptFile = StringTable->insert(pScriptFile); + pScriptFile = StringTable->insert(pScriptFile, true); // Ignore no change, - if (pScriptFile == mScriptFile) + if (pScriptFile == mTAMLFile) return; // Update. @@ -176,7 +176,7 @@ void GameObjectAsset::setTAMLFile(const char* pTAMLFile) AssertFatal(pTAMLFile != NULL, "Cannot use a NULL TAML file."); // Fetch image file. - pTAMLFile = StringTable->insert(pTAMLFile); + pTAMLFile = StringTable->insert(pTAMLFile, true); // Ignore no change, if (pTAMLFile == mTAMLFile) diff --git a/Engine/source/T3D/assets/ImageAsset.cpp b/Engine/source/T3D/assets/ImageAsset.cpp index f1dfa97e0..dad83350f 100644 --- a/Engine/source/T3D/assets/ImageAsset.cpp +++ b/Engine/source/T3D/assets/ImageAsset.cpp @@ -296,21 +296,15 @@ void ImageAsset::loadImage() void ImageAsset::initializeAsset() { - if (mImageFileName == StringTable->insert("z.png")) - { - Con::printf("Loaded z"); - } - ResourceManager::get().getChangedSignal().notify(this, &ImageAsset::_onResourceChanged); - mImagePath = expandAssetFilePath(mImageFileName); + mImagePath = getOwned() ? expandAssetFilePath(mImageFileName) : mImagePath; loadImage(); } void ImageAsset::onAssetRefresh() { - mImagePath = expandAssetFilePath(mImageFileName); - + mImagePath = getOwned() ? expandAssetFilePath(mImageFileName) : mImagePath; loadImage(); } @@ -321,7 +315,7 @@ void ImageAsset::_onResourceChanged(const Torque::Path& path) refreshAsset(); - loadImage(); + //loadImage(); } void ImageAsset::setImageFileName(const char* pScriptFile) @@ -330,7 +324,10 @@ void ImageAsset::setImageFileName(const char* pScriptFile) AssertFatal(pScriptFile != NULL, "Cannot use a NULL image file."); // Update. - mImageFileName = StringTable->insert(pScriptFile); + mImageFileName = StringTable->insert(pScriptFile, true); + + // Refresh the asset. + refreshAsset(); } const GBitmap& ImageAsset::getImage() diff --git a/Engine/source/T3D/assets/LevelAsset.cpp b/Engine/source/T3D/assets/LevelAsset.cpp index edbc1243b..ab22c7488 100644 --- a/Engine/source/T3D/assets/LevelAsset.cpp +++ b/Engine/source/T3D/assets/LevelAsset.cpp @@ -161,11 +161,11 @@ void LevelAsset::onAssetRefresh(void) void LevelAsset::loadAsset() { // Ensure the image-file is expanded. - mLevelPath = expandAssetFilePath(mLevelFile); - mPostFXPresetPath = expandAssetFilePath(mPostFXPresetFile); - mDecalsPath = expandAssetFilePath(mDecalsFile); - mForestPath = expandAssetFilePath(mForestFile); - mNavmeshPath = expandAssetFilePath(mNavmeshFile); + mLevelPath = getOwned() ? expandAssetFilePath(mLevelFile) : mLevelPath; + mPostFXPresetPath = getOwned() ? expandAssetFilePath(mPostFXPresetFile) : mPostFXPresetPath; + mDecalsPath = getOwned() ? expandAssetFilePath(mDecalsFile) : mDecalsPath; + mForestPath = getOwned() ? expandAssetFilePath(mForestFile) : mForestPath; + mNavmeshPath = getOwned() ? expandAssetFilePath(mNavmeshFile) : mNavmeshPath; StringTableEntry previewImageAssetId = getAssetDependencyField("previewImageAsset"); @@ -183,14 +183,14 @@ void LevelAsset::setLevelFile(const char* pLevelFile) AssertFatal(pLevelFile != NULL, "Cannot use a NULL level file."); // Fetch image file. - pLevelFile = StringTable->insert(pLevelFile); + pLevelFile = StringTable->insert(pLevelFile, true); // Ignore no change, if (pLevelFile == mLevelFile) return; // Update. - mLevelFile = pLevelFile; + mLevelFile = getOwned() ? expandAssetFilePath(pLevelFile) : pLevelFile; // Refresh the asset. refreshAsset(); @@ -217,14 +217,14 @@ void LevelAsset::setEditorFile(const char* pEditorFile) AssertFatal(pEditorFile != NULL, "Cannot use a NULL level file."); // Fetch image file. - pEditorFile = StringTable->insert(pEditorFile); + pEditorFile = StringTable->insert(pEditorFile, true); // Ignore no change, if (pEditorFile == mEditorFile) return; // Update. - mEditorFile = pEditorFile; + mEditorFile = getOwned() ? expandAssetFilePath(pEditorFile) : pEditorFile; // Refresh the asset. refreshAsset(); @@ -236,14 +236,14 @@ void LevelAsset::setBakedSceneFile(const char* pBakedSceneFile) AssertFatal(pBakedSceneFile != NULL, "Cannot use a NULL level file."); // Fetch image file. - pBakedSceneFile = StringTable->insert(pBakedSceneFile); + pBakedSceneFile = StringTable->insert(pBakedSceneFile, true); // Ignore no change, if (pBakedSceneFile == mBakedSceneFile) return; // Update. - mBakedSceneFile = pBakedSceneFile; + mBakedSceneFile = getOwned() ? expandAssetFilePath(pBakedSceneFile) : pBakedSceneFile; // Refresh the asset. refreshAsset(); @@ -255,14 +255,14 @@ void LevelAsset::setPostFXPresetFile(const char* pPostFXPresetFile) AssertFatal(pPostFXPresetFile != NULL, "Cannot use a NULL postFX preset file."); // Fetch file. - pPostFXPresetFile = StringTable->insert(pPostFXPresetFile); + pPostFXPresetFile = StringTable->insert(pPostFXPresetFile, true); // Ignore no change, if (pPostFXPresetFile == mPostFXPresetFile) return; // Update. - mPostFXPresetFile = pPostFXPresetFile; + mPostFXPresetFile = getOwned() ? expandAssetFilePath(pPostFXPresetFile) : pPostFXPresetFile; // Refresh the asset. refreshAsset(); @@ -274,14 +274,14 @@ void LevelAsset::setDecalsFile(const char* pDecalsFile) AssertFatal(pDecalsFile != NULL, "Cannot use a NULL decals file."); // Fetch file. - pDecalsFile = StringTable->insert(pDecalsFile); + pDecalsFile = StringTable->insert(pDecalsFile, true); // Ignore no change, if (pDecalsFile == mDecalsFile) return; // Update. - mDecalsFile = pDecalsFile; + mDecalsFile = getOwned() ? expandAssetFilePath(pDecalsFile) : pDecalsFile; // Refresh the asset. refreshAsset(); @@ -293,14 +293,14 @@ void LevelAsset::setForestFile(const char* pForestFile) AssertFatal(pForestFile != NULL, "Cannot use a NULL decals file."); // Fetch file. - pForestFile = StringTable->insert(pForestFile); + pForestFile = StringTable->insert(pForestFile, true); // Ignore no change, if (pForestFile == mForestFile) return; // Update. - mForestFile = pForestFile; + mForestFile = getOwned() ? expandAssetFilePath(pForestFile) : pForestFile; // Refresh the asset. refreshAsset(); @@ -312,14 +312,14 @@ void LevelAsset::setNavmeshFile(const char* pNavmeshFile) AssertFatal(pNavmeshFile != NULL, "Cannot use a NULL Navmesh file."); // Fetch file. - pNavmeshFile = StringTable->insert(pNavmeshFile); + pNavmeshFile = StringTable->insert(pNavmeshFile, true); // Ignore no change, if (pNavmeshFile == mNavmeshFile) return; // Update. - mNavmeshFile = pNavmeshFile; + mNavmeshFile = getOwned() ? expandAssetFilePath(pNavmeshFile) : pNavmeshFile; // Refresh the asset. refreshAsset(); diff --git a/Engine/source/T3D/assets/MaterialAsset.cpp b/Engine/source/T3D/assets/MaterialAsset.cpp index 94b1d48ea..147fe93a0 100644 --- a/Engine/source/T3D/assets/MaterialAsset.cpp +++ b/Engine/source/T3D/assets/MaterialAsset.cpp @@ -188,7 +188,7 @@ void MaterialAsset::setScriptFile(const char* pScriptFile) AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file."); // Fetch image file. - pScriptFile = StringTable->insert(pScriptFile); + pScriptFile = StringTable->insert(pScriptFile, true); // Update. mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile; diff --git a/Engine/source/T3D/assets/MaterialAsset.h b/Engine/source/T3D/assets/MaterialAsset.h index c1582dcf8..7e307cd2b 100644 --- a/Engine/source/T3D/assets/MaterialAsset.h +++ b/Engine/source/T3D/assets/MaterialAsset.h @@ -109,7 +109,11 @@ protected: virtual void initializeAsset(); virtual void onAssetRefresh(void); - static bool setScriptFile(void *obj, const char *index, const char *data) { static_cast(obj)->setScriptFile(data); return false; } + static bool setScriptFile(void *obj, const char *index, const char *data) + { + static_cast(obj)->setScriptFile(data); + return false; + } static const char* getScriptFile(void* obj, const char* data) { return static_cast(obj)->getScriptFile(); } }; diff --git a/Engine/source/T3D/assets/PostEffectAsset.cpp b/Engine/source/T3D/assets/PostEffectAsset.cpp index e14d3ad7f..e20aedef7 100644 --- a/Engine/source/T3D/assets/PostEffectAsset.cpp +++ b/Engine/source/T3D/assets/PostEffectAsset.cpp @@ -132,9 +132,9 @@ void PostEffectAsset::copyTo(SimObject* object) void PostEffectAsset::initializeAsset() { - mScriptPath = expandAssetFilePath(mScriptFile); - mHLSLShaderPath = expandAssetFilePath(mHLSLShaderFile); - mGLSLShaderPath = expandAssetFilePath(mGLSLShaderFile); + mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath; + mHLSLShaderPath = getOwned() ? expandAssetFilePath(mHLSLShaderFile) : mHLSLShaderPath; + mGLSLShaderPath = getOwned() ? expandAssetFilePath(mGLSLShaderFile) : mGLSLShaderPath; if (Torque::FS::IsScriptFile(mScriptPath)) Con::executeFile(mScriptPath, false, false); @@ -142,9 +142,9 @@ void PostEffectAsset::initializeAsset() void PostEffectAsset::onAssetRefresh() { - mScriptPath = expandAssetFilePath(mScriptFile); - mHLSLShaderPath = expandAssetFilePath(mHLSLShaderFile); - mGLSLShaderPath = expandAssetFilePath(mGLSLShaderFile); + mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath; + mHLSLShaderPath = getOwned() ? expandAssetFilePath(mHLSLShaderFile) : mHLSLShaderPath; + mGLSLShaderPath = getOwned() ? expandAssetFilePath(mGLSLShaderFile) : mGLSLShaderPath; if (Torque::FS::IsScriptFile(mScriptPath)) Con::executeFile(mScriptPath, false, false); @@ -156,14 +156,14 @@ void PostEffectAsset::setScriptFile(const char* pScriptFile) AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file."); // Fetch image file. - pScriptFile = StringTable->insert(pScriptFile); + pScriptFile = StringTable->insert(pScriptFile, true); // Ignore no change, if (pScriptFile == mScriptFile) return; // Update. - mScriptFile = pScriptFile; + mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile; // Refresh the asset. refreshAsset(); @@ -175,14 +175,14 @@ void PostEffectAsset::setHLSLShaderFile(const char* pShaderFile) AssertFatal(pShaderFile != NULL, "Cannot use a NULL shader file."); // Fetch image file. - pShaderFile = StringTable->insert(pShaderFile); + pShaderFile = StringTable->insert(pShaderFile, true); // Ignore no change, if (pShaderFile == mHLSLShaderFile) return; // Update. - mHLSLShaderFile = pShaderFile; + mHLSLShaderFile = getOwned() ? expandAssetFilePath(pShaderFile) : pShaderFile; // Refresh the asset. refreshAsset(); @@ -194,14 +194,14 @@ void PostEffectAsset::setGLSLShaderFile(const char* pShaderFile) AssertFatal(pShaderFile != NULL, "Cannot use a NULL shader file."); // Fetch image file. - pShaderFile = StringTable->insert(pShaderFile); + pShaderFile = StringTable->insert(pShaderFile, true); // Ignore no change, if (pShaderFile == mGLSLShaderFile) return; // Update. - mGLSLShaderFile = pShaderFile; + mGLSLShaderFile = getOwned() ? expandAssetFilePath(pShaderFile) : pShaderFile; // Refresh the asset. refreshAsset(); diff --git a/Engine/source/T3D/assets/ScriptAsset.cpp b/Engine/source/T3D/assets/ScriptAsset.cpp index 5ff8889e2..dad8ab1c6 100644 --- a/Engine/source/T3D/assets/ScriptAsset.cpp +++ b/Engine/source/T3D/assets/ScriptAsset.cpp @@ -122,7 +122,7 @@ void ScriptAsset::copyTo(SimObject* object) void ScriptAsset::initializeAsset() { - mScriptPath = expandAssetFilePath(mScriptFile); + mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath; if (Torque::FS::IsScriptFile(mScriptPath)) { @@ -150,7 +150,7 @@ void ScriptAsset::initializeAsset() void ScriptAsset::onAssetRefresh() { - mScriptPath = expandAssetFilePath(mScriptFile); + mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath; if (Torque::FS::IsScriptFile(mScriptPath)) { @@ -170,14 +170,14 @@ void ScriptAsset::setScriptFile(const char* pScriptFile) AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file."); // Fetch image file. - pScriptFile = StringTable->insert(pScriptFile); + pScriptFile = StringTable->insert(pScriptFile, true); // Ignore no change, if (pScriptFile == mScriptFile) return; // Update. - mScriptFile = StringTable->insert(pScriptFile); + mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile; // Refresh the asset. refreshAsset(); diff --git a/Engine/source/T3D/assets/ShapeAnimationAsset.cpp b/Engine/source/T3D/assets/ShapeAnimationAsset.cpp index 2510e40a9..50d668a1f 100644 --- a/Engine/source/T3D/assets/ShapeAnimationAsset.cpp +++ b/Engine/source/T3D/assets/ShapeAnimationAsset.cpp @@ -147,7 +147,7 @@ void ShapeAnimationAsset::initializeAsset(void) if (!mIsEmbedded) { //If we're not embedded, we need to load in our initial shape and do some prepwork - mFilePath = expandAssetFilePath(mFileName); + mFilePath = getOwned() ? expandAssetFilePath(mFileName) : mFilePath; mSourceShape = ResourceManager::get().load(mFilePath); @@ -177,14 +177,14 @@ void ShapeAnimationAsset::setAnimationFile(const char* pAnimationFile) AssertFatal(pAnimationFile != NULL, "Cannot use a NULL animation file."); // Fetch image file. - pAnimationFile = StringTable->insert(pAnimationFile); + pAnimationFile = StringTable->insert(pAnimationFile, true); // Ignore no change, if (pAnimationFile == mFileName) return; // Update. - mFileName = StringTable->insert(pAnimationFile); + mFileName = getOwned() ? expandAssetFilePath(pAnimationFile) : pAnimationFile; // Refresh the asset. refreshAsset(); diff --git a/Engine/source/T3D/assets/ShapeAsset.cpp b/Engine/source/T3D/assets/ShapeAsset.cpp index 61b76d006..b968f70c3 100644 --- a/Engine/source/T3D/assets/ShapeAsset.cpp +++ b/Engine/source/T3D/assets/ShapeAsset.cpp @@ -186,10 +186,9 @@ void ShapeAsset::initializeAsset() ResourceManager::get().getChangedSignal().notify(this, &ShapeAsset::_onResourceChanged); //Ensure our path is expando'd if it isn't already - if (!Platform::isFullPath(mFilePath)) - mFilePath = getOwned() ? expandAssetFilePath(mFileName) : mFilePath; + mFilePath = getOwned() ? expandAssetFilePath(mFileName) : mFilePath; - mConstructorFilePath = expandAssetFilePath(mConstructorFilePath); + mConstructorFilePath = getOwned() ? expandAssetFilePath(mConstructorFilePath) : mConstructorFilePath; loadShape(); } @@ -200,13 +199,13 @@ void ShapeAsset::setShapeFile(const char* pShapeFile) AssertFatal(pShapeFile != NULL, "Cannot use a NULL shape file."); // Fetch image file. - pShapeFile = StringTable->insert(pShapeFile); + pShapeFile = StringTable->insert(pShapeFile, true); // Ignore no change, if (pShapeFile == mFileName) return; - mFileName = pShapeFile; + mFileName = getOwned() ? expandAssetFilePath(pShapeFile) : pShapeFile; // Refresh the asset. refreshAsset(); @@ -218,13 +217,13 @@ void ShapeAsset::setShapeConstructorFile(const char* pShapeConstructorFile) AssertFatal(pShapeConstructorFile != NULL, "Cannot use a NULL shape constructor file."); // Fetch image file. - pShapeConstructorFile = StringTable->insert(pShapeConstructorFile); + pShapeConstructorFile = StringTable->insert(pShapeConstructorFile, true); // Ignore no change, if (pShapeConstructorFile == mConstructorFileName) return; - mConstructorFileName = pShapeConstructorFile; + mConstructorFileName = getOwned() ? expandAssetFilePath(pShapeConstructorFile) : pShapeConstructorFile; // Refresh the asset. refreshAsset(); diff --git a/Engine/source/T3D/assets/SoundAsset.cpp b/Engine/source/T3D/assets/SoundAsset.cpp index a2e13f0b5..14cb00744 100644 --- a/Engine/source/T3D/assets/SoundAsset.cpp +++ b/Engine/source/T3D/assets/SoundAsset.cpp @@ -184,8 +184,7 @@ void SoundAsset::initializeAsset(void) //ResourceManager::get().getChangedSignal.notify(this, &SoundAsset::_onResourceChanged); //Ensure our path is expando'd if it isn't already - if (!Platform::isFullPath(mSoundPath)) - mSoundPath = getOwned() ? expandAssetFilePath(mSoundFile) : mSoundPath; + mSoundPath = getOwned() ? expandAssetFilePath(mSoundFile) : mSoundPath; mSoundPath = expandAssetFilePath(mSoundPath); @@ -208,8 +207,7 @@ void SoundAsset::onAssetRefresh(void) return; //Update - if (!Platform::isFullPath(mSoundFile)) - mSoundPath = getOwned() ? expandAssetFilePath(mSoundFile) : mSoundPath; + mSoundPath = getOwned() ? expandAssetFilePath(mSoundFile) : mSoundPath; loadSound(); } @@ -243,14 +241,14 @@ void SoundAsset::setSoundFile(const char* pSoundFile) AssertFatal(pSoundFile != NULL, "Cannot use a NULL sound file."); // Fetch sound file. - pSoundFile = StringTable->insert(pSoundFile); + pSoundFile = StringTable->insert(pSoundFile, true); // Ignore no change, if (pSoundFile == mSoundFile) return; // Update. - mSoundFile = pSoundFile; + mSoundFile = getOwned() ? expandAssetFilePath(pSoundFile) : pSoundFile; // Refresh the asset. refreshAsset(); diff --git a/Engine/source/T3D/assets/TerrainAsset.cpp b/Engine/source/T3D/assets/TerrainAsset.cpp index 40bc950b0..997806ed6 100644 --- a/Engine/source/T3D/assets/TerrainAsset.cpp +++ b/Engine/source/T3D/assets/TerrainAsset.cpp @@ -161,14 +161,14 @@ void TerrainAsset::initializeAsset() // Call parent. Parent::initializeAsset(); - mTerrainFilePath = expandAssetFilePath(mTerrainFileName); + mTerrainFilePath = getOwned() ? expandAssetFilePath(mTerrainFileName) : mTerrainFilePath; loadTerrain(); } void TerrainAsset::onAssetRefresh() { - mTerrainFilePath = expandAssetFilePath(mTerrainFileName); + mTerrainFilePath = getOwned() ? expandAssetFilePath(mTerrainFileName) : mTerrainFilePath; loadTerrain(); } @@ -176,13 +176,16 @@ void TerrainAsset::onAssetRefresh() void TerrainAsset::setTerrainFileName(const char* pScriptFile) { // Sanity! - AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file."); + AssertFatal(pScriptFile != NULL, "Cannot use a NULL terrain file."); - // Fetch image file. - pScriptFile = StringTable->insert(pScriptFile); + pScriptFile = StringTable->insert(pScriptFile, true); + + // Ignore no change, + if (pScriptFile == mTerrainFileName) + return; // Update. - mTerrainFileName = pScriptFile; + mTerrainFileName = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile; // Refresh the asset. refreshAsset(); diff --git a/Engine/source/T3D/assets/TerrainMaterialAsset.cpp b/Engine/source/T3D/assets/TerrainMaterialAsset.cpp index 717d497aa..b4d0c4214 100644 --- a/Engine/source/T3D/assets/TerrainMaterialAsset.cpp +++ b/Engine/source/T3D/assets/TerrainMaterialAsset.cpp @@ -119,7 +119,7 @@ void TerrainMaterialAsset::initializeAsset() // Call parent. Parent::initializeAsset(); - mScriptPath = expandAssetFilePath(mScriptFile); + mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath; if (Torque::FS::IsScriptFile(mScriptPath)) Con::executeFile(mScriptPath, false, false); @@ -127,7 +127,7 @@ void TerrainMaterialAsset::initializeAsset() void TerrainMaterialAsset::onAssetRefresh() { - mScriptPath = expandAssetFilePath(mScriptFile); + mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath; if (Torque::FS::IsScriptFile(mScriptPath)) Con::executeFile(mScriptPath, false, false); @@ -150,11 +150,14 @@ void TerrainMaterialAsset::setScriptFile(const char* pScriptFile) // Sanity! AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file."); - // Fetch image file. - pScriptFile = StringTable->insert(pScriptFile); + pScriptFile = StringTable->insert(pScriptFile, true); + + // Ignore no change, + if (pScriptFile == mScriptFile) + return; // Update. - mScriptFile = pScriptFile; + mScriptFile = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile; // Refresh the asset. refreshAsset(); diff --git a/Engine/source/T3D/assets/stateMachineAsset.cpp b/Engine/source/T3D/assets/stateMachineAsset.cpp index c58b486cd..888898bf3 100644 --- a/Engine/source/T3D/assets/stateMachineAsset.cpp +++ b/Engine/source/T3D/assets/stateMachineAsset.cpp @@ -126,15 +126,14 @@ void StateMachineAsset::setStateMachineFile(const char* pStateMachineFile) // Sanity! AssertFatal(pStateMachineFile != NULL, "Cannot use a NULL state machine file."); - // Fetch image file. - pStateMachineFile = StringTable->insert(pStateMachineFile); + pStateMachineFile = StringTable->insert(pStateMachineFile, true); // Ignore no change, if (pStateMachineFile == mStateMachineFile) return; // Update. - mStateMachineFile = StringTable->insert(pStateMachineFile); + mStateMachineFile = getOwned() ? expandAssetFilePath(pStateMachineFile) : pStateMachineFile; // Refresh the asset. refreshAsset(); @@ -142,12 +141,12 @@ void StateMachineAsset::setStateMachineFile(const char* pStateMachineFile) void StateMachineAsset::initializeAsset() { - mStateMachinePath = expandAssetFilePath(mStateMachineFile); + mStateMachinePath = getOwned() ? expandAssetFilePath(mStateMachineFile) : mStateMachinePath; } void StateMachineAsset::onAssetRefresh() { - mStateMachinePath = expandAssetFilePath(mStateMachineFile); + mStateMachinePath = getOwned() ? expandAssetFilePath(mStateMachineFile) : mStateMachinePath; } diff --git a/Engine/source/assets/assetFieldTypes.cpp b/Engine/source/assets/assetFieldTypes.cpp index 154513d41..242cc23e0 100644 --- a/Engine/source/assets/assetFieldTypes.cpp +++ b/Engine/source/assets/assetFieldTypes.cpp @@ -72,7 +72,7 @@ ConsoleSetType( TypeAssetLooseFilePath ) StringTableEntry* assetLooseFilePath = (StringTableEntry*)(dptr); // Update asset loose file-path value. - *assetLooseFilePath = StringTable->insert(pFieldValue); + *assetLooseFilePath = StringTable->insert(pFieldValue, true); return; } From 64b98b0c1023864f86ba98e5c37cb4aef1f406a8 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 22 Aug 2021 02:15:14 -0500 Subject: [PATCH 12/17] Converts most of AFX classes to utilize assets Adds modified classes to project importer convert logic --- Engine/source/afx/afxMagicMissile.cpp | 19 ++--- Engine/source/afx/afxMagicMissile.h | 6 +- Engine/source/afx/ce/afxBillboard.cpp | 24 ++---- Engine/source/afx/ce/afxBillboard.h | 7 +- Engine/source/afx/ce/afxBillboard_T3D.cpp | 2 +- Engine/source/afx/ce/afxModel.cpp | 76 ++++++++++--------- Engine/source/afx/ce/afxModel.h | 15 ++-- Engine/source/afx/ce/afxStaticShape.cpp | 2 +- Engine/source/afx/ce/afxZodiac.cpp | 45 ++++++----- Engine/source/afx/ce/afxZodiac.h | 11 ++- Engine/source/afx/ce/afxZodiacMgr.cpp | 4 +- Engine/source/afx/ce/afxZodiacPlane.cpp | 26 +++---- Engine/source/afx/ce/afxZodiacPlane.h | 11 ++- Engine/source/afx/ce/afxZodiacPlane_T3D.cpp | 2 +- .../pre40/T3Dpre4ProjectImporter.tscript | 5 ++ 15 files changed, 137 insertions(+), 118 deletions(-) diff --git a/Engine/source/afx/afxMagicMissile.cpp b/Engine/source/afx/afxMagicMissile.cpp index 2c4d9e64d..93d4ef237 100644 --- a/Engine/source/afx/afxMagicMissile.cpp +++ b/Engine/source/afx/afxMagicMissile.cpp @@ -141,7 +141,7 @@ U32 Projectile::smProjectileWarpTicks = 5; // afxMagicMissileData::afxMagicMissileData() { - projectileShapeName = ST_NULLSTRING; + INIT_SHAPEASSET(ProjectileShape); sound = NULL; @@ -246,7 +246,7 @@ afxMagicMissileData::afxMagicMissileData() afxMagicMissileData::afxMagicMissileData(const afxMagicMissileData& other, bool temp_clone) : GameBaseData(other, temp_clone) { - projectileShapeName = other.projectileShapeName; + CLONE_SHAPEASSET(ProjectileShape); projectileShape = other.projectileShape; // -- TSShape loads using projectileShapeName sound = other.sound; splash = other.splash; @@ -335,7 +335,7 @@ void afxMagicMissileData::initPersistFields() addField("particleEmitter", TYPEID(), Offset(particleEmitter, afxMagicMissileData)); addField("particleWaterEmitter", TYPEID(), Offset(particleWaterEmitter, afxMagicMissileData)); - addField("projectileShapeName", TypeFilename, Offset(projectileShapeName, afxMagicMissileData)); + INITPERSISTFIELD_SHAPEASSET(ProjectileShape, afxMagicMissileData, "Shape for the projectile"); addField("scale", TypePoint3F, Offset(scale, afxMagicMissileData)); addField("sound", TypeSFXTrackName, Offset(sound, afxMagicMissileData)); @@ -375,7 +375,7 @@ void afxMagicMissileData::initPersistFields() // FIELDS ADDED BY MAGIC-MISSILE - addField("missileShapeName", TypeFilename, myOffset(projectileShapeName)); + //addField("missileShapeName", TypeFilename, myOffset(projectileShapeName)); addField("missileShapeScale", TypePoint3F, myOffset(scale)); addField("startingVelocityVector",TypePoint3F, myOffset(starting_vel_vec)); @@ -542,12 +542,12 @@ bool afxMagicMissileData::preload(bool server, String &errorStr) Con::errorf(ConsoleLogEntry::General, "afxMagicMissileData::preload: Invalid packet, bad datablockid(lightDesc): %d", lightDescId); } - if (projectileShapeName != ST_NULLSTRING) + if (!mProjectileShapeAsset.isNull()) { - projectileShape = ResourceManager::get().load(projectileShapeName); + projectileShape = mProjectileShapeAsset->getShapeResource(); if (bool(projectileShape) == false) { - errorStr = String::ToString("afxMagicMissileData::load: Couldn't load shape \"%s\"", projectileShapeName); + errorStr = String::ToString("afxMagicMissileData::load: Couldn't load shape \"%s\"", mProjectileShapeAssetId); return false; } /* From stock Projectile code... @@ -599,7 +599,8 @@ void afxMagicMissileData::packData(BitStream* stream) { Parent::packData(stream); - stream->writeString(projectileShapeName); + PACKDATA_SHAPEASSET(ProjectileShape); + /* From stock Projectile code... stream->writeFlag(faceViewer); */ @@ -709,7 +710,7 @@ void afxMagicMissileData::unpackData(BitStream* stream) { Parent::unpackData(stream); - projectileShapeName = stream->readSTString(); + UNPACKDATA_SHAPEASSET(ProjectileShape); /* From stock Projectile code... faceViewer = stream->readFlag(); */ diff --git a/Engine/source/afx/afxMagicMissile.h b/Engine/source/afx/afxMagicMissile.h index 332d69d3c..1206354fd 100644 --- a/Engine/source/afx/afxMagicMissile.h +++ b/Engine/source/afx/afxMagicMissile.h @@ -65,11 +65,15 @@ protected: public: enum { MaxLifetimeTicks = 4095 }; + + void onShapeChanged() {} public: // variables set in datablock definition: // Shape related - StringTableEntry projectileShapeName; + DECLARE_SHAPEASSET(afxMagicMissileData, ProjectileShape, onShapeChanged); + DECLARE_SHAPEASSET_SETGET(afxMagicMissileData, ProjectileShape); + //StringTableEntry projectileShapeName; //bool hasLight; //F32 lightRadius; diff --git a/Engine/source/afx/ce/afxBillboard.cpp b/Engine/source/afx/ce/afxBillboard.cpp index 85f816962..553c2942f 100644 --- a/Engine/source/afx/ce/afxBillboard.cpp +++ b/Engine/source/afx/ce/afxBillboard.cpp @@ -51,7 +51,7 @@ ConsoleDocClass( afxBillboardData, afxBillboardData::afxBillboardData() { color.set(1.0f, 1.0f, 1.0f, 1.0f); - txr_name = ST_NULLSTRING; + INIT_IMAGEASSET(Texture); dimensions.set(1.0f, 1.0f); texCoords[0].set(0.0f, 0.0f); texCoords[1].set(0.0f, 1.0f); @@ -66,8 +66,7 @@ afxBillboardData::afxBillboardData(const afxBillboardData& other, bool temp_clon : GameBaseData(other, temp_clone) { color = other.color; - txr_name = other.txr_name; - txr = other.txr; + CLONE_IMAGEASSET(Texture); dimensions = other.dimensions; texCoords[0] = other.texCoords[0]; texCoords[1] = other.texCoords[1]; @@ -95,8 +94,9 @@ void afxBillboardData::initPersistFields() addField("color", TypeColorF, myOffset(color), "The color assigned to the quadrangle geometry. The way it combines with the given " "texture varies according to the setting of the textureFunction field."); - addField("texture", TypeFilename, myOffset(txr_name), - "An image to use as the billboard's texture."); + + INITPERSISTFIELD_IMAGEASSET(Texture, afxBillboardData, "An image to use as the billboard's texture."); + addField("dimensions", TypePoint2F, myOffset(dimensions), "A value-pair that specifies the horizontal and vertical dimensions of the billboard " "in scene units."); @@ -123,7 +123,8 @@ void afxBillboardData::packData(BitStream* stream) Parent::packData(stream); stream->write(color); - stream->writeString(txr_name); + PACKDATA_IMAGEASSET(Texture); + mathWrite(*stream, dimensions); mathWrite(*stream, texCoords[0]); mathWrite(*stream, texCoords[1]); @@ -139,8 +140,7 @@ void afxBillboardData::unpackData(BitStream* stream) Parent::unpackData(stream); stream->read(&color); - txr_name = stream->readSTString(); - txr = GFXTexHandle(); + UNPACKDATA_IMAGEASSET(Texture); mathRead(*stream, &dimensions); mathRead(*stream, &texCoords[0]); mathRead(*stream, &texCoords[1]); @@ -156,14 +156,6 @@ bool afxBillboardData::preload(bool server, String &errorStr) if (!Parent::preload(server, errorStr)) return false; - if (!server) - { - if (txr_name && txr_name[0] != '\0') - { - txr.set(txr_name, &GFXStaticTextureSRGBProfile, "Billboard Texture"); - } - } - // if blend-style is set to User, check for defined blend-factors if (blendStyle == BlendUser && (srcBlendFactor == BLEND_UNDEFINED || dstBlendFactor == BLEND_UNDEFINED)) { diff --git a/Engine/source/afx/ce/afxBillboard.h b/Engine/source/afx/ce/afxBillboard.h index 208b8b0f0..1183500a2 100644 --- a/Engine/source/afx/ce/afxBillboard.h +++ b/Engine/source/afx/ce/afxBillboard.h @@ -47,8 +47,9 @@ public: }; public: - StringTableEntry txr_name; - GFXTexHandle txr; + DECLARE_IMAGEASSET(afxBillboardData, Texture, onChangeTexture, GFXStaticTextureSRGBProfile); + DECLARE_IMAGEASSET_SETGET(afxBillboardData, Texture); + LinearColorF color; Point2F texCoords[4]; @@ -70,6 +71,8 @@ public: static void initPersistFields(); + void onChangeTexture() {} + DECLARE_CONOBJECT(afxBillboardData); DECLARE_CATEGORY("AFX"); }; diff --git a/Engine/source/afx/ce/afxBillboard_T3D.cpp b/Engine/source/afx/ce/afxBillboard_T3D.cpp index 2162f7143..81d84ebc4 100644 --- a/Engine/source/afx/ce/afxBillboard_T3D.cpp +++ b/Engine/source/afx/ce/afxBillboard_T3D.cpp @@ -87,7 +87,7 @@ void afxBillboard::_renderBillboard(ObjectRenderInst *ri, SceneRenderState* stat GFXTransformSaver saver; GFX->multWorld(getRenderTransform()); - GFX->setTexture(0, mDataBlock->txr); + GFX->setTexture(0, mDataBlock->mTexture); MatrixF worldmod = GFX->getWorldMatrix(); MatrixF viewmod = GFX->getViewMatrix(); diff --git a/Engine/source/afx/ce/afxModel.cpp b/Engine/source/afx/ce/afxModel.cpp index 95a190deb..ba452156b 100644 --- a/Engine/source/afx/ce/afxModel.cpp +++ b/Engine/source/afx/ce/afxModel.cpp @@ -54,7 +54,7 @@ ConsoleDocClass( afxModelData, afxModelData::afxModelData() { - shapeName = ST_NULLSTRING; + INIT_SHAPEASSET(Shape); sequence = ST_NULLSTRING; seq_rate = 1.0f; seq_offset = 0.0f; @@ -84,8 +84,7 @@ afxModelData::afxModelData() afxModelData::afxModelData(const afxModelData& other, bool temp_clone) : GameBaseData(other, temp_clone) { - shapeName = other.shapeName; - shape = other.shape; // -- + CLONE_SHAPEASSET(Shape); sequence = other.sequence; seq_rate = other.seq_rate; seq_offset = other.seq_offset; @@ -127,12 +126,11 @@ bool afxModelData::preload(bool server, String &errorStr) if (server) return true; - if (shapeName != ST_NULLSTRING && !shape) + if (mShapeAsset.notNull()) { - shape = ResourceManager::get().load(shapeName); - if (!shape) + if (!mShape) { - errorStr = String::ToString("afxModelData::load: Failed to load shape \"%s\"", shapeName); + errorStr = String::ToString("afxModelData::load: Failed to load shape \"%s\"", mShapeAssetId); return false; } @@ -164,7 +162,7 @@ bool afxModelData::preload(bool server, String &errorStr) if (txr_tag_remappings.size() == 0) { // this little hack forces the textures to preload - TSShapeInstance* pDummy = new TSShapeInstance(shape); + TSShapeInstance* pDummy = new TSShapeInstance(mShape); delete pDummy; } } @@ -176,9 +174,8 @@ bool afxModelData::preload(bool server, String &errorStr) void afxModelData::initPersistFields() { - addField("shapeFile", TypeFilename, myOffset(shapeName), - "The name of a .dts format file to use for the model."); - addField("sequence", TypeFilename, myOffset(sequence), + INITPERSISTFIELD_SHAPEASSET(Shape, afxModelData, "The name of a .dts format file to use for the model."); + addField("sequence", TypeString, myOffset(sequence), "The name of an animation sequence to play in the model."); addField("sequenceRate", TypeF32, myOffset(seq_rate), "The rate of playback for the sequence."); @@ -256,7 +253,7 @@ void afxModelData::packData(BitStream* stream) { Parent::packData(stream); - stream->writeString(shapeName); + PACKDATA_SHAPEASSET(Shape); stream->writeString(sequence); stream->write(seq_rate); stream->write(seq_offset); @@ -288,7 +285,7 @@ void afxModelData::unpackData(BitStream* stream) { Parent::unpackData(stream); - shapeName = stream->readSTString(); + UNPACKDATA_SHAPEASSET(Shape); sequence = stream->readSTString(); stream->read(&seq_rate); stream->read(&seq_offset); @@ -316,19 +313,24 @@ void afxModelData::unpackData(BitStream* stream) stream->read(&shadowSphereAdjust); } -void afxModelData::onPerformSubstitutions() -{ - if (shapeName != ST_NULLSTRING) - { - shape = ResourceManager::get().load(shapeName); - if (!shape) - { - Con::errorf("afxModelData::onPerformSubstitutions: Failed to load shape \"%s\"", shapeName); - return; - } +void afxModelData::onPerformSubstitutions() +{ + if (mShapeAssetId != StringTable->EmptyString()) + { + mShapeAsset = mShapeAssetId; + if (mShapeAsset.notNull()) + { + mShape = mShapeAsset->getShapeResource(); + } - // REMAP-TEXTURE-TAGS ISSUES? - } + if (!mShape) + { + Con::errorf("afxModelData::onPerformSubstitutions: Failed to load shape \"%s\"", mShapeAssetId); + return; + } + + // REMAP-TEXTURE-TAGS ISSUES? + } } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -401,18 +403,18 @@ bool afxModel::onAdd() return false; // setup our bounding box - if (mDataBlock->shape) - mObjBox = mDataBlock->shape->mBounds; + if (mDataBlock->mShape) + mObjBox = mDataBlock->mShape->mBounds; else mObjBox = Box3F(Point3F(-1, -1, -1), Point3F(1, 1, 1)); // setup the shape instance and sequence - if (mDataBlock->shape) + if (mDataBlock->mShape) { if (/*isClientObject() && */mDataBlock->txr_tag_remappings.size() > 0) { // temporarily substitute material tags with alternates - TSMaterialList* mat_list = mDataBlock->shape->materialList; + TSMaterialList* mat_list = mDataBlock->mShape->materialList; if (mat_list) { for (S32 i = 0; i < mDataBlock->txr_tag_remappings.size(); i++) @@ -433,7 +435,7 @@ bool afxModel::onAdd() } } - shape_inst = new TSShapeInstance(mDataBlock->shape); + shape_inst = new TSShapeInstance(mDataBlock->mShape); if (true) // isClientObject()) { @@ -442,7 +444,7 @@ bool afxModel::onAdd() // restore the material tags to original form if (mDataBlock->txr_tag_remappings.size() > 0) { - TSMaterialList* mat_list = mDataBlock->shape->materialList; + TSMaterialList* mat_list = mDataBlock->mShape->materialList; if (mat_list) { for (S32 i = 0; i < mDataBlock->txr_tag_remappings.size(); i++) @@ -508,14 +510,14 @@ bool afxModel::onAdd() resetWorldBox(); - if (mDataBlock->shape) + if (mDataBlock->mShape) { // Scan out the collision hulls... static const String sCollisionStr( "collision-" ); - for (U32 i = 0; i < mDataBlock->shape->details.size(); i++) + for (U32 i = 0; i < mDataBlock->mShape->details.size(); i++) { - const String &name = mDataBlock->shape->names[mDataBlock->shape->details[i].nameIndex]; + const String &name = mDataBlock->mShape->names[mDataBlock->mShape->details[i].nameIndex]; if (name.compare( sCollisionStr, sCollisionStr.length(), String::NoCase ) == 0) { @@ -529,7 +531,7 @@ bool afxModel::onAdd() char buff[128]; dSprintf(buff, sizeof(buff), "LOS-%d", i + 1 + 8/*MaxCollisionShapes*/); - U32 los = mDataBlock->shape->findDetail(buff); + U32 los = mDataBlock->mShape->findDetail(buff); if (los == -1) mLOSDetails.last() = i; else @@ -540,9 +542,9 @@ bool afxModel::onAdd() // Snag any "unmatched" LOS details static const String sLOSStr( "LOS-" ); - for (U32 i = 0; i < mDataBlock->shape->details.size(); i++) + for (U32 i = 0; i < mDataBlock->mShape->details.size(); i++) { - const String &name = mDataBlock->shape->names[mDataBlock->shape->details[i].nameIndex]; + const String &name = mDataBlock->mShape->names[mDataBlock->mShape->details[i].nameIndex]; if (name.compare( sLOSStr, sLOSStr.length(), String::NoCase ) == 0) { diff --git a/Engine/source/afx/ce/afxModel.h b/Engine/source/afx/ce/afxModel.h index 931f89287..0d13692ef 100644 --- a/Engine/source/afx/ce/afxModel.h +++ b/Engine/source/afx/ce/afxModel.h @@ -27,6 +27,7 @@ #define _AFX_MODEL_H_ #include "renderInstance/renderPassManager.h" +#include "T3D/assets/ShapeAsset.h" class ParticleEmitterData; class ParticleEmitter; @@ -42,8 +43,11 @@ struct afxModelData : public GameBaseData { typedef GameBaseData Parent; - StringTableEntry shapeName; + DECLARE_SHAPEASSET(afxModelData, Shape, onShapeChanged); + DECLARE_SHAPEASSET_SETGET(afxModelData, Shape); + StringTableEntry sequence; + F32 seq_rate; F32 seq_offset; F32 alpha_mult; @@ -63,8 +67,6 @@ struct afxModelData : public GameBaseData StringTableEntry remap_txr_tags; - Resource shape; - bool overrideLightingOptions; bool receiveSunLight; bool receiveLMLighting; @@ -93,6 +95,9 @@ public: static void initPersistFields(); + void onShapeChanged() {} + void onSequenceChanged() {} + DECLARE_CONOBJECT(afxModelData); DECLARE_CATEGORY("AFX"); }; @@ -148,9 +153,9 @@ public: void setSequenceRateFactor(F32 factor); void setSortPriority(S8 priority) { sort_priority = priority; } - const char* getShapeFileName() const { return mDataBlock->shapeName; } + const char* getShapeFileName() const { return mDataBlock->getShape(); } void setVisibility(bool flag) { is_visible = flag; } - TSShape* getTSShape() { return mDataBlock->shape; } + TSShape* getTSShape() { return mDataBlock->getShapeResource(); } TSShapeInstance* getTSShapeInstance() { return shape_inst; } U32 setAnimClip(const char* clip, F32 pos, F32 rate, F32 trans); diff --git a/Engine/source/afx/ce/afxStaticShape.cpp b/Engine/source/afx/ce/afxStaticShape.cpp index ffe731b55..4aad448f8 100644 --- a/Engine/source/afx/ce/afxStaticShape.cpp +++ b/Engine/source/afx/ce/afxStaticShape.cpp @@ -70,7 +70,7 @@ afxStaticShapeData::afxStaticShapeData(const afxStaticShapeData& other, bool tem void afxStaticShapeData::initPersistFields() { - addField("sequence", TypeFilename, myOffset(sequence), + addField("sequence", TypeString, myOffset(sequence), "An animation sequence in the StaticShape to play."); addField("ignoreSceneAmbient", TypeBool, myOffset(ignore_scene_amb), "..."); diff --git a/Engine/source/afx/ce/afxZodiac.cpp b/Engine/source/afx/ce/afxZodiac.cpp index 62f6996ae..eca56af5a 100644 --- a/Engine/source/afx/ce/afxZodiac.cpp +++ b/Engine/source/afx/ce/afxZodiac.cpp @@ -78,7 +78,8 @@ bool afxZodiacData::sPreferDestinationGradients = false; afxZodiacData::afxZodiacData() { - txr_name = ST_NULLSTRING; + INIT_IMAGEASSET(Texture); + radius_xy = 1; vert_range.set(0.0f, 0.0f); start_ang = 0; @@ -119,8 +120,8 @@ afxZodiacData::afxZodiacData() afxZodiacData::afxZodiacData(const afxZodiacData& other, bool temp_clone) : GameBaseData(other, temp_clone) { - txr_name = other.txr_name; - txr = other.txr; + CLONE_IMAGEASSET(Texture); + radius_xy = other.radius_xy; vert_range = other.vert_range; start_ang = other.start_ang; @@ -155,8 +156,7 @@ EndImplementEnumType; void afxZodiacData::initPersistFields() { - addField("texture", TypeFilename, Offset(txr_name, afxZodiacData), - "An image to use as the zodiac's texture."); + INITPERSISTFIELD_IMAGEASSET(Texture, afxZodiacData, "An image to use as the zodiac's texture."); addField("radius", TypeF32, Offset(radius_xy, afxZodiacData), "The zodiac's radius in scene units."); addField("verticalRange", TypePoint2F, Offset(vert_range, afxZodiacData), @@ -269,7 +269,7 @@ void afxZodiacData::packData(BitStream* stream) merge_zflags(); - stream->writeString(txr_name); + PACKDATA_IMAGEASSET(Texture); stream->write(radius_xy); stream->write(vert_range.x); stream->write(vert_range.y); @@ -294,8 +294,7 @@ void afxZodiacData::unpackData(BitStream* stream) { Parent::unpackData(stream); - txr_name = stream->readSTString(); - txr = GFXTexHandle(); + UNPACKDATA_IMAGEASSET(Texture); stream->read(&radius_xy); stream->read(&vert_range.x); stream->read(&vert_range.y); @@ -323,14 +322,6 @@ bool afxZodiacData::preload(bool server, String &errorStr) if (!Parent::preload(server, errorStr)) return false; - if (!server) - { - if (txr_name && txr_name[0] != '\0') - { - txr.set(txr_name, &AFX_GFXZodiacTextureProfile, "Zodiac Texture"); - } - } - if (vert_range.x == 0.0f && vert_range.y == 0.0f) vert_range.x = vert_range.y = radius_xy; @@ -349,11 +340,23 @@ void afxZodiacData::onStaticModified(const char* slot, const char* newValue) } void afxZodiacData::onPerformSubstitutions() -{ - if (txr_name && txr_name[0] != '\0') - { - txr.set(txr_name, &AFX_GFXZodiacTextureProfile, "Zodiac Texture"); - } +{ + if (mTextureAssetId != StringTable->EmptyString()) + { + mTextureAsset = mTextureAssetId; + if (mTextureAsset.notNull()) + { + if (getTexture() != StringTable->EmptyString() && mTextureName != StringTable->insert("texhandle")) + { + if (mTextureAsset.notNull()) + { + mTextureAsset->getChangedSignal().notify(this, &afxZodiacData::onImageChanged); + } + + mTexture.set(getTexture(), mTextureProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__)); + } + } + } } F32 afxZodiacData::calcRotationAngle(F32 elapsed, F32 rate_factor) diff --git a/Engine/source/afx/ce/afxZodiac.h b/Engine/source/afx/ce/afxZodiac.h index c6adb7625..d03fcf593 100644 --- a/Engine/source/afx/ce/afxZodiac.h +++ b/Engine/source/afx/ce/afxZodiac.h @@ -35,6 +35,8 @@ #include "console/typeValidators.h" +GFX_DeclareTextureProfile(AFX_GFXZodiacTextureProfile); + //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// // afxZodiacData @@ -54,9 +56,12 @@ public: static void convertGradientRangeFromDegrees(Point2F& gradrange, const Point2F& gradrange_deg); + void onImageChanged() {} + public: - StringTableEntry txr_name; - GFXTexHandle txr; + DECLARE_IMAGEASSET(afxZodiacData, Texture, onImageChanged, AFX_GFXZodiacTextureProfile); + DECLARE_IMAGEASSET_SETGET(afxZodiacData, Texture); + F32 radius_xy; Point2F vert_range; F32 start_ang; @@ -125,8 +130,6 @@ public: typedef afxZodiacData::BlendType afxZodiac_BlendType; DefineEnumType( afxZodiac_BlendType ); -GFX_DeclareTextureProfile(AFX_GFXZodiacTextureProfile); - //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #endif // _AFX_ZODIAC_H_ diff --git a/Engine/source/afx/ce/afxZodiacMgr.cpp b/Engine/source/afx/ce/afxZodiacMgr.cpp index abc8c38e2..fe9924128 100644 --- a/Engine/source/afx/ce/afxZodiacMgr.cpp +++ b/Engine/source/afx/ce/afxZodiacMgr.cpp @@ -61,7 +61,7 @@ void afxZodiacMgr::addTerrainZodiac(Point3F& pos, F32 radius, LinearColorF& colo z.color = color.toColorI(); z.angle = mDegToRad(angle); z.zflags = zode->zflags; - z.txr = &zode->txr; + z.txr = &zode->mTexture; z.distance_max = zode->distance_max*zode->distance_max; z.distance_falloff = zode->distance_falloff*zode->distance_falloff; @@ -84,7 +84,7 @@ void afxZodiacMgr::addInteriorZodiac(Point3F& pos, F32 radius, Point2F& vert_ran z.color = color.toColorI(); z.angle = mDegToRad(angle); z.zflags = zode->zflags; - z.txr = &zode->txr; + z.txr = &zode->mTexture; z.distance_max = zode->distance_max*zode->distance_max; z.distance_falloff = zode->distance_falloff*zode->distance_falloff; diff --git a/Engine/source/afx/ce/afxZodiacPlane.cpp b/Engine/source/afx/ce/afxZodiacPlane.cpp index 7af581f2f..aaea763e7 100644 --- a/Engine/source/afx/ce/afxZodiacPlane.cpp +++ b/Engine/source/afx/ce/afxZodiacPlane.cpp @@ -51,7 +51,8 @@ ConsoleDocClass( afxZodiacPlaneData, afxZodiacPlaneData::afxZodiacPlaneData() { - txr_name = ST_NULLSTRING; + INIT_IMAGEASSET(Texture); + radius_xy = 1; start_ang = 0; ang_per_sec = 0; @@ -70,8 +71,8 @@ afxZodiacPlaneData::afxZodiacPlaneData() afxZodiacPlaneData::afxZodiacPlaneData(const afxZodiacPlaneData& other, bool temp_clone) : GameBaseData(other, temp_clone) { - txr_name = other.txr_name; - txr = other.txr; + CLONE_IMAGEASSET(Texture); + radius_xy = other.radius_xy; start_ang = other.start_ang; ang_per_sec = other.ang_per_sec; @@ -110,8 +111,8 @@ EndImplementEnumType; void afxZodiacPlaneData::initPersistFields() { - addField("texture", TypeFilename, myOffset(txr_name), - "An image to use as the zodiac's texture."); + INITPERSISTFIELD_IMAGEASSET(Texture, afxZodiacPlaneData, "An image to use as the zodiac's texture."); + addField("radius", TypeF32, myOffset(radius_xy), "The zodiac's radius in scene units."); addField("startAngle", TypeF32, myOffset(start_ang), @@ -164,7 +165,8 @@ void afxZodiacPlaneData::packData(BitStream* stream) merge_zflags(); - stream->writeString(txr_name); + PACKDATA_IMAGEASSET(Texture); + stream->write(radius_xy); stream->write(start_ang); stream->write(ang_per_sec); @@ -182,8 +184,8 @@ void afxZodiacPlaneData::unpackData(BitStream* stream) { Parent::unpackData(stream); - txr_name = stream->readSTString(); - txr = GFXTexHandle(); + UNPACKDATA_IMAGEASSET(Texture); + stream->read(&radius_xy); stream->read(&start_ang); stream->read(&ang_per_sec); @@ -204,14 +206,6 @@ bool afxZodiacPlaneData::preload(bool server, String &errorStr) if (!Parent::preload(server, errorStr)) return false; - if (!server) - { - if (txr_name && txr_name[0] != '\0') - { - txr.set(txr_name, &AFX_GFXZodiacTextureProfile, "Zodiac Texture"); - } - } - return true; } diff --git a/Engine/source/afx/ce/afxZodiacPlane.h b/Engine/source/afx/ce/afxZodiacPlane.h index 05b7ad56f..e99702b4c 100644 --- a/Engine/source/afx/ce/afxZodiacPlane.h +++ b/Engine/source/afx/ce/afxZodiacPlane.h @@ -28,6 +28,10 @@ #include "afx/ce/afxZodiacDefs.h" +#ifndef _AFX_ZODIAC_H_ +#include "afx/ce/afxZodiac.h" +#endif + class afxZodiacPlaneData : public GameBaseData, public afxZodiacDefs { typedef GameBaseData Parent; @@ -52,9 +56,12 @@ public: FACES_BITS = 3 }; + void onImageChanged() {} + public: - StringTableEntry txr_name; - GFXTexHandle txr; + DECLARE_IMAGEASSET(afxZodiacPlaneData, Texture, onImageChanged, AFX_GFXZodiacTextureProfile); + DECLARE_IMAGEASSET_SETGET(afxZodiacPlaneData, Texture); + F32 radius_xy; F32 start_ang; F32 ang_per_sec; diff --git a/Engine/source/afx/ce/afxZodiacPlane_T3D.cpp b/Engine/source/afx/ce/afxZodiacPlane_T3D.cpp index 476f353c3..59ea81763 100644 --- a/Engine/source/afx/ce/afxZodiacPlane_T3D.cpp +++ b/Engine/source/afx/ce/afxZodiacPlane_T3D.cpp @@ -207,7 +207,7 @@ void afxZodiacPlane::_renderZodiacPlane(ObjectRenderInst *ri, SceneRenderState* GFXTransformSaver saver; GFX->multWorld(getRenderTransform()); - GFX->setTexture(0, mDataBlock->txr); + GFX->setTexture(0, mDataBlock->mTexture); PrimBuild::begin(GFXTriangleStrip, 4); { diff --git a/Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript b/Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript index 9c0b1691f..a798a9b1d 100644 --- a/Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript +++ b/Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript @@ -831,6 +831,11 @@ T3Dpre4ProjectImporter::genProcessor("LevelInfo", "accuTexture accuTextureAsset" T3Dpre4ProjectImporter::genProcessor("TSStatic", "shape shapeAsset shapeName shapeAsset"); T3Dpre4ProjectImporter::genProcessor("TSForestItemData", "shape shapeAsset shapeName shapeAsset shapeFile shapeAsset"); T3Dpre4ProjectImporter::genProcessor("TerrainBlock", "terrainFile terrainAsset"); +T3Dpre4ProjectImporter::genProcessor("afxMagicMissileData", "projectileShapeName projectileShapeAsset"); +T3Dpre4ProjectImporter::genProcessor("afxBillboardData", "texture textureAsset"); +T3Dpre4ProjectImporter::genProcessor("afxModelData", "shapeName shapeAsset shapeFile shapeAsset"); +T3Dpre4ProjectImporter::genProcessor("afxZodiacData", "texture textureAsset"); +T3Dpre4ProjectImporter::genProcessor("afxZodiacPlaneData", "texture textureAsset"); //============================================================================== // Levels //============================================================================== From 868bd6c361290992fbdfd847545b170922d396ac Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Mon, 23 Aug 2021 19:37:09 -0500 Subject: [PATCH 13/17] fixes for copypastas that somehow slipped in --- .../tools/assetBrowser/scripts/assetTypes/gameObject.tscript | 2 +- .../game/tools/assetBrowser/scripts/assetTypes/postFX.tscript | 2 +- .../game/tools/assetBrowser/scripts/assetTypes/script.tscript | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gameObject.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gameObject.tscript index 944342421..e3a5014ad 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gameObject.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gameObject.tscript @@ -269,7 +269,7 @@ function AssetBrowser::buildGameObjectAssetPreview(%this, %assetDef, %previewDat %previewData.assetFriendlyName = %assetDef.gameObjectName; %previewData.assetDesc = %assetDef.description; - %previewData.tooltip = = "Asset Name: " @ %assetDef.gameObjectName @ "\nDefinition Path: " @ %assetDef.getFilename(); + %previewData.tooltip = "Asset Name: " @ %assetDef.gameObjectName @ "\nDefinition Path: " @ %assetDef.getFilename(); } function GuiInspectorTypeGameObjectAssetPtr::onClick( %this, %fieldName ) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/postFX.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/postFX.tscript index 8964114f9..704a6ddf2 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/postFX.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/postFX.tscript @@ -165,5 +165,5 @@ function AssetBrowser::buildPostEffectAssetPreview(%this, %assetDef, %previewDat %previewData.assetFriendlyName = %assetDef.assetName; %previewData.assetDesc = %assetDef.description; - %previewData.tooltip = = "Asset Name: " @ %assetDef.assetName @ "\nDefinition Path: " @ %assetDef.getFilename(); + %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\nDefinition Path: " @ %assetDef.getFilename(); } \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/script.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/script.tscript index 7cf471ffb..c23850c2c 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/script.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/script.tscript @@ -103,7 +103,7 @@ function AssetBrowser::buildTScriptPreview(%this, %assetDef, %previewData) %previewData.assetFriendlyName = %assetDef.assetName; %previewData.assetDesc = %assetDef.description; - %previewData.tooltip = = "Asset Name: " @ %assetDef.assetName @ "\nDefinition Path: " @ %assetDef.getFilename(); + %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\nDefinition Path: " @ %assetDef.getFilename(); } function GuiInspectorTypeScriptAssetPtr::onClick( %this, %fieldName ) From 50fb4df1f0d7f19459f98bf60bb49751471f223b Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Sat, 28 Aug 2021 15:54:21 -0500 Subject: [PATCH 14/17] kill off glowchan leftovers --- .../scripts/materialEditor.ed.tscript | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript b/Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript index 3d24330c7..e1bb86cab 100644 --- a/Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript +++ b/Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript @@ -1059,7 +1059,6 @@ function MaterialEditorGui::guiSync( %this, %material ) %this.getRoughChan((%material).RoughnessChan[%layer]); %this.getAOChan((%material).AOChan[%layer]); %this.getMetalChan((%material).metalChan[%layer]); - %this.getGlowChan((%material).glowChan[%layer]); %this.preventUndo = false; } @@ -1081,11 +1080,7 @@ function MaterialEditorGui::getMetalChan(%this, %channel) %guiElement = metalChanBtn @ %channel; %guiElement.setStateOn(true); } -function MaterialEditorGui::getGlowChan(%this, %channel) -{ - %guiElement = glowChanBtn @ %channel; - %guiElement.setStateOn(true); -} + //======================================= // Material Update Functionality @@ -2420,12 +2415,6 @@ function MaterialEditorGui::setMetalChan(%this, %value) MaterialEditorGui.guiSync( materialEd_previewMaterial ); } -function MaterialEditorGui::setGlowChan(%this, %value) -{ - MaterialEditorGui.updateActiveMaterial("glowChan[" @ MaterialEditorGui.currentLayer @ "]", %value); - MaterialEditorGui.guiSync( materialEd_previewMaterial ); -} - function MaterialEditorGui::saveCompositeMap(%this) { %saveAs = ""; From cabfeea76bcb85dccc0fc3a89d75adfa309acda1 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Sat, 28 Aug 2021 16:20:58 -0500 Subject: [PATCH 15/17] nother stray --- .../game/tools/materialEditor/scripts/materialEditor.ed.tscript | 1 - 1 file changed, 1 deletion(-) diff --git a/Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript b/Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript index e1bb86cab..c3acecec6 100644 --- a/Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript +++ b/Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript @@ -2443,7 +2443,6 @@ function MaterialEditorGui::saveCompositeMap(%this) %roughMap = %material.getRoughMap(%layer); %aoMap = %material.getAOMap(%layer); %metalMap = %material.getMetalMap(%layer); - %glowMap = %material.getGlowMap(%layer); %roughness = %material.RoughnessChan[%layer]; %ao = %material.AOChan[%layer]; From 2287c28d32571f9d778d81c9c2dd83aba0801e1b Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Sat, 28 Aug 2021 17:21:45 -0500 Subject: [PATCH 16/17] be clear where we're referencing gbuffer render targets --- .../source/shaderGen/GLSL/accuFeatureGLSL.cpp | 4 +- Engine/source/shaderGen/GLSL/bumpGLSL.cpp | 2 +- .../shaderGen/GLSL/debugVizFeatureGLSL.cpp | 2 +- .../shaderGen/GLSL/shaderFeatureGLSL.cpp | 18 +-- .../source/shaderGen/HLSL/accuFeatureHLSL.cpp | 2 +- Engine/source/shaderGen/HLSL/bumpHLSL.cpp | 2 +- .../shaderGen/HLSL/customFeatureHLSL.cpp | 130 ------------------ .../shaderGen/HLSL/debugVizFeatureHLSL.cpp | 2 +- .../shaderGen/HLSL/shaderFeatureHLSL.cpp | 16 +-- 9 files changed, 24 insertions(+), 154 deletions(-) diff --git a/Engine/source/shaderGen/GLSL/accuFeatureGLSL.cpp b/Engine/source/shaderGen/GLSL/accuFeatureGLSL.cpp index 7d172179e..1ab722fd9 100644 --- a/Engine/source/shaderGen/GLSL/accuFeatureGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/accuFeatureGLSL.cpp @@ -55,7 +55,7 @@ void AccuTexFeatGLSL::processPix(Vector &componentList, output = meta; // OUT.col - Var *color = (Var*) LangElement::find( "col1" ); + Var *color = (Var*) LangElement::find(getOutputTargetVarName(ShaderFeature::RenderTarget1)); if (!color) { output = new GenOp(" //NULL COLOR!"); @@ -236,4 +236,4 @@ Var* AccuTexFeatGLSL::addOutAccuVec(Vector &componentList, Mul } return outAccuVec; -} \ No newline at end of file +} diff --git a/Engine/source/shaderGen/GLSL/bumpGLSL.cpp b/Engine/source/shaderGen/GLSL/bumpGLSL.cpp index ab034bc2d..36ff9ec46 100644 --- a/Engine/source/shaderGen/GLSL/bumpGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/bumpGLSL.cpp @@ -452,7 +452,7 @@ void NormalsOutFeatGLSL::processPix( Vector &componentList, } LangElement *normalOut; - Var *outColor = (Var*)LangElement::find( "col" ); + Var *outColor = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget)); if ( outColor && !fd.features[MFT_AlphaTest] ) normalOut = new GenOp( "float4( ( -@ + 1 ) * 0.5, @.a )", wsNormal, outColor ); else diff --git a/Engine/source/shaderGen/GLSL/debugVizFeatureGLSL.cpp b/Engine/source/shaderGen/GLSL/debugVizFeatureGLSL.cpp index 22bb4c839..219ef07e9 100644 --- a/Engine/source/shaderGen/GLSL/debugVizFeatureGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/debugVizFeatureGLSL.cpp @@ -30,7 +30,7 @@ void DebugVizGLSL::processPix(Vector& componentList, if (surface && (vizDisplayMode == 0 || vizDisplayMode == 1)) { - Var* color = (Var*)LangElement::find("col"); + Var* color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget)); if (color) { Var* specularColor = (Var*)LangElement::find("specularColor"); diff --git a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp index b6c825864..2bd24931d 100644 --- a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp @@ -1181,13 +1181,13 @@ void DiffuseFeatureGLSL::processPix( Vector &componentList, diffuseMaterialColor->constSortPos = cspPotentialPrimitive; MultiLine* meta = new MultiLine; - Var *col = (Var*)LangElement::find("col"); + Var *col = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget)); ShaderFeature::OutputTarget targ = ShaderFeature::DefaultTarget; if (fd.features[MFT_isDeferred]) { targ = ShaderFeature::RenderTarget1; - col = (Var*)LangElement::find("col1"); + col = (Var*)LangElement::find(getOutputTargetVarName(targ)); meta = new MultiLine; if (!col) { @@ -1196,7 +1196,7 @@ void DiffuseFeatureGLSL::processPix( Vector &componentList, col->setType("vec4"); col->setName(getOutputTargetVarName(targ)); col->setStructName("OUT"); - meta->addStatement(new GenOp(" @ = vec4(1.0);\r\n", col)); + meta->addStatement(new GenOp(" @ = vec4(1.0,1.0,1.0,1.0);\r\n", col)); } } @@ -2334,7 +2334,7 @@ void FogFeatGLSL::processPix( Vector &componentList, fogColor->constSortPos = cspPass; // Get the out color. - Var *color = (Var*) LangElement::find( "col" ); + Var *color = (Var*) LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget)); if ( !color ) { color = new Var; @@ -2466,7 +2466,7 @@ void VisibilityFeatGLSL::processPix( Vector &componentList, // Translucent objects do a simple alpha fade. if ( fd.features[ MFT_IsTranslucent ] ) { - Var *color = (Var*) LangElement::find( "col" ); + Var *color = (Var*) LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget)); meta->addStatement( new GenOp( " @.a *= @;\r\n", color, visibility ) ); return; } @@ -2507,9 +2507,9 @@ void AlphaTestGLSL::processPix( Vector &componentList, } // If we don't have a color var then we cannot do an alpha test. - Var *color = (Var*)LangElement::find( "col1" ); + Var *color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::RenderTarget1) ); if ( !color ) - color = (Var*)LangElement::find("col"); + color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget)); if ( !color ) { output = NULL; @@ -2542,7 +2542,7 @@ void GlowMaskGLSL::processPix( Vector &componentList, // // The shader compiler will optimize out all the other // code above that doesn't contribute to the alpha mask. - Var *color = (Var*)LangElement::find( "col" ); + Var *color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget)); if ( color ) output = new GenOp( " @.rgb = vec3(0);\r\n", color ); } @@ -2574,7 +2574,7 @@ void HDROutGLSL::processPix( Vector &componentList, const MaterialFeatureData &fd ) { // Let the helper function do the work. - Var *color = (Var*)LangElement::find( "col" ); + Var *color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget)); if ( color ) output = new GenOp( " @ = hdrEncode( @ );\r\n", color, color ); } diff --git a/Engine/source/shaderGen/HLSL/accuFeatureHLSL.cpp b/Engine/source/shaderGen/HLSL/accuFeatureHLSL.cpp index 3c0ec061f..17ddd844b 100644 --- a/Engine/source/shaderGen/HLSL/accuFeatureHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/accuFeatureHLSL.cpp @@ -55,7 +55,7 @@ void AccuTexFeatHLSL::processPix( Vector &componentList, output = meta; // OUT.col - Var *color = (Var*) LangElement::find( "col1" ); + Var *color = (Var*) LangElement::find(getOutputTargetVarName(ShaderFeature::RenderTarget1)); if (!color) { output = new GenOp(" //NULL COLOR!"); diff --git a/Engine/source/shaderGen/HLSL/bumpHLSL.cpp b/Engine/source/shaderGen/HLSL/bumpHLSL.cpp index c916d8b38..c1cd2635e 100644 --- a/Engine/source/shaderGen/HLSL/bumpHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/bumpHLSL.cpp @@ -460,7 +460,7 @@ void NormalsOutFeatHLSL::processPix( Vector &componentList, } LangElement *normalOut; - Var *outColor = (Var*)LangElement::find( "col" ); + Var *outColor = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget)); if ( outColor && !fd.features[MFT_AlphaTest] ) normalOut = new GenOp( "float4( ( -@ + 1 ) * 0.5, @.a )", wsNormal, outColor ); else diff --git a/Engine/source/shaderGen/HLSL/customFeatureHLSL.cpp b/Engine/source/shaderGen/HLSL/customFeatureHLSL.cpp index fa0a3934e..c9e797fff 100644 --- a/Engine/source/shaderGen/HLSL/customFeatureHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/customFeatureHLSL.cpp @@ -68,136 +68,6 @@ void CustomFeatureHLSL::processPix(Vector& componentList, mOutputState = PixelOutput; - /*MultiLine *meta = new MultiLine; - - output = meta; - - // OUT.col - Var *color = (Var*) LangElement::find( "col1" ); - if (!color) - { - output = new GenOp(" //NULL COLOR!"); - return; - } - - // accu map - Var *accuMap = new Var; - accuMap->setType("SamplerState"); - - accuMap->setName( "accuMap" ); - accuMap->uniform = true; - accuMap->sampler = true; - accuMap->constNum = Var::getTexUnitNum(); // used as texture unit num here - - // accuColor var - Var *accuColor = new Var; - accuColor->setType( "float4" ); - accuColor->setName( "accuColor" ); - LangElement *colorAccuDecl = new DecOp( accuColor ); - - // plc (placement) - Var *accuPlc = new Var; - accuPlc->setType( "float4" ); - accuPlc->setName( "plc" ); - LangElement *plcAccu = new DecOp( accuPlc ); - - // accu constants - Var *accuScale = (Var*)LangElement::find( "accuScale" ); - if ( !accuScale ) - { - accuScale = new Var; - accuScale->setType( "float" ); - accuScale->setName( "accuScale" ); - accuScale->uniform = true; - accuScale->sampler = false; - accuScale->constSortPos = cspPotentialPrimitive; - } - Var *accuDirection = (Var*)LangElement::find( "accuDirection" ); - if ( !accuDirection ) - { - accuDirection = new Var; - accuDirection->setType( "float" ); - accuDirection->setName( "accuDirection" ); - accuDirection->uniform = true; - accuDirection->sampler = false; - accuDirection->constSortPos = cspPotentialPrimitive; - } - Var *accuStrength = (Var*)LangElement::find( "accuStrength" ); - if ( !accuStrength ) - { - accuStrength = new Var; - accuStrength->setType( "float" ); - accuStrength->setName( "accuStrength" ); - accuStrength->uniform = true; - accuStrength->sampler = false; - accuStrength->constSortPos = cspPotentialPrimitive; - } - Var *accuCoverage = (Var*)LangElement::find( "accuCoverage" ); - if ( !accuCoverage ) - { - accuCoverage = new Var; - accuCoverage->setType( "float" ); - accuCoverage->setName( "accuCoverage" ); - accuCoverage->uniform = true; - accuCoverage->sampler = false; - accuCoverage->constSortPos = cspPotentialPrimitive; - } - Var *accuSpecular = (Var*)LangElement::find( "accuSpecular" ); - if ( !accuSpecular ) - { - accuSpecular = new Var; - accuSpecular->setType( "float" ); - accuSpecular->setName( "accuSpecular" ); - accuSpecular->uniform = true; - accuSpecular->sampler = false; - accuSpecular->constSortPos = cspPotentialPrimitive; - } - - Var *inTex = getInTexCoord( "texCoord", "float2", componentList ); - Var *accuVec = getInTexCoord( "accuVec", "float3", componentList ); - Var *bumpNorm = (Var *)LangElement::find( "bumpSample" ); - if( bumpNorm == NULL ) - { - bumpNorm = (Var *)LangElement::find( "bumpNormal" ); - if (!bumpNorm) - return; - } - - // get the accu pixel color - - Var *accuMapTex = new Var; - accuMapTex->setType("Texture2D"); - accuMapTex->setName("accuMapTex"); - accuMapTex->uniform = true; - accuMapTex->texture = true; - accuMapTex->constNum = accuMap->constNum; - meta->addStatement(new GenOp(" @ = @.Sample(@, @ * @);\r\n", colorAccuDecl, accuMapTex, accuMap, inTex, accuScale)); - - // scale up normals - meta->addStatement( new GenOp( " @.xyz = @.xyz * 2.0 - 0.5;\r\n", bumpNorm, bumpNorm ) ); - - // assign direction - meta->addStatement( new GenOp( " @.z *= @*2.0;\r\n", accuVec, accuDirection ) ); - - // saturate based on strength - meta->addStatement( new GenOp( " @ = saturate( dot( @.xyz, @.xyz * pow(@, 5) ) );\r\n", plcAccu, bumpNorm, accuVec, accuStrength ) ); - - // add coverage - meta->addStatement( new GenOp( " @.a += (2 * pow(@/2, 5)) - 0.5;\r\n", accuPlc, accuCoverage ) ); - - // clamp to a sensible value - meta->addStatement( new GenOp( " @.a = clamp(@.a, 0, 1);\r\n", accuPlc, accuPlc ) ); - - // light - Var *lightColor = (Var*) LangElement::find( "d_lightcolor" ); - if(lightColor != NULL) - meta->addStatement( new GenOp( " @ *= float4(@, 1.0);\r\n\r\n", accuColor, lightColor ) ); - - // lerp with current pixel - use the accu alpha as well - meta->addStatement( new GenOp( " @ = lerp( @, @, @.a * @.a);\r\n", color, color, accuColor, accuPlc, accuColor ) ); - - // the result should always be opaque - meta->addStatement( new GenOp( " @.a = 1.0;\r\n", color ) );*/ if (mOwner->isMethod("processPixelHLSL")) Con::executef(mOwner, "processPixelHLSL"); diff --git a/Engine/source/shaderGen/HLSL/debugVizFeatureHLSL.cpp b/Engine/source/shaderGen/HLSL/debugVizFeatureHLSL.cpp index 84b724e29..fe2fdb3af 100644 --- a/Engine/source/shaderGen/HLSL/debugVizFeatureHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/debugVizFeatureHLSL.cpp @@ -24,7 +24,7 @@ void DebugVizHLSL::processPix(Vector& componentList, { MultiLine* meta = new MultiLine; Var* surface = (Var*)LangElement::find("surface"); - Var* color = (Var*)LangElement::find("col"); + Var* color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget)); if (!surface) return; diff --git a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp index 09fb93fc2..80601ad68 100644 --- a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp @@ -1192,13 +1192,13 @@ void DiffuseFeatureHLSL::processPix( Vector &componentList, diffuseMaterialColor->constSortPos = cspPotentialPrimitive; MultiLine* meta = new MultiLine; - Var *col = (Var*)LangElement::find("col"); + Var *col = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget)); ShaderFeature::OutputTarget targ = ShaderFeature::DefaultTarget; if (fd.features[MFT_isDeferred]) { targ = ShaderFeature::RenderTarget1; - col = (Var*)LangElement::find("col1"); + col = (Var*)LangElement::find(getOutputTargetVarName(targ)); if (!col) { // create color var @@ -2403,7 +2403,7 @@ void FogFeatHLSL::processPix( Vector &componentList, fogColor->constSortPos = cspPass; // Get the out color. - Var *color = (Var*) LangElement::find( "col" ); + Var *color = (Var*) LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget)); if ( !color ) { color = new Var; @@ -2535,7 +2535,7 @@ void VisibilityFeatHLSL::processPix( Vector &componentList, // Translucent objects do a simple alpha fade. if ( fd.features[ MFT_IsTranslucent ] ) { - Var *color = (Var*)LangElement::find( "col" ); + Var *color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget)); meta->addStatement( new GenOp( " @.a *= @;\r\n", color, visibility ) ); return; } @@ -2577,9 +2577,9 @@ void AlphaTestHLSL::processPix( Vector &componentList, } // If we don't have a color var then we cannot do an alpha test. - Var *color = (Var*)LangElement::find( "col1" ); + Var *color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::RenderTarget1)); if (!color) - color = (Var*)LangElement::find("col"); + color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget)); if ( !color ) { output = NULL; @@ -2612,7 +2612,7 @@ void GlowMaskHLSL::processPix( Vector &componentList, // // The shader compiler will optimize out all the other // code above that doesn't contribute to the alpha mask. - Var *color = (Var*)LangElement::find( "col" ); + Var *color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget)); if ( color ) output = new GenOp( " @.rgb = 0;\r\n", color ); } @@ -2644,7 +2644,7 @@ void HDROutHLSL::processPix( Vector &componentList, const MaterialFeatureData &fd ) { // Let the helper function do the work. - Var *color = (Var*)LangElement::find( "col" ); + Var *color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget)); if ( color ) output = new GenOp( " @ = hdrEncode( @ );\r\n", color, color ); } From ad05a789465da0ea703473915e1ad27fa1303888 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Sun, 29 Aug 2021 01:11:29 -0500 Subject: [PATCH 17/17] sanity check nodelist presence --- Engine/source/environment/nodeListManager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Engine/source/environment/nodeListManager.cpp b/Engine/source/environment/nodeListManager.cpp index 0a67d6b39..5794b63c6 100644 --- a/Engine/source/environment/nodeListManager.cpp +++ b/Engine/source/environment/nodeListManager.cpp @@ -79,7 +79,8 @@ void NodeListEvent::unpack(NetConnection* conn, BitStream* stream) stream->read(&mTotalNodes); stream->read(&mLocalListStart); - mNodeList->mId = mId; + if (mNodeList) + mNodeList->mId = mId; // NOTE: Child class needs to populate the local node list }