Converts precipitationData to use sound asset macros

Adds handling for soundProfile fields and lookups of sound assets by SFXProfile name in project importer
This commit is contained in:
Areloch 2021-09-15 00:41:23 -05:00
parent 328319b853
commit 17d1253ba2
4 changed files with 58 additions and 28 deletions

View file

@ -919,7 +919,7 @@ T3Dpre4ProjectImporter::genProcessor("DebrisData", "shape shapeAsset shapeFile s
T3Dpre4ProjectImporter::genProcessor("DecalData", "material materialAsset");
T3Dpre4ProjectImporter::genProcessor("ExplosionData", "explosionShape explosionShapeAsset");
T3Dpre4ProjectImporter::genProcessor("ParticleData", "texture textureAsset textureName textureAsset textureExt textureExtAsset textureExtName textureExtAsset");
T3Dpre4ProjectImporter::genProcessor("PrecipitationData", "drop dropAsset dropTexture dropAsset splash splashAsset splashTexture splashAsset");
T3Dpre4ProjectImporter::genProcessor("PrecipitationData", "drop dropAsset dropTexture dropAsset splash splashAsset splashTexture splashAsset soundProfile soundAsset");
T3Dpre4ProjectImporter::genProcessor("SplashData", "texture textureAsset");
T3Dpre4ProjectImporter::genProcessor("LightFlareData", "flareTexture flareTextureAsset");
T3Dpre4ProjectImporter::genProcessor("PhysicsDebrisData", "shape shapeAsset shapeFile shapeAsset");

View file

@ -556,23 +556,49 @@ function processLegacyField(%line, %originalFieldName, %newFieldName)
%targetFilename = sanitizeFilename(%value);
if(isObject(%targetFilename))
{
if(%originalFieldName $= "soundProfile")
{
$ProjectImporter::assetQuery.clear();
%foundAssets = AssetDatabase.findAssetName($ProjectImporter::assetQuery, %targetFilename);
if(%foundAssets != 0)
{
%assetId = $ProjectImporter::assetQuery.getAsset(0);
}
}
else
{
//likely a material name, so handle it that way
%assetId = MaterialAsset::getAssetIdByMaterialName(%targetFilename);
}
}
else
{
if(!isFile(%targetFilename))
{
if(%originalFieldName $= "soundProfile")
{
$ProjectImporter::assetQuery.clear();
%foundAssets = AssetDatabase.findAssetName($ProjectImporter::assetQuery, %targetFilename);
if(%foundAssets != 0)
{
%assetId = $ProjectImporter::assetQuery.getAsset(0);
}
}
else
{
error("Legacy Project Importer - file described in line could not be found/is not valid");
return %line;
}
}
else
{
$ProjectImporter::assetQuery.clear();
%foundAssets = AssetDatabase.findAssetLooseFile($ProjectImporter::assetQuery, %targetFilename);
if(%foundAssets != 0)
{
%assetId = $ProjectImporter::assetQuery.getAsset(0);
}
}
}