viniciusgerevini / godot-aseprite-wizard

Godot Editor plugin to help import Aseprite animations to AnimationPlayers, AnimatedSprites and SpriteFrames.
MIT License
827 stars 42 forks source link

Import without filtering #17

Closed SirRamEsq closed 3 years ago

SirRamEsq commented 3 years ago

Hi guys, thanks for the tool, really helps me out :)

I'm not sure how to import from Aseprite while disabling filtering. All of my sprites have that 'fuzzy' look to them now. I'm sure there's a way to do it, as your sample images seem to have filtering disabled and everything looks crisp.

Can you clue me in on where to look? Actually, is there a way to set the import settings like you would on a texture (like repeat, filtering, and so on) while using the importer? Some other folks might have a problem with this too, it might be good to add this question to the FAQ? Or, maybe it is somewhere there and I just missed it...

Anyhow, let me know when you get a moment, Thanks.

SirRamEsq commented 3 years ago

Seem like in aseprite_cmd.gd::_parse_texture_path() image is generated with the method create_from_image using the default flags value of 7.

func _parse_texture_path(path):
    if not _should_check_file_system and not ResourceLoader.has_cached(path):
        # this is a fallback for the importer. It generates the spritesheet file when it hasn't
        # been imported before. Files generated in this method are usually
        # bigger in size than the ones imported by Godot's default importer.
        var image = Image.new()
        image.load(path)
        var texture = ImageTexture.new()
        texture.create_from_image(image) # <-- Right here
        return texture

    return ResourceLoader.load(path, 'Image', true)

The default flag value includes filtering. Any way to change this? Or am I approaching it incorrectly?

viniciusgerevini commented 3 years ago

Hello @SirRamEsq,

thanks for looking into this. You are in the right place.That flag should have been zero.

There are a few things to consider though:

First, how are you importing your Aseprite files? Do you use the Wizard Screen or the automatic importer? Given the issue you found I'd say you are probably using the automatic importer.

The Wizard screen uses Godot's default image importer. Because of that the plugin does not have control over the filter flag. It relies on the preset used by the editor. As you mentioned, this is probably something relevant for a FAQ.

The code block you referenced is used by the automatic importer only. Ideally, both methods should behave the same way, but because of some limitations in the importer, they don't.

You are right about that line. That's what's causing the issue for the importer. I'll send a new version with these flags off. In the meantime, you can change you local files to use texture.create_from_image(image, 0). It should do the trick.

Thanks for notifying this issue. Everybody using the automatic importer will benefit from this :)

SirRamEsq commented 3 years ago

Happy to help, thanks for getting back to me so quickly.

One thought though, do you think it would make sense to have a "flag" property for aseprite importer options? It could just be a simple integer field and the end user could set it to import with whatever flags they want. Then, later on, the user's preference can be used in the create_from_image function.

The main use case I have in mind is if someone would want some textures to repeat for some kind of visual effect, but not necessarily have all their imported textures repeat,.

viniciusgerevini commented 3 years ago

I see. Unfortunately this wouldn't work with this plugin. Animations are imported as a spritesheet, having all frames in the same png file. If repeat is enable, for example, the result won't be the desired one as the current frame would leak to the next one.

At the moment, I can't think on any other scenario where changing this flag would be necessary.

SirRamEsq commented 3 years ago

Ah, got it. In retrospect, that use case doesn't make a whole lot of sense :) Setting flags to '0' makes sense Thanks @viniciusgerevini :+1:

viniciusgerevini commented 3 years ago

No worries. It was a good suggestion though. Thanks :)