mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
clean up redundant loads, shift first load to getResource methods for sound and shape.
still need to properly sort image
This commit is contained in:
parent
b710a309bd
commit
a8d640e311
|
|
@ -301,13 +301,11 @@ void ImageAsset::initializeAsset()
|
|||
ResourceManager::get().getChangedSignal().notify(this, &ImageAsset::_onResourceChanged);
|
||||
|
||||
mImagePath = getOwned() ? expandAssetFilePath(mImageFileName) : mImagePath;
|
||||
//loadImage();
|
||||
}
|
||||
|
||||
void ImageAsset::onAssetRefresh()
|
||||
{
|
||||
mImagePath = getOwned() ? expandAssetFilePath(mImageFileName) : mImagePath;
|
||||
//loadImage();
|
||||
}
|
||||
|
||||
void ImageAsset::_onResourceChanged(const Torque::Path& path)
|
||||
|
|
@ -317,7 +315,6 @@ void ImageAsset::_onResourceChanged(const Torque::Path& path)
|
|||
|
||||
refreshAsset();
|
||||
|
||||
//loadImage();
|
||||
onAssetRefresh();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -224,8 +224,6 @@ void ShapeAsset::initializeAsset()
|
|||
String normalPath = String(mFilePath) + "_imposter_normals.dds";
|
||||
mNormalImposterPath = StringTable->insert(normalPath.c_str());
|
||||
}
|
||||
|
||||
//loadShape();
|
||||
}
|
||||
|
||||
void ShapeAsset::setShapeFile(const char* pShapeFile)
|
||||
|
|
@ -461,7 +459,6 @@ U32 ShapeAsset::getAssetByFilename(StringTableEntry fileName, AssetPtr<ShapeAsse
|
|||
{
|
||||
//acquire and bind the asset, and return it out
|
||||
shapeAsset->setAssetId(query.mAssetList[0]);
|
||||
(*shapeAsset)->loadShape();
|
||||
return (*shapeAsset)->mLoadedState;
|
||||
}
|
||||
}
|
||||
|
|
@ -494,7 +491,6 @@ U32 ShapeAsset::getAssetById(StringTableEntry assetId, AssetPtr<ShapeAsset>* sha
|
|||
|
||||
if (shapeAsset->notNull())
|
||||
{
|
||||
(*shapeAsset)->loadShape();
|
||||
return (*shapeAsset)->mLoadedState;
|
||||
}
|
||||
else
|
||||
|
|
@ -504,7 +500,6 @@ U32 ShapeAsset::getAssetById(StringTableEntry assetId, AssetPtr<ShapeAsset>* sha
|
|||
|
||||
if (shapeAsset->isNull())
|
||||
{
|
||||
(*shapeAsset)->loadShape();
|
||||
//Well that's bad, loading the fallback failed.
|
||||
Con::warnf("ShapeAsset::getAssetById - Finding of asset with id %s failed with no fallback asset", assetId);
|
||||
return AssetErrCode::Failed;
|
||||
|
|
@ -513,7 +508,6 @@ U32 ShapeAsset::getAssetById(StringTableEntry assetId, AssetPtr<ShapeAsset>* sha
|
|||
//handle noshape not being loaded itself
|
||||
if ((*shapeAsset)->mLoadedState == BadFileReference)
|
||||
{
|
||||
(*shapeAsset)->loadShape();
|
||||
Con::warnf("ShapeAsset::getAssetById - Finding of asset with id %s failed, and fallback asset reported error of Bad File Reference.", assetId);
|
||||
return AssetErrCode::BadFileReference;
|
||||
}
|
||||
|
|
@ -540,8 +534,6 @@ void ShapeAsset::onAssetRefresh(void)
|
|||
// Update.
|
||||
if(!Platform::isFullPath(mFileName))
|
||||
mFilePath = getOwned() ? expandAssetFilePath(mFileName) : mFilePath;
|
||||
|
||||
loadShape();
|
||||
}
|
||||
|
||||
void ShapeAsset::SplitSequencePathAndName(String& srcPath, String& srcName)
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ public:
|
|||
|
||||
TSShape* getShape() { return mShape; }
|
||||
|
||||
Resource<TSShape> getShapeResource() { return mShape; }
|
||||
Resource<TSShape> getShapeResource() { loadShape(); return mShape; }
|
||||
|
||||
void SplitSequencePathAndName(String& srcPath, String& srcName);
|
||||
StringTableEntry getShapeFileName() { return mFileName; }
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ void SoundAsset::initializeAsset(void)
|
|||
return;
|
||||
|
||||
mSoundPath = getOwned() ? expandAssetFilePath(mSoundFile) : mSoundPath;
|
||||
loadSound();
|
||||
//loadSound();
|
||||
}
|
||||
|
||||
void SoundAsset::_onResourceChanged(const Torque::Path &path)
|
||||
|
|
@ -208,7 +208,7 @@ void SoundAsset::_onResourceChanged(const Torque::Path &path)
|
|||
|
||||
refreshAsset();
|
||||
|
||||
loadSound();
|
||||
//loadSound();
|
||||
}
|
||||
|
||||
void SoundAsset::onAssetRefresh(void)
|
||||
|
|
@ -218,7 +218,7 @@ void SoundAsset::onAssetRefresh(void)
|
|||
|
||||
//Update
|
||||
mSoundPath = getOwned() ? expandAssetFilePath(mSoundFile) : mSoundPath;
|
||||
loadSound();
|
||||
//loadSound();
|
||||
}
|
||||
|
||||
bool SoundAsset::loadSound()
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ public:
|
|||
virtual void copyTo(SimObject* object);
|
||||
|
||||
//SFXResource* getSound() { return mSoundResource; }
|
||||
Resource<SFXResource> getSoundResource() { return mSFXProfile.getResource(); }
|
||||
Resource<SFXResource> getSoundResource() { loadSound(); return mSFXProfile.getResource(); }
|
||||
|
||||
/// Declare Console Object.
|
||||
DECLARE_CONOBJECT(SoundAsset);
|
||||
|
|
|
|||
Loading…
Reference in a new issue