Просмотр исходного кода

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
marauder2k7 2 месяцев назад
Родитель
Сommit
45f1447d2b
1 измененных файлов с 9 добавлено и 1 удалено
  1. 9 1
      Engine/source/T3D/assets/ImageAsset.h

+ 9 - 1
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;                                                                                                                                        \