decal safeties via if (mMaterialAsset.notNull() && mMaterialAsset->getStatus() == MaterialAsset::Ok)

This commit is contained in:
AzaezelX 2021-08-17 15:27:23 -05:00
parent 68fee78744
commit 0bf97ad2c8

View file

@ -202,7 +202,7 @@ void DecalData::initPersistFields()
"grid; use #textureCoords to manually specify UV coordinates for " "grid; use #textureCoords to manually specify UV coordinates for "
"irregular sized frames." ); "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) " "@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" "representing the UV coordinates for each frame in the imagemap.\n\n"
"@note This field should only be set if the imagemap frames are " "@note This field should only be set if the imagemap frames are "
@ -313,7 +313,9 @@ void DecalData::_initMaterial()
{ {
SAFE_DELETE( matInst ); SAFE_DELETE( matInst );
if (mMaterialAsset.notNull()) _setMaterial(getMaterial());
if (mMaterialAsset.notNull() && mMaterialAsset->getStatus() == MaterialAsset::Ok)
{ {
matInst = getMaterialResource()->createMatInstance(); matInst = getMaterialResource()->createMatInstance();
} }