[csharp] Fixed copies of RegionAttachment not playing back Sequence timelines. See #3040.

This commit is contained in:
Harald Csaszar 2026-03-10 15:39:26 +01:00
parent 73a50ef12d
commit f3f5574eff
4 changed files with 15 additions and 5 deletions

View File

@ -1923,9 +1923,9 @@ namespace Spine {
Attachment slotAttachment = pose.attachment;
if (slotAttachment != attachment) {
VertexAttachment vertexAttachment = slotAttachment as VertexAttachment;
if ((vertexAttachment == null)
|| vertexAttachment.TimelineAttachment != attachment) return;
IHasSequence sequenceAttachment = slotAttachment as IHasSequence;
if ((sequenceAttachment == null)
|| sequenceAttachment.TimelineAttachment != attachment) return;
}
if (direction == MixDirection.Out) {

View File

@ -42,6 +42,9 @@ namespace Spine {
void SetColor (Color32F color);
void SetColor (float r, float g, float b, float a);
Sequence Sequence { get; }
/// <summary>Timelines for the timeline attachment are also applied to this attachment.
/// May be null if no attachment-specific timelines should be applied.</summary>
Attachment TimelineAttachment { get; set; }
void UpdateSequence ();
}
}

View File

@ -56,8 +56,7 @@ namespace Spine {
/// <summary>The UV pair for each vertex, normalized within the texture region.</summary>
public float[] RegionUVs { get { return regionUVs; } set { regionUVs = value; } }
/// <summary>The UV pair for each vertex, normalized within the entire texture.
/// <seealso cref="MeshAttachment.UpdateRegion"/></summary>
/// <summary>Triplets of vertex indices which describe the mesh's triangulation.</summary>
public int[] Triangles { get { return triangles; } set { triangles = value; } }
public Color32F GetColor () {
@ -74,6 +73,10 @@ 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; }

View File

@ -46,6 +46,7 @@ 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;
@ -75,11 +76,13 @@ 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;
}
/// <summary>Copy constructor.</summary>
@ -95,6 +98,7 @@ namespace Spine {
height = other.height;
color = other.color;
sequence = new Sequence(other.sequence);
timelineAttachment = other.timelineAttachment;
}
/// <summary><para>