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 defining custom icons for exported categories in the Inspector #5710

Closed
xxSeys1 opened this issue Nov 2, 2022 · 2 comments
Closed

Comments

@xxSeys1
Copy link

xxSeys1 commented Nov 2, 2022

Describe the project you are working on

I'm building a lot of custom scenes that I then only have to instance and configure a bit to speed up my game development. For the customization I'm using the [at]export keyword.

Describe the problem or limitation you are having in your project

There are non, maybe that the Inspector gets a bit cluttered when there are many exported variables, but custom icons would really only be a cosmetic thing.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

In the case that the Inspector becomes to cluttered custom icons could help keeping it organized.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Maybe add an option to specify a path to an item after the [at]export_category keyword (for example [at]export_category("name", "path_to_icon") ) .

If this enhancement will not be used often, can it be worked around with a few lines of script?

It can be worked around by using category names like "zoom" or "debug", for which icons already exist. This is probably because there are categories with these names somewhere in some nodes.

Is there a reason why this should be core and not an add-on in the asset library?

It's an editor feature

@Calinou Calinou changed the title Custom icons for exported categories in the Inspector Allow defining custom icons for exported categories in the Inspector Nov 2, 2022
@YuriSizov
Copy link
Contributor

It can be worked around by using category names like "zoom" or "debug", for which icons already exist. This is probably because there are categories with these names somewhere in some nodes.

Don't tell anyone I told you that, but you can actually do it for custom categories as well.

godot windows opt tools 64_2022-11-03_12-11-48

The icons are displayed for any globally registered class, so all you need is a dummy exposed class, like

extends Object
class_name Customization, "res://assets/editor/configuration.png"

This works in 3.x, should still work in 4.x.

@xxSeys1 xxSeys1 closed this as completed Apr 10, 2024
@dalexeev
Copy link
Member

In 4.x the hack no longer works, as the inspector distinguishes custom categories from standard categories by hint_string and does not display icons for custom categories at all. See godotengine/godot#81221 for details.

You can use the hack by setting a hint_string in _get_property_list() or @export_custom, but this is a bad idea as it will break the documentation tooltips.

We could add support for custom icons using a special prefix in hint_string that the Inspector would recognize. For example, icon:res://icon.svg. Let me know if you are interested in this.

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

No branches or pull requests

4 participants