|
@@ -34,6 +34,7 @@ import com.badlogic.gdx.utils.Array;
|
|
import com.badlogic.gdx.utils.ObjectMap;
|
|
import com.badlogic.gdx.utils.ObjectMap;
|
|
import com.badlogic.gdx.utils.ObjectMap.Entry;
|
|
import com.badlogic.gdx.utils.ObjectMap.Entry;
|
|
import com.badlogic.gdx.utils.Pool;
|
|
import com.badlogic.gdx.utils.Pool;
|
|
|
|
+
|
|
import com.esotericsoftware.spine.attachments.Attachment;
|
|
import com.esotericsoftware.spine.attachments.Attachment;
|
|
|
|
|
|
/** Stores attachments by slot index and attachment name.
|
|
/** Stores attachments by slot index and attachment name.
|
|
@@ -77,6 +78,15 @@ public class Skin {
|
|
return attachments.get(lookup);
|
|
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<String> names) {
|
|
public void findNamesForSlot (int slotIndex, Array<String> names) {
|
|
if (names == null) throw new IllegalArgumentException("names cannot be null.");
|
|
if (names == null) throw new IllegalArgumentException("names cannot be null.");
|
|
if (slotIndex < 0) throw new IllegalArgumentException("slotIndex must be >= 0.");
|
|
if (slotIndex < 0) throw new IllegalArgumentException("slotIndex must be >= 0.");
|
|
@@ -97,6 +107,10 @@ public class Skin {
|
|
attachments.clear(1024);
|
|
attachments.clear(1024);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public int size () {
|
|
|
|
+ return attachments.size;
|
|
|
|
+ }
|
|
|
|
+
|
|
/** The skin's name, which is unique within the skeleton. */
|
|
/** The skin's name, which is unique within the skeleton. */
|
|
public String getName () {
|
|
public String getName () {
|
|
return name;
|
|
return name;
|