diff --git a/Engine/source/T3D/assets/ImageAsset.h b/Engine/source/T3D/assets/ImageAsset.h index 169bf0cdf..027dfbac1 100644 --- a/Engine/source/T3D/assets/ImageAsset.h +++ b/Engine/source/T3D/assets/ImageAsset.h @@ -406,11 +406,9 @@ public: \ }\ if (get##name(index) != StringTable->EmptyString() && m##name##Name[index] != StringTable->insert("texhandle"))\ {\ - if (get##name(index)[0] == '$' || get##name(index)[0] == '#') {\ - m##name##Asset[index]->getChangedSignal().notify(this, &className::changeFunc);\ - }\ - else\ - m##name[index].set(get##name(index), m##name##Profile[index], avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__));\ + m##name##Asset[index]->getChangedSignal().notify(this, &className::changeFunc);\ + if (get##name(index)[0] != '$' && get##name(index)[0] != '#')\ + m##name[index].set(get##name(index), m##name##Profile[index], avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__));\ }\ else\ {\ diff --git a/Engine/source/materials/materialDefinition.cpp b/Engine/source/materials/materialDefinition.cpp index feb23c81c..c9a09bd0d 100644 --- a/Engine/source/materials/materialDefinition.cpp +++ b/Engine/source/materials/materialDefinition.cpp @@ -245,6 +245,7 @@ Material::Material() void Material::onImageAssetChanged() { + flush(); reload(); } diff --git a/Engine/source/materials/processedMaterial.cpp b/Engine/source/materials/processedMaterial.cpp index 1fa542c84..1b951751e 100644 --- a/Engine/source/materials/processedMaterial.cpp +++ b/Engine/source/materials/processedMaterial.cpp @@ -401,14 +401,8 @@ void ProcessedMaterial::_setStageData() if (String(mMaterial->mDiffuseMapAsset[i]->getImageFileName()).startsWith("#") || String(mMaterial->mDiffuseMapAsset[i]->getImageFileName()).startsWith("$")) { mMaterial->logError("Named Target not ready %s for stage %i", mMaterial->mDiffuseMapAsset[i]->getImageFileName(), i); - mHasSetStageData = false; - } - else - { - // Load a debug texture to make it clear to the user - // that the texture for this stage was missing. - mStages[i].setTex(MFT_DiffuseMap, _createTexture(GFXTextureManager::getMissingTexturePath().c_str(), &GFXStaticTextureSRGBProfile)); } + mStages[i].setTex(MFT_DiffuseMap, _createTexture(GFXTextureManager::getMissingTexturePath().c_str(), &GFXStaticTextureSRGBProfile)); } } else if (mMaterial->mDiffuseMapName[i] != StringTable->EmptyString()) @@ -421,14 +415,10 @@ void ProcessedMaterial::_setStageData() if (String(mMaterial->mDiffuseMapName[i]).startsWith("#") || String(mMaterial->mDiffuseMapName[i]).startsWith("$")) { mMaterial->logError("Named Target not ready %s for stage %i", mMaterial->mDiffuseMapName[i], i); - mHasSetStageData = false; - } - else - { - // Load a debug texture to make it clear to the user - // that the texture for this stage was missing. - mStages[i].setTex(MFT_DiffuseMap, _createTexture(GFXTextureManager::getMissingTexturePath().c_str(), &GFXStaticTextureSRGBProfile)); } + // Load a debug texture to make it clear to the user + // that the texture for this stage was missing. + mStages[i].setTex(MFT_DiffuseMap, _createTexture(GFXTextureManager::getMissingTexturePath().c_str(), &GFXStaticTextureSRGBProfile)); } } // OverlayMap