From 0ec9438429ea745f8e72397c714496bc97cd6de8 Mon Sep 17 00:00:00 2001 From: Areloch Date: Mon, 6 Jun 2016 21:20:00 -0500 Subject: [PATCH] The default configuration is for the asset database to automatically unload an asset when it's no longer referenced. This causes problems when we would delete objects and then go to make more instances that reference the same asset while the same mission is going. So autounload is disabled to prevent excessive unloading of assets before the level is concluded. --- Engine/source/T3D/assets/ShapeAsset.cpp | 6 ++++-- Engine/source/T3D/assets/ShapeAsset.h | 2 +- Engine/source/T3D/components/render/meshComponent.cpp | 3 ++- Engine/source/assets/assetManager.cpp | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Engine/source/T3D/assets/ShapeAsset.cpp b/Engine/source/T3D/assets/ShapeAsset.cpp index 9b2aec3de..ea4882add 100644 --- a/Engine/source/T3D/assets/ShapeAsset.cpp +++ b/Engine/source/T3D/assets/ShapeAsset.cpp @@ -100,8 +100,6 @@ mAcquireReferenceCount(0), mpOwningAssetManager(NULL), mAssetInitialized(false) { - // Generate an asset definition. - mpAssetDefinition = new AssetDefinition(); } //----------------------------------------------------------------------------- @@ -154,4 +152,8 @@ void ShapeAsset::copyTo(SimObject* object) { // Call to parent. Parent::copyTo(object); +} + +void ShapeAsset::onAssetRefresh(void) +{ } \ No newline at end of file diff --git a/Engine/source/T3D/assets/ShapeAsset.h b/Engine/source/T3D/assets/ShapeAsset.h index 6766d1682..d727d0a1c 100644 --- a/Engine/source/T3D/assets/ShapeAsset.h +++ b/Engine/source/T3D/assets/ShapeAsset.h @@ -79,7 +79,7 @@ public: Resource getShapeResource() { return mShape; } protected: - virtual void onAssetRefresh(void) {} + virtual void onAssetRefresh(void); }; DefineConsoleType(TypeShapeAssetPtr, ShapeAsset) diff --git a/Engine/source/T3D/components/render/meshComponent.cpp b/Engine/source/T3D/components/render/meshComponent.cpp index 6f4835666..708a48ae1 100644 --- a/Engine/source/T3D/components/render/meshComponent.cpp +++ b/Engine/source/T3D/components/render/meshComponent.cpp @@ -167,7 +167,8 @@ bool MeshComponent::setMeshAsset(const char* assetName) { // Fetch the asset Id. mMeshAssetId = StringTable->insert(assetName); - mMeshAsset.setAssetId(mMeshAssetId); + + mMeshAsset = mMeshAssetId; if (mMeshAsset.isNull()) { diff --git a/Engine/source/assets/assetManager.cpp b/Engine/source/assets/assetManager.cpp index bfd21c699..66df77d11 100644 --- a/Engine/source/assets/assetManager.cpp +++ b/Engine/source/assets/assetManager.cpp @@ -76,7 +76,7 @@ AssetManager::AssetManager() : mMaxLoadedPrivateAssetsCount( 0 ), mAcquiredReferenceCount( 0 ), mEchoInfo( false ), - mIgnoreAutoUnload( false ) + mIgnoreAutoUnload( true ) { }