material definition

changing the beast over to the refactor
This commit is contained in:
marauder2k7 2024-12-27 12:53:04 +00:00
parent 4d980e5406
commit cebfdbc5ec
13 changed files with 61 additions and 105 deletions

View file

@ -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

View file

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

View file

@ -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)
{

View file

@ -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())
{