From 7361358121150e339ed13f542d34986b2680b741 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 27 Jun 2017 15:36:18 +0800 Subject: [PATCH] [unity] AttachmentTools handle Points and Clipping --- .../AttachmentTools/AttachmentTools.cs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/spine-unity/Assets/spine-unity/Modules/AttachmentTools/AttachmentTools.cs b/spine-unity/Assets/spine-unity/Modules/AttachmentTools/AttachmentTools.cs index f24497731..466059fdb 100644 --- a/spine-unity/Assets/spine-unity/Modules/AttachmentTools/AttachmentTools.cs +++ b/spine-unity/Assets/spine-unity/Modules/AttachmentTools/AttachmentTools.cs @@ -798,6 +798,14 @@ namespace Spine.Unity.Modules.AttachmentTools { if (pathAttachment != null) return pathAttachment.GetClone(); + var pointAttachment = o as PointAttachment; + if (pointAttachment != null) + return pointAttachment.GetClone(); + + var clippingAttachment = o as ClippingAttachment; + if (clippingAttachment != null) + return clippingAttachment.GetClone(); + return null; } @@ -829,6 +837,23 @@ namespace Spine.Unity.Modules.AttachmentTools { }; } + public static ClippingAttachment GetClone (this ClippingAttachment o) { + var ca = new ClippingAttachment(o.Name) { + endSlot = o.endSlot + }; + CloneVertexAttachment(o, ca); + return ca; + } + + public static PointAttachment GetClone (this PointAttachment o) { + var pa = new PointAttachment(o.Name) { + rotation = o.rotation, + x = o.x, + y = o.y + }; + return pa; + } + public static BoundingBoxAttachment GetClone (this BoundingBoxAttachment o) { var ba = new BoundingBoxAttachment(o.Name); CloneVertexAttachment(o, ba);