From 3e84da4d63e5ad2817f10bb00b78a3765f1fb840 Mon Sep 17 00:00:00 2001 From: badlogic Date: Thu, 25 Jul 2019 15:21:19 +0200 Subject: [PATCH] [cpp] Added Skin::removeAttachment. --- spine-cpp/spine-cpp/include/spine/Skin.h | 3 +++ spine-cpp/spine-cpp/src/spine/Skin.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/spine-cpp/spine-cpp/include/spine/Skin.h b/spine-cpp/spine-cpp/include/spine/Skin.h index 6a4a6b6e0..1ecdbf270 100644 --- a/spine-cpp/spine-cpp/include/spine/Skin.h +++ b/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. 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. Attachment *getAttachment(size_t slotIndex, const String &name); diff --git a/spine-cpp/spine-cpp/src/spine/Skin.cpp b/spine-cpp/spine-cpp/src/spine/Skin.cpp index 4f2c8152f..ff8a23e4b 100644 --- a/spine-cpp/spine-cpp/src/spine/Skin.cpp +++ b/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); } +void Skin::removeAttachment(size_t slotIndex, const String& name) { + _attachments.remove(slotIndex, name); +} + Attachment *Skin::getAttachment(size_t slotIndex, const String &name) { return _attachments.get(slotIndex, name); }