瀏覽代碼

Merged with origin

badlogic 8 年之前
父節點
當前提交
241c7980f8

+ 6 - 3
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonJson.java

@@ -411,9 +411,12 @@ public class SkeletonJson {
 			ClippingAttachment clip = attachmentLoader.newClippingAttachment(skin, name);
 			if (clip == null) return null;
 
-			SlotData slot = skeletonData.findSlot(map.getString("end"));
-			if (slot == null) throw new SerializationException("Slot not found: " + map.getString("end"));
-			clip.setEndSlot(slot.index);
+			String end = map.getString("end", null);
+			if (end != null) {
+				SlotData slot = skeletonData.findSlot(end);
+				if (slot == null) throw new SerializationException("Slot not found: " + end);
+				clip.setEndSlot(slot.index);
+			}
 
 			readVertices(map, clip, map.getInt("vertexCount") << 1);
 

+ 3 - 1
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonRenderer.java

@@ -52,7 +52,6 @@ public class SkeletonRenderer implements Disposable {
 
 	private boolean premultipliedAlpha;
 	private final FloatArray vertices = new FloatArray(32);
-	
 	private ImmediateModeRenderer renderer;
 	private final SkeletonClipping clipper = new SkeletonClipping();
 
@@ -122,6 +121,7 @@ public class SkeletonRenderer implements Disposable {
 
 			if (clipper.isClipping() && clipper.getClippingAttachment().getEndSlot() == i) clipper.clipEnd();
 		}
+		if (clipper.isClipping()) clipper.clipEnd();
 	}
 
 	@SuppressWarnings("null")
@@ -223,6 +223,7 @@ public class SkeletonRenderer implements Disposable {
 
 			if (clipper.isClipping() && clipper.getClippingAttachment().getEndSlot() == i) clipper.clipEnd();
 		}
+		if (clipper.isClipping()) clipper.clipEnd();
 	}
 
 	@SuppressWarnings("null")
@@ -331,6 +332,7 @@ public class SkeletonRenderer implements Disposable {
 
 			if (clipper.isClipping() && clipper.getClippingAttachment().getEndSlot() == i) clipper.clipEnd();
 		}
+		if (clipper.isClipping()) clipper.clipEnd();
 	}
 
 	public void setPremultipliedAlpha (boolean premultipliedAlpha) {

+ 3 - 2
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/ClippingAttachment.java

@@ -34,7 +34,7 @@ import com.badlogic.gdx.graphics.Color;
 
 /** An attachment with vertices that make up a polygon used for clipping the rendering of other attachments. */
 public class ClippingAttachment extends VertexAttachment {
-	int endSlot;
+	int endSlot = -1;
 
 	// Nonessential.
 	final Color color = new Color(0.2275f, 0.2275f, 0.8078f, 1); // ce3a3aff
@@ -43,7 +43,8 @@ public class ClippingAttachment extends VertexAttachment {
 		super(name);
 	}
 
-	/** Clipping is performed between the clipping polygon's slot and the end slot. */
+	/** Clipping is performed between the clipping polygon's slot and the end slot. Returns -1 if clipping is done until the end of
+	 * the skeleton's rendering. */
 	public int getEndSlot () {
 		return endSlot;
 	}