EsotericSoftware / spine-editor

Issue tracking for the Spine editor.
http://esotericsoftware.com/
28 stars 2 forks source link

Stepped color alpha exported as 254 fe instead of 255 ff #778

Closed HaraldCsaszar closed 5 months ago

HaraldCsaszar commented 5 months ago

Export issue, reported on the forum: https://esotericsoftware.com/forum/d/25604-slot-alpha-value-problem/2 Reproduction project sent via email: FMfcgzGxRnfnnrNZSDTzjKwzSvBMMtTj Occurs with the only included anim testAnim at slot [#51FFFC]cloth-up-outer-jumper-hat-r2.

A user on the forum reported that when keying color alpha value with mode Stepped, he's setting alpha of 255 but getting 254 at runtime. I could repro that the skeleton .json file actually contains alpha fe at the stepped key instead of ff (while a subsequent identical unnecessary key without the stepped keyword is reading alpha ff). The issue also occurs when exported as binary. He reported it for Spine 4.0, but this issue seems to still occur with 4.1 and 4.2-beta and the latest 0.0.00 dev release. I haven't tested binary export yet, but json export still behaves the same.

reproduction-slot-alpha-stepped

NathanSweet commented 5 months ago

The alpha stored in the project for the problematic key is 0.9989 which is exported as 0xFE by all editor versions, but I can't reproduce setting a key and getting such a value. I tried 4.2.10-beta and 4.0.64.

4.0.64 project: http://n4te.com/x/9614-alpha-test.spine 4.0.64 export: http://n4te.com/x/9615-alpha-test.json In this project the exported JSON has the correct key values that were set in the editor:

{ "color": "ffffff00" },
{ "time": 0.3333, "color": "ffffffff" },
{ "time": 0.6667, "color": "fffffffe" }

Until we know how a "bad" key is set that looks like 0xFF in the editor and 0xFE when exported, we can't fully fix the issue.

In 4.2.10-beta we'll round the color values, eg 0.9989 * 255 = round(254.7195) = 0xFF. This hides the problem but makes it appear fixed for users.