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

The custom icon for a Script Class is only shown in the node creation dialog before restarting the editor #35896

Open
mausedev opened this issue Feb 4, 2020 · 7 comments

Comments

@mausedev
Copy link

mausedev commented Feb 4, 2020

Godot version:
3.2 stable

OS/device including version:
Windows 10 x64 version 1909

Issue description:
The icon defined in a Script Class is displayed in the node creation dialog but not in the scene tree dock. Reopening the project solves the issue.

Node creation dialog Scene tree dock
dialog dock

Also, several errors that seem to be related to image handling occur when using a Script Class, providing or not the optional icon. I guess those could be related, see #35895

Steps to reproduce:

  1. create a new project.
  2. create a GDScript script and open it.
  3. register it as a type with the Godot icon: class_name MyClass, "res://icon.png"
  4. save the script.
  5. open the node creation dialog and search for the Script Class, it will be using the custom icon.
  6. add the node to the tree. Now, instead of the custom icon, the Script Class appears with the icon from the class that it extends from.
  7. save the scene. The editor will output several erros.
  8. Reopen the project and open the scene created in the last step. The Script Class will now be using the custom icon in both the scene tree dock and node creation dialog.
@synasius
Copy link
Contributor

synasius commented Feb 6, 2020

I could replicate the issue in Ubuntu 19.10 too, using an svg icon.

@gelvinp
Copy link
Contributor

gelvinp commented Apr 22, 2020

I also encounter this issue, but if I close the project and reopen it then the icons show properly.

I have only tested it with svg icons and I am using linux as well

@Calinou Calinou changed the title The custom icon for a Script Class is only shown in the node creation dialog The custom icon for a Script Class is only shown in the node creation dialog before restarting the editor Apr 23, 2020
@akien-mga
Copy link
Member

For the reference, this regressed in 3.2.2-stable, as now after adding a new script class icon, it's not visible in the node creation dialog at all:
Screenshot_20210131_141816
And it's still the same as of 3.2.4 RC 1.

In 3.2 and 3.2.1, it behaves as described in the OP.

In either case, a restart of the editor solves it.

@programaths
Copy link

I also tried to set a custom icon from an atlast texture and it doesn't work. (Godot v3.5.rc7.official [e71cf7c] on Windows 10)

class_name Bush,"res://bush_icon.tres"

working_and_not

@Calinou
Copy link
Member

Calinou commented Oct 17, 2022

I also tried to set a custom icon from an atlast texture and it doesn't work. (Godot v3.5.rc7.official [e71cf7c] on Windows 10)

Atlas support is limited to specific things; it's not universal. Use a PNG or SVG instead (recommended size is 32×32 for hiDPI support).

@ClarkThyLord
Copy link
Contributor

ClarkThyLord commented Oct 22, 2022

I just wanted to note that I've also encounter this issue(with both .png and .svg used for @icon) in Godot 4 beta 3 on Windows 10, but as stated above, a restart of the editor solves it.

@thiagola92
Copy link
Contributor

It seems that the scene dock will only load each node icon one time (when the node is added).
After changing your script, you need to force the scene dock to reload (reopening the scene is enough).

https://www.youtube.com/watch?v=BWKHVkSrbQs

Godot version:
4.0.2 stable

OS/device including version:
Fedora 38

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

9 participants