mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-25 22:23:42 +08:00
Renderers need to skip slots where the bone is not visible.
This commit is contained in:
parent
659c3901c3
commit
7ee57dc46f
@ -54,7 +54,7 @@ public class Bone implements Updatable {
|
||||
float a, b, worldX;
|
||||
float c, d, worldY;
|
||||
|
||||
boolean sorted, update;
|
||||
boolean sorted, visible;
|
||||
|
||||
/** @param parent May be null. */
|
||||
public Bone (BoneData data, Skeleton skeleton, Bone parent) {
|
||||
|
||||
@ -166,15 +166,15 @@ public class Skeleton {
|
||||
for (int i = 0; i < boneCount; i++) {
|
||||
Bone bone = (Bone)bones[i];
|
||||
bone.sorted = bone.data.skinRequired;
|
||||
bone.update = !bone.sorted;
|
||||
bone.visible = !bone.sorted;
|
||||
}
|
||||
if (skin != null) {
|
||||
Object[] skinBones = skin.bones.items;
|
||||
for (int i = 0, n = skin.bones.size; i < n; i++) {
|
||||
Bone bone = (Bone)skinBones[i];
|
||||
Bone bone = (Bone)bones[((BoneData)skinBones[i]).index];
|
||||
do {
|
||||
bone.sorted = false;
|
||||
bone.update = true;
|
||||
bone.visible = true;
|
||||
bone = bone.parent;
|
||||
} while (bone != null);
|
||||
}
|
||||
@ -319,7 +319,7 @@ public class Skeleton {
|
||||
private void sortReset (Array<Bone> bones) {
|
||||
for (int i = 0, n = bones.size; i < n; i++) {
|
||||
Bone bone = bones.get(i);
|
||||
if (!bone.update) continue;
|
||||
if (!bone.visible) continue;
|
||||
if (bone.sorted) sortReset(bone.children);
|
||||
bone.sorted = false;
|
||||
}
|
||||
|
||||
@ -88,6 +88,7 @@ public class SkeletonRenderer {
|
||||
Array<Slot> drawOrder = skeleton.drawOrder;
|
||||
for (int i = 0, n = drawOrder.size; i < n; i++) {
|
||||
Slot slot = drawOrder.get(i);
|
||||
if (!slot.bone.visible) continue;
|
||||
Attachment attachment = slot.attachment;
|
||||
if (attachment instanceof RegionAttachment) {
|
||||
RegionAttachment region = (RegionAttachment)attachment;
|
||||
@ -166,6 +167,7 @@ public class SkeletonRenderer {
|
||||
Array<Slot> drawOrder = skeleton.drawOrder;
|
||||
for (int i = 0, n = drawOrder.size; i < n; i++) {
|
||||
Slot slot = drawOrder.get(i);
|
||||
if (!slot.bone.visible) continue;
|
||||
Texture texture = null;
|
||||
int vertexSize = clipper.isClipping() ? 2 : 5;
|
||||
Attachment attachment = slot.attachment;
|
||||
@ -289,6 +291,7 @@ public class SkeletonRenderer {
|
||||
Array<Slot> drawOrder = skeleton.drawOrder;
|
||||
for (int i = 0, n = drawOrder.size; i < n; i++) {
|
||||
Slot slot = drawOrder.get(i);
|
||||
if (!slot.bone.visible) continue;
|
||||
Texture texture = null;
|
||||
int vertexSize = clipper.isClipping() ? 2 : 6;
|
||||
Attachment attachment = slot.attachment;
|
||||
|
||||
@ -84,7 +84,7 @@ public class SkeletonRendererDebug {
|
||||
if (drawBones) {
|
||||
for (int i = 0, n = bones.size; i < n; i++) {
|
||||
Bone bone = bones.get(i);
|
||||
if (bone.parent == null) continue;
|
||||
if (bone.parent == null || !bone.visible) continue;
|
||||
float length = bone.data.length, width = boneWidth;
|
||||
if (length == 0) {
|
||||
length = 8;
|
||||
@ -239,6 +239,7 @@ public class SkeletonRendererDebug {
|
||||
shapes.setColor(boneOriginColor);
|
||||
for (int i = 0, n = bones.size; i < n; i++) {
|
||||
Bone bone = bones.get(i);
|
||||
if (!bone.visible) continue;
|
||||
shapes.circle(bone.worldX, bone.worldY, 3 * scale, 8);
|
||||
}
|
||||
}
|
||||
@ -294,7 +295,7 @@ public class SkeletonRendererDebug {
|
||||
public void setPoints (boolean points) {
|
||||
this.drawPoints = points;
|
||||
}
|
||||
|
||||
|
||||
public void setClipping (boolean clipping) {
|
||||
this.drawClipping = clipping;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user