Refactor asset handler system and catalog for safety
- Introduced AssetHandlerInfo struct for handler registration and lookup, enabling handler caching and decoupling instantiation from extension/type. - Changed CustomAssetHandlerAttribute to use required named properties; updated source generator. - Replaced HandlerTypeId with AssetTypeId throughout metadata, catalog, and sub-asset records for clarity. - Refactored asset catalog to use connection pooling and local command creation for thread safety. - Updated asset handler interfaces and implementations to align with new registration system and removed redundant properties. - Migrated mesh import and meshlet building to async JobScheduler jobs; switched to TLSF allocator and improved safety checks. - Made meshlet/LOD hierarchy building async and job-based with better memory management. - Updated usages and tests for new APIs; refreshed project references and package versions. - Improved documentation and code comments for clarity.
This commit is contained in:
@@ -41,7 +41,7 @@ public class AssetCatalogTests
|
||||
[TestMethod]
|
||||
public void TestAssetCatalog_UpsertLookup()
|
||||
{
|
||||
using var catalog = new AssetCatalog(_dbPath);
|
||||
var catalog = new AssetCatalog(_dbPath);
|
||||
var guid = Guid.NewGuid();
|
||||
var meta = new AssetMeta { Guid = guid, HandlerVersion = 1 };
|
||||
var path = "Textures/hero.png";
|
||||
@@ -55,7 +55,7 @@ public class AssetCatalogTests
|
||||
[TestMethod]
|
||||
public void TestAssetCatalog_Dependencies()
|
||||
{
|
||||
using var catalog = new AssetCatalog(_dbPath);
|
||||
var catalog = new AssetCatalog(_dbPath);
|
||||
var asset1 = Guid.NewGuid();
|
||||
var asset2 = Guid.NewGuid();
|
||||
|
||||
@@ -72,14 +72,14 @@ public class AssetCatalogTests
|
||||
[TestMethod]
|
||||
public void TestAssetCatalog_VirtualSubAssets()
|
||||
{
|
||||
using var catalog = new AssetCatalog(_dbPath);
|
||||
var catalog = new AssetCatalog(_dbPath);
|
||||
var parent = Guid.NewGuid();
|
||||
var subMesh = Guid.NewGuid();
|
||||
var handlerTypeId = Guid.NewGuid();
|
||||
|
||||
catalog.Upsert(new AssetMeta { Guid = parent, HandlerTypeId = handlerTypeId, HandlerVersion = 1 }, "Props/kit.fbx");
|
||||
catalog.Upsert(new AssetMeta { Guid = parent, AssetTypeId = handlerTypeId, HandlerVersion = 1 }, "Props/kit.fbx");
|
||||
catalog.UpsertSubAsset(parent,
|
||||
new AssetMeta { Guid = subMesh, HandlerTypeId = handlerTypeId, HandlerVersion = 1 },
|
||||
new AssetMeta { Guid = subMesh, AssetTypeId = handlerTypeId, HandlerVersion = 1 },
|
||||
"Props/kit.fbx#Mesh/Root/Crate",
|
||||
"Mesh",
|
||||
"Crate",
|
||||
|
||||
@@ -30,7 +30,7 @@ public class AssetMetaTests
|
||||
var originalMeta = new AssetMeta
|
||||
{
|
||||
Guid = Guid.NewGuid(),
|
||||
HandlerTypeId = Guid.NewGuid(),
|
||||
AssetTypeId = Guid.NewGuid(),
|
||||
HandlerVersion = 1,
|
||||
Labels = ["test", "hero"]
|
||||
};
|
||||
@@ -41,7 +41,7 @@ public class AssetMetaTests
|
||||
var loadedMeta = await AssetMetaIO.ReadAsync(metaPath);
|
||||
Assert.IsNotNull(loadedMeta);
|
||||
Assert.AreEqual(originalMeta.Guid, loadedMeta.Guid);
|
||||
Assert.AreEqual(originalMeta.HandlerTypeId, loadedMeta.HandlerTypeId);
|
||||
Assert.AreEqual(originalMeta.AssetTypeId, loadedMeta.AssetTypeId);
|
||||
Assert.AreEqual(originalMeta.HandlerVersion, loadedMeta.HandlerVersion);
|
||||
CollectionAssert.AreEqual(originalMeta.Labels, loadedMeta.Labels);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user