diff --git a/Engine/source/T3D/assets/ImageAsset.cpp b/Engine/source/T3D/assets/ImageAsset.cpp index 044d72dfe..325acfe09 100644 --- a/Engine/source/T3D/assets/ImageAsset.cpp +++ b/Engine/source/T3D/assets/ImageAsset.cpp @@ -125,13 +125,18 @@ ImplementEnumType(ImageAssetType, EndImplementEnumType; - +const String ImageAsset::mErrCodeStrings[] = +{ + "TooManyMips", + "UnKnown" +}; //----------------------------------------------------------------------------- ImageAsset::ImageAsset() : AssetBase(), mUseMips(true), mIsHDRImage(false), mIsValidImage(false), mImageType(Albedo) { mImageFileName = StringTable->EmptyString(); mImagePath = StringTable->EmptyString(); mLoadedState = AssetErrCode::NotLoaded; + mChangeSignal.notify(this, &ImageAsset::onAssetRefresh); } //----------------------------------------------------------------------------- @@ -202,6 +207,7 @@ U32 ImageAsset::getAssetByFilename(StringTableEntry fileName, AssetPtrsetAssetId(query.mAssetList[0]); + (*imageAsset)->loadImage(); return (*imageAsset)->mLoadedState; } } @@ -234,12 +240,14 @@ U32 ImageAsset::getAssetById(StringTableEntry assetId, AssetPtr* ima if (imageAsset->notNull()) { + (*imageAsset)->loadImage(); return (*imageAsset)->mLoadedState; } else { if (imageAsset->isNull()) { + (*imageAsset)->loadImage(); //Well that's bad, loading the fallback failed. Con::warnf("ImageAsset::getAssetById - Finding of asset with id %s failed with no fallback asset", assetId); return AssetErrCode::Failed; @@ -248,6 +256,7 @@ U32 ImageAsset::getAssetById(StringTableEntry assetId, AssetPtr* ima //handle noshape 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; } @@ -268,6 +277,7 @@ void ImageAsset::copyTo(SimObject* object) void ImageAsset::loadImage() { + if (mLoadedState == AssetErrCode::Ok) return; if (mImagePath) { if (!Torque::FS::IsFile(mImagePath)) @@ -279,7 +289,6 @@ void ImageAsset::loadImage() mLoadedState = Ok; mIsValidImage = true; - mChangeSignal.trigger(); return; } mLoadedState = BadFileReference; @@ -292,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) @@ -308,7 +315,7 @@ void ImageAsset::_onResourceChanged(const Torque::Path& path) refreshAsset(); - //loadImage(); + onAssetRefresh(); } void ImageAsset::setImageFileName(const char* pScriptFile) diff --git a/Engine/source/T3D/assets/ImageAsset.h b/Engine/source/T3D/assets/ImageAsset.h index a4a32c199..c4826a0ef 100644 --- a/Engine/source/T3D/assets/ImageAsset.h +++ b/Engine/source/T3D/assets/ImageAsset.h @@ -54,6 +54,7 @@ class ImageAsset : public AssetBase { typedef AssetBase Parent; + typedef AssetPtr ConcreteAssetPtr; public: /// The different types of image use cases @@ -75,6 +76,22 @@ public: static StringTableEntry smNoImageAssetFallback; + enum ImageAssetErrCode + { + TooManyMips = AssetErrCode::Extended, + Extended + }; + + static const String mErrCodeStrings[U32(ImageAssetErrCode::Extended) - U32(Parent::Extended) + 1]; + static U32 getAssetErrCode(ConcreteAssetPtr checkAsset) { if (checkAsset) return checkAsset->mLoadedState; else return 0; } + + static String getAssetErrstrn(U32 errCode) + { + if (errCode < Parent::Extended) return Parent::getAssetErrstrn(errCode); + if (errCode > ImageAssetErrCode::Extended) return "undefined error"; + return mErrCodeStrings[errCode - Parent::Extended]; + }; + protected: StringTableEntry mImageFileName; StringTableEntry mImagePath; diff --git a/Engine/source/T3D/assets/MaterialAsset.cpp b/Engine/source/T3D/assets/MaterialAsset.cpp index 5540ce6a9..363d7bc30 100644 --- a/Engine/source/T3D/assets/MaterialAsset.cpp +++ b/Engine/source/T3D/assets/MaterialAsset.cpp @@ -45,6 +45,13 @@ StringTableEntry MaterialAsset::smNoMaterialAssetFallback = NULL; +const String MaterialAsset::mErrCodeStrings[] = +{ + "ScriptLoaded", + "DefinitionAlreadyExists", + "EmbeddedDefinition", + "UnKnown" +}; //----------------------------------------------------------------------------- IMPLEMENT_CONOBJECT(MaterialAsset); diff --git a/Engine/source/T3D/assets/MaterialAsset.h b/Engine/source/T3D/assets/MaterialAsset.h index efb677ef6..d51f6dabb 100644 --- a/Engine/source/T3D/assets/MaterialAsset.h +++ b/Engine/source/T3D/assets/MaterialAsset.h @@ -63,6 +63,7 @@ class MaterialAsset : public AssetBase { typedef AssetBase Parent; + typedef AssetPtr ConcreteAssetPtr; String mShaderGraphFile; StringTableEntry mScriptFile; @@ -82,6 +83,16 @@ public: Extended }; + static const String mErrCodeStrings[U32(MaterialAssetErrCode::Extended) - U32(Parent::Extended) + 1]; + static U32 getAssetErrCode(ConcreteAssetPtr checkAsset) { if (checkAsset) return checkAsset->mLoadedState; else return 0; } + + static String getAssetErrstrn(U32 errCode) + { + if (errCode < Parent::Extended) return Parent::getAssetErrstrn(errCode); + if (errCode > MaterialAssetErrCode::Extended) return "undefined error"; + return mErrCodeStrings[errCode - Parent::Extended]; + }; + public: MaterialAsset(); virtual ~MaterialAsset(); diff --git a/Engine/source/T3D/assets/ShapeAnimationAsset.cpp b/Engine/source/T3D/assets/ShapeAnimationAsset.cpp index e0fbac423..e84283734 100644 --- a/Engine/source/T3D/assets/ShapeAnimationAsset.cpp +++ b/Engine/source/T3D/assets/ShapeAnimationAsset.cpp @@ -90,6 +90,12 @@ ConsoleSetType(TypeShapeAnimationAssetPtr) Con::warnf("(TypeShapeAnimationAssetPtr) - Cannot set multiple args to a single asset."); } +const String ShapeAnimationAsset::mErrCodeStrings[] = +{ + "TooManyBones", + "UnKnown" +}; + //----------------------------------------------------------------------------- ShapeAnimationAsset::ShapeAnimationAsset() : diff --git a/Engine/source/T3D/assets/ShapeAnimationAsset.h b/Engine/source/T3D/assets/ShapeAnimationAsset.h index c94828de5..ad286ccbb 100644 --- a/Engine/source/T3D/assets/ShapeAnimationAsset.h +++ b/Engine/source/T3D/assets/ShapeAnimationAsset.h @@ -44,11 +44,17 @@ #include "core/resource.h" #endif +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif + +#include "assetMacroHelpers.h" + //----------------------------------------------------------------------------- class ShapeAnimationAsset : public AssetBase { typedef AssetBase Parent; - + typedef AssetPtr ConcreteAssetPtr; protected: StringTableEntry mFileName; StringTableEntry mFilePath; @@ -72,6 +78,21 @@ protected: Resource mSourceShape; public: + enum ShapeAnimationAssetErrCode + { + TooManyBones = AssetErrCode::Extended, + Extended + }; + + static const String mErrCodeStrings[U32(ShapeAnimationAssetErrCode::Extended) - U32(Parent::Extended) + 1]; + static U32 getAssetErrCode(ConcreteAssetPtr checkAsset) { if (checkAsset) return checkAsset->mLoadedState; else return 0; } + + static String getAssetErrstrn(U32 errCode) + { + if (errCode < Parent::Extended) return Parent::getAssetErrstrn(errCode); + if (errCode > ShapeAnimationAssetErrCode::Extended) return "undefined error"; + return mErrCodeStrings[errCode - Parent::Extended]; + }; ShapeAnimationAsset(); virtual ~ShapeAnimationAsset(); diff --git a/Engine/source/T3D/assets/ShapeAsset.cpp b/Engine/source/T3D/assets/ShapeAsset.cpp index 4ef66af84..7958212c7 100644 --- a/Engine/source/T3D/assets/ShapeAsset.cpp +++ b/Engine/source/T3D/assets/ShapeAsset.cpp @@ -117,7 +117,7 @@ ConsoleSetType(TypeShapeAssetId) //----------------------------------------------------------------------------- -const String ShapeAsset::mShapeErrCodeStrings[] = +const String ShapeAsset::mErrCodeStrings[] = { "TooManyVerts", "TooManyBones", @@ -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) @@ -307,11 +305,13 @@ void ShapeAsset::_onResourceChanged(const Torque::Path &path) refreshAsset(); - loadShape(); + onAssetRefresh(); } bool ShapeAsset::loadShape() { + if (mLoadedState == AssetErrCode::Ok) return true; + mMaterialAssets.clear(); mMaterialAssetIds.clear(); @@ -396,7 +396,8 @@ bool ShapeAsset::loadShape() //First, we need to make sure the anim asset we depend on for our blend is loaded AssetPtr blendAnimAsset = mAnimationAssets[i]->getBlendAnimationName(); - if (blendAnimAsset.isNull()) + U32 assetStatus = ShapeAnimationAsset::getAssetErrCode(blendAnimAsset); + if (assetStatus != AssetBase::Ok) { Con::errorf("ShapeAsset::initializeAsset - Unable to acquire reference animation asset %s for asset %s to blend!", mAnimationAssets[i]->getBlendAnimationName(), mAnimationAssets[i]->getAssetName()); { @@ -533,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) @@ -707,6 +706,7 @@ DefineEngineMethod(ShapeAsset, generateCachedPreviewImage, const char*, (S32 res "@param resolution Optional field for what resolution to bake the preview image at. Must be pow2\n" "@param overrideMaterialName Optional field for overriding the material used when rendering the shape for the bake.") { + object->loadShape(); return object->generateCachedPreviewImage(resolution, overrideMaterialName); } diff --git a/Engine/source/T3D/assets/ShapeAsset.h b/Engine/source/T3D/assets/ShapeAsset.h index 07290a3b0..abeb13c39 100644 --- a/Engine/source/T3D/assets/ShapeAsset.h +++ b/Engine/source/T3D/assets/ShapeAsset.h @@ -65,6 +65,7 @@ class ShapeAsset : public AssetBase { typedef AssetBase Parent; + typedef AssetPtr ConcreteAssetPtr; protected: StringTableEntry mFileName; @@ -104,15 +105,14 @@ public: static StringTableEntry smNoShapeAssetFallback; - static const String mShapeErrCodeStrings[U32(ShapeAssetErrCode::Extended) - U32(Parent::Extended) + 1]; - - static U32 getAssetErrCode(AssetPtr shapeAsset) { if (shapeAsset) return shapeAsset->mLoadedState; else return 0; } + static const String mErrCodeStrings[U32(ShapeAssetErrCode::Extended) - U32(Parent::Extended) + 1]; + static U32 getAssetErrCode(ConcreteAssetPtr checkAsset) { if (checkAsset) return checkAsset->mLoadedState; else return 0; } static String getAssetErrstrn(U32 errCode) { if (errCode < Parent::Extended) return Parent::getAssetErrstrn(errCode); if (errCode > ShapeAssetErrCode::Extended) return "undefined error"; - return mShapeErrCodeStrings[errCode - Parent::Extended]; + return mErrCodeStrings[errCode - Parent::Extended]; }; ShapeAsset(); @@ -136,7 +136,7 @@ public: TSShape* getShape() { return mShape; } - Resource getShapeResource() { return mShape; } + Resource getShapeResource() { loadShape(); return mShape; } void SplitSequencePathAndName(String& srcPath, String& srcName); StringTableEntry getShapeFileName() { return mFileName; } diff --git a/Engine/source/T3D/assets/SoundAsset.cpp b/Engine/source/T3D/assets/SoundAsset.cpp index 7d49bb30d..dd6ab9a0a 100644 --- a/Engine/source/T3D/assets/SoundAsset.cpp +++ b/Engine/source/T3D/assets/SoundAsset.cpp @@ -106,6 +106,14 @@ ConsoleSetType(TypeSoundAssetId) Con::warnf("(TypeAssetId) - Cannot set multiple args to a single asset."); } +const String SoundAsset::mErrCodeStrings[] = +{ + "BadProfile", + "BadDescription", + "BadBufferData", + "UnKnown" +}; + //----------------------------------------------------------------------------- SoundAsset::SoundAsset() @@ -190,7 +198,7 @@ void SoundAsset::initializeAsset(void) return; mSoundPath = getOwned() ? expandAssetFilePath(mSoundFile) : mSoundPath; - loadSound(); + //loadSound(); } void SoundAsset::_onResourceChanged(const Torque::Path &path) @@ -200,7 +208,7 @@ void SoundAsset::_onResourceChanged(const Torque::Path &path) refreshAsset(); - loadSound(); + //loadSound(); } void SoundAsset::onAssetRefresh(void) @@ -210,11 +218,12 @@ void SoundAsset::onAssetRefresh(void) //Update mSoundPath = getOwned() ? expandAssetFilePath(mSoundFile) : mSoundPath; - loadSound(); + //loadSound(); } bool SoundAsset::loadSound() { + if (mLoadedState == AssetErrCode::Ok) return true; if (mSoundPath) { if (!Torque::FS::IsFile(mSoundPath)) diff --git a/Engine/source/T3D/assets/SoundAsset.h b/Engine/source/T3D/assets/SoundAsset.h index e7c3ee460..63f81194a 100644 --- a/Engine/source/T3D/assets/SoundAsset.h +++ b/Engine/source/T3D/assets/SoundAsset.h @@ -70,6 +70,7 @@ class SFXResource; class SoundAsset : public AssetBase { typedef AssetBase Parent; + typedef AssetPtr ConcreteAssetPtr; protected: StringTableEntry mSoundFile; @@ -106,6 +107,23 @@ protected: SoundAssetChanged mChangeSignal; public: + enum SoundAssetErrCode + { + BadProfile = AssetErrCode::Extended, + BadDescription, + BadBufferData, + Extended + }; + + static const String mErrCodeStrings[U32(SoundAssetErrCode::Extended) - U32(Parent::Extended) + 1]; + static U32 getAssetErrCode(ConcreteAssetPtr checkAsset) { if (checkAsset) return checkAsset->mLoadedState; else return 0; } + + static String getAssetErrstrn(U32 errCode) + { + if (errCode < Parent::Extended) return Parent::getAssetErrstrn(errCode); + if (errCode > SoundAssetErrCode::Extended) return "undefined error"; + return mErrCodeStrings[errCode - Parent::Extended]; + }; SoundAsset(); virtual ~SoundAsset(); @@ -114,7 +132,7 @@ public: virtual void copyTo(SimObject* object); //SFXResource* getSound() { return mSoundResource; } - Resource getSoundResource() { return mSFXProfile.getResource(); } + Resource getSoundResource() { loadSound(); return mSFXProfile.getResource(); } /// Declare Console Object. DECLARE_CONOBJECT(SoundAsset); diff --git a/Engine/source/T3D/decal/decalData.cpp b/Engine/source/T3D/decal/decalData.cpp index 0c8f84ca6..371de1294 100644 --- a/Engine/source/T3D/decal/decalData.cpp +++ b/Engine/source/T3D/decal/decalData.cpp @@ -340,9 +340,11 @@ void DecalData::_initMaterial() void DecalData::_updateMaterial() { - if(mMaterialAsset.isNull()) + U32 assetStatus = MaterialAsset::getAssetErrCode(mMaterialAsset); + if (assetStatus != AssetBase::Ok && assetStatus != AssetBase::UsingFallback) + { return; - + } // Only update material instance if we have one allocated. if ( matInst ) _initMaterial(); diff --git a/Engine/source/T3D/groundPlane.cpp b/Engine/source/T3D/groundPlane.cpp index 53ed0fe77..87fca458f 100644 --- a/Engine/source/T3D/groundPlane.cpp +++ b/Engine/source/T3D/groundPlane.cpp @@ -157,7 +157,8 @@ bool GroundPlane::onAdd() void GroundPlane::onRemove() { - if (!mMaterialAsset.isNull()) + U32 assetStatus = MaterialAsset::getAssetErrCode(mMaterialAsset); + if (assetStatus == AssetBase::Ok) AssetDatabase.releaseAsset(mMaterialAsset.getAssetId()); //SAFE_DELETE(mMaterialInst); @@ -593,8 +594,11 @@ void GroundPlane::generateGrid( U32 width, U32 height, F32 squareSize, void GroundPlane::getUtilizedAssets(Vector* usedAssetsList) { - if (!mMaterialAsset.isNull() && mMaterialAsset->getAssetId() != MaterialAsset::smNoMaterialAssetFallback) + U32 assetStatus = MaterialAsset::getAssetErrCode(mMaterialAsset); + if (assetStatus == AssetBase::Ok) + { usedAssetsList->push_back_unique(mMaterialAsset->getAssetId()); + } } diff --git a/Engine/source/T3D/physics/physicsShape.cpp b/Engine/source/T3D/physics/physicsShape.cpp index 4666b2450..d504ffdce 100644 --- a/Engine/source/T3D/physics/physicsShape.cpp +++ b/Engine/source/T3D/physics/physicsShape.cpp @@ -241,9 +241,11 @@ void PhysicsShapeData::onRemove() void PhysicsShapeData::_onResourceChanged( const Torque::Path &path ) { - if (mShapeAsset.isNull()) + U32 assetStatus = ShapeAsset::getAssetErrCode(mShapeAsset); + if (assetStatus != AssetBase::Ok && assetStatus != AssetBase::UsingFallback) + { return; - + } if ( path != Path(mShapeAsset->getShapeFilePath()) ) return; diff --git a/Engine/source/T3D/sfx/sfxEmitter.cpp b/Engine/source/T3D/sfx/sfxEmitter.cpp index a3a030395..2ff998eec 100644 --- a/Engine/source/T3D/sfx/sfxEmitter.cpp +++ b/Engine/source/T3D/sfx/sfxEmitter.cpp @@ -698,7 +698,7 @@ void SFXEmitter::_update() // is toggled on a local profile sound. It makes the // editor feel responsive and that things are working. if( gEditingMission && - (mSoundAsset.isNull() || !mSoundAsset->getSfxProfile()) && + (SoundAsset::getAssetErrCode(mSoundAsset) || !mSoundAsset->getSfxProfile()) && mPlayOnAdd && mDirty.test( IsLooping ) ) prevState = SFXStatusPlaying; diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index 4e02c74bc..c130b57b4 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -344,7 +344,8 @@ bool ShapeBaseData::preload(bool server, String &errorStr) } S32 i; - if (ShapeAsset::getAssetErrCode(mShapeAsset) != ShapeAsset::Failed && ShapeAsset::getAssetErrCode(mShapeAsset) != ShapeAsset::BadFileReference) + U32 assetStatus = ShapeAsset::getAssetErrCode(mShapeAsset); + if (assetStatus == AssetBase::Ok|| assetStatus == AssetBase::UsingFallback) { if (!server && !mShape->preloadMaterialList(mShape.getPath()) && NetConnection::filesWereDownloaded()) shapeError = true; diff --git a/Engine/source/T3D/tsStatic.cpp b/Engine/source/T3D/tsStatic.cpp index 2301d3531..b7cd9b664 100644 --- a/Engine/source/T3D/tsStatic.cpp +++ b/Engine/source/T3D/tsStatic.cpp @@ -391,7 +391,8 @@ bool TSStatic::_createShape() mAmbientThread = NULL; mShape = NULL; - if(!mShapeAsset.isNull()) + U32 assetStatus = ShapeAsset::getAssetErrCode(mShapeAsset); + if (assetStatus == AssetBase::Ok || assetStatus == AssetBase::UsingFallback) { //Special-case handling, usually because we set noShape mShape = mShapeAsset->getShapeResource(); @@ -1628,8 +1629,11 @@ void TSStatic::updateMaterials() void TSStatic::getUtilizedAssets(Vector* usedAssetsList) { - if(!mShapeAsset.isNull() && mShapeAsset->getAssetId() != ShapeAsset::smNoShapeAssetFallback) + U32 assetStatus = ShapeAsset::getAssetErrCode(mShapeAsset); + if (assetStatus == AssetBase::Ok) + { usedAssetsList->push_back_unique(mShapeAsset->getAssetId()); + } } //------------------------------------------------------------------------ diff --git a/Engine/source/afx/afxMagicMissile.cpp b/Engine/source/afx/afxMagicMissile.cpp index a61f8e86d..73cbfefc0 100644 --- a/Engine/source/afx/afxMagicMissile.cpp +++ b/Engine/source/afx/afxMagicMissile.cpp @@ -527,7 +527,8 @@ bool afxMagicMissileData::preload(bool server, String &errorStr) Con::errorf(ConsoleLogEntry::General, "afxMagicMissileData::preload: Invalid packet, bad datablockid(lightDesc): %d", lightDescId); } - if (!mProjectileShapeAsset.isNull()) + U32 assetStatus = ShapeAsset::getAssetErrCode(mProjectileShapeAsset); + if (assetStatus == AssetBase::Ok || assetStatus == AssetBase::UsingFallback) { projectileShape = mProjectileShapeAsset->getShapeResource(); if (bool(projectileShape) == false) diff --git a/Engine/source/assets/assetBase.cpp b/Engine/source/assets/assetBase.cpp index 4223b8654..dba9f142a 100644 --- a/Engine/source/assets/assetBase.cpp +++ b/Engine/source/assets/assetBase.cpp @@ -58,6 +58,7 @@ const String AssetBase::mErrCodeStrings[] = "Failed", "Ok", "NotLoaded", + "Reloading", "BadFileReference", "InvalidFormat", "DependencyNotFound", @@ -293,6 +294,8 @@ void AssetBase::refreshAsset(void) if (mpOwningAssetManager == NULL || !mAssetInitialized) return; + mLoadedState = Reloading; + // Yes, so refresh the asset via the asset manager. mpOwningAssetManager->refreshAsset(getAssetId()); } diff --git a/Engine/source/assets/assetBase.h b/Engine/source/assets/assetBase.h index 17dbc3be3..bffc8d7ba 100644 --- a/Engine/source/assets/assetBase.h +++ b/Engine/source/assets/assetBase.h @@ -75,6 +75,7 @@ public: Failed, Ok, NotLoaded, + Reloading, BadFileReference, InvalidFormat, DependencyNotFound, @@ -90,6 +91,7 @@ public: return mErrCodeStrings[errCode]; }; U32 getStatus() { return mLoadedState; }; + AssetBase(); virtual ~AssetBase(); diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index ff02e3d99..6c01e4f00 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -560,7 +560,7 @@ void SimObject::onTamlCustomRead(TamlCustomNodes const& customNodes) // Check common fields. if (field) { - setDataField(fieldName, buf, cField->getFieldValue()); + setPrefixedDataField(fieldName, buf, cField->getFieldValue()); } else { diff --git a/Engine/source/environment/VolumetricFog.cpp b/Engine/source/environment/VolumetricFog.cpp index 0dd3841ec..a4065c8ad 100644 --- a/Engine/source/environment/VolumetricFog.cpp +++ b/Engine/source/environment/VolumetricFog.cpp @@ -352,8 +352,8 @@ bool VolumetricFog::setShapeAsset(const StringTableEntry shapeAssetId) bool VolumetricFog::LoadShape() { GFXPrimitiveType GFXdrawTypes[] = { GFXTriangleList, GFXTriangleStrip }; - - if (mShapeAsset.isNull()) + U32 assetStatus = ShapeAsset::getAssetErrCode(mShapeAsset); + if (assetStatus != AssetBase::Ok && assetStatus != AssetBase::UsingFallback) { Con::errorf("[VolumetricFog] Failed to load shape asset."); return false; @@ -1217,9 +1217,11 @@ void VolumetricFog::InitTexture() { mIsTextured = false; - if (mTextureAsset.isNull()) + U32 assetStatus = ImageAsset::getAssetErrCode(mTextureAsset); + if (assetStatus != AssetBase::Ok && assetStatus != AssetBase::UsingFallback) + { return; - + } if (!mTexture.isNull()) { mIsTextured = true; diff --git a/Engine/source/forest/ts/tsForestItemData.cpp b/Engine/source/forest/ts/tsForestItemData.cpp index 29c67899e..5c88cf0ef 100644 --- a/Engine/source/forest/ts/tsForestItemData.cpp +++ b/Engine/source/forest/ts/tsForestItemData.cpp @@ -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; -} \ No newline at end of file +} diff --git a/Engine/source/gui/controls/guiGameListMenuCtrl.cpp b/Engine/source/gui/controls/guiGameListMenuCtrl.cpp index 7b1e207a1..4637a2285 100644 --- a/Engine/source/gui/controls/guiGameListMenuCtrl.cpp +++ b/Engine/source/gui/controls/guiGameListMenuCtrl.cpp @@ -1758,7 +1758,8 @@ bool GuiGameListMenuProfile::onAdd() // We can't call enforceConstraints() here because incRefCount initializes // some of the things to enforce. Do a basic sanity check here instead. - if(mBitmapAsset.isNull()) + U32 assetStatus = ImageAsset::getAssetErrCode(mBitmapAsset); + if (assetStatus != AssetBase::Ok && assetStatus != AssetBase::UsingFallback) { Con::errorf( "GuiGameListMenuProfile: %s can't be created without a bitmap. Please add a 'Bitmap' property to the object definition.", getName() ); return false; diff --git a/Engine/source/ts/tsShapeConstruct.cpp b/Engine/source/ts/tsShapeConstruct.cpp index 60d0752bd..efac6e241 100644 --- a/Engine/source/ts/tsShapeConstruct.cpp +++ b/Engine/source/ts/tsShapeConstruct.cpp @@ -528,7 +528,8 @@ void TSShapeConstructor::_onLoad(TSShape* shape) AssetPtr sequenceAsset = mSequenceAssetIds[i]; - if (sequenceAsset.isNull()) + U32 assetStatus = ShapeAnimationAsset::getAssetErrCode(sequenceAsset); + if (assetStatus != AssetBase::Ok) continue; // Split the sequence path from the target sequence name