Browse Source

[cpp] Added Skin::removeAttachment.

badlogic 6 years ago
parent
commit
3e84da4d63

+ 3 - 0
spine-cpp/spine-cpp/include/spine/Skin.h

@@ -119,6 +119,9 @@ public:
 	/// If the name already exists for the slot, the previous value is replaced.
 	/// If the name already exists for the slot, the previous value is replaced.
 	void addAttachment(size_t slotIndex, const String &name, Attachment *attachment);
 	void addAttachment(size_t slotIndex, const String &name, Attachment *attachment);
 
 
+	// Removes the attachment from the skin.
+	void removeAttachment(size_t slotIndex, const String& name);
+
 	/// Returns the attachment for the specified slot index and name, or NULL.
 	/// Returns the attachment for the specified slot index and name, or NULL.
 	Attachment *getAttachment(size_t slotIndex, const String &name);
 	Attachment *getAttachment(size_t slotIndex, const String &name);
 
 

+ 4 - 0
spine-cpp/spine-cpp/src/spine/Skin.cpp

@@ -95,6 +95,10 @@ void Skin::addAttachment(size_t slotIndex, const String &name, Attachment *attac
 	_attachments.put(slotIndex, name, attachment);
 	_attachments.put(slotIndex, name, attachment);
 }
 }
 
 
+void Skin::removeAttachment(size_t slotIndex, const String& name) {
+	_attachments.remove(slotIndex, name);
+}
+
 Attachment *Skin::getAttachment(size_t slotIndex, const String &name) {
 Attachment *Skin::getAttachment(size_t slotIndex, const String &name) {
 	return _attachments.get(slotIndex, name);
 	return _attachments.get(slotIndex, name);
 }
 }