Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support files exported from Spine versions 4.2.0 and above #25

Closed
kumorig opened this issue Apr 21, 2024 · 4 comments
Closed

Support files exported from Spine versions 4.2.0 and above #25

kumorig opened this issue Apr 21, 2024 · 4 comments

Comments

@kumorig
Copy link

kumorig commented Apr 21, 2024

Hey, thanks for this lib and bevy_spine. super useful!

I updated the spine software to 4.2.06 and when re-exporting the same spines (with almost no changes), my app using bevy_spine stopped loading spines, no errors just failed silently displaying nothing where my spine assets were previously.

I put the issue in this repo because I think the actual problem is in this repo (only allowing "4.1*" versions), and probably here:

rusty_spine/src/c/spine_c.rs

Lines 17921 to 17924 in 58d4421

} else if string_starts_with_binary(
(*skeletonData).version,
b"4.1\0" as *const u8 as *const c_char,
) == 0

Here is an example of exported json-file before and after:

before:

{
"skeleton": {
	"hash": "/fGfMFPfVdE",
	"spine": "4.1.24",
	"x": -221.36,
	"y": -97.78,
	"width": 446.78,
	"height": 652.25,
	"images": "C:/projects/my_project/assets/spine/images/",
	"audio": ""
},
"bones": ... (omitted the rest)

after:

{
"skeleton": {
	"hash": "Pga2cB0zv2k",
	"spine": "4.2.06",
	"x": -245.25,
	"y": -97.78,
	"width": 470.67,
	"height": 652.25,
	"images": "./images/",
	"audio": "C:/Users/someuser/Spine/examples/4.1/spineboy"
},
"bones": ... (omitted the rest)
  • Just opening the the json file and changing the version back to "spine": "4.1.24", does make things work again, so there is a simple workaround.
  • I'm unable to load using bevy_spine's SkeletonData::new_from_binary at all.

Thanks for the help!

@kumorig kumorig changed the title Support spine-versions 4.2.* Support files exported from Spine versions 4.2.0 and above Apr 21, 2024
@jabuwu
Copy link
Owner

jabuwu commented Apr 21, 2024

Hey there. You're reporting two separate issues here, so I have to address them separately.

Issue 1: rusty_spine should fail when trying to load an incorrect spine version. 4.2 is very new, and the runtimes haven't caught up yet. The c runtime (which this runtime is based off of) only "finished" 5 days ago (according to their git history). It will take a little longer for this runtime to catch up (basically, whenever I or someone else finds the time).

We inherit the hard version check from spine-c, so we can't really change it. You'll have to use the workaround for now. Physics constraints won't work since that's new in 4.2.

Issue 2: The issue with bevy_spine is kind of an issue with Bevy itself. There's not a great way to report errors up to users when spine files fail, so I totally expect nothing to happen. I have a todo that we should print an error, but that's not really a great solution. I'm open to other ideas.

https://github.com/jabuwu/bevy_spine/blob/c6a40c8a1b0e4a3e0f3cf562d6117b9b797aea7c/src/lib.rs#L580

@jabuwu
Copy link
Owner

jabuwu commented Apr 23, 2024

#26

@jabuwu
Copy link
Owner

jabuwu commented Apr 25, 2024

If you would like to help test, you can now try this branch: jabuwu/bevy_spine#21

bevy_spine = { git = "https://github.com/jabuwu/bevy_spine", branch = "spine_4.2" }

@jabuwu
Copy link
Owner

jabuwu commented May 12, 2024

@jabuwu jabuwu closed this as completed May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants