This pull request improve the loading of binary skeleton so that there is no crash in case of attachment problems. Essentially, it will have the same behavior as for JSON skeleton, just returning NULL, and you can print pSkeleton->error to the output for the debug purpose. The functions spSkeletonBinary_create() and spSkeletonJson_create() both use spAtlasAttachmentLoader, which creates attachments in its _spAtlasAttachmentLoader_createAttachment(). This function can return NULL in case of any problems with the atlas regions also setting internal error1,error2 to "Region not found: ", region_path In case of SkeletonJson.c, there is a check for attachment != NULL after calling spAttachmentLoader_createAttachment(). However, unfortunately, there is no such check for SkeletonBinary.c, and if the region is not found, there is simply a crash deep inside the spine lib. I fixed it like this Currently, all calls to spAttachmentLoader_createAttachment() in SkeletonBinary.c are located inside the spSkeletonBinary_readAttachment() function, which is convenient. It is possible to check for the validity of the attachment after each _createAttachment() call. We can use if (!attachment) return NULL; In fact, the problem with the attachment can only be in three cases inside spSkeletonBinary_readAttachment() case SP_ATTACHMENT_REGION: case SP_ATTACHMENT_MESH: case SP_ATTACHMENT_LINKED_MESH: But for the sake of consistency, it may be worth checking the other four cases: SP_ATTACHMENT_BOUNDING_BOX: SP_ATTACHMENT_PATH: SP_ATTACHMENT_POINT: SP_ATTACHMENT_CLIPPING: (I do attachment check here, but maybe we can just "trust" that the attachment is always valid in this cases). Now that spSkeletonBinary_readAttachment() can return NULL instead of crashing, so go on and fix the next function - spSkeletonBinary_readSkin() Here, we also check the attachment for validity in this code 'for (i = 0; i < slotCount; ++i)'. Unfortunately, we cannot use 'continue' inside the loop here, as it is done in SkeletonJson.c, as we cannot move 'input->cursor' to the beginning of the data for the next slot. Here, we can only exit using return NULL, which generally suits us And finally, in the function spSkeletonBinary_readSkeletonData(), there are only two calls to spSkeletonBinary_readSkin() - one for the default skin and another inside the loop for other skins. Here, you can apply a check 'if(self->attachmentLoader->error1)', and in case of problems, clear the data by spSkeletonData_dispose() and exit with return NULL; similarly to how it is done below for errors "Skin not found: " and "Parent mesh not found: ". Thus, there will be no crash inside spine lib in case of attachment problems. Instead, NULL will be returned when calling spSkeletonBinary_readSkeletonData(), which the game engine can recognize and output the error message from pSkeleton->error in the output. This will help understand why my wonderful spine animation is not loading.
Spine Runtimes
This GitHub project hosts the Spine Runtimes which are needed to use Spine 2D skeletal animation data with various game toolkits.
Licensing
You are welcome to evaluate the Spine Runtimes and the examples we provide in this repository free of charge.
You can integrate the Spine Runtimes into your software free of charge, but users of your software must have their own Spine license. Please make your users aware of this requirement! This option is often chosen by those making development tools, such as an SDK, game toolkit, or software library.
In order to distribute your software containing the Spine Runtimes to others that don't have a Spine license, you need a Spine license at the time of integration. Then you can distribute your software containing the Spine Runtimes however you like, provided others don't modify it or use it to create new software. If others want to do that, they'll need their own Spine license.
For the official legal terms governing the Spine Runtimes, please read the Spine Runtimes License Agreement and Section 2 of the Spine Editor License Agreement.
Documentation
See the Spine Runtimes Guide for detailed information about using the Spine Runtimes. The Spine documentation page provides further information about tools and data formats. For runtime specific documentation, refer to the README.md file in each runtime directory.
Bugs, enhancements, and tasks
Review our backlog of bugs, enhancements, and tasks in the spine-runtimes and spine-editor issue trackers. Our roadmap provides a more convenient view of the same issue tracker information.
Versioning
The default branch on GitHub is stable and works with data exported from the latest, non-beta version of the Spine editor. New development is done in an X.X-beta branch, which may be a work in progress. Important changes to the runtimes can be reviewed in the CHANGELOG.md file. Occasionally the Spine Runtimes are tagged with the specific Spine editor version they work with.
It is highly suggested to freeze the Spine editor version to match the Spine Runtimes source being used and to update them in lock step. See the Spine Runtimes Guide for more information.
Contributing
In order to merge your contributions, we need a signed contributor license agreement (CLA) from you. You can send a copy of the CLA to contact@esotericsoftware.com.
When possible, it is best to base your contributions on the current beta branch (X.X-beta). Please be sure to follow the style and formatting you find in the respective runtime code to which you are contributing.