cute_framework icon indicating copy to clipboard operation
cute_framework copied to clipboard

Fix how sprite origin is loaded from aseprite

Open bullno1 opened this issue 1 year ago • 2 comments

  • 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)

bullno1 avatar Nov 28 '24 23:11 bullno1

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.

bullno1 avatar Dec 01 '24 03:12 bullno1

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.

RandyGaul avatar Dec 18 '24 22:12 RandyGaul