mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-10 17:18:44 +08:00
Support attachment loader discarding attachment by returning null.
This commit is contained in:
parent
26e4fb0d74
commit
083a842c97
@ -223,6 +223,7 @@ public class SkeletonBinary {
|
||||
String path = input.readString();
|
||||
if (path == null) path = name;
|
||||
MeshAttachment mesh = attachmentLoader.newMeshAttachment(skin, name, path);
|
||||
if (mesh == null) return null;
|
||||
float[] uvs = readFloatArray(input, 1);
|
||||
short[] triangles = readShortArray(input);
|
||||
float[] vertices = readFloatArray(input, scale);
|
||||
@ -240,6 +241,7 @@ public class SkeletonBinary {
|
||||
String path = input.readString();
|
||||
if (path == null) path = name;
|
||||
SkinnedMeshAttachment mesh = attachmentLoader.newSkinnedMeshAttachment(skin, name, path);
|
||||
if (mesh == null) return null;
|
||||
float[] uvs = readFloatArray(input, 1);
|
||||
short[] triangles = readShortArray(input);
|
||||
|
||||
|
||||
@ -174,6 +174,7 @@ public class SkeletonJson {
|
||||
switch (AttachmentType.valueOf(map.getString("type", AttachmentType.region.name()))) {
|
||||
case region:
|
||||
RegionAttachment region = attachmentLoader.newRegionAttachment(skin, name, map.getString("path", name));
|
||||
if (region == null) return null;
|
||||
region.setX(map.getFloat("x", 0) * scale);
|
||||
region.setY(map.getFloat("y", 0) * scale);
|
||||
region.setScaleX(map.getFloat("scaleX", 1));
|
||||
@ -189,6 +190,7 @@ public class SkeletonJson {
|
||||
return region;
|
||||
case boundingbox: {
|
||||
BoundingBoxAttachment box = attachmentLoader.newBoundingBoxAttachment(skin, name);
|
||||
if (box == null) return null;
|
||||
float[] vertices = map.require("vertices").asFloatArray();
|
||||
if (scale != 1) {
|
||||
for (int i = 0, n = vertices.length; i < n; i++)
|
||||
@ -199,6 +201,7 @@ public class SkeletonJson {
|
||||
}
|
||||
case mesh: {
|
||||
MeshAttachment mesh = attachmentLoader.newMeshAttachment(skin, name, map.getString("path", name));
|
||||
if (mesh == null) return null;
|
||||
float[] uvs = map.require("uvs").asFloatArray();
|
||||
short[] triangles = map.require("triangles").asShortArray();
|
||||
|
||||
@ -217,6 +220,7 @@ public class SkeletonJson {
|
||||
}
|
||||
case skinnedmesh: {
|
||||
SkinnedMeshAttachment mesh = attachmentLoader.newSkinnedMeshAttachment(skin, name, map.getString("path", name));
|
||||
if (mesh == null) return null;
|
||||
float[] uvs = map.require("uvs").asFloatArray();
|
||||
short[] triangles = map.require("triangles").asShortArray();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user