644 Commits

Author SHA1 Message Date
Mario Zechner
18eef55eb5 [cpp] Formatting. 2023-05-02 13:06:10 +02:00
Mario Zechner
fc1cc6f0ee [c] Fix readVarint, closes #2281 2023-05-02 11:44:49 +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
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
2b5bedd543 [c][cpp] Fixed IK constraint NaN when a parent bone has zero scale. 2023-04-05 15:50:28 +02:00
Mario Zechner
6f63f76600 [c] Fixed IK constraint NaN when a parent bone has zero scale. 2023-04-05 15:30:10 +02:00
Mario Zechner
de52f2a9e3 [c] Formatting. 2023-04-05 15:06:03 +02:00
Mario Zechner
7a5c6995ef [c] Closes #2264, initialize atlas page defaults properly. 2023-03-15 10:55:53 +01:00
Mario Zechner
f85928c03a [c] Closes #2263, fix dark alpha component in JSON parser. 2023-03-15 10:49:34 +01:00
Mario Zechner
15f9e39b14 Formatting. 2023-02-27 13:44:19 +01:00
Mario Zechner
b0b1fe011e [c] Closes #2258, check for empty skins in JSON parser 2023-02-27 13:43:22 +01:00
Mario Zechner
de808262bb [c] Closes #2253, incorrect parsing of stepped curves in SkeletonJson. 2023-02-20 12:57:23 +01:00
Mario Zechner
83945e17dc Apply formatter. 2023-01-16 14:00:01 +01:00
Mario Zechner
19b1ea703c [c] Closes #2224, incorrect position calculation in path constraint 2023-01-16 13:55:31 +01:00
Mario Zechner
59dbba3e31 [c] Closes #2216, assign alpha if not given. 2022-12-27 11:50:38 +01:00
Luke Ingram
38ae6f886c [c][cpp][ts] Port of 4bad9ec25e3281361a6599509881397711722e58 2022-11-30 13:34:20 -04:00
Mario Zechner
3493de7fe8 Formatting 2022-10-28 10:40:38 +02:00
Mario Zechner
88515ec1a9 [c][cpp] Check if slot attachment is NULL when applying sequence timeline. 2022-10-07 12:24:07 +02:00
Mario Zechner
ec0ea45149 [c] Fix formatting. 2022-09-26 14:03:59 +02:00
Mario Zechner
ef7eb1cb07 [c] Closes #2157, missing break in deform timeline apply. 2022-09-26 10:03:57 +02:00
Mario Zechner
aeacf6e502 [c] Closes #2156, incorrect timeline type check. 2022-09-21 13:19:44 +02:00
Mario Zechner
669af9f6bb Formatting. 2022-09-15 08:37:55 +02:00
Mario Zechner
531e256d6d [c][cpp][sfml] Fixes #2154 2022-09-15 07:58:12 +02:00
Nathan Sweet
d0002bcbab [c] Formatting. 2022-09-14 10:28:42 -04:00
Mario Zechner
926612b104 [c] Fix compiler warning/error on MSVC 2019 v16.11.18 2022-09-14 10:52:53 +02:00
Mario Zechner
316c114855 Formatting. 2022-09-13 10:00:54 +02:00
Mario Zechner
a64b79b498 [c] Closes #2149, use timeline type instead property ids.ds 2022-09-12 10:03:00 +02:00
Mario Zechner
2b69bb2af5 [sdl] Fix up texture loader in C implementation. 2022-08-02 10:45:32 +02:00
Mario Zechner
110e11d540 [c] Closes #2123, spTransformConstraintTimeline_setFrame assigned mixY to the wrong entry. 2022-07-22 10:01:45 +02:00
Mario Zechner
4bba3f1822 Merge branch '4.0' into 4.1 2022-07-18 14:10:10 +02:00
Daniel Collins
3cdfb25a48
[c] Fixed JSON parsing of PathConstraint spacing mode (#2065). (#2115)
See 4ec3290b987230a0b71d67c34269ba50f4e5e57f
2022-07-18 14:07:14 +02:00
Mario Zechner
ca75d3605e [c][cpp] Port of 4efd63f89cb995cbe4f30358d268a9d0eaf0c9be and 81baef0b5bb181376d15b0208697db8dabce095e 2022-06-20 15:39:33 +02:00
Mario Zechner
771c526915 Formatting pass. 2022-05-31 12:26:05 +02:00
Mario Zechner
9762da09cd [c] Removed VertexEffect, see #2076 2022-05-30 13:57:10 +02:00
Harald Csaszar
f26b12821e Merge branch '4.0' into 4.1-beta 2022-05-24 16:37:15 +02:00
Sergey Kazantsev
1880447f0b
[spine-c] Add initialization of mixRotate to transform constraint(SkeletonJson) (#2083) 2022-05-21 01:34:08 +02:00
Mario Zechner
8761f44aa7 [cocos2d-objc] Fix example project for latest Xcode. 2022-03-25 14:34:32 +01:00
Mario Zechner
2022713bd2 [c][cpp] Formatter pass. 2022-03-25 13:31:58 +01:00
Mario Zechner
ba1de97f04 [c] Return error if skeleton version doesn't match runtime version. See #1998 2022-03-22 13:37:08 +01:00
Mario Zechner
a725dcd292 [c] Fix sequences for meshes, sanitizer warnings 2022-03-22 12:51:42 +01:00
Mario Zechner
b33e66e1d2 Merge branch '4.0' into 4.1-beta 2022-03-11 18:07:46 +01:00
Mario Zechner
f4a92fbfae [c] Fixes #2041, adds sanitizer support via Cmake flag SPINE_SANITIZER=TRUE 2022-03-11 18:07:30 +01:00
Mario Zechner
9319029763 [c] Sequence support in SkeletonBinary and SkeletonJson. 2022-02-10 16:00:53 +01:00
Mario Zechner
0d237b1529 [c] Port sequence timeline loading to SkeletonBinary
Deform timeline parsing not working.
2022-02-04 13:21:44 +01:00
Mario Zechner
ffb9e75b09 [c][cpp] Port of shortestRotation, see #2027 2022-02-02 12:02:43 +01:00
Mario Zechner
504f52a5a7 Merge branch '4.0' into 4.1-beta
# Conflicts:
#	spine-as3/spine-as3/src/spine/animation/ScaleTimeline.as
#	spine-as3/spine-as3/src/spine/animation/ScaleXTimeline.as
#	spine-as3/spine-as3/src/spine/animation/ScaleYTimeline.as
#	spine-lua/spine-lua/Animation.lua
#	spine-ts/package-lock.json
#	spine-ts/package.json
#	spine-ts/spine-canvas/package.json
#	spine-ts/spine-core/package.json
#	spine-ts/spine-player/package.json
#	spine-ts/spine-threejs/package.json
#	spine-ts/spine-webgl/package.json
2022-01-27 18:42:14 +01:00
Mario Zechner
c8fe2c884b [c] Ported scale mixing fix, see #2028. 2022-01-26 20:36:10 +01:00