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

Editor icon size are different on macOS (image 16px vs 32px) #92628

Closed
MikeSchulze opened this issue Jun 1, 2024 · 3 comments
Closed

Editor icon size are different on macOS (image 16px vs 32px) #92628

MikeSchulze opened this issue Jun 1, 2024 · 3 comments

Comments

@MikeSchulze
Copy link

Tested versions

v4.2.2.stable.official [15073af]

System information

macOS

Issue description

I use the original editor icons for my plugin and merge two icons together to present success or error state.
On my merge method I have a check to merge only images with the same image size, and it is failing only on macOS

Steps to reproduce

  • create a plugin and put this code
@tool
extends EditorPlugin


func _enter_tree() -> void:
	var icon_a := EditorInterface.get_base_control().get_theme_icon("CSharpScript", "EditorIcons")
	var icon_b := EditorInterface.get_base_control().get_theme_icon("StatusSuccess", "EditorIcons")
	prints("check icon size", icon_a.get_height(), icon_b.get_height() )


func _exit_tree() -> void:
	# Clean-up of the plugin goes here.
	pass

on Windows the icon size is 16 for both icons and on macOS it is different 16 vs 32 px

Minimal reproduction project (MRP)

N/A

@MikeSchulze MikeSchulze changed the title Editor icon size are different on macOS image 16px vs 32px Editor icon size are different on macOS (image 16px vs 32px) Jun 1, 2024
@AThousandShips
Copy link
Member

AThousandShips commented Jun 1, 2024

This is likely due to editor scale which is OS dependent, and different icons are scaled differently, these are two different types of icons, one is a type icon and one is a status icon, so they might be processed differently

@Calinou
Copy link
Member

Calinou commented Jun 1, 2024

Icon size depends on the editor scale setting, so you need to use Image.resize() if you want to guarantee the icons will be the same size no matter the editor scale.

Most macOS devices have hiDPI displays now, hence the 2x scale factor by default.

@MikeSchulze
Copy link
Author

Thanks for the feedback, yes you are right.
I checked, and the image is scaled, I use scale 150% also on Windows.

  core/variant/variant_utility.cpp:1091 - invalid height:16 vs 24
  Invalid image: null
check icon size 16 24

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

4 participants