mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +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
5 changed files with 5 additions and 16 deletions
|
|
@ -301,13 +301,11 @@ void ImageAsset::initializeAsset()
|
||||||
ResourceManager::get().getChangedSignal().notify(this, &ImageAsset::_onResourceChanged);
|
ResourceManager::get().getChangedSignal().notify(this, &ImageAsset::_onResourceChanged);
|
||||||
|
|
||||||
mImagePath = getOwned() ? expandAssetFilePath(mImageFileName) : mImagePath;
|
mImagePath = getOwned() ? expandAssetFilePath(mImageFileName) : mImagePath;
|
||||||
//loadImage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImageAsset::onAssetRefresh()
|
void ImageAsset::onAssetRefresh()
|
||||||
{
|
{
|
||||||
mImagePath = getOwned() ? expandAssetFilePath(mImageFileName) : mImagePath;
|
mImagePath = getOwned() ? expandAssetFilePath(mImageFileName) : mImagePath;
|
||||||
//loadImage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImageAsset::_onResourceChanged(const Torque::Path& path)
|
void ImageAsset::_onResourceChanged(const Torque::Path& path)
|
||||||
|
|
@ -317,7 +315,6 @@ void ImageAsset::_onResourceChanged(const Torque::Path& path)
|
||||||
|
|
||||||
refreshAsset();
|
refreshAsset();
|
||||||
|
|
||||||
//loadImage();
|
|
||||||
onAssetRefresh();
|
onAssetRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -224,8 +224,6 @@ void ShapeAsset::initializeAsset()
|
||||||
String normalPath = String(mFilePath) + "_imposter_normals.dds";
|
String normalPath = String(mFilePath) + "_imposter_normals.dds";
|
||||||
mNormalImposterPath = StringTable->insert(normalPath.c_str());
|
mNormalImposterPath = StringTable->insert(normalPath.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
//loadShape();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShapeAsset::setShapeFile(const char* pShapeFile)
|
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
|
//acquire and bind the asset, and return it out
|
||||||
shapeAsset->setAssetId(query.mAssetList[0]);
|
shapeAsset->setAssetId(query.mAssetList[0]);
|
||||||
(*shapeAsset)->loadShape();
|
|
||||||
return (*shapeAsset)->mLoadedState;
|
return (*shapeAsset)->mLoadedState;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -494,7 +491,6 @@ U32 ShapeAsset::getAssetById(StringTableEntry assetId, AssetPtr<ShapeAsset>* sha
|
||||||
|
|
||||||
if (shapeAsset->notNull())
|
if (shapeAsset->notNull())
|
||||||
{
|
{
|
||||||
(*shapeAsset)->loadShape();
|
|
||||||
return (*shapeAsset)->mLoadedState;
|
return (*shapeAsset)->mLoadedState;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -504,7 +500,6 @@ U32 ShapeAsset::getAssetById(StringTableEntry assetId, AssetPtr<ShapeAsset>* sha
|
||||||
|
|
||||||
if (shapeAsset->isNull())
|
if (shapeAsset->isNull())
|
||||||
{
|
{
|
||||||
(*shapeAsset)->loadShape();
|
|
||||||
//Well that's bad, loading the fallback failed.
|
//Well that's bad, loading the fallback failed.
|
||||||
Con::warnf("ShapeAsset::getAssetById - Finding of asset with id %s failed with no fallback asset", assetId);
|
Con::warnf("ShapeAsset::getAssetById - Finding of asset with id %s failed with no fallback asset", assetId);
|
||||||
return AssetErrCode::Failed;
|
return AssetErrCode::Failed;
|
||||||
|
|
@ -513,7 +508,6 @@ U32 ShapeAsset::getAssetById(StringTableEntry assetId, AssetPtr<ShapeAsset>* sha
|
||||||
//handle noshape not being loaded itself
|
//handle noshape not being loaded itself
|
||||||
if ((*shapeAsset)->mLoadedState == BadFileReference)
|
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);
|
Con::warnf("ShapeAsset::getAssetById - Finding of asset with id %s failed, and fallback asset reported error of Bad File Reference.", assetId);
|
||||||
return AssetErrCode::BadFileReference;
|
return AssetErrCode::BadFileReference;
|
||||||
}
|
}
|
||||||
|
|
@ -540,8 +534,6 @@ void ShapeAsset::onAssetRefresh(void)
|
||||||
// Update.
|
// Update.
|
||||||
if(!Platform::isFullPath(mFileName))
|
if(!Platform::isFullPath(mFileName))
|
||||||
mFilePath = getOwned() ? expandAssetFilePath(mFileName) : mFilePath;
|
mFilePath = getOwned() ? expandAssetFilePath(mFileName) : mFilePath;
|
||||||
|
|
||||||
loadShape();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShapeAsset::SplitSequencePathAndName(String& srcPath, String& srcName)
|
void ShapeAsset::SplitSequencePathAndName(String& srcPath, String& srcName)
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ public:
|
||||||
|
|
||||||
TSShape* getShape() { return mShape; }
|
TSShape* getShape() { return mShape; }
|
||||||
|
|
||||||
Resource<TSShape> getShapeResource() { return mShape; }
|
Resource<TSShape> getShapeResource() { loadShape(); return mShape; }
|
||||||
|
|
||||||
void SplitSequencePathAndName(String& srcPath, String& srcName);
|
void SplitSequencePathAndName(String& srcPath, String& srcName);
|
||||||
StringTableEntry getShapeFileName() { return mFileName; }
|
StringTableEntry getShapeFileName() { return mFileName; }
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,7 @@ void SoundAsset::initializeAsset(void)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mSoundPath = getOwned() ? expandAssetFilePath(mSoundFile) : mSoundPath;
|
mSoundPath = getOwned() ? expandAssetFilePath(mSoundFile) : mSoundPath;
|
||||||
loadSound();
|
//loadSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundAsset::_onResourceChanged(const Torque::Path &path)
|
void SoundAsset::_onResourceChanged(const Torque::Path &path)
|
||||||
|
|
@ -208,7 +208,7 @@ void SoundAsset::_onResourceChanged(const Torque::Path &path)
|
||||||
|
|
||||||
refreshAsset();
|
refreshAsset();
|
||||||
|
|
||||||
loadSound();
|
//loadSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundAsset::onAssetRefresh(void)
|
void SoundAsset::onAssetRefresh(void)
|
||||||
|
|
@ -218,7 +218,7 @@ void SoundAsset::onAssetRefresh(void)
|
||||||
|
|
||||||
//Update
|
//Update
|
||||||
mSoundPath = getOwned() ? expandAssetFilePath(mSoundFile) : mSoundPath;
|
mSoundPath = getOwned() ? expandAssetFilePath(mSoundFile) : mSoundPath;
|
||||||
loadSound();
|
//loadSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SoundAsset::loadSound()
|
bool SoundAsset::loadSound()
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ public:
|
||||||
virtual void copyTo(SimObject* object);
|
virtual void copyTo(SimObject* object);
|
||||||
|
|
||||||
//SFXResource* getSound() { return mSoundResource; }
|
//SFXResource* getSound() { return mSoundResource; }
|
||||||
Resource<SFXResource> getSoundResource() { return mSFXProfile.getResource(); }
|
Resource<SFXResource> getSoundResource() { loadSound(); return mSFXProfile.getResource(); }
|
||||||
|
|
||||||
/// Declare Console Object.
|
/// Declare Console Object.
|
||||||
DECLARE_CONOBJECT(SoundAsset);
|
DECLARE_CONOBJECT(SoundAsset);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue