From 5444a8bd6b9acefe19640987d7600da4a77ae801 Mon Sep 17 00:00:00 2001 From: Nattsu39 Date: Sun, 15 Oct 2023 22:18:18 +0800 Subject: [PATCH] fix: Read SpriteBone correctly Should read rotaion in SpriteBone via read_quaternion. (Only tested in version 2020.3.38) --- UnityPy/classes/Sprite.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/UnityPy/classes/Sprite.py b/UnityPy/classes/Sprite.py index 3f65e84e..291b2e73 100644 --- a/UnityPy/classes/Sprite.py +++ b/UnityPy/classes/Sprite.py @@ -55,7 +55,7 @@ def __init__(self, reader): 2020, 3, ): - self.m_Bones = [SpriteBone() for _ in range(m_BonesSize)] + self.m_Bones = [SpriteBone(self.reader) for _ in range(m_BonesSize)] else: self.m_Bones = [reader.read_vector2_array() for _ in range(m_BonesSize)] @@ -242,13 +242,13 @@ class SpriteBone: def __init__(self, reader: EndianBinaryReader) -> None: self.name = reader.read_aligned_string() self.position = reader.read_vector3() - self.rotation = reader.read_vector3() + self.rotation = reader.read_quaternion() self.length = reader.read_float() self.parentId = reader.read_int() def save(self, writer: EndianBinaryWriter): writer.write_aligned_string(self.name) writer.write_vector3(self.position) - writer.write_vector3(self.rotation) + writer.write_quaternion(self.rotation) writer.write_float(self.length) writer.write_int(self.parentId)