Skip to content
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

Allow images to be imported "for editor use" and respect editor settings #64938

Merged
merged 1 commit into from
Sep 9, 2022

Conversation

YuriSizov
Copy link
Contributor

Closes godotengine/godot-proposals#5034.

This is implemented pretty much as I've described in the proposal. There are now two new import options that let the SVG icons to be imported for editor use and either scale, or convert colors, or both. We still need to document somehow which colors do we use, and there are some other limitations to the color conversion logic as it is currently implemented. But scaling is straightforward.

One limitation which I don't know how to fix without dirty hacks in core is that if you change the polarity of the editor theme you need to restart the editor or manually reimport the image for it to update. Changing scale already requires a restart, so it's not a big deal. There is already a hacky thing in core resource importer, but it shouldn't be too bad because we sometimes allow TOOLS_ENABLED in core and I think in this case this is a valid need.

Anyway, DEMO TIME!

godot.windows.tools.x86_64_2022-08-26_20-03-42.mp4

This work is kindly sponsored by the Dialogic project.

@YuriSizov
Copy link
Contributor Author

From RC:

reduz 12:38 This is quite interesting, and looks good for the most part, I just wonder if there can be an easier way to get the icon to update

I think we could add some sort of cache to EditorFileSystem that would track all textures imported with those flags and invalidate their cache if the relevant editor settings change. But I also think we can do it afterwards, as an enhancement. I'd like this to be included in the next alpha, before we're completely locked into beta.

I can still fix the comment from @akien-mga and replace TOOLS_ENABLED code with a static member that EditorColorMap could set. Module should be loaded by the point the editor theme is created, because the module is required for it to load resources. So that should work fine regarding the order of operation.

@YuriSizov
Copy link
Contributor Author

YuriSizov commented Sep 7, 2022

@akien-mga I've pushed an attempt at making it static without a direct editor dependency as a separate commit. Let me know if this is better, then I can squash.

And I hope at this point we'd be okay merging. 👀 I can work on improving this with a better, automatic reimporting on settings change later.

@fire fire requested a review from a team September 7, 2022 18:25
@fire
Copy link
Member

fire commented Sep 7, 2022

I am not able to do a proper review. Can defer to others.

@akien-mga
Copy link
Member

Looks good 👍

@akien-mga akien-mga merged commit 24ce46e into godotengine:master Sep 9, 2022
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow icons to be marked "for editor use" during import and automatically handled to match the editor settings
3 participants