YoYoGames / GameMaker-Bugs

Public tracking for GameMaker bugs
22 stars 8 forks source link

The ability the generate sprites using UVs #2945

Open LioranWaters opened 11 months ago

LioranWaters commented 11 months ago

Is your feature request related to a problem?

There is currently no way to optimize external sprites.

Currently you have sprites inside the gamemaker app, they look something like this https://i.imgur.com/LjKU4zO.png when you compile your project, they are optimized and turned into this https://i.imgur.com/KfDGRRM.png

When you load a strip using sprite_add, lets say a 10 frame strip like this https://i.imgur.com/lQTjHaP.png the same optimization does not happen, instead each frame is loaded as a seperate texture and the blank areas are kept like this. https://i.imgur.com/MkUoG4B.png

Describe the solution you'd like

Give the ability to create additional sprites+images from already loaded sprite by simply providing UVs, same type as the one given from sprite_get_uvs(). This would allow us to load an already optimized texture page with sprite_add and then generate a whole sprite that can be drawn using draw_sprite command. I think the best way would be to add 2 commands

One to add a new sprite but you decide the first UVs sprite_add_with_uvs(fname,removeback,smooth,xorig,yorig,uvTop,uvLeft,uvBottom,uvRight,...) And one to add a new image frame with UVs data sprite_add_image_from_uvs(sprite,xorigOffset,yorigOffset,uvTop,uvLeft,uvBottom,uvRight,...)

Describe alternatives you've considered

It is currently possible to accomplish this just by loading the texture page along with all the date needed and do it through the draw_sprite_part scripts to make seperate copies of the draw_sprite scripts that replicate the expected behavior. But this alternative is not as convenient and not as fast as just using the built-in draw_sprite scripts.

Additional context

I have already designed a software that comes with an animation software that gives me all the data needed to accomplish this. It turns an image like this https://i.imgur.com/lQTjHaP.png into this https://i.imgur.com/lyiAmEQ.png along with a data file(or appended straight to the PNG file) that contains all the values needed to either generate it with the draw_sprite_part scripts or if it was available, to generate sprite from UVs.

This feature would serve a very good purpose for optimizing projects with external sprites.

BscotchSeth commented 10 months ago

Agreed. This would be huge, especially for adding modding support to games!