7843 Commits

Author SHA1 Message Date
Mario Zechner
54cc75c203 hreejs] Closes #2278, coordinate transform example. 2023-05-02 13:27:16 +02:00
Mario Zechner
18eef55eb5 [cpp] Formatting. 2023-05-02 13:06:10 +02:00
Mario Zechner
4f01861cac [sdl] Fix renderer to use new TextureRegion struct. 2023-05-02 11:45:08 +02:00
Mario Zechner
fc1cc6f0ee [c] Fix readVarint, closes #2281 2023-05-02 11:44:49 +02:00
Mario Zechner
350ad06269 [c] Fix SDL CMake build 2023-05-02 11:09:37 +02:00
Mario Zechner
7d33f18b36 [godot] Update GH Action runners to Ubuntu 20.04, update to latest Godot tags 2023-05-02 10:54:09 +02:00
Mario Zechner
d83cae37f0 [cpp] Formatting. 2023-04-28 14:05:57 +02:00
Mario Zechner
3545fa9f32 [cpp] Fix up root CMakeLists.txt to always include spine-c, spine-cpp, and spine-cpp-unit-tests 2023-04-28 13:54:59 +02:00
Mario Zechner
42626d7ff7 [phaser] Clean-up and inline documentation. 2023-04-28 13:32:17 +02:00
Mario Zechner
b4969465a0 [phaser] Fix extracting atlas page file names. 2023-04-28 09:06:28 +02:00
Mario Zechner
9dbada6541 [phaser] Fix control bones example. 2023-04-27 17:32:36 +02:00
Mario Zechner
de894957da [phaser] Update assets. 2023-04-27 17:27:53 +02:00
Mario Zechner
90e369fcfe [phaser] More example work, Stretchyman idle animation. 2023-04-27 17:25:23 +02:00
Mario Zechner
bf3f70379f [phaser] Improve TypeScript example. 2023-04-26 11:16:13 +02:00
Mario Zechner
43caf7563b Merge branch '4.1' of https://github.com/esotericsoftware/spine-runtimes into 4.1 2023-04-26 10:53:11 +02:00
Mario Zechner
a996baa2b0 [phaser] Add before and after update world transforms callbacks. 2023-04-26 10:53:01 +02:00
Luke Ingram
d3004bfbf7 [godot] Updates scripts to handle spaces in file paths (#2244). 2023-04-25 13:35:06 -04:00
Mario Zechner
5662c75db9 [phaser] Expose getters for preloaded skeleton data and atlases. 2023-04-25 15:13:12 +02:00
Mario Zechner
f8837604f5 [phaser] Rework skeleton data loading. Cache based on data + atlas key. 2023-04-25 14:33:22 +02:00
Mario Zechner
125d7c9903 [phaser] Example clean-up 2023-04-24 10:33:40 +02:00
Mario Zechner
cf68a9fd07 Formatting. 2023-04-24 10:11:14 +02:00
Alexey Gulev
4ca219668e
fix crash (#2270) 2023-04-24 09:39:55 +02:00
Dmitriy Sechin
77e2e34e8f
Handle skeleton loading problems without crashes (#2276)
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.
2023-04-24 09:39:05 +02:00
Mario Zechner
0aca55b453 [phaser] Fix TypeScript example version. 2023-04-21 14:08:32 +02:00
Mario Zechner
d15e51340b [ts] 4.1.31 release. 2023-04-21 14:08:20 +02:00
Mario Zechner
ba2eb2cf9c [phaser] Fix GameObjectCreator.spine parameter types. 2023-04-21 14:05:32 +02:00
Mario Zechner
8db318ab85 [phaser] 4.1.30 release 2023-04-21 14:03:40 +02:00
Mario Zechner
d24787b81e [phaser] Fix preDestroy in SpineGameObject. 2023-04-21 13:54:28 +02:00
Mario Zechner
2900605300 [phaser] Clean-up, TypeScript example README, non-null SpineGameObject fields. 2023-04-21 13:52:35 +02:00
Mario Zechner
cc0ee7ce80 [ts] 4.1.29 release. 2023-04-21 11:45:37 +02:00
Mario Zechner
c0b8b31945 [ts] Fix versions of dependencies. 2023-04-21 11:43:46 +02:00
Mario Zechner
2f70cdde77 [phaser] Move TS/NPM example. 2023-04-21 11:38:24 +02:00
Mario Zechner
7a07f0b512 [ts] 4.1.28 release. 2023-04-21 11:36:22 +02:00
Mario Zechner
eb51ae30d9 [phaser] Exclude example TS files from build 2023-04-21 11:35:35 +02:00
Mario Zechner
2cc7667a18 [phaser] Add vanilla JS and NPM/TS examples, fix typings. 2023-04-21 11:33:35 +02:00
Mario Zechner
ac424c9164 Formatting. 2023-04-21 08:52:24 +02:00
Mario Zechner
0815c4433b [phaser] Mix-and-match example, rework example index. 2023-04-18 11:18:55 +02:00
Harald Csaszar
01e457a8af [unity] Fixed remaining shader compile error occurring during build on Unity URP versions 12.x and 13.x. See related commit 2f1b0b8. 2023-04-17 17:38:02 +02:00
Mario Zechner
f0ad8e2024 [ts] 4.1.27 release. 2023-04-17 16:26:38 +02:00
Mario Zechner
aa1064b83b [phaser] Update for 3.60.0 release. 2023-04-17 16:25:22 +02:00
Mario Zechner
889148cd97 Merge branch '4.1' of https://github.com/esotericsoftware/spine-runtimes into 4.1 2023-04-17 16:12:29 +02:00
Mario Zechner
98f060b435 [ts] Refactor how textures are stored in texture regions, fix renderers, add custom attachment WebGL example. 2023-04-17 16:12:26 +02:00
Harald Csaszar
245ff29b26 [unity] Minor: whitespace fix to please automatic checks. 2023-04-13 18:14:37 +02:00
Harald Csaszar
a09ec88b16 [unity] Fixed compile error on old Unity version 2017.1, introduced by commit 7d0833f. See #2275. 2023-04-13 18:08:09 +02:00
Harald Csaszar
92728548b7 [unity] Minor: refactoring, variable renamed. 2023-04-13 17:59:25 +02:00
Harald Csaszar
7d0833f881 [unity] Fixed SkeletonGraphic exception when Attachment changed after SkeletonGraphic.LateUpdate. Closes #2275. 2023-04-13 17:59:25 +02:00
Mario Zechner
6ec6c4c21c Merge branch '4.1' of https://github.com/esotericsoftware/spine-runtimes into 4.1 2023-04-12 15:13:35 +02:00
Mario Zechner
14219fa609 [phaser] Fix pack file plugin loading, clipping, demos. 2023-04-12 15:13:25 +02:00
Harald Csaszar
476fb151dd [unity] Fixed skeleton baking when AttachmentTimeline only contains a single frame. Closes #2272. 2023-04-07 15:33:33 +02:00
Mario Zechner
fb3ebb56eb [phaser] More tests, fix make factory, add Alpha mixin 2023-04-06 15:41:54 +02:00