Made a Frame class, no longer use multiple Canvases for multiple frames

The Canvas is now single node, instead of having multiple canvases for each frame. This should also be a performance optimization, since there are less canvas nodes, so there are less _input() calls. It should also fix a rare Undo/Redo issue with motion drawing and making lines. Could be unstable, needs more testing.

As a side effect, the guides are now the same for all frames, so this should also close #246.
This commit is contained in:
OverloadedOrama 2020-06-03 02:14:24 +03:00
parent d8136a3e17
commit 54b628f6cb
17 changed files with 412 additions and 459 deletions

View file

@ -55,10 +55,9 @@ func _ready() -> void:
Global.transparent_checker._ready()
for canvas in Global.canvases:
for guide in canvas.get_children():
if guide is Guide:
guide.default_color = Global.guide_color
for guide in Global.canvas.get_children():
if guide is Guide:
guide.default_color = Global.guide_color
func _on_Preference_toggled(button_pressed : bool, prop : String) -> void:
@ -96,10 +95,9 @@ func preference_update(prop : String) -> void:
Global.transparent_checker._ready()
if prop in ["guide_color"]:
for canvas in Global.canvases:
for guide in canvas.get_children():
if guide is Guide:
guide.default_color = Global.guide_color
for guide in Global.canvas.get_children():
if guide is Guide:
guide.default_color = Global.guide_color
Global.config_cache.save("user://cache.ini")