Node icon is too big in Inspector
Godot version
4.0 beta5
System information
Ubuntu 22.04.1 LTS
Issue description
I have a node with the following definition:
class_name Weapon
@icon("res://assets/opencliparts/sword_01.svg")
The icon showed up fine in the scene tree, but in the Node Inspector, it takes the whole width of the inspector pane and obscures some of the fields.


Here is the file that I'm using as the node icon:
CC0 openclipart.org
Steps to reproduce
Create a node with @icon("res://sword_01.svg") using the attached file. Inspect the node.
Minimal reproduction project
N/A
This happens because it renders the sword with the original texture size in the inspector. It is scaled appropiatly in the scene tree, but on the inspector it renders at the original size (533x533 in this case).
You can fix this by importing the texture with a 32x32 size (common size of all icons) by either modifying the .svg file or using the import dock in the editor.
Edit: I first said "16x16 size", but I found out the icon size should be 32x32 (see comment thread)
Related to https://github.com/godotengine/godot/issues/36981. While we should aim to fix this issue, it'd also help to warn when textures larger than 32×32 as class icons. Non-square textures could also have a warning.
Oh yeah, setting size-limit to 16 in the import dock after double clicking on the file then clicking the "re-import" button solves the problem. Setting the size-limit to 32 makes the image overflow just a little bit in the inspector, which looks rather good so that's what I went for.
We can close this if the import settings are the right solution for this. Mentioning the 16x16 size recommendation in the @icon() documentation would be a good idea in any case.
Mentioning the 16x16 size recommendation in the @icon() documentation would be a good idea in any case.
32×32 is recommended, so that the icon looks good on hiDPI displays.
Related to #57286, except this one is about class_name.