material-maker icon indicating copy to clipboard operation
material-maker copied to clipboard

Experimental Scaling Approach

Open Jowan-Spooner opened this issue 5 months ago • 2 comments

This PR tries to solve multiple issues:

  • Scaling is messy in sub-windows or separate windows
  • Higher Scale have blurry icons
  • Icons are fixed colored, meaning they can't adapt to the theme

It solves these by not using the Window.content_scale_factor and instead scales the theme values up and reloads theme icons from svg when the scale changes. During this loading certain icon colors can be changed as well.

EnhancedTheme Resource

This whole logic is implemented by the EnhancedTheme resource. It can be used in place of a theme and takes a base_theme which can then be modified with a scale and color_swap settings.

Requirements & Drawbacks

This system only works with scalable icons (svg). This meant changing the way many icons are implemented (WIP). This system also ONLY scales up the theme. Any relevant constants outside the theme (like minimum sizes, magic numbers in drawing etc.) are NOT automatically updated. This means more scripts need to listen to _notification(NOTIFICATION_THEME_CHANGED) and use mm_globals.ui_scale to update these things.

It also means all icons should be defined in the theme instead of being set directly on the nodes. I've added a helper script to make this easier on buttons. Basically this boils down to just using get_theme_icon("IconName", "MM_Icons") instead of load("res://...icons.tres")

I've started these necessary changes, but there are A LOT of buttons with icons in places that I don't know very well so this is definitely still a WIP (especially because I also need to recreate many icons and would like to find a more consistent style at the same time).

This was a bunch of work, especially because inkscape and godot didn't like to collaborate, there is some bug in ThorVG...

If anyone would like to test this, especially on a HiDPI monitor, that would be very cool!

Jowan-Spooner avatar Sep 04 '24 19:09 Jowan-Spooner