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

Show custom icons in autocompletion suggestions #91923

Merged
merged 1 commit into from
May 14, 2024

Conversation

hakro
Copy link
Contributor

@hakro hakro commented May 13, 2024

Fixes #91721

@hakro hakro requested a review from a team as a code owner May 13, 2024 22:15
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

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

Makes sense to me.

But might be worth evaluating what's the cost of this function in e.g. a project with a lot of class icons. I remember we wanted to do some caching, was it implemented in the end @KoBeWi ?

@KoBeWi
Copy link
Member

KoBeWi commented May 14, 2024

get_class_icon() does not have cache, only get_script_icon() in EditorData does.
We're missing a method that uses cache and would return an icon for anything 🤔

@akien-mga
Copy link
Member

BTW something to look into potentially:

Ref<Texture2D> ReplicationEditor::_get_class_icon(const Node *p_node) {
        if (!p_node || !has_theme_icon(p_node->get_class(), EditorStringName(EditorIcons))) {
                return get_theme_icon(SNAME("ImportFail"), EditorStringName(EditorIcons));
        }
        return get_theme_icon(p_node->get_class(), EditorStringName(EditorIcons));
}

We seem to use get_class_icon a lot already throughout the editor, so I guess one more use case shouldn't have dramatic impact if the rest of the editor behaves.

@akien-mga akien-mga merged commit 147e737 into godotengine:master May 14, 2024
16 checks passed
@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.

Autocomplete doesn't show custom icons
3 participants