Browse Source

material definition

changing the beast over to the refactor
marauder2k7 9 months ago
parent
commit
cebfdbc5ec

+ 15 - 0
Engine/source/T3D/assets/ImageAsset.h

@@ -721,5 +721,20 @@ public:
 #define INITPERSISTFIELD_IMAGEASSET_ARRAY_REFACTOR(name, arraySize, consoleClass, docs)                                                                                       \
    addProtectedField(assetText(name, Asset), TypeImageAssetPtrRefactor, Offset(m##name##Asset, consoleClass), _set##name##Data, &defaultProtectedGetFn, arraySize, assetDoc(name, asset docs.));
 
+#define DEF_IMAGEASSET_ARRAY_BINDS_REFACTOR(className,name, max)\
+DefineEngineMethod(className, get##name, const char*, (S32 index), , "get name")\
+{\
+   return object->get##name##Asset(index).notNull() ? object->get##name##Asset(index)->getImageFile() : ""; \
+}\
+DefineEngineMethod(className, get##name##Asset, const char*, (S32 index), , assetText(name, asset reference))\
+{\
+   if(index >= max || index < 0)\
+      return "";\
+   return object->_get##name(index); \
+}\
+DefineEngineMethod(className, set##name, void, (const char* map, S32 index), , assetText(name,assignment. first tries asset then flat file.))\
+{\
+    object->_set##name(StringTable->insert(map), index);\
+}
 
 #pragma endregion

+ 2 - 2
Engine/source/T3D/assets/MaterialAsset.cpp

@@ -644,7 +644,7 @@ void GuiInspectorTypeMaterialAssetPtr::updatePreviewImage()
          MaterialAsset* matAsset = AssetDatabase.acquireAsset<MaterialAsset>(previewImage);
          if (matAsset && matAsset->getMaterialDefinition())
          {
-            mPreviewImage->_setBitmap(matAsset->getMaterialDefinition()->mDiffuseMapAssetId[0]);
+            mPreviewImage->_setBitmap(matAsset->getMaterialDefinition()->_getDiffuseMap(0));
          }
       }
    }
@@ -676,7 +676,7 @@ void GuiInspectorTypeMaterialAssetPtr::setPreviewImage(StringTableEntry assetId)
          MaterialAsset* matAsset = AssetDatabase.acquireAsset<MaterialAsset>(assetId);
          if (matAsset && matAsset->getMaterialDefinition())
          {
-            mPreviewImage->_setBitmap(matAsset->getMaterialDefinition()->mDiffuseMapAssetId[0]);
+            mPreviewImage->_setBitmap(matAsset->getMaterialDefinition()->_getDiffuseMap(0));
          }
       }
    }

+ 2 - 2
Engine/source/T3D/assets/assetImporter.cpp

@@ -2988,11 +2988,11 @@ Torque::Path AssetImporter::importMaterialAsset(AssetImportObject* assetItem)
 
          if (imageType == ImageAsset::ImageTypes::Albedo || childItem->imageSuffixType.isEmpty())
          {
-            newMat->mDiffuseMapAssetId[0] = assetMapFillInStr;
+            newMat->_setDiffuseMap(assetMapFillInStr,0);
          }
          else if (imageType == ImageAsset::ImageTypes::Normal)
          {
-            newMat->mNormalMapAssetId[0] = assetMapFillInStr;
+            newMat->_setNormalMap(assetMapFillInStr, 0);
          }
          else if (imageType == ImageAsset::ImageTypes::ORMConfig)
          {

+ 4 - 4
Engine/source/T3D/fx/groundCover.cpp

@@ -969,10 +969,10 @@ void GroundCover::_initialize( U32 cellCount, U32 cellPlacementCount )
       if(mat)
       {
          GFXTexHandle tex;
-         if (mat->getDiffuseMapResource(0))
-            tex = mat->getDiffuseMapResource(0);
-         else if (mat->getDiffuseMap(0) != StringTable->EmptyString())
-            tex = GFXTexHandle(mat->getDiffuseMap(0), &GFXStaticTextureSRGBProfile, "GroundCover texture aspect ratio check");
+         if (mat->getDiffuseMap(0))
+            tex = mat->getDiffuseMap(0);
+         else if (mat->getDiffuseMapAsset(0).notNull())
+            tex = mat->getDiffuseMap(0);
 
          if(tex.isValid())
          {

+ 9 - 34
Engine/source/materials/materialDefinition.cpp

@@ -142,18 +142,15 @@ Material::Material()
       mAccuCoverage[i] = 0.9f;
       mAccuSpecular[i] = 16.0f;
 
-      INIT_IMAGEASSET_ARRAY(DiffuseMap, GFXStaticTextureSRGBProfile, i);
       INIT_IMAGEASSET_ARRAY(OverlayMap, GFXStaticTextureProfile, i);
       INIT_IMAGEASSET_ARRAY(LightMap, GFXStaticTextureProfile, i);
       INIT_IMAGEASSET_ARRAY(ToneMap, GFXStaticTextureProfile, i);
       INIT_IMAGEASSET_ARRAY(DetailMap, GFXStaticTextureProfile, i);
-      INIT_IMAGEASSET_ARRAY(NormalMap, GFXNormalMapProfile, i);
       INIT_IMAGEASSET_ARRAY(ORMConfigMap, GFXStaticTextureProfile, i);
       INIT_IMAGEASSET_ARRAY(RoughMap, GFXStaticTextureProfile, i);
       INIT_IMAGEASSET_ARRAY(AOMap, GFXStaticTextureProfile, i);
       INIT_IMAGEASSET_ARRAY(MetalMap, GFXStaticTextureProfile, i);
       INIT_IMAGEASSET_ARRAY(GlowMap, GFXStaticTextureProfile, i);
-      INIT_IMAGEASSET_ARRAY(DetailNormalMap, GFXNormalMapProfile, i);
 
       mParallaxScale[i] = 0.0f;
 
@@ -258,14 +255,14 @@ void Material::initPersistFields()
    addArray("Stages", MAX_STAGES);
 
    addGroup("Basic Texture Maps");
-      INITPERSISTFIELD_IMAGEASSET_ARRAY(DiffuseMap, MAX_STAGES, Material, "Albedo");
+      INITPERSISTFIELD_IMAGEASSET_ARRAY_REFACTOR(DiffuseMap, MAX_STAGES, Material, "Albedo");
       addField("diffuseColor", TypeColorF, Offset(mDiffuse, Material), MAX_STAGES,
          "This color is multiplied against the diffuse texture color.  If no diffuse texture "
          "is present this is the material color.");
       addField("diffuseMapSRGB", TypeBool, Offset(mDiffuseMapSRGB, Material), MAX_STAGES,
          "Enable sRGB for the diffuse color texture map.");
 
-      INITPERSISTFIELD_IMAGEASSET_ARRAY(NormalMap, MAX_STAGES, Material, "NormalMap");
+      INITPERSISTFIELD_IMAGEASSET_ARRAY_REFACTOR(NormalMap, MAX_STAGES, Material, "NormalMap");
    endGroup("Basic Texture Maps");
 
    addGroup("Light Influence Maps");
@@ -303,7 +300,7 @@ void Material::initPersistFields()
       addField("detailScale", TypePoint2F, Offset(mDetailScale, Material), MAX_STAGES,
          "The scale factor for the detail map.");
 
-      INITPERSISTFIELD_IMAGEASSET_ARRAY(DetailNormalMap, MAX_STAGES, Material, "DetailNormalMap");
+      INITPERSISTFIELD_IMAGEASSET_ARRAY_REFACTOR(DetailNormalMap, MAX_STAGES, Material, "DetailNormalMap");
       addField("detailNormalMapStrength", TypeF32, Offset(mDetailNormalMapStrength, Material), MAX_STAGES,
          "Used to scale the strength of the detail normal map when blended with the base normal map.");
 
@@ -506,18 +503,12 @@ void Material::initPersistFields()
    // They point at the new 'map' fields, but reads always return
    // an empty string and writes only apply if the value is not empty.
    //
-   addProtectedField("baseTex", TypeImageFilename, Offset(mDiffuseMapName, Material),
-      defaultProtectedSetNotEmptyFn, emptyStringProtectedGetFn, MAX_STAGES,
-      "For backwards compatibility.\n@see diffuseMap\n", AbstractClassRep::FIELD_HideInInspectors);
    addProtectedField("detailTex", TypeImageFilename, Offset(mDetailMapName, Material),
       defaultProtectedSetNotEmptyFn, emptyStringProtectedGetFn, MAX_STAGES,
       "For backwards compatibility.\n@see detailMap\n", AbstractClassRep::FIELD_HideInInspectors);
    addProtectedField("overlayTex", TypeImageFilename, Offset(mOverlayMapName, Material),
       defaultProtectedSetNotEmptyFn, emptyStringProtectedGetFn, MAX_STAGES,
       "For backwards compatibility.\n@see overlayMap\n", AbstractClassRep::FIELD_HideInInspectors);
-   addProtectedField("bumpTex", TypeImageFilename, Offset(mNormalMapName, Material),
-      defaultProtectedSetNotEmptyFn, emptyStringProtectedGetFn, MAX_STAGES,
-      "For backwards compatibility.\n@see normalMap\n", AbstractClassRep::FIELD_HideInInspectors);
    addProtectedField("colorMultiply", TypeColorF, Offset(mDiffuse, Material),
       defaultProtectedSetNotEmptyFn, emptyStringProtectedGetFn, MAX_STAGES,
       "For backwards compatibility.\n@see diffuseColor\n", AbstractClassRep::FIELD_HideInInspectors);
@@ -656,26 +647,11 @@ void Material::_mapMaterial()
    // If mapTo not defined in script, try to use the base texture name instead
    if (mMapTo.isEmpty())
    {
-      if (mDiffuseMapName[0] == StringTable->EmptyString() && mDiffuseMapAsset->isNull())
+      if (mDiffuseMapAsset->isNull())
          return;
-
-      else
+      else if (mDiffuseMapAsset->notNull())
       {
-         // extract filename from base texture
-         if (mDiffuseMapName[0] != StringTable->EmptyString())
-         {
-            U32 slashPos = String(mDiffuseMapName[0]).find('/', 0, String::Right);
-            if (slashPos == String::NPos)
-               // no '/' character, must be no path, just the filename
-               mMapTo = mDiffuseMapName[0];
-            else
-               // use everything after the last slash
-               mMapTo = String(mDiffuseMapName[0]).substr(slashPos + 1, (U32)strlen(mDiffuseMapName[0]) - slashPos - 1);
-         }
-         else if (!mDiffuseMapAsset->isNull())
-         {
-            mMapTo = mDiffuseMapAsset[0]->getImageFile();
-         }
+         mMapTo = mDiffuseMapAsset[0]->getImageFile();
       }
    }
 
@@ -850,16 +826,15 @@ bool Material::_setAccuEnabled(void* object, const char* index, const char* data
 //material.getDiffuseMap(%layer); //returns the raw file referenced
 //material.getDiffuseMapAsset(%layer); //returns the asset id
 //material.setDiffuseMap(%texture, %layer); //tries to set the asset and failing that attempts a flat file reference
-DEF_IMAGEASSET_ARRAY_BINDS(Material, DiffuseMap)
+DEF_IMAGEASSET_ARRAY_BINDS_REFACTOR(Material, DiffuseMap, Material::Constants::MAX_STAGES)
+DEF_IMAGEASSET_ARRAY_BINDS_REFACTOR(Material, NormalMap, Material::Constants::MAX_STAGES)
+DEF_IMAGEASSET_ARRAY_BINDS_REFACTOR(Material, DetailNormalMap, Material::Constants::MAX_STAGES)
 DEF_IMAGEASSET_ARRAY_BINDS(Material, OverlayMap);
 DEF_IMAGEASSET_ARRAY_BINDS(Material, LightMap);
 DEF_IMAGEASSET_ARRAY_BINDS(Material, ToneMap);
 DEF_IMAGEASSET_ARRAY_BINDS(Material, DetailMap);
-DEF_IMAGEASSET_ARRAY_BINDS(Material, NormalMap);
 DEF_IMAGEASSET_ARRAY_BINDS(Material, ORMConfigMap);
 DEF_IMAGEASSET_ARRAY_BINDS(Material, RoughMap);
 DEF_IMAGEASSET_ARRAY_BINDS(Material, AOMap);
 DEF_IMAGEASSET_ARRAY_BINDS(Material, MetalMap);
 DEF_IMAGEASSET_ARRAY_BINDS(Material, GlowMap);
-DEF_IMAGEASSET_ARRAY_BINDS(Material, DetailNormalMap);
-

+ 3 - 10
Engine/source/materials/materialDefinition.h

@@ -208,10 +208,9 @@ public:
    //-----------------------------------------------------------------------
    // Data
    //-----------------------------------------------------------------------
-   void onImageAssetChanged();
-
-   DECLARE_IMAGEASSET_ARRAY(Material, DiffuseMap, MAX_STAGES, onImageAssetChanged);
-   DECLARE_IMAGEASSET_ARRAY_SETGET(Material, DiffuseMap);
+   DECLARE_IMAGEASSET_ARRAY_REFACTOR(Material, DiffuseMap, GFXStaticTextureSRGBProfile, MAX_STAGES)
+   DECLARE_IMAGEASSET_ARRAY_REFACTOR(Material, NormalMap, GFXNormalMapProfile, MAX_STAGES)
+   DECLARE_IMAGEASSET_ARRAY_REFACTOR(Material, DetailNormalMap, GFXNormalMapProfile, MAX_STAGES)
 
    bool     mDiffuseMapSRGB[MAX_STAGES];   // SRGB diffuse
    DECLARE_IMAGEASSET_ARRAY(Material, OverlayMap, MAX_STAGES, onImageAssetChanged);
@@ -226,8 +225,6 @@ public:
    DECLARE_IMAGEASSET_ARRAY(Material, DetailMap, MAX_STAGES, onImageAssetChanged);
    DECLARE_IMAGEASSET_ARRAY_SETGET(Material, DetailMap);
 
-   DECLARE_IMAGEASSET_ARRAY(Material, NormalMap, MAX_STAGES, onImageAssetChanged);
-   DECLARE_IMAGEASSET_ARRAY_SETGET(Material, NormalMap);
 
    DECLARE_IMAGEASSET_ARRAY(Material, ORMConfigMap, MAX_STAGES, onImageAssetChanged);
    DECLARE_IMAGEASSET_ARRAY_SETGET(Material, ORMConfigMap);
@@ -250,10 +247,6 @@ public:
    DECLARE_IMAGEASSET_ARRAY_SETGET(Material, GlowMap);
 
    F32      mGlowMul[MAX_STAGES];
-   /// A second normal map which repeats at the detail map
-   /// scale and blended with the base normal map.
-   DECLARE_IMAGEASSET_ARRAY(Material, DetailNormalMap, MAX_STAGES, onImageAssetChanged);
-   DECLARE_IMAGEASSET_ARRAY_SETGET(Material, DetailNormalMap);
 
    /// The strength scalar for the detail normal map.
    F32 mDetailNormalMapStrength[MAX_STAGES];

+ 7 - 33
Engine/source/materials/processedMaterial.cpp

@@ -392,9 +392,9 @@ void ProcessedMaterial::_setStageData()
    for (i = 0; i < Material::MAX_STAGES; i++)
    {
       // DiffuseMap
-      if (mMaterial->mDiffuseMapAsset[i] && !mMaterial->mDiffuseMapAsset[i].isNull())
+      if (mMaterial->getDiffuseMapAsset(i).notNull())
       {
-         mStages[i].setTex(MFT_DiffuseMap, mMaterial->getDiffuseMapResource(i));
+         mStages[i].setTex(MFT_DiffuseMap, mMaterial->getDiffuseMap(i));
          if (!mStages[i].getTex(MFT_DiffuseMap))
          {
             // If we start with a #, we're probably actually attempting to hit a named target and it may not get a hit on the first pass.
@@ -404,20 +404,6 @@ void ProcessedMaterial::_setStageData()
             mStages[i].setTex(MFT_DiffuseMap, _createTexture(GFXTextureManager::getMissingTexturePath().c_str(), &GFXStaticTextureSRGBProfile));
          }
       }
-      else if (mMaterial->mDiffuseMapName[i] != StringTable->EmptyString())
-      {
-         mStages[i].setTex(MFT_DiffuseMap, _createTexture(mMaterial->mDiffuseMapName[i], &GFXStaticTextureSRGBProfile));
-         if (!mStages[i].getTex(MFT_DiffuseMap))
-         {
-            //If we start with a #, we're probably actually attempting to hit a named target and it may not get a hit on the first pass.
-            if (!String(mMaterial->mDiffuseMapName[i]).startsWith("#") && !String(mMaterial->mDiffuseMapName[i]).startsWith("$"))
-               mMaterial->logError("Failed to load diffuse map %s for stage %i", mMaterial->mDiffuseMapName[i], i);
-
-            // 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
       if (mMaterial->getOverlayMap(i) != StringTable->EmptyString())
       {
@@ -451,10 +437,9 @@ void ProcessedMaterial::_setStageData()
       }
 
       // NormalMap
-      if (mMaterial->mNormalMapAsset[i] && !mMaterial->mNormalMapAsset[i].isNull())
+      if (mMaterial->getNormalMapAsset(i).notNull())
       {
-         mStages[i].setTex(MFT_NormalMap, mMaterial->getNormalMapResource(i));
-         //mStages[i].setTex(MFT_DiffuseMap, _createTexture(mMaterial->getDiffuseMap(i), &GFXStaticTextureSRGBProfile));
+         mStages[i].setTex(MFT_NormalMap, mMaterial->getNormalMap(i));
          if (!mStages[i].getTex(MFT_NormalMap))
          {
             // Load a debug texture to make it clear to the user 
@@ -462,24 +447,13 @@ void ProcessedMaterial::_setStageData()
             mStages[i].setTex(MFT_NormalMap, _createTexture(GFXTextureManager::getMissingTexturePath().c_str(), &GFXNormalMapProfile));
          }
       }
-      else if (mMaterial->mNormalMapName[i] != StringTable->EmptyString())
-      {
-         mStages[i].setTex(MFT_NormalMap, _createTexture(mMaterial->mNormalMapName[i], &GFXNormalMapProfile));
-         if (!mStages[i].getTex(MFT_NormalMap))
-         {
-            //If we start with a #, we're probably actually attempting to hit a named target and it may not get a hit on the first pass. So we'll
-            //pass on the error rather than spamming the console
-            if (!String(mMaterial->mNormalMapName[i]).startsWith("#"))
-               mMaterial->logError("Failed to load normal map %s for stage %i", mMaterial->mNormalMapName[i], i);
-         }
-      }
 
       // Detail Normal Map
-      if (mMaterial->getDetailNormalMap(i) != StringTable->EmptyString())
+      if (mMaterial->getDetailNormalMapAsset(i).notNull())
       {
-         mStages[i].setTex(MFT_DetailNormalMap, mMaterial->getDetailNormalMapResource(i));
+         mStages[i].setTex(MFT_DetailNormalMap, mMaterial->getDetailNormalMap(i));
          if (!mStages[i].getTex(MFT_DetailNormalMap))
-            mMaterial->logError("Failed to load normal map %s for stage %i", mMaterial->getDetailNormalMap(i), i);
+            mMaterial->logError("Failed to load normal map %s for stage %i", mMaterial->getDetailNormalMapAsset(i), i);
       }
 
       //depending on creation method this may or may not have been shoved into srgb space eroneously

+ 2 - 2
Engine/source/materials/processedShaderMaterial.cpp

@@ -229,9 +229,9 @@ bool ProcessedShaderMaterial::init( const FeatureSet &features,
       mInstancingState = new InstancingState();
       mInstancingState->setFormat( _getRPD( 0 )->shader->getInstancingFormat(), mVertexFormat );
    }
-   if (mMaterial && mMaterial->mDiffuseMapName[0] != StringTable->EmptyString() && String(mMaterial->mDiffuseMapName[0]).startsWith("#"))
+   if (mMaterial && mMaterial->getDiffuseMapAsset(0).notNull() && String(mMaterial->getDiffuseMapAsset(0)->getImageFile()).startsWith("#"))
    {
-      String texTargetBufferName = String(mMaterial->mDiffuseMapName[0]).substr(1, (U32)strlen(mMaterial->mDiffuseMapName[0]) - 1);
+      String texTargetBufferName = String(mMaterial->getDiffuseMapAsset(0)->getImageFile()).substr(1, (U32)strlen(mMaterial->getDiffuseMapAsset(0)->getImageFile()) - 1);
       NamedTexTarget *texTarget = NamedTexTarget::find(texTargetBufferName);
       RenderPassData* rpd = getPass(0);
 

+ 3 - 4
Engine/source/renderInstance/renderDeferredMgr.cpp

@@ -883,11 +883,10 @@ bool DeferredMatInstance::init( const FeatureSet &features,
 {
    bool vaild = Parent::init(features, vertexFormat);
 
-   if (mMaterial && mMaterial->getDiffuseMap(0) != StringTable->EmptyString() && String(mMaterial->getDiffuseMap(0)).startsWith("#"))
+   if (mMaterial && mMaterial->getDiffuseMapAsset(0).notNull() && String(mMaterial->getDiffuseMapAsset(0)->getImageFile()).startsWith("#"))
    {
-      String difName = mMaterial->getDiffuseMap(0);
-      String texTargetBufferName = difName.substr(1, difName.length() - 1);
-      NamedTexTarget *texTarget = NamedTexTarget::find(texTargetBufferName);
+      String texTargetBufferName = String(mMaterial->getDiffuseMapAsset(0)->getImageFile()).substr(1, (U32)strlen(mMaterial->getDiffuseMapAsset(0)->getImageFile()) - 1);
+      NamedTexTarget* texTarget = NamedTexTarget::find(texTargetBufferName);
       RenderPassData* rpd = getPass(0);
 
       if (rpd)

+ 2 - 2
Engine/source/ts/assimp/assimpAppMaterial.cpp

@@ -170,14 +170,14 @@ void AssimpAppMaterial::initMaterial(const Torque::Path& path, Material* mat) co
    {
       torquePath = texName.C_Str();
       if (!torquePath.isEmpty())
-         mat->mDiffuseMapName[0] = cleanTextureName(torquePath, cleanFile, path, false);
+         mat->_setDiffuseMap(cleanTextureName(torquePath, cleanFile, path, false), 0);
    }
 
    if (AI_SUCCESS == mAIMat->Get(AI_MATKEY_TEXTURE(aiTextureType_NORMALS, 0), texName))
    {
       torquePath = texName.C_Str();
       if (!torquePath.isEmpty())
-         mat->mNormalMapName[0] = cleanTextureName(torquePath, cleanFile, path, false);
+         mat->_setNormalMap(cleanTextureName(torquePath, cleanFile, path, false), 0);
    }
 
 #ifdef TORQUE_PBR_MATERIALS

+ 2 - 2
Engine/source/ts/collada/colladaAppMaterial.cpp

@@ -208,8 +208,8 @@ Material *ColladaAppMaterial::createMaterial(const Torque::Path& path) const
    Material *newMat = MATMGR->allocateAndRegister( cleanName, getName() );
    Con::setVariable("$Con::File", oldScriptFile);        // restore script path
 
-   newMat->mDiffuseMapName[0] = diffuseMap;
-   newMat->mNormalMapName[0] = normalMap;
+   newMat->_setDiffuseMap(diffuseMap, 0);
+   newMat->_setNormalMap(normalMap, 0);
 
    newMat->mDiffuse[0] = diffuseColor;
    newMat->mRoughness[0] = roughness;

+ 8 - 8
Engine/source/ts/collada/colladaUtils.cpp

@@ -1030,8 +1030,8 @@ void ColladaUtils::exportColladaMaterials(tinyxml2::XMLElement* rootNode, const
       {
          Torque::Path diffusePath;
 
-         if (mat->mDiffuseMapName[0] != StringTable->EmptyString())
-            diffusePath = Torque::Path(mat->mDiffuseMapName[0]);
+         if (mat->getDiffuseMapAsset(0).notNull())
+            diffusePath = Torque::Path(mat->getDiffuseMapAsset(0)->getImageFile());
          else
             diffusePath = String("warningMat");
 
@@ -1040,8 +1040,8 @@ void ColladaUtils::exportColladaMaterials(tinyxml2::XMLElement* rootNode, const
       }
       else
       {
-         if (mat->mDiffuseMapName[0] != StringTable->EmptyString())
-            diffuseMap += Torque::Path(mat->mDiffuseMapName[0]);
+         if (mat->getDiffuseMapAsset(0).notNull())
+            diffuseMap += Torque::Path(mat->getDiffuseMapAsset(0)->getImageFile());
          else
             diffuseMap += "warningMat";
       }
@@ -1316,8 +1316,8 @@ void ColladaUtils::exportColladaMaterials(tinyxml2::XMLElement* rootNode, const
       {
          Torque::Path diffusePath;
 
-         if (mat->mDiffuseMapName[0] != StringTable->EmptyString())
-            diffusePath = Torque::Path(mat->mDiffuseMapName[0]);
+         if (mat->getDiffuseMapAsset(0).notNull())
+            diffusePath = Torque::Path(mat->getDiffuseMapAsset(0)->getImageFile());
          else
             diffusePath = String("warningMat");
 
@@ -1326,8 +1326,8 @@ void ColladaUtils::exportColladaMaterials(tinyxml2::XMLElement* rootNode, const
       }
       else
       {
-         if (mat->mDiffuseMapName[0] != StringTable->EmptyString())
-            diffuseMap += Torque::Path(mat->mDiffuseMapName[0]);
+         if (mat->getDiffuseMapAsset(0).notNull())
+            diffuseMap += Torque::Path(mat->getDiffuseMapAsset(0)->getImageFile());
          else
             diffuseMap += "warningMat";
       }

+ 2 - 2
Engine/source/ts/tsLastDetail.cpp

@@ -252,8 +252,8 @@ void TSLastDetail::update( bool forceUpdate )
    // Setup the material for this imposter.
    mMaterial = MATMGR->allocateAndRegister( String::EmptyString );
    mMaterial->mAutoGenerated = true;
-   mMaterial->setDiffuseMapFile(diffuseMapPath, 0);
-   mMaterial->setNormalMapFile(_getNormalMapPath(), 0);
+   mMaterial->_setDiffuseMap(diffuseMapPath, 0);
+   mMaterial->_setNormalMap(_getNormalMapPath(), 0);
 
    mMaterial->mImposterLimits.set( (mNumPolarSteps * 2) + 1, mNumEquatorSteps, mPolarAngle, mIncludePoles );
    mMaterial->mTranslucent = true;