From 45f1447d2b6c75312199ce6ace188fa67ca7c3f6 Mon Sep 17 00:00:00 2001 From: marauder2k7 Date: Thu, 19 Jun 2025 07:53:32 +0100 Subject: [PATCH] Update ImageAsset.h add check for if _in matches the filename that is already set for image asset, this stops the set being called twice when loading the same image asset --- Engine/source/T3D/assets/ImageAsset.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Engine/source/T3D/assets/ImageAsset.h b/Engine/source/T3D/assets/ImageAsset.h index 2300e0de6..102f59052 100644 --- a/Engine/source/T3D/assets/ImageAsset.h +++ b/Engine/source/T3D/assets/ImageAsset.h @@ -123,7 +123,7 @@ public: }; static const String mErrCodeStrings[U32(ImageAssetErrCode::Extended) - U32(Parent::Extended) + 1]; - static U32 getAssetErrCode(ConcreteAssetPtr checkAsset) { if (checkAsset) return checkAsset->mLoadedState; else return 0; } + static U32 getAssetErrCode(ConcreteAssetPtr checkAsset) { if (checkAsset.notNull()) return checkAsset->mLoadedState; else return 0; } static String getAssetErrstrn(U32 errCode) { @@ -241,6 +241,8 @@ public: void _set##name(StringTableEntry _in){ \ if(m##name##Asset.getAssetId() == _in) \ return; \ + if(get##name##File() == _in) \ + return; \ if(_in == NULL || _in == StringTable->EmptyString()) \ { \ m##name##Asset = NULL; \ @@ -296,6 +298,8 @@ public: void _set##name(StringTableEntry _in){ \ if(m##name##Asset.getAssetId() == _in) \ return; \ + if(get##name##File() == _in) \ + return; \ if(_in == NULL || _in == StringTable->EmptyString()) \ { \ m##name##Asset = NULL; \ @@ -358,6 +362,8 @@ public: void _set##name(StringTableEntry _in, const U32& index){ \ if(m##name##Asset[index].getAssetId() == _in) \ return; \ + if(get##name##File(index) == _in) \ + return; \ if(_in == NULL || _in == StringTable->EmptyString()) \ { \ m##name##Asset[index] = NULL; \ @@ -414,6 +420,8 @@ public: void _set##name(StringTableEntry _in, const U32& index){ \ if(m##name##Asset[index].getAssetId() == _in) \ return; \ + if(get##name##File(index) == _in) \ + return; \ if(_in == NULL || _in == StringTable->EmptyString()) \ { \ m##name##Asset[index] = NULL; \