From b194dbf2c8d043d86c5f97243b6926098461d23d Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Sun, 11 Nov 2018 23:45:51 +0100 Subject: [PATCH] [libgdx] Added Skin#removeAttachment. --- .../src/com/esotericsoftware/spine/Skin.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Skin.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Skin.java index 2d053ce41..5c5f205fd 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Skin.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Skin.java @@ -34,6 +34,7 @@ import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.ObjectMap; import com.badlogic.gdx.utils.ObjectMap.Entry; import com.badlogic.gdx.utils.Pool; + import com.esotericsoftware.spine.attachments.Attachment; /** Stores attachments by slot index and attachment name. @@ -77,6 +78,15 @@ public class Skin { return attachments.get(lookup); } + /** Removes the attachment in the skin for the specified slot index and name, if any. */ + public void removeAttachment (int slotIndex, String name) { + if (slotIndex < 0) throw new IllegalArgumentException("slotIndex must be >= 0."); + Key key = keyPool.obtain(); + key.set(slotIndex, name); + attachments.remove(key); + keyPool.free(key); + } + public void findNamesForSlot (int slotIndex, Array names) { if (names == null) throw new IllegalArgumentException("names cannot be null."); if (slotIndex < 0) throw new IllegalArgumentException("slotIndex must be >= 0."); @@ -97,6 +107,10 @@ public class Skin { attachments.clear(1024); } + public int size () { + return attachments.size; + } + /** The skin's name, which is unique within the skeleton. */ public String getName () { return name;