processed material null ref

processedMaterial was not checking to see if each asset was null before getting the image filename inside the call to _createCompositeTexture
This commit is contained in:
marauder2k7 2025-05-13 23:46:54 +01:00
parent c0d87cd3f1
commit a52069bbc5
2 changed files with 6 additions and 4 deletions

View file

@ -130,7 +130,7 @@ for (U32 i = 0; i < max; i++)\
#define DEF_ASSET_BINDS_REFACTOR(className,name)\ #define DEF_ASSET_BINDS_REFACTOR(className,name)\
DefineEngineMethod(className, get##name, StringTableEntry, (), , "get name")\ DefineEngineMethod(className, get##name, StringTableEntry, (), , "get name")\
{\ {\
return object->get##name##Asset()->getImageFile(); \ return object->get##name##Asset().notNull() ? object->get##name##Asset()->getImageFile() : ""; \
}\ }\
DefineEngineMethod(className, get##name##Asset, StringTableEntry, (), , assetText(name, asset reference))\ DefineEngineMethod(className, get##name##Asset, StringTableEntry, (), , assetText(name, asset reference))\
{\ {\

View file

@ -477,9 +477,11 @@ void ProcessedMaterial::_setStageData()
inputKey[1] = mMaterial->mRoughnessChan[i]; inputKey[1] = mMaterial->mRoughnessChan[i];
inputKey[2] = mMaterial->mMetalChan[i]; inputKey[2] = mMaterial->mMetalChan[i];
inputKey[3] = 0; inputKey[3] = 0;
mStages[i].setTex(MFT_OrmMap, _createCompositeTexture( mMaterial->getAOMapAsset(i)->getImageFile(), mMaterial->getRoughMapAsset(i)->getImageFile(), mStages[i].setTex(MFT_OrmMap,
mMaterial->getMetalMapAsset(i)->getImageFile(), "", _createCompositeTexture(mMaterial->getAOMapAsset(i).notNull() ? mMaterial->getAOMapAsset(i)->getImageFile() : "",
inputKey, profile)); mMaterial->getRoughMapAsset(i).notNull() ? mMaterial->getRoughMapAsset(i)->getImageFile() : "",
mMaterial->getMetalMapAsset(i).notNull() ? mMaterial->getMetalMapAsset(i)->getImageFile() : "",
"", inputKey, profile));
if (!mStages[i].getTex(MFT_OrmMap)) if (!mStages[i].getTex(MFT_OrmMap))
mMaterial->logError("Failed to dynamically create ORM Config map for stage %i", i); mMaterial->logError("Failed to dynamically create ORM Config map for stage %i", i);
} }