mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 08:34:40 +00:00
Shifted long-form check/fetch of sound asset's SFXProfile to a convenience function
Fixed formatting on projectImporter.tscript file
This commit is contained in:
parent
17d1253ba2
commit
2a8f8c15f3
3 changed files with 23 additions and 18 deletions
|
|
@ -189,7 +189,7 @@ bool PrecipitationData::preload( bool server, String &errorStr )
|
||||||
if( Parent::preload( server, errorStr) == false)
|
if( Parent::preload( server, errorStr) == false)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!server && (mSoundAsset.isNull() || !mSoundAsset->getSfxProfile()))
|
if (!server && !getSFXProfile())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -200,7 +200,6 @@ void PrecipitationData::packData(BitStream* stream)
|
||||||
Parent::packData(stream);
|
Parent::packData(stream);
|
||||||
|
|
||||||
PACKDATA_SOUNDASSET(Sound);
|
PACKDATA_SOUNDASSET(Sound);
|
||||||
//sfxWrite( stream, soundProfile );
|
|
||||||
|
|
||||||
PACKDATA_IMAGEASSET(Drop);
|
PACKDATA_IMAGEASSET(Drop);
|
||||||
|
|
||||||
|
|
@ -218,7 +217,6 @@ void PrecipitationData::unpackData(BitStream* stream)
|
||||||
Parent::unpackData(stream);
|
Parent::unpackData(stream);
|
||||||
|
|
||||||
UNPACKDATA_SOUNDASSET(Sound);
|
UNPACKDATA_SOUNDASSET(Sound);
|
||||||
//sfxRead( stream, &soundProfile );
|
|
||||||
|
|
||||||
UNPACKDATA_IMAGEASSET(Drop);
|
UNPACKDATA_IMAGEASSET(Drop);
|
||||||
|
|
||||||
|
|
@ -599,9 +597,9 @@ bool Precipitation::onNewDataBlock( GameBaseData *dptr, bool reload )
|
||||||
{
|
{
|
||||||
SFX_DELETE( mAmbientSound );
|
SFX_DELETE( mAmbientSound );
|
||||||
|
|
||||||
if ( mDataBlock->mSoundAsset && mDataBlock->mSoundAsset->getSfxProfile() )
|
if ( mDataBlock->getSFXProfile())
|
||||||
{
|
{
|
||||||
mAmbientSound = SFX->createSource(mDataBlock->mSoundAsset->getSfxProfile(), &getTransform() );
|
mAmbientSound = SFX->createSource(mDataBlock->getSFXProfile(), &getTransform() );
|
||||||
if ( mAmbientSound )
|
if ( mAmbientSound )
|
||||||
mAmbientSound->play();
|
mAmbientSound->play();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,13 @@ class PrecipitationData : public GameBaseData
|
||||||
|
|
||||||
void onDropChanged() {}
|
void onDropChanged() {}
|
||||||
void onSplashChanged() {}
|
void onSplashChanged() {}
|
||||||
|
|
||||||
|
SFXProfile* getSFXProfile() {
|
||||||
|
if (mSoundAsset.notNull())
|
||||||
|
return mSoundAsset->getSfxProfile();
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Raindrop
|
struct Raindrop
|
||||||
|
|
|
||||||
|
|
@ -556,7 +556,7 @@ function processLegacyField(%line, %originalFieldName, %newFieldName)
|
||||||
%targetFilename = sanitizeFilename(%value);
|
%targetFilename = sanitizeFilename(%value);
|
||||||
|
|
||||||
if(isObject(%targetFilename))
|
if(isObject(%targetFilename))
|
||||||
{
|
{
|
||||||
if(%originalFieldName $= "soundProfile")
|
if(%originalFieldName $= "soundProfile")
|
||||||
{
|
{
|
||||||
$ProjectImporter::assetQuery.clear();
|
$ProjectImporter::assetQuery.clear();
|
||||||
|
|
@ -568,14 +568,14 @@ function processLegacyField(%line, %originalFieldName, %newFieldName)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//likely a material name, so handle it that way
|
//likely a material name, so handle it that way
|
||||||
%assetId = MaterialAsset::getAssetIdByMaterialName(%targetFilename);
|
%assetId = MaterialAsset::getAssetIdByMaterialName(%targetFilename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(!isFile(%targetFilename))
|
if(!isFile(%targetFilename))
|
||||||
{
|
{
|
||||||
if(%originalFieldName $= "soundProfile")
|
if(%originalFieldName $= "soundProfile")
|
||||||
{
|
{
|
||||||
$ProjectImporter::assetQuery.clear();
|
$ProjectImporter::assetQuery.clear();
|
||||||
|
|
@ -587,17 +587,17 @@ function processLegacyField(%line, %originalFieldName, %newFieldName)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
error("Legacy Project Importer - file described in line could not be found/is not valid");
|
error("Legacy Project Importer - file described in line could not be found/is not valid");
|
||||||
return %line;
|
return %line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$ProjectImporter::assetQuery.clear();
|
$ProjectImporter::assetQuery.clear();
|
||||||
%foundAssets = AssetDatabase.findAssetLooseFile($ProjectImporter::assetQuery, %targetFilename);
|
%foundAssets = AssetDatabase.findAssetLooseFile($ProjectImporter::assetQuery, %targetFilename);
|
||||||
if(%foundAssets != 0)
|
if(%foundAssets != 0)
|
||||||
{
|
{
|
||||||
%assetId = $ProjectImporter::assetQuery.getAsset(0);
|
%assetId = $ProjectImporter::assetQuery.getAsset(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue