//--------------- Serialize / Deserialize --------------------
 public static byte[] Serialize(SBoneWeightArray input)
 {
     ComposedByteStream stream = ComposedByteStream.FetchStream();
     if (input != null) {
         stream.AddStream(input.indices);
         stream.AddStream(input.weights);
     } else {
         stream.AddEmptyStreams(2);
     }
     return stream.Compose();
 }
        public override void Dispose()
        {
            base.Dispose();

            if (header != null) header.Dispose();
            if (subMeshes != null) subMeshes.Dispose();
            if (vertices != null) vertices.Dispose();
            if (uv != null) uv.Dispose();
            if (uv1 != null) uv1.Dispose();
            if (uv2 != null) uv2.Dispose();
            if (uv3 != null) uv3.Dispose();
            if (uv4 != null) uv4.Dispose();
            if (bindPoses != null) bindPoses.Dispose();
            if (bones != null) bones.Dispose();
            if (boneWeights != null) boneWeights.Dispose();

            header = null;
            subMeshes = null;
            triangles = null;
            vertices = null;
            uv = null;
            uv1 = null;
            uv2 = null;
            uv3 = null;
            uv4 = null;
            bindPoses = null;
            bones = null;
            boneWeights = null;
        }
 public static SBoneWeightArray Deserialize(byte[] input)
 {
     SBoneWeightArray result = new SBoneWeightArray();
     ComposedByteStream stream = ComposedByteStream.FromByteArray(input);
     result.indices = stream.ReadNextStream<int>();
     result.weights = stream.ReadNextStream<float>();
     result.count = result.weights.Length / 4;
     stream.Dispose();
     return result;
 }