ソースを参照

[cpp] Added Skin::removeAttachment.

badlogic 6 年 前
コミット
a578557934

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

@@ -124,6 +124,9 @@ public:
 	/// Returns the attachment for the specified slot index and name, or NULL.
 	Attachment *getAttachment(size_t slotIndex, const String &name);
 
+	// Removes the attachment from the skin.
+	void removeAttachment(size_t slotIndex, const String& name);
+
 	/// Finds the skin keys for a given slot. The results are added to the passed array of names.
 	/// @param slotIndex The target slotIndex. To find the slot index, use Skeleton::findSlotIndex or SkeletonData::findSlotIndex
 	/// @param names Found skin key names will be added to this array.

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

@@ -112,6 +112,10 @@ Attachment *Skin::getAttachment(size_t slotIndex, const String &name) {
 	return _attachments.get(slotIndex, name);
 }
 
+void Skin::removeAttachment(size_t slotIndex, const String& name) {
+	_attachments.remove(slotIndex, name);
+}
+
 void Skin::findNamesForSlot(size_t slotIndex, Vector<String> &names) {
 	Skin::AttachmentMap::Entries entries = _attachments.getEntries();
 	while (entries.hasNext()) {