From 3e2516a743937a18d6b18d51a77f266a160a44dd Mon Sep 17 00:00:00 2001 From: "lizhou.zhu" Date: Thu, 13 Jan 2022 11:20:51 +0800 Subject: [PATCH] Support SpriteBone --- AssetStudio/Classes/Sprite.cs | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/AssetStudio/Classes/Sprite.cs b/AssetStudio/Classes/Sprite.cs index 6e3c6534..a8f013a8 100644 --- a/AssetStudio/Classes/Sprite.cs +++ b/AssetStudio/Classes/Sprite.cs @@ -191,6 +191,24 @@ public Rectf(BinaryReader reader) } } + public class SpriteBone + { + public string name; + public Vector3 position; + public Quaternion rotation; + public float length; + public int parentId; + + public SpriteBone(BinaryReader reader) + { + name = reader.ReadAlignedString(); + position = reader.ReadVector3(); + rotation = reader.ReadQuaternion(); + length = reader.ReadSingle(); + parentId = reader.ReadInt32(); + } + } + public sealed class Sprite : NamedObject { public Rectf m_Rect; @@ -205,7 +223,7 @@ public sealed class Sprite : NamedObject public PPtr m_SpriteAtlas; public SpriteRenderData m_RD; public Vector2[][] m_PhysicsShape; - + public SpriteBone[] m_Bones; public Sprite(ObjectReader reader) : base(reader) { m_Rect = new Rectf(reader); @@ -255,6 +273,15 @@ public Sprite(ObjectReader reader) : base(reader) } //vector m_Bones 2018 and up + if (version[0] >= 2018) + { + var m_BonesSize = reader.ReadInt32(); + m_Bones = new SpriteBone[m_BonesSize]; + for (int i = 0;i < m_BonesSize;i++) + { + m_Bones[i] = new SpriteBone(reader); + } + } } } }