Browse Source

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

AzaezelX 4 years ago
parent
commit
0bf97ad2c8
1 changed files with 4 additions and 2 deletions
  1. 4 2
      Engine/source/T3D/decal/decalData.cpp

+ 4 - 2
Engine/source/T3D/decal/decalData.cpp

@@ -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();
    }
    }