Closed TheOrioli closed 2 years ago
This looks great. Thank you.
I also couldn't find an official way of accessing the import presets, so instead there is now an additional file called 2d_pixel_preset.cfg which is read by the plugin and copied into the project settings when needed.
Yeah, I'm also not a big fan of keeping this file, but I can't really think of any better way. It's a good workaround.
I'll just give it a try locally here before I merge, but it looks good to go.
Hello @TheOrioli . This is working like charm. I have two observations to make.
The first one is that this currently only works for AnimationPlayer
s. For it to work for SpriteFrames
as well, a similar implementation needs to be added to sprite_frames_creator.gd
. I like to keep feature parity between both., but I understand you don't use SpriteFrames at the moment. I don't mind doing it myself in case you don't have time for it, as it would be pretty much extracting it and reusing the same thing.
The second thing is that any manual change done via Godot's default Import dock is lost when re-importing the animation. I'm not sure what is the preferable behaviour, always overwrite with the preset or only using it on the first time? As you've been using this feature I believe you have a better understanding what would work best.
@viniciusgerevini
implementation needs to be added to sprite_frames_creator.gd
I can give it a pass, no problem π
any manual change done via Godot's default Import dock is lost when re-importing the animation. I'm not sure what is the preferable behaviour, always overwrite with the preset or only using it on the first time?
IMO if the user decided to change the import settings for a specific resource it should be respected, but the process of actually checking the import settings for a resource and comparing it is a total nightmare from everything I can tell so far. Of the top of my head, the best we could do is check if a .import
file exists for that resource and not delete/overwrite it. I will give it a pass as well π
PR updated π
That's awesome. Thanks a lot. :tada:
I'll merge this PR now, but I'll actually hold a few days before releasing it to the asset lib. I have another feature I'm working on at the moment and I would like to batch them together.
This PR will add a new feature, the ability to use a custom texture import preset.
It adds a new checkbox to the
config_dialog.tscn
The preset is stored in the project settings:
It is a replica of the dictionary stored in the project settings when selecting
2D Pixel
as saving that as the default import preset.I couldn't find a good official way of modifying resource import settings without writing a custom plugin that handles every resource of that type. This is worked around by creating a partial
.import
file for the resource before a filesystem scan is triggered. That way the engine just fills out the unspecified sections of the import file, leaving the wanted parameters untouched.I also couldn't find an official way of accessing the import presets, so instead there is now an additional file called
2d_pixel_preset.cfg
which is read by the plugin and copied into the project settings when needed. It seems that ConfigFile demands an absolute path when loading from file so it's referenced as such.