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

Support extension icons in ScriptCreateDialog #98914

Merged

Conversation

fuzzybinary
Copy link
Contributor

Attempt to grab the icon for a script type from an extension first, before falling back to the theme.

This adds a method to option_button to allow the ScriptCreateDialog to set the max size of an item icon, so that it can set the size from the Editor Theme when reading the icon from extension.

Example from Godot Dart:
image

Fixes #98800

@fuzzybinary fuzzybinary requested review from a team as code owners November 7, 2024 01:23
@fuzzybinary fuzzybinary force-pushed the gdextension-editor-settings branch from 4f8db25 to bf3441c Compare November 7, 2024 01:25
@fuzzybinary fuzzybinary requested a review from a team as a code owner November 7, 2024 02:39
@fuzzybinary fuzzybinary force-pushed the gdextension-editor-settings branch 2 times, most recently from 2d42776 to 0a3fc27 Compare November 7, 2024 02:45
@AThousandShips AThousandShips added enhancement topic:editor bug topic:gdextension cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release and removed enhancement labels Nov 7, 2024
@AThousandShips AThousandShips added this to the 4.4 milestone Nov 7, 2024
@fuzzybinary fuzzybinary force-pushed the gdextension-editor-settings branch from cccc520 to 4f207b1 Compare November 25, 2024 04:23
@fuzzybinary
Copy link
Contributor Author

@Ivorforce Updated so that theme takes precedence unless it returns the fallback icon, at which point it will ask the extension.

Copy link
Member

@Ivorforce Ivorforce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is two changes in one (resizable language icon, and asking GDExtensions for language icons); normally I'd put them in two PRs or at least two commits, but I think it's fine here.
Implementation looks good to me!

@KoBeWi
Copy link
Member

KoBeWi commented Nov 27, 2024

Any easy way to test this?

@fuzzybinary
Copy link
Contributor Author

@KoBeWi You can install Godot Dart. Prior to this change it will have the default invalid icon and after it will use the included Dart icon.

@KoBeWi
Copy link
Member

KoBeWi commented Nov 28, 2024

You can install Godot Dart.

I don't know how. I'm not familiar with Dart, the downloaded release has no .gdextension file and I tried following the instructions, but ran into problems.

@fuzzybinary
Copy link
Contributor Author

@KoBeWi See if this helps: https://youtu.be/4VyS9piW_gM (sorry I probably should have linked it in the original comment).

Note, I've also noticed that for some reason the extension sometimes requires an extra reboot after everything is installed. I have no idea why.

If you don't want to install Dart (which you will need to run dart pub get), I guess the other way to do this would be to find any other extension that adds a language, (like Lua maybe?) and modify it's .gdextension file to supply the icon for the type.

@KoBeWi
Copy link
Member

KoBeWi commented Nov 30, 2024

Ok I managed to get it working. btw the Actions link in your README points to wrong repo.

@KoBeWi
Copy link
Member

KoBeWi commented Nov 30, 2024

I think it's fine, but the changes outside ScriptCreateDialog are unnecessary.

@fuzzybinary
Copy link
Contributor Author

Removed the unnecessary additions to OptionsButton

@KoBeWi
Copy link
Member

KoBeWi commented Dec 1, 2024

Needs to be squashed into 1 commit.

@fuzzybinary fuzzybinary force-pushed the gdextension-editor-settings branch 3 times, most recently from abf90e7 to 40a9c5f Compare December 1, 2024 21:31
@fuzzybinary
Copy link
Contributor Author

Done and adjusted the commit comments to be correct.

Verified

This commit was signed with the committer’s verified signature.
akien-mga Rémi Verschelde
Attempt to grab the icon for a script type from the theme first, then ask the extension for the icon.
@fuzzybinary fuzzybinary force-pushed the gdextension-editor-settings branch from 40a9c5f to 5da3e81 Compare December 2, 2024 01:57
@akien-mga akien-mga merged commit b3ca2e1 into godotengine:master Dec 2, 2024
20 checks passed
@akien-mga
Copy link
Member

Thanks!

@fuzzybinary fuzzybinary deleted the gdextension-editor-settings branch December 8, 2024 16:57
@akien-mga akien-mga removed the cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release label Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release topic:editor topic:gdextension
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ScriptCreateDialog does not look for icons in GDExtensions
5 participants