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

Fix how sprite origin is loaded from aseprite #255

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bullno1
Copy link
Contributor

@bullno1 bullno1 commented Nov 28, 2024

  • Apply pivot from a slice's frame to the end of the sprite.
  • Check that the slice is named "origin".

Reference: https://github.com/aseprite/aseprite/blob/main/docs/ase-file-specs.md#slice-chunk-0x2022

DWORD Frame number (this slice is valid from this frame to the end of the animation)

* Apply pivot from a slice's frame to the end of the sprite.
* Check that the slice is named "origin".
@bullno1
Copy link
Contributor Author

bullno1 commented Dec 1, 2024

The slice named "origin"'s center is used to define the local offset.

Now that I read this again, I'm not sure what is correct.

On one hand, aseprite is arbitrary with the pivot feature and even slice.
It is meant to be "userdata".
So CF can define its own convention.
In this case, it's the center, not the pivot.

On the other, at least in the aseprite editor, the pivot is not relative to the center of the slice or has anything to do with the bounds at all.
It is always independent and the origin is always at the top left being (0, 0).
And it always have that shenanigans where if the slice is the same for several frames, it decides to save only one frame as stated in the format spec.
And CF also used the pivot but to offset from the center.
But it is not quite intuitive in the editor.

@RandyGaul
Copy link
Owner

This is a bit of a finnicky feature in aseprite, like we discussed, so I'll take a closer look at a later time once I get back into dev on my own game project here, and can give it the attention it deserves in an actual project.

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

Successfully merging this pull request may close these issues.

2 participants