godot icon indicating copy to clipboard operation
godot copied to clipboard

Node icon is too big in Inspector

Open ygingras opened this issue 3 years ago • 5 comments

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.

Screenshot from 2022-11-21 09-13-58

Screenshot from 2022-11-21 09-12-59

Here is the file that I'm using as the node icon: sword_01 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

ygingras avatar Nov 21 '22 16:11 ygingras

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)

TamerSoup625 avatar Nov 21 '22 17:11 TamerSoup625

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.

Calinou avatar Nov 21 '22 18:11 Calinou

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.

ygingras avatar Nov 21 '22 18:11 ygingras

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.

Calinou avatar Nov 21 '22 18:11 Calinou

Related to #57286, except this one is about class_name.

KoBeWi avatar Nov 22 '22 17:11 KoBeWi