[unity] AttachmentTools handle Points and Clipping

This commit is contained in:
John 2017-06-27 15:36:18 +08:00 committed by GitHub
parent 0abefacf23
commit 7361358121

View File

@ -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);