mirror of
https://github.com/aelurum/AssetStudio.git
synced 2026-11-15 19:28:48 -05:00
Add Material loading via typetree
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
@@ -8,6 +9,8 @@ namespace AssetStudio
|
||||
public Vector2 m_Scale;
|
||||
public Vector2 m_Offset;
|
||||
|
||||
public UnityTexEnv() { }
|
||||
|
||||
public UnityTexEnv(ObjectReader reader)
|
||||
{
|
||||
m_Texture = new PPtr<Texture>(reader);
|
||||
@@ -23,6 +26,8 @@ namespace AssetStudio
|
||||
public KeyValuePair<string, float>[] m_Floats;
|
||||
public KeyValuePair<string, Color>[] m_Colors;
|
||||
|
||||
public UnityPropertySheet() { }
|
||||
|
||||
public UnityPropertySheet(ObjectReader reader)
|
||||
{
|
||||
var version = reader.version;
|
||||
@@ -65,6 +70,15 @@ namespace AssetStudio
|
||||
public PPtr<Shader> m_Shader;
|
||||
public UnityPropertySheet m_SavedProperties;
|
||||
|
||||
public Material() { }
|
||||
|
||||
public Material(ObjectReader reader, byte[] type, JsonSerializerOptions jsonOptions) : base(reader)
|
||||
{
|
||||
var parsedMaterial = JsonSerializer.Deserialize<Material>(type, jsonOptions);
|
||||
m_Shader = parsedMaterial.m_Shader;
|
||||
m_SavedProperties = parsedMaterial.m_SavedProperties;
|
||||
}
|
||||
|
||||
public Material(ObjectReader reader) : base(reader)
|
||||
{
|
||||
m_Shader = new PPtr<Shader>(reader);
|
||||
|
||||
Reference in New Issue
Block a user