From 0cd92b8010100d57f7b3a6ec55e7ab1ad632fc36 Mon Sep 17 00:00:00 2001 From: copygirl Date: Mon, 9 Dec 2024 07:45:34 +0100 Subject: [PATCH] Serialize model transform as 16-bit floats --- sync_controller.gd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sync_controller.gd b/sync_controller.gd index 84081fc..e4feeb3 100644 --- a/sync_controller.gd +++ b/sync_controller.gd @@ -76,7 +76,8 @@ func sync_model_animation( var uncompressed_buffer := buffer.decompress(uncompressed_length, FileAccess.COMPRESSION_ZSTD); var stream := StreamBuffer.from_buffer(uncompressed_buffer) - model.transform = stream.read_transform32() + + model.transform = stream.read_transform16() # We skipped some bones, so reset the skipped ones to the rest pose. var all_bones := {} @@ -114,7 +115,7 @@ static func send_model_animation(module: copyMultiplayer) -> void: var media_pipe = module.get_node("../MediaPipeController") if (not model) or (not skeleton) or (not media_pipe): return - write_stream.write_transform32(model.transform) + write_stream.write_transform16(model.transform) # Pre-filter any bones that are in rest pose. var restless_bones := {} @@ -127,9 +128,8 @@ static func send_model_animation(module: copyMultiplayer) -> void: write_stream.write_uint8(restless_bones.size()) for bone_name in restless_bones: - var bone_pose: Transform3D = restless_bones[bone_name] write_stream.write_uint8(module.bone_to_lookup[bone_name]) - write_stream.write_bone_pose(bone_pose) + write_stream.write_bone_pose(restless_bones[bone_name]) # TODO: Only write non-default blendshapes. Anything missing = default. var shape_dict: Dictionary = media_pipe.blend_shape_last_values