TextureRegionAttachment -> HasTextureRegion.

This commit is contained in:
Nathan Sweet 2021-09-25 23:04:56 -10:00
parent f4e893ef88
commit 920604dff7
6 changed files with 13 additions and 13 deletions

View File

@ -87,7 +87,7 @@ import com.esotericsoftware.spine.attachments.PointAttachment;
import com.esotericsoftware.spine.attachments.RegionAttachment;
import com.esotericsoftware.spine.attachments.SequenceAttachment;
import com.esotericsoftware.spine.attachments.SequenceAttachment.SequenceMode;
import com.esotericsoftware.spine.attachments.TextureRegionAttachment;
import com.esotericsoftware.spine.attachments.HasTextureRegion;
import com.esotericsoftware.spine.attachments.VertexAttachment;
/** Loads skeleton data in the Spine binary format.
@ -543,7 +543,7 @@ public class SkeletonBinary extends SkeletonLoader {
SequenceMode mode = SequenceMode.values[input.readInt(true)];
if (attachment == null) return null;
String path = ((TextureRegionAttachment)attachment).getPath();
String path = ((HasTextureRegion)attachment).getPath();
SequenceAttachment sequence = attachmentLoader.newSequenceAttachment(skin, name, path, frameCount);
if (sequence == null) return null;

View File

@ -86,7 +86,7 @@ import com.esotericsoftware.spine.attachments.PointAttachment;
import com.esotericsoftware.spine.attachments.RegionAttachment;
import com.esotericsoftware.spine.attachments.SequenceAttachment;
import com.esotericsoftware.spine.attachments.SequenceAttachment.SequenceMode;
import com.esotericsoftware.spine.attachments.TextureRegionAttachment;
import com.esotericsoftware.spine.attachments.HasTextureRegion;
import com.esotericsoftware.spine.attachments.VertexAttachment;
/** Loads skeleton data in the Spine JSON format.
@ -475,7 +475,7 @@ public class SkeletonJson extends SkeletonLoader {
case sequence:
Attachment attachment = readAttachment(map.getChild("attachment"), skin, slotIndex, name, skeletonData);
if (attachment == null) return null;
String path = ((TextureRegionAttachment)attachment).getPath();
String path = ((HasTextureRegion)attachment).getPath();
int frameCount = map.getInt("count");
SequenceAttachment sequence = attachmentLoader.newSequenceAttachment(skin, name, path, frameCount);
if (sequence == null) return null;

View File

@ -4,7 +4,12 @@ package com.esotericsoftware.spine.attachments;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
public interface TextureRegionAttachment {
public interface HasTextureRegion {
/** The name used to find the {@link #getRegion()}. */
public String getPath ();
public void setPath (String path);
/** Sets the region used to draw the attachment. If the region or its properties are changed, {@link #updateRegion()} must be
* called. */
public void setRegion (TextureRegion region);
@ -17,9 +22,4 @@ public interface TextureRegionAttachment {
/** The color to tint the attachment. */
public Color getColor ();
/** The name used to find the {@link #getRegion()}. */
public String getPath ();
public void setPath (String path);
}

View File

@ -40,7 +40,7 @@ import com.badlogic.gdx.utils.Null;
* supported. Each vertex has UVs (texture coordinates) and triangles are used to map an image on to the mesh.
* <p>
* See <a href="http://esotericsoftware.com/spine-meshes">Mesh attachments</a> in the Spine User Guide. */
public class MeshAttachment extends VertexAttachment implements TextureRegionAttachment {
public class MeshAttachment extends VertexAttachment implements HasTextureRegion {
private TextureRegion region;
private String path;
private float[] regionUVs, uvs;

View File

@ -40,7 +40,7 @@ import com.esotericsoftware.spine.Bone;
/** An attachment that displays a textured quadrilateral.
* <p>
* See <a href="http://esotericsoftware.com/spine-regions">Region attachments</a> in the Spine User Guide. */
public class RegionAttachment extends Attachment implements TextureRegionAttachment {
public class RegionAttachment extends Attachment implements HasTextureRegion {
static public final int BLX = 0;
static public final int BLY = 1;
static public final int ULX = 2;

View File

@ -37,7 +37,7 @@ import com.esotericsoftware.spine.Slot;
/** An attachment that applies a sequence of texture atlas regions to a region or mesh attachment.
* <p>
* See <a href="http://esotericsoftware.com/spine-sequences">Sequence attachments</a> in the Spine User Guide. */
public class SequenceAttachment<T extends Attachment & TextureRegionAttachment> extends Attachment {
public class SequenceAttachment<T extends Attachment & HasTextureRegion> extends Attachment {
private T attachment;
private String path;
private int frameCount;