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

ScriptCreateDialog does not look for icons in GDExtensions #98800

Closed
fuzzybinary opened this issue Nov 3, 2024 · 3 comments · Fixed by #98914
Closed

ScriptCreateDialog does not look for icons in GDExtensions #98800

fuzzybinary opened this issue Nov 3, 2024 · 3 comments · Fixed by #98914

Comments

@fuzzybinary
Copy link
Contributor

Tested versions

  • Reproducible 4.x+
  • Reproducible in master

System information

Window 10 (affects all)

Issue description

When creating a GDExtension that adds a script language (such as Godot Dart) I want to be able to have the icon show in the Create Script dialog. This is the current result:
image

Although the icon appears properly when the script is attached:
image

Steps to reproduce

  • Create a ScriptLanguageExtension for Godot
  • Add an icon for the script in the .gdextension file under [icons].
  • Open the ScriptCreateDialog
  • Note the lack of icon

Minimal reproduction project (MRP)

N/A

@fuzzybinary
Copy link
Contributor Author

From research -

The reason this happens is because the ScriptCreateDialog only references the theme, and (so far as I know) GDExtensions don't currently have a way to add icons to the theme. (Relevant code)

The EditorNode, on the other hand, asks the extension for the script's icon (Relevant code).

The easy way forward here is to just make ScriptCreateDialog follow a similar approach as EditorNode, and look to see if the icon is defined in the Script's extension first.

The harder way forward is to support GDExtensions adding theme icons probably....

@KoBeWi
Copy link
Member

KoBeWi commented Nov 27, 2024

The harder way forward is to support GDExtensions adding theme icons probably....

Modules can already add icons, so I think it makes sense for GDExtensions. How custom types register their icons normally?

@fuzzybinary
Copy link
Contributor Author

So far as I can tell, certain areas of the code ask extensions if they have an icon for a particular type, which is registered in the .gdextension file.

For example, in my .gdextension file I have the following:

[icons]

DartScript = "res://godot_dart/logo_dart.svg"
DartHotReload = "res://godot_dart/hot_reload.svg"

Certain areas of the editor ask the extension system if they define an icon for a type (such as in EditorNode , but others (like the ScriptCreateDialog) don't, and only ask the Theme.

I think the larger refactor would be for the Theme to handle asking extensions. My PR is the simpler solution to have ScriptCreateDialog work more similarly to EditorNode.

@akien-mga akien-mga added this to the 4.4 milestone Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants