8210 Commits

Author SHA1 Message Date
Mario Zechner
0d443644c5 Merge branch '4.1' into 4.2-beta 2023-04-24 10:11:24 +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
0a0f007de9 [ts] 4.2.14 release. 2023-04-21 14:19:38 +02:00
Mario Zechner
04d22e1043 [ts][webgl] Fix duplicate case clause. 2023-04-21 14:18:17 +02:00
Mario Zechner
4566f75922 Merge branch '4.1' into 4.2-beta
# Conflicts:
#	spine-ts/package-lock.json
#	spine-ts/package.json
#	spine-ts/spine-canvas/package.json
#	spine-ts/spine-core/package.json
#	spine-ts/spine-phaser/package.json
#	spine-ts/spine-player/package.json
#	spine-ts/spine-threejs/package.json
#	spine-ts/spine-webgl/package.json
2023-04-21 14:13:46 +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
5103a3da38 Merge branch '4.1' into 4.2-beta 2023-04-21 08:52:38 +02:00
Mario Zechner
ac424c9164 Formatting. 2023-04-21 08:52:24 +02:00
Harald Csaszar
6245c399fe [unity] Changed SpineShaderWithOutlineGUI outline methods from private to protected virtual. 2023-04-18 11:49:19 +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
0289cdcb92 [ts] 4.2.13 release. 2023-04-17 16:42:39 +02:00
Mario Zechner
db6f624bc6 Merge branch '4.1' into 4.2-beta
# Conflicts:
#	spine-ts/package-lock.json
#	spine-ts/package.json
#	spine-ts/publish.sh
#	spine-ts/spine-canvas/package.json
#	spine-ts/spine-core/package.json
#	spine-ts/spine-phaser/package.json
#	spine-ts/spine-player/package.json
#	spine-ts/spine-threejs/package.json
#	spine-ts/spine-webgl/package.json
2023-04-17 16:29:45 +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
764a480610 Merge branch '4.1' into 4.2-beta 2023-04-13 18:18:48 +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
260c269a1a Merge branch '4.1' into 4.2-beta 2023-04-12 15:13:52 +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
Harald Csaszar
954ab69bce Merge branch '4.1' into 4.2-beta 2023-04-06 13:30:38 +02:00
Mario Zechner
da68e66e9c [c][cpp] Formatting. 2023-04-06 13:26:25 +02:00
Mario Zechner
1fb89b6e89 [c][cpp] Port of commit e04e7b5. Adjusted fix for IK constraint NaN when parent has zero scale. 2023-04-06 13:25:13 +02:00
Mario Zechner
9382265484 [ts] Port of commit e04e7b5. Adjusted fix for IK constraint NaN when parent has zero scale. 2023-04-06 13:21:44 +02:00
Harald Csaszar
210dc04109 [csharp] Port of commit e04e7b5. Adjusted fix for IK constraint NaN when parent has zero scale. 2023-04-06 11:07:26 +02:00
Harald Csaszar
463e18596c Revert "[csharp] Fix of incorrect bugfix commit f5fb9b5a. Fixed IK constraint NaN when a parent bone has zero scale."
This reverts commit fb59ba45b31bf8507e72134adec67c2740c40b44.
2023-04-06 11:07:26 +02:00
Nathan Sweet
e04e7b58f3 Adjusted fix for IK constraint NaN when parent has zero scale. 2023-04-05 17:58:42 -04:00
Mario Zechner
0fac0504ac [cpp] Fix incorrectly referencing attachment when adding skin to another skin. 2023-04-05 15:50:59 +02:00
Mario Zechner
2b5bedd543 [c][cpp] Fixed IK constraint NaN when a parent bone has zero scale. 2023-04-05 15:50:28 +02:00
Mario Zechner
bc8fc3906d Merge branch '4.1' of https://github.com/esotericsoftware/spine-runtimes into 4.1 2023-04-05 15:48:31 +02:00