-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add an import preset stored in project settings for textures #55
add an import preset stored in project settings for textures #55
Conversation
This looks great. Thank you.
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 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. |
I can give it a pass, no problem 👍
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 |
PR updated 👍 |
@@ -59,6 +59,10 @@ func _create_animations_from_file(sprite: AnimatedSprite, options: Dictionary): | |||
|
|||
if output.empty(): | |||
return result_code.ERR_ASEPRITE_EXPORT_FAILED | |||
|
|||
if _config.is_import_preset_enabled(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks so clean!! 👍
That's awesome. Thanks a lot. 🎉 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.