mirror of
https://github.com/aelurum/AssetStudio.git
synced 2026-11-15 19:28:48 -05:00
Improve support for Unity 6.5, 6.6+ and some cleanup
This commit is contained in:
@@ -327,6 +327,7 @@ namespace AssetStudio
|
||||
PluginBuildInfo = 382020655,
|
||||
UIAnimationBinder = 382093023,
|
||||
MemorySettings = 387306366,
|
||||
UIAnimationClip = 392092235,
|
||||
BuildMetaDataImporter = 403037116,
|
||||
BuildInstructionImporter = 403037117,
|
||||
EditorProjectAccess = 426301858,
|
||||
|
||||
@@ -957,7 +957,7 @@ namespace AssetStudio
|
||||
{
|
||||
isSerializeReferenceCurve = reader.ReadByte();
|
||||
}
|
||||
if ((!version.IsAlpha && version >= (6000, 5)) || (version.IsAlpha && version >= (6000, 5, 0, 7))) //6000.5.0a7 and up
|
||||
if (version >= (6000, 5)) //6000.5.0a7 and up
|
||||
{
|
||||
metaData = reader.ReadUInt16();
|
||||
}
|
||||
|
||||
@@ -516,7 +516,7 @@ namespace AssetStudio
|
||||
public Vector3[] m_PositionValues;
|
||||
public Vector4[] m_QuaternionValues;
|
||||
public Vector3[] m_ScaleValues;
|
||||
public int[] m_EntityIdValues;
|
||||
public ulong[] m_EntityIdValues;
|
||||
|
||||
public ValueArray(ObjectReader reader)
|
||||
{
|
||||
@@ -566,7 +566,15 @@ namespace AssetStudio
|
||||
reader.AlignStream();
|
||||
if (version >= (6000, 2)) //6000.2 and up
|
||||
{
|
||||
m_EntityIdValues = reader.ReadInt32Array();
|
||||
var numEntities = reader.ReadInt32();
|
||||
var m_EntityIdList = new List<ulong>();
|
||||
for (var i = 0; i < numEntities; i++)
|
||||
{
|
||||
m_EntityIdList.Add(version >= (6000, 5) //6000.5 and up
|
||||
? reader.ReadUInt64()
|
||||
: reader.ReadUInt32());
|
||||
}
|
||||
m_EntityIdValues = m_EntityIdList.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace AssetStudio
|
||||
}
|
||||
}
|
||||
|
||||
if ((!version.IsAlpha && version >= (6000, 5)) || (version.IsAlpha && version >= (6000, 5, 0, 7))) //6000.5.0a7 and up
|
||||
if (version >= (6000, 5)) //6000.5.0a7 and up
|
||||
{
|
||||
m_BlendShapes = new BlendShapeData(reader);
|
||||
}
|
||||
@@ -228,7 +228,7 @@ namespace AssetStudio
|
||||
}
|
||||
|
||||
m_Extrude = reader.ReadUInt32();
|
||||
if (version.IsInRange((5, 3), (6000, 5))) //5.3 - 6000.4
|
||||
if (version.IsInRange((5, 3), (6000, 5))) //5.3 - 6000.5 down
|
||||
{
|
||||
m_IsPolygon = reader.ReadBoolean();
|
||||
reader.AlignStream();
|
||||
|
||||
@@ -4,7 +4,83 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public class SpriteAtlasData
|
||||
public sealed class SpriteBone
|
||||
{
|
||||
public string name;
|
||||
public string guid;
|
||||
public Vector3 position;
|
||||
public Quaternion rotation;
|
||||
public float length;
|
||||
public int parentId;
|
||||
public Color color;
|
||||
|
||||
public SpriteBone(ObjectReader reader)
|
||||
{
|
||||
name = reader.ReadAlignedString();
|
||||
guid = reader.ReadAlignedString();
|
||||
position = reader.ReadVector3();
|
||||
rotation = reader.ReadQuaternion();
|
||||
length = reader.ReadSingle();
|
||||
parentId = reader.ReadInt32();
|
||||
color = reader.ReadColor4();
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class SpriteInstanceData
|
||||
{
|
||||
public string spriteName;
|
||||
public Rectf rect;
|
||||
public Vector4 border;
|
||||
public Vector2 pivot;
|
||||
public float pixelsToUnits;
|
||||
public int m_IndexFormat;
|
||||
public List<SubMesh> m_SubMeshes;
|
||||
public byte[] m_IndexBuffer;
|
||||
public VertexData m_VertexData;
|
||||
public Matrix4x4[] m_Bindpose;
|
||||
public BlendShapeData m_BlendShapes;
|
||||
public List<SpriteBone> spriteBones;
|
||||
public List<Vector2[]> physicsShape;
|
||||
|
||||
public SpriteInstanceData(ObjectReader reader)
|
||||
{
|
||||
spriteName = reader.ReadAlignedString();
|
||||
rect = new Rectf(reader);
|
||||
border = reader.ReadVector4();
|
||||
pivot = reader.ReadVector2();
|
||||
pixelsToUnits = reader.ReadSingle();
|
||||
m_IndexFormat = reader.ReadInt32();
|
||||
|
||||
var m_SubMeshesCount = reader.ReadInt32();
|
||||
m_SubMeshes = new List<SubMesh>();
|
||||
for (var i = 0; i < m_SubMeshesCount; i++)
|
||||
{
|
||||
m_SubMeshes.Add(new SubMesh(reader));
|
||||
}
|
||||
|
||||
m_IndexBuffer = reader.ReadUInt8Array();
|
||||
reader.AlignStream();
|
||||
m_VertexData = new VertexData(reader);
|
||||
m_Bindpose = reader.ReadMatrixArray();
|
||||
m_BlendShapes = new BlendShapeData(reader);
|
||||
|
||||
var spriteBonesCount = reader.ReadInt32();
|
||||
spriteBones = new List<SpriteBone>();
|
||||
for (var i = 0; i < spriteBonesCount; i++)
|
||||
{
|
||||
spriteBones.Add(new SpriteBone(reader));
|
||||
}
|
||||
|
||||
var physicsShapeCount = reader.ReadInt32();
|
||||
physicsShape = new List<Vector2[]>();
|
||||
for (var i = 0; i < physicsShapeCount; i++)
|
||||
{
|
||||
physicsShape.Add(reader.ReadVector2Array());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class SpriteAtlasData
|
||||
{
|
||||
public PPtr<Texture2D> texture;
|
||||
public PPtr<Texture2D> alphaTexture;
|
||||
@@ -15,6 +91,7 @@ namespace AssetStudio
|
||||
public float downscaleMultiplier;
|
||||
public SpriteSettings settingsRaw;
|
||||
public List<SecondarySpriteTexture> secondaryTextures;
|
||||
public SpriteInstanceData spriteInstanceData;
|
||||
|
||||
public SpriteAtlasData(ObjectReader reader)
|
||||
{
|
||||
@@ -32,20 +109,24 @@ namespace AssetStudio
|
||||
settingsRaw = new SpriteSettings(reader);
|
||||
if (version >= (2020, 2)) //2020.2 and up
|
||||
{
|
||||
var secondaryTexturesSize = reader.ReadInt32();
|
||||
var secondaryTexturesCount = reader.ReadInt32();
|
||||
secondaryTextures = new List<SecondarySpriteTexture>();
|
||||
for (var i = 0; i < secondaryTexturesSize; i++)
|
||||
for (var i = 0; i < secondaryTexturesCount; i++)
|
||||
{
|
||||
secondaryTextures.Add(new SecondarySpriteTexture(reader));
|
||||
}
|
||||
reader.AlignStream();
|
||||
}
|
||||
if (version >= (6000, 6)) //6000.6.0a3 and up
|
||||
{
|
||||
spriteInstanceData = new SpriteInstanceData(reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class SpriteAtlas : NamedObject
|
||||
{
|
||||
public List<PPtr<Sprite>> m_PackedSprites;
|
||||
public List<PPtr<Sprite>> m_PackedSprites = new List<PPtr<Sprite>>();
|
||||
public string[] m_PackedSpriteNamesToIndex;
|
||||
[JsonConverter(typeof(JsonConverterHelper.RenderDataMapConverter))]
|
||||
public Dictionary<KeyValuePair<Guid, long>, SpriteAtlasData> m_RenderDataMap;
|
||||
@@ -55,18 +136,20 @@ namespace AssetStudio
|
||||
|
||||
public SpriteAtlas(ObjectReader reader) : base(reader)
|
||||
{
|
||||
var m_PackedSpritesSize = reader.ReadInt32();
|
||||
m_PackedSprites = new List<PPtr<Sprite>>();
|
||||
for (var i = 0; i < m_PackedSpritesSize; i++)
|
||||
if (version < (6000, 6)) //6000.6 down
|
||||
{
|
||||
m_PackedSprites.Add(new PPtr<Sprite>(reader));
|
||||
var m_PackedSpritesCount = reader.ReadInt32();
|
||||
for (var i = 0; i < m_PackedSpritesCount; i++)
|
||||
{
|
||||
m_PackedSprites.Add(new PPtr<Sprite>(reader));
|
||||
}
|
||||
|
||||
m_PackedSpriteNamesToIndex = reader.ReadStringArray();
|
||||
}
|
||||
|
||||
m_PackedSpriteNamesToIndex = reader.ReadStringArray();
|
||||
|
||||
var m_RenderDataMapSize = reader.ReadInt32();
|
||||
var m_RenderDataMapCount = reader.ReadInt32();
|
||||
m_RenderDataMap = new Dictionary<KeyValuePair<Guid, long>, SpriteAtlasData>();
|
||||
for (var i = 0; i < m_RenderDataMapSize; i++)
|
||||
for (var i = 0; i < m_RenderDataMapCount; i++)
|
||||
{
|
||||
var first = new Guid(reader.ReadBytes(16));
|
||||
var second = reader.ReadInt64();
|
||||
@@ -77,7 +160,7 @@ namespace AssetStudio
|
||||
m_IsVariant = reader.ReadBoolean();
|
||||
reader.AlignStream();
|
||||
|
||||
if ((!version.IsAlpha && version >= (6000, 5)) || (version.IsAlpha && version >= (6000, 5, 0, 4))) //6000.5.0a4 and up
|
||||
if (version >= (6000, 5)) //6000.5.0a4 and up
|
||||
{
|
||||
m_Guid = new Guid(reader.ReadBytes(16));
|
||||
}
|
||||
|
||||
@@ -279,5 +279,37 @@
|
||||
/// Four channel (RGBA) texture format, 16-bits unsigned integer per channel.
|
||||
/// </summary>
|
||||
RGBA64,
|
||||
/// <summary>
|
||||
/// Single channel (R) texture format, 8-bits signed integer.
|
||||
/// </summary>
|
||||
R8_SIGNED,
|
||||
/// <summary>
|
||||
/// Two channel (RG) texture format, 8-bits signed integer per channel.
|
||||
/// </summary>
|
||||
RG16_SIGNED,
|
||||
/// <summary>
|
||||
/// Three channel (RGB) texture format, 8-bits signed integer per channel.
|
||||
/// </summary>
|
||||
RGB24_SIGNED,
|
||||
/// <summary>
|
||||
/// Four channel (RGBA) texture format, 8-bits signed integer per channel.
|
||||
/// </summary>
|
||||
RGBA32_SIGNED,
|
||||
/// <summary>
|
||||
/// Single channel (R) texture format, 16-bits signed integer.
|
||||
/// </summary>
|
||||
R16_SIGNED,
|
||||
/// <summary>
|
||||
/// Two channel (RG) texture format, 16-bits signed integer per channel.
|
||||
/// </summary>
|
||||
RG32_SIGNED,
|
||||
/// <summary>
|
||||
/// Three color (RGB) texture format, 16-bits signed integer per channel.
|
||||
/// </summary>
|
||||
RGB48_SIGNED,
|
||||
/// <summary>
|
||||
/// Four channel (RGBA) texture format, 16-bits signed integer per channel.
|
||||
/// </summary>
|
||||
RGBA64_SIGNED,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,6 +118,7 @@ namespace AssetStudio
|
||||
{1169, "RenderingLayerMask"},
|
||||
{1188, "fixed_array"},
|
||||
{1200, "EntityId"},
|
||||
{1209, "LoadableObjectId"},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user