godot icon indicating copy to clipboard operation
godot copied to clipboard

Custom script icons render too small on Retina display

Open samuelfine opened this issue 1 year ago • 2 comments

Tested versions

v4.3.stable.official [77dcf97d8]

System information

Godot v4.3.stable - macOS 14.6.1 - GLES3 (Compatibility) - Intel(R) UHD Graphics 617 - Intel(R) Core(TM) i5-8210Y CPU @ 1.60GHz (4 Threads)

Issue description

When setting a custom @icon on a script, the icon renders smaller than expected in the Scene Tree. The icon preview in the FileSystem renders at the correct size.

icon-issue

I'm using a MacBook Air with a high DPI / Retina display:

Screen Width: 1440 pixels Screen Height: 900 pixels DPR (Device Pixel Ratio): 2

Steps to reproduce

  • Create a new script
  • Add a custom @icon pointed at an asset in the FileSystem (.png and .svg both tested)
@icon ("res://assets/icons/icon_save.svg")
extends Node2D
class_name SaveDataResource
  • Observe icon in FileSystem pane at incorrect size

Minimal reproduction project (MRP)

customiconsizeissue.zip

samuelfine avatar Aug 25 '24 13:08 samuelfine

Checking "Scale With Editor Scale" in the import tab and then reimporting it should resize the icon to the correct scale.

import

detomon avatar Aug 26 '24 15:08 detomon

@detomon Good catch, this does fix the problem for SVG icons! Does lead me to a few additional questions though:

  • Should this be checked/true by default? I can't think of any reason why someone would want to use an SVG in the Editor but not scale it to match.
  • Should only SVG assets be allowed as custom @icons? Looks like all the built-in icons are SVG and I don't see that Scale With Editor Scale option for importing PNG assets, which leads me to believe the Editor prefers SVG for @icon. And I wouldn't be against the idea of requiring SVG for custom icons, for the sake of simplicity and ensuring accurate rendering.

The documentation doesn't specify a filetype, so at the very least it feels like there's an opportunity for providing clearer user guidance.

samuelfine avatar Aug 26 '24 19:08 samuelfine