asset load flow work

add reloading state to asset tracking,
convert most asset.isnull() checks on over to skipping out unless the errcode is ::Ok, or ::UsingFallback
add more errstriongcodes to hook up
skip load<type> execution if the asset loaded state is ::Ok
This commit is contained in:
AzaezelX 2023-10-08 13:19:43 -05:00
parent 753cbe32d9
commit b710a309bd
23 changed files with 177 additions and 35 deletions

View file

@ -99,7 +99,12 @@ void TSForestItemData::inspectPostApply()
void TSForestItemData::_onResourceChanged( const Torque::Path &path )
{
if (mShapeAsset.isNull()) return;
U32 assetStatus = ShapeAsset::getAssetErrCode(mShapeAsset);
if (assetStatus != AssetBase::Ok && assetStatus != AssetBase::UsingFallback)
{
return;
}
if ( path != Path(mShapeAsset->getShapeFilePath()) )
return;
@ -111,8 +116,11 @@ void TSForestItemData::_onResourceChanged( const Torque::Path &path )
void TSForestItemData::_loadShape()
{
if (mShapeAsset.isNull()) return;
U32 assetStatus = ShapeAsset::getAssetErrCode(mShapeAsset);
if (assetStatus != AssetBase::Ok && assetStatus != AssetBase::UsingFallback)
{
return;
}
_setShape(mShapeAssetId);
if ( !(bool)mShape )
@ -157,7 +165,12 @@ TSShapeInstance* TSForestItemData::_getShapeInstance() const
void TSForestItemData::_checkLastDetail()
{
if (mShapeAsset.isNull()) return;
U32 assetStatus = ShapeAsset::getAssetErrCode(mShapeAsset);
if (assetStatus != AssetBase::Ok && assetStatus != AssetBase::UsingFallback)
{
return;
}
const S32 dl = mShape->mSmallestVisibleDL;
const TSDetail *detail = &mShape->details[dl];
@ -255,4 +268,4 @@ bool TSForestItemData::render( TSRenderState *rdata, const ForestItem &item ) co
shapeInst->animate();
shapeInst->render( *rdata );
return true;
}
}