Procházet zdrojové kódy

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 před 9 roky
rodič
revize
0ec9438429

+ 4 - 2
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)
+{
 }

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

@@ -79,7 +79,7 @@ public:
    Resource<TSShape> getShapeResource() { return mShape; }
 
 protected:
-   virtual void            onAssetRefresh(void) {}
+   virtual void            onAssetRefresh(void);
 };
 
 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.
    mMeshAssetId = StringTable->insert(assetName);
-   mMeshAsset.setAssetId(mMeshAssetId);
+
+   mMeshAsset = mMeshAssetId;
 
    if (mMeshAsset.isNull())
    {

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

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