Minor TransparentChecker performance boost

Got rid of its _process, using _ready() instead. It also gets called when the canvas size changes, or the checker settings in the preferences change.
This commit is contained in:
OverloadedOrama 2020-04-20 19:12:22 +03:00
parent b21455cfd0
commit 79a4c0232e
4 changed files with 11 additions and 1 deletions

View file

@ -97,6 +97,8 @@ func _ready() -> void:
Global.checker_color_2 = Global.config_cache.get_value("preferences", "checker_color_2")
checker_color_2.color = Global.checker_color_2
Global.transparent_checker._ready()
if Global.config_cache.has_section_key("preferences", "guide_color"):
Global.guide_color = Global.config_cache.get_value("preferences", "guide_color")
for canvas in Global.canvases:
@ -405,18 +407,21 @@ func _on_GridColor_color_changed(color : Color) -> void:
func _on_CheckerSize_value_changed(value : float) -> void:
Global.checker_size = value
Global.transparent_checker._ready()
Global.config_cache.set_value("preferences", "checker_size", value)
Global.config_cache.save("user://cache.ini")
func _on_CheckerColor1_color_changed(color : Color) -> void:
Global.checker_color_1 = color
Global.transparent_checker._ready()
Global.config_cache.set_value("preferences", "checker_color_1", color)
Global.config_cache.save("user://cache.ini")
func _on_CheckerColor2_color_changed(color : Color) -> void:
Global.checker_color_2 = color
Global.transparent_checker._ready()
Global.config_cache.set_value("preferences", "checker_color_2", color)
Global.config_cache.save("user://cache.ini")