Browse Source

[libgdx] Added skin color to nonessential data.

Nathan Sweet 1 year ago
parent
commit
e894b10802

+ 3 - 0
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBinary.java

@@ -399,6 +399,9 @@ public class SkeletonBinary extends SkeletonLoader {
 			skin = new Skin("default");
 		} else {
 			skin = new Skin(input.readString());
+
+			if (nonessential) Color.rgba8888ToColor(skin.color, input.readInt());
+
 			Object[] bones = skin.bones.setSize(input.readInt(true)), items = skeletonData.bones.items;
 			for (int i = 0, n = skin.bones.size; i < n; i++)
 				bones[i] = items[input.readInt(true)];

+ 9 - 0
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Skin.java

@@ -29,6 +29,7 @@
 
 package com.esotericsoftware.spine;
 
+import com.badlogic.gdx.graphics.Color;
 import com.badlogic.gdx.utils.Array;
 import com.badlogic.gdx.utils.Null;
 import com.badlogic.gdx.utils.OrderedSet;
@@ -47,6 +48,9 @@ public class Skin {
 	final Array<ConstraintData> constraints = new Array(0);
 	private final SkinEntry lookup = new SkinEntry(0, "", null);
 
+	// Nonessential.
+	final Color color = new Color(0.99607843f, 0.61960787f, 0.30980393f, 1); // fe9e4fff
+
 	public Skin (String name) {
 		if (name == null) throw new IllegalArgumentException("name cannot be null.");
 		this.name = name;
@@ -139,6 +143,11 @@ public class Skin {
 		return name;
 	}
 
+	/** The color of the skin as it was in Spine, or a default color if nonessential data was not exported. */
+	public Color getColor () {
+		return color;
+	}
+
 	public String toString () {
 		return name;
 	}