Expands/Cleans up a lot of the asset functionality, including management, file association, and creation/importing

This commit is contained in:
Areloch 2019-05-04 11:49:42 -05:00
parent a366f65047
commit 4422082035
73 changed files with 4468 additions and 1876 deletions

View file

@ -92,7 +92,7 @@ ConsoleSetType(TypeSoundAssetPtr)
SoundAsset::SoundAsset()
{
mSoundFilePath = StringTable->EmptyString();
mSoundFile = StringTable->EmptyString();
mPitchAdjust = 0;
mVolumeAdjust = 0;
@ -117,7 +117,8 @@ void SoundAsset::initPersistFields()
// Call parent.
Parent::initPersistFields();
addField("soundFilePath", TypeFilename, Offset(mSoundFilePath, SoundAsset), "Path to the sound file.");
addProtectedField("soundFile", TypeAssetLooseFilePath, Offset(mSoundFile, SoundAsset),
&setSoundFile, &getSoundFile, "Path to the sound file.");
addField("pitchAdjust", TypeF32, Offset(mPitchAdjust, SoundAsset), "Adjustment of the pitch value");
addField("volumeAdjust", TypeF32, Offset(mVolumeAdjust, SoundAsset), "Adjustment to the volume.");
@ -138,4 +139,23 @@ void SoundAsset::initializeAsset(void)
void SoundAsset::onAssetRefresh(void)
{
}
}
void SoundAsset::setSoundFile(const char* pSoundFile)
{
// Sanity!
AssertFatal(pSoundFile != NULL, "Cannot use a NULL shape file.");
// Fetch image file.
pSoundFile = StringTable->insert(pSoundFile);
// Ignore no change,
if (pSoundFile == mSoundFile)
return;
// Update.
mSoundFile = getOwned() ? expandAssetFilePath(pSoundFile) : StringTable->insert(pSoundFile);
// Refresh the asset.
refreshAsset();
}