mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
asset load refactor
genral load method, now returns loadedstate across the board
This commit is contained in:
parent
11ad16583e
commit
1cf754dbca
13 changed files with 50 additions and 68 deletions
|
|
@ -207,8 +207,7 @@ U32 ImageAsset::getAssetByFilename(StringTableEntry fileName, AssetPtr<ImageAsse
|
|||
{
|
||||
//acquire and bind the asset, and return it out
|
||||
imageAsset->setAssetId(query.mAssetList[0]);
|
||||
(*imageAsset)->loadImage();
|
||||
return (*imageAsset)->mLoadedState;
|
||||
return (*imageAsset)->load();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -240,8 +239,7 @@ U32 ImageAsset::getAssetById(StringTableEntry assetId, AssetPtr<ImageAsset>* ima
|
|||
|
||||
if (imageAsset->notNull())
|
||||
{
|
||||
(*imageAsset)->loadImage();
|
||||
return (*imageAsset)->mLoadedState;
|
||||
return (*imageAsset)->load();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -253,7 +251,6 @@ U32 ImageAsset::getAssetById(StringTableEntry assetId, AssetPtr<ImageAsset>* ima
|
|||
//handle fallback not being loaded itself
|
||||
if ((*imageAsset)->mLoadedState == BadFileReference)
|
||||
{
|
||||
(*imageAsset)->loadImage();
|
||||
Con::warnf("ImageAsset::getAssetById - Finding of asset with id %s failed, and fallback asset reported error of Bad File Reference.", assetId);
|
||||
return AssetErrCode::BadFileReference;
|
||||
}
|
||||
|
|
@ -272,25 +269,26 @@ void ImageAsset::copyTo(SimObject* object)
|
|||
Parent::copyTo(object);
|
||||
}
|
||||
|
||||
void ImageAsset::loadImage()
|
||||
U32 ImageAsset::load()
|
||||
{
|
||||
if (mLoadedState == AssetErrCode::Ok) return;
|
||||
if (mLoadedState == AssetErrCode::Ok) return mLoadedState;
|
||||
if (mImagePath)
|
||||
{
|
||||
if (!Torque::FS::IsFile(mImagePath))
|
||||
{
|
||||
Con::errorf("ImageAsset::initializeAsset: Attempted to load file %s but it was not valid!", mImageFileName);
|
||||
mLoadedState = BadFileReference;
|
||||
return;
|
||||
return mLoadedState;
|
||||
}
|
||||
|
||||
mLoadedState = Ok;
|
||||
mIsValidImage = true;
|
||||
return;
|
||||
return mLoadedState;
|
||||
}
|
||||
mLoadedState = BadFileReference;
|
||||
|
||||
mIsValidImage = false;
|
||||
return mLoadedState;
|
||||
}
|
||||
|
||||
void ImageAsset::initializeAsset()
|
||||
|
|
@ -327,11 +325,6 @@ void ImageAsset::setImageFileName(const char* pScriptFile)
|
|||
refreshAsset();
|
||||
}
|
||||
|
||||
const GBitmap& ImageAsset::getImage()
|
||||
{
|
||||
return GBitmap(); //TODO fix this
|
||||
}
|
||||
|
||||
GFXTexHandle ImageAsset::getTexture(GFXTextureProfile* requestedProfile)
|
||||
{
|
||||
if (mResourceMap.contains(requestedProfile))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue