예제 #1
0
        public void AssignSlotDataToOther(SpineDocument document, Slot[] identical)
        {
            var other = document.Slots;

            document.Bones = Bones;
            var imageScale = CalculateImageSizeRatio(document.ActualWidth, document.ActualHeight);


            //BoneResolver.AdjustBonePositions(document.Bones, scale.X, scale.Y);

            for (int i = 0; i < identical.Length; i++)
            {
                for (int j = 0; j < other.Length; j++)
                {
                    if (identical[i].Equals(other[j]))
                    {
                        var thisAttachment  = identical[i].Attachment;
                        var otherAttachment = other[j].Attachment;

                        if (thisAttachment is IVertexIncludingAttachment thisMesh &&
                            otherAttachment is IVertexIncludingAttachment otherMesh)
                        {
                            var scale = CalculateAttachmentSizeRatio(thisMesh, otherMesh);
                            BoneResolver.AdjustBonePositions(thisMesh.VertexCollection.GetRelativeBones(), scale.X, scale.Y, true);

                            AssignVerticesToOther(
                                thisMesh,
                                otherMesh,
                                scale);
                        }
                        else
                        {
                            AssignPositionToOther(
                                (IVertexExcludingAttachment)thisAttachment,
                                (IVertexExcludingAttachment)otherAttachment,
                                imageScale);
                        }
                    }
                }
            }
예제 #2
0
 public string Serialize(SpineDocument document)
 {
     return(JsonSerializer.Serialize(document, _options));
 }