Serialize Mesh and MeshRenderer in scene + fixed Light serialization

This commit is contained in:
Simon Lübeß
2023-01-08 19:31:01 +01:00
parent b5ca86d8de
commit e38373dccf
8 changed files with 204 additions and 42 deletions
@@ -77,15 +77,16 @@ class MaterialAssetLoader : IAssetLoader //, IReloadingAssetLoader
for (let (slotName, textureIdentifier) in materialFile.Textures)
{
Texture texture = contentManager.LoadAsset(textureIdentifier) as Texture;
if (texture == null)
using (Texture texture = contentManager.LoadAsset(textureIdentifier) as Texture)
{
Log.EngineLogger.Error("Failed to load texture.");
// TODO: LoadAsset should return an error texture.
}
if (texture == null)
{
Log.EngineLogger.Error("Failed to load texture.");
// TODO: LoadAsset should return an error texture.
}
material.SetTexture(slotName, texture);
material.SetTexture(slotName, texture);
}
}
fx.ReleaseRef();
@@ -268,10 +268,10 @@ namespace GlitchyEditor.EditWindows
StringView path = .((char8*)payload.Data, (int)payload.DataSize);
Texture2D texture = Content.LoadAsset<Texture2D>(path);//new Texture2D(path, true);
spriteRendererComponent.Sprite?.ReleaseRef();
spriteRendererComponent.Sprite = texture;
using (Texture2D texture = Content.LoadAsset<Texture2D>(path))
{
spriteRendererComponent.Sprite = texture;
}
}
ImGui.EndDragDropTarget();