[libgdx] Added skin color to nonessential data.

This commit is contained in:
Nathan Sweet 2023-11-08 09:28:06 -04:00
parent 63202d339b
commit e894b10802
2 changed files with 12 additions and 0 deletions

View File

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

View File

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