Docs, accept empty string for std::string refs that can be null in the C API.

This commit is contained in:
NathanSweet 2015-03-16 19:56:51 +01:00
parent 91e7d4e973
commit fae952d73c
3 changed files with 7 additions and 5 deletions

View File

@ -117,7 +117,8 @@ int spSkeleton_setSkinByName (spSkeleton* self, const char* skinName);
spAttachment* spSkeleton_getAttachmentForSlotName (const spSkeleton* self, const char* slotName, const char* attachmentName);
/* Returns 0 if the slot or attachment was not found. */
spAttachment* spSkeleton_getAttachmentForSlotIndex (const spSkeleton* self, int slotIndex, const char* attachmentName);
/* Returns 0 if the slot or attachment was not found. */
/* Returns 0 if the slot or attachment was not found.
* @param attachmentName May be 0. */
int spSkeleton_setAttachment (spSkeleton* self, const char* slotName, const char* attachmentName);
/* Returns 0 if the IK constraint was not found. */

View File

@ -346,14 +346,14 @@ spSlot* SkeletonRenderer::findSlot (const std::string& slotName) const {
}
bool SkeletonRenderer::setSkin (const std::string& skinName) {
return spSkeleton_setSkinByName(_skeleton, skinName.c_str()) ? true : false;
return spSkeleton_setSkinByName(_skeleton, skinName.empty() ? 0 : skinName.c_str()) ? true : false;
}
spAttachment* SkeletonRenderer::getAttachment (const std::string& slotName, const std::string& attachmentName) const {
return spSkeleton_getAttachmentForSlotName(_skeleton, slotName.c_str(), attachmentName.c_str());
}
bool SkeletonRenderer::setAttachment (const std::string& slotName, const std::string& attachmentName) {
return spSkeleton_setAttachment(_skeleton, slotName.c_str(), attachmentName.c_str()) ? true : false;
return spSkeleton_setAttachment(_skeleton, slotName.c_str(), attachmentName.empty() ? 0 : attachmentName.c_str()) ? true : false;
}
spSkeleton* SkeletonRenderer::getSkeleton () {

View File

@ -77,12 +77,13 @@ public:
/* Sets the skin used to look up attachments not found in the SkeletonData defaultSkin. Attachments from the new skin are
* attached if the corresponding attachment from the old skin was attached. Returns false if the skin was not found.
* @param skin May be 0.*/
* @param skin May be empty string ("") for no skin.*/
bool setSkin (const std::string& skinName);
/* Returns 0 if the slot or attachment was not found. */
spAttachment* getAttachment (const std::string& slotName, const std::string& attachmentName) const;
/* Returns false if the slot or attachment was not found. */
/* Returns false if the slot or attachment was not found.
* @param attachmentName May be empty string ("") for no attachment. */
bool setAttachment (const std::string& slotName, const std::string& attachmentName);
// --- BlendProtocol