diff --git a/spine-csharp/src/Animation.cs b/spine-csharp/src/Animation.cs
index 704fa5027..f0fe82916 100644
--- a/spine-csharp/src/Animation.cs
+++ b/spine-csharp/src/Animation.cs
@@ -1898,6 +1898,9 @@ namespace Spine {
return slotIndex;
}
}
+
+ /// The attachment for which the will be set.
+ /// .
public Attachment Attachment {
get {
return (Attachment)attachment;
@@ -1922,11 +1925,8 @@ namespace Spine {
SlotPose pose = appliedPose ? slot.applied : slot.pose;
Attachment slotAttachment = pose.attachment;
- if (slotAttachment != attachment) {
- IHasSequence sequenceAttachment = slotAttachment as IHasSequence;
- if ((sequenceAttachment == null)
- || sequenceAttachment.TimelineAttachment != attachment) return;
- }
+ IHasSequence hasSequence = slotAttachment as IHasSequence;
+ if ((hasSequence == null) || slotAttachment.TimelineAttachment != attachment) return;
if (direction == MixDirection.Out) {
if (blend == MixBlend.Setup) pose.SequenceIndex = -1;
@@ -1944,7 +1944,7 @@ namespace Spine {
int modeAndIndex = (int)frames[i + MODE];
float delay = frames[i + DELAY];
- int index = modeAndIndex >> 4, count = (((IHasSequence)slotAttachment).Sequence).Regions.Length;
+ int index = modeAndIndex >> 4, count = hasSequence.Sequence.Regions.Length;
SequenceMode mode = (SequenceMode)(modeAndIndex & 0xf);
if (mode != SequenceMode.Hold) {
index += (int)((time - before) / delay + 0.0001f);
diff --git a/spine-csharp/src/Attachments/Attachment.cs b/spine-csharp/src/Attachments/Attachment.cs
index cb4467e0d..ea7c694e3 100644
--- a/spine-csharp/src/Attachments/Attachment.cs
+++ b/spine-csharp/src/Attachments/Attachment.cs
@@ -33,17 +33,25 @@ namespace Spine {
/// The base class for all attachments.
abstract public class Attachment {
+ internal Attachment timelineAttachment;
+
/// The attachment's name.
public string Name { get; }
+ /// Timelines for the timeline attachment are also applied to this attachment.
+ /// May be null if no attachment-specific timelines should be applied.
+ public Attachment TimelineAttachment { get { return timelineAttachment; } set { timelineAttachment = value; } }
+
protected Attachment (string name) {
if (name == null) throw new ArgumentNullException("name", "name cannot be null");
this.Name = name;
+ timelineAttachment = this;
}
/// Copy constructor.
protected Attachment (Attachment other) {
Name = other.Name;
+ timelineAttachment = other.timelineAttachment;
}
override public string ToString () {
diff --git a/spine-csharp/src/Attachments/IHasSequence.cs b/spine-csharp/src/Attachments/IHasSequence.cs
index 74ec9acbd..15da803ca 100644
--- a/spine-csharp/src/Attachments/IHasSequence.cs
+++ b/spine-csharp/src/Attachments/IHasSequence.cs
@@ -42,9 +42,6 @@ namespace Spine {
void SetColor (Color32F color);
void SetColor (float r, float g, float b, float a);
Sequence Sequence { get; }
- /// Timelines for the timeline attachment are also applied to this attachment.
- /// May be null if no attachment-specific timelines should be applied.
- Attachment TimelineAttachment { get; set; }
void UpdateSequence ();
}
}
diff --git a/spine-csharp/src/Attachments/MeshAttachment.cs b/spine-csharp/src/Attachments/MeshAttachment.cs
index a5800d830..74e21764b 100644
--- a/spine-csharp/src/Attachments/MeshAttachment.cs
+++ b/spine-csharp/src/Attachments/MeshAttachment.cs
@@ -73,11 +73,7 @@ namespace Spine {
public string Path { get { return path; } set { path = value; } }
public Sequence Sequence { get { return sequence; } }
- Attachment IHasSequence.TimelineAttachment {
- get { return timelineAttachment; }
- set { timelineAttachment = (VertexAttachment)value; }
- }
-
+
public MeshAttachment ParentMesh {
get { return parentMesh; }
set {
diff --git a/spine-csharp/src/Attachments/RegionAttachment.cs b/spine-csharp/src/Attachments/RegionAttachment.cs
index 654ea8018..2154f7912 100644
--- a/spine-csharp/src/Attachments/RegionAttachment.cs
+++ b/spine-csharp/src/Attachments/RegionAttachment.cs
@@ -46,7 +46,6 @@ namespace Spine {
public const int BRX = 6, BRY = 7;
internal readonly Sequence sequence;
- internal Attachment timelineAttachment;
internal float x, y, rotation, scaleX = 1, scaleY = 1, width, height;
// Color is a struct, set to protected to prevent
// Color color = slot.color; color.a = 0.5;
@@ -76,13 +75,11 @@ namespace Spine {
public string Path { get; set; }
public Sequence Sequence { get { return sequence; } }
- public Attachment TimelineAttachment { get { return timelineAttachment; } set { timelineAttachment = value; } }
-
+
public RegionAttachment (string name, Sequence sequence)
: base(name) {
if (sequence == null) throw new ArgumentException("sequence cannot be null.", "sequence");
this.sequence = sequence;
- timelineAttachment = this;
}
/// Copy constructor.
@@ -98,7 +95,6 @@ namespace Spine {
height = other.height;
color = other.color;
sequence = new Sequence(other.sequence);
- timelineAttachment = other.timelineAttachment;
}
///
diff --git a/spine-csharp/src/Attachments/VertexAttachment.cs b/spine-csharp/src/Attachments/VertexAttachment.cs
index 29ff3b40c..f9e701d4d 100644
--- a/spine-csharp/src/Attachments/VertexAttachment.cs
+++ b/spine-csharp/src/Attachments/VertexAttachment.cs
@@ -37,7 +37,6 @@ namespace Spine {
static readonly Object nextIdLock = new Object();
internal readonly int id;
- internal VertexAttachment timelineAttachment;
internal int[] bones;
internal float[] vertices;
internal int worldVerticesLength;
@@ -47,17 +46,13 @@ namespace Spine {
public int[] Bones { get { return bones; } set { bones = value; } }
public float[] Vertices { get { return vertices; } set { vertices = value; } }
public int WorldVerticesLength { get { return worldVerticesLength; } set { worldVerticesLength = value; } }
- /// Timelines for the timeline attachment are also applied to this attachment.
- /// May be null if no attachment-specific timelines should be applied.
- public VertexAttachment TimelineAttachment { get { return timelineAttachment; } set { timelineAttachment = value; } }
-
+
public VertexAttachment (string name)
: base(name) {
lock (VertexAttachment.nextIdLock) {
id = VertexAttachment.nextID++;
}
- timelineAttachment = this;
}
/// Copy constructor.