mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 16:14:38 +00:00
Merge pull request #363 from Areloch/ImprovedImageSuffixHandling
Improves default suffix handling for asset importer on image assets under a material asset
This commit is contained in:
commit
225a2ecf4e
1 changed files with 47 additions and 27 deletions
|
|
@ -1613,6 +1613,9 @@ void AssetImporter::processMaterialAsset(AssetImportObject* assetItem)
|
||||||
|
|
||||||
String imageAssetName = childAssetItem->assetName;
|
String imageAssetName = childAssetItem->assetName;
|
||||||
|
|
||||||
|
if (suffix.isEmpty())
|
||||||
|
materialImageNoSuffix = imageAssetName;
|
||||||
|
else
|
||||||
materialImageNoSuffix = imageAssetName.erase(imageAssetName.length() - suffix.length(), suffix.length());//cache this for later as we may need it for file association lookups
|
materialImageNoSuffix = imageAssetName.erase(imageAssetName.length() - suffix.length(), suffix.length());//cache this for later as we may need it for file association lookups
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1621,8 +1624,6 @@ void AssetImporter::processMaterialAsset(AssetImportObject* assetItem)
|
||||||
|
|
||||||
//Now that we've checked off any existingly matched image types, process through the unmatched to look for files that associate
|
//Now that we've checked off any existingly matched image types, process through the unmatched to look for files that associate
|
||||||
for (S32 t = 0; t < ImageAsset::ImageTypeCount; t++)
|
for (S32 t = 0; t < ImageAsset::ImageTypeCount; t++)
|
||||||
{
|
|
||||||
if (!matchedImageTypes[t])
|
|
||||||
{
|
{
|
||||||
//This type wasn't found, so try and find a match based on suffix
|
//This type wasn't found, so try and find a match based on suffix
|
||||||
String suffixList;
|
String suffixList;
|
||||||
|
|
@ -1650,6 +1651,8 @@ void AssetImporter::processMaterialAsset(AssetImportObject* assetItem)
|
||||||
//TODO: Glow map lookup too
|
//TODO: Glow map lookup too
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!matchedImageTypes[t])
|
||||||
|
{
|
||||||
U32 suffixCount = StringUnit::getUnitCount(suffixList.c_str(), ",;");
|
U32 suffixCount = StringUnit::getUnitCount(suffixList.c_str(), ",;");
|
||||||
for (U32 i = 0; i < suffixCount; i++)
|
for (U32 i = 0; i < suffixCount; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -1716,6 +1719,18 @@ void AssetImporter::processMaterialAsset(AssetImportObject* assetItem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//just a bit of cleanup and logical testing for matches
|
||||||
|
//in the event we KNOW what the type is, but we don't have a suffix, such as a found image on a material lookup
|
||||||
|
//that doesn't have a suffix, we assume it to be the albedo, so we'll just append the suffix to avoid collisions if
|
||||||
|
//the name already matches our material name, similar to above logic
|
||||||
|
if (matchedImageTypes[t]->assetName == assetItem->assetName)
|
||||||
|
{
|
||||||
|
matchedImageTypes[t]->assetName += StringUnit::getUnit(suffixList.c_str(), 0, ",;");
|
||||||
|
matchedImageTypes[t]->cleanAssetName = matchedImageTypes[t]->assetName;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*for (U32 i = 0; i < assetItem->childAssetItems.size(); i++)
|
/*for (U32 i = 0; i < assetItem->childAssetItems.size(); i++)
|
||||||
|
|
@ -1904,6 +1919,11 @@ void AssetImporter::processShapeMaterialInfo(AssetImportObject* assetItem, S32 m
|
||||||
{
|
{
|
||||||
imageAssetItem->imageSuffixType = suffixType;
|
imageAssetItem->imageSuffixType = suffixType;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//we'll assume it's albedo
|
||||||
|
imageAssetItem->imageSuffixType = "Albedo";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue