godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.14k stars 93 forks source link

Allow cutting a spritesheet into an AtlasTexture automatically #1053

Open revanj opened 4 years ago

revanj commented 4 years ago

Describe the project you are working on:

I'm working on a project where I have to import atlas texture from a large sprite sheet, instead of cutting them into pieces and importing them as an atlas.

Describe the problem or limitation you are having in your project:

I find the current AtlasTexture resource type quite useless, as normally people would just cut their pictures into pieces, and "import them as atlas texture". However, there is no way to handle the cases where there actually is only one large sprite sheet and has to be spliced in the engine. (If the splices are not the same size / not orderly). Currently AtlasTexture support auto slice but I see no way to save these auto slice results, and use them conveniently.

Describe the feature / enhancement and how it helps to overcome the problem or limitation:

Currently godot supports importing small textures and packing them into a atlas. I thinking of a similar thing. For a large sprite sheet, create an atlas file, and treat the splices as separate files in the editor.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:

Currently godot supports importing small textures and packing them into a atlas. I thinking of a similar thing. For a large sprite sheet, create an atlas file, cut the sprite sheet into pieces, and treat them as separate files in the editor.

If this enhancement will not be used often, can it be worked around with a few lines of script?:

It can be worked around with an external tool that cuts the sprite sheet. But with files downloaded from the internet this may be inconvenient.

Is there a reason why this should be core and not an add-on in the asset library?:

The existence of a AtlasTexture resource seem frustrating if this is not added to the engine. Current AtlasTexture would always need an external json to be used properly. Seem like a waste.

Calinou commented 2 years ago

Closing in favor of https://github.com/godotengine/godot-proposals/issues/3530, which is more detailed.

joshsegall commented 2 years ago

The problem described in this issues is different from #3530, not a less detailed version of it. #3530 is about taking individual frames from a directory and creating an AtlasTexture directly without having to import them first into Godot.

This issue is about taking a single spritesheet with many frames and creating an AtlasTexture, without having to carve up the sheet into multiple images first.

If this issue can't be re-opened I will file a new issue.

luislodosm commented 2 years ago

With current functionality of AtlasTexture, it should be called RegionTexture.

Calinou commented 2 years ago

With current functionality of AtlasTexture, it should be called RegionTexture.

Pull requests adding atlas support to more node types are welcome, but we won't rename AtlasTexture to another name.