Browse Source

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.
Areloch 9 years ago
parent
commit
0ec9438429

+ 4 - 2
Engine/source/T3D/assets/ShapeAsset.cpp

@@ -100,8 +100,6 @@ mAcquireReferenceCount(0),
 mpOwningAssetManager(NULL),
 mpOwningAssetManager(NULL),
 mAssetInitialized(false)
 mAssetInitialized(false)
 {
 {
-   // Generate an asset definition.
-   mpAssetDefinition = new AssetDefinition();
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
@@ -154,4 +152,8 @@ void ShapeAsset::copyTo(SimObject* object)
 {
 {
    // Call to parent.
    // Call to parent.
    Parent::copyTo(object);
    Parent::copyTo(object);
+}
+
+void ShapeAsset::onAssetRefresh(void)
+{
 }
 }

+ 1 - 1
Engine/source/T3D/assets/ShapeAsset.h

@@ -79,7 +79,7 @@ public:
    Resource<TSShape> getShapeResource() { return mShape; }
    Resource<TSShape> getShapeResource() { return mShape; }
 
 
 protected:
 protected:
-   virtual void            onAssetRefresh(void) {}
+   virtual void            onAssetRefresh(void);
 };
 };
 
 
 DefineConsoleType(TypeShapeAssetPtr, ShapeAsset)
 DefineConsoleType(TypeShapeAssetPtr, ShapeAsset)

+ 2 - 1
Engine/source/T3D/components/render/meshComponent.cpp

@@ -167,7 +167,8 @@ bool MeshComponent::setMeshAsset(const char* assetName)
 {
 {
    // Fetch the asset Id.
    // Fetch the asset Id.
    mMeshAssetId = StringTable->insert(assetName);
    mMeshAssetId = StringTable->insert(assetName);
-   mMeshAsset.setAssetId(mMeshAssetId);
+
+   mMeshAsset = mMeshAssetId;
 
 
    if (mMeshAsset.isNull())
    if (mMeshAsset.isNull())
    {
    {

+ 1 - 1
Engine/source/assets/assetManager.cpp

@@ -76,7 +76,7 @@ AssetManager::AssetManager() :
     mMaxLoadedPrivateAssetsCount( 0 ),
     mMaxLoadedPrivateAssetsCount( 0 ),
     mAcquiredReferenceCount( 0 ),
     mAcquiredReferenceCount( 0 ),
     mEchoInfo( false ),
     mEchoInfo( false ),
-    mIgnoreAutoUnload( false )
+    mIgnoreAutoUnload( true )
 {
 {
 }
 }