diff --git a/src/Autoload/Global.gd b/src/Autoload/Global.gd index de69a1ae6..1edc67239 100644 --- a/src/Autoload/Global.gd +++ b/src/Autoload/Global.gd @@ -189,10 +189,10 @@ var palette_panel : PalettePanel var error_dialog : AcceptDialog var quit_dialog : ConfirmationDialog var quit_and_save_dialog : ConfirmationDialog +var notification_label_node = preload("res://src/UI/NotificationLabel.tscn") onready var current_version : String = ProjectSettings.get_setting("application/config/Version") - func _ready() -> void: randomize() if OS.get_name() == "OSX": @@ -327,7 +327,7 @@ func _ready() -> void: func notification_label(text : String) -> void: - var notification : Label = load("res://src/UI/NotificationLabel.tscn").instance() + var notification : Label = notification_label_node.instance() notification.text = tr(text) notification.rect_position = Vector2(70, OS.window_size.y - animation_timeline.rect_size.y - 20) notification.theme = control.theme diff --git a/src/Classes/Project.gd b/src/Classes/Project.gd index 1f1c4a21f..ffca16c85 100644 --- a/src/Classes/Project.gd +++ b/src/Classes/Project.gd @@ -42,6 +42,7 @@ var was_exported := false var frame_button_node = preload("res://src/UI/Timeline/FrameButton.tscn") var layer_button_node = preload("res://src/UI/Timeline/LayerButton.tscn") var cel_button_node = preload("res://src/UI/Timeline/CelButton.tscn") +var animation_tag_node = preload("res://src/UI/Timeline/AnimationTagUI.tscn") func _init(_frames := [], _name := tr("untitled"), _size := Vector2(64, 64)) -> void: @@ -564,7 +565,7 @@ func animation_tags_changed(value : Array) -> void: for tag in animation_tags: var tag_base_size = Global.animation_timeline.cel_size + 3 - var tag_c : Container = load("res://src/UI/Timeline/AnimationTagUI.tscn").instance() + var tag_c : Container = animation_tag_node.instance() Global.tag_container.add_child(tag_c) tag_c.tag = tag var tag_position : int = Global.tag_container.get_child_count() - 1 diff --git a/src/Palette/PalettePanel.gd b/src/Palette/PalettePanel.gd index b6d9de740..0e9ccf2f1 100644 --- a/src/Palette/PalettePanel.gd +++ b/src/Palette/PalettePanel.gd @@ -8,7 +8,7 @@ var edited_swatch_index = -1 onready var palette_select := $PaletteVBoxContainer/PaletteButtons/PaletteSelect onready var add_palette_button := $PaletteVBoxContainer/PaletteButtons/AddPalette -onready var palette_grid := $PaletteVBoxContainer/SwatchesContainer/PaletteScroll/HBoxContainer/CenterContainer/HBoxContainer/PaletteGrid +onready var palette_grid := find_node("PaletteGrid") onready var palette_scroll := $PaletteVBoxContainer/SwatchesContainer/PaletteScroll onready var add_color_button := $PaletteVBoxContainer/SwatchesContainer/ColorButtons/AddColor diff --git a/src/UI/BrushButton.gd b/src/UI/BrushButton.gd index 1363c7a7f..12c7ee7be 100644 --- a/src/UI/BrushButton.gd +++ b/src/UI/BrushButton.gd @@ -1,7 +1,7 @@ extends BaseButton -var brush := Brushes.Brush.new() +var brush = Global.brushes_popup.Brush.new() func _on_BrushButton_pressed() -> void: @@ -13,17 +13,17 @@ func _on_BrushButton_pressed() -> void: func _on_DeleteButton_pressed() -> void: - if brush.type != Brushes.CUSTOM: + if brush.type != Global.brushes_popup.CUSTOM: return Global.brushes_popup.remove_brush(self) func _on_BrushButton_mouse_entered() -> void: - if brush.type == Brushes.CUSTOM: + if brush.type == Global.brushes_popup.CUSTOM: $DeleteButton.visible = true func _on_BrushButton_mouse_exited() -> void: - if brush.type == Brushes.CUSTOM: + if brush.type == Global.brushes_popup.CUSTOM: $DeleteButton.visible = false diff --git a/src/UI/BrushesPopup.gd b/src/UI/BrushesPopup.gd index 07685c09e..96a1b69f2 100644 --- a/src/UI/BrushesPopup.gd +++ b/src/UI/BrushesPopup.gd @@ -52,7 +52,7 @@ static func get_default_brush() -> Brush: static func create_button(image : Image) -> Node: - var button : BaseButton = load("res://src/UI/BrushButton.tscn").instance() + var button : BaseButton = preload("res://src/UI/BrushButton.tscn").instance() var tex := ImageTexture.new() tex.create_from_image(image, 0) button.get_child(0).texture = tex diff --git a/src/UI/PatternButton.gd b/src/UI/PatternButton.gd index 5847acf7d..f7f684d81 100644 --- a/src/UI/PatternButton.gd +++ b/src/UI/PatternButton.gd @@ -1,7 +1,7 @@ extends BaseButton -var pattern := Patterns.Pattern.new() +var pattern = Global.patterns_popup.Pattern.new() func _on_PatternButton_pressed() -> void: diff --git a/src/UI/PatternsPopup.gd b/src/UI/PatternsPopup.gd index 1c7e09bb9..6a612f5c0 100644 --- a/src/UI/PatternsPopup.gd +++ b/src/UI/PatternsPopup.gd @@ -17,7 +17,7 @@ func select_pattern(pattern : Pattern) -> void: static func create_button(image : Image) -> Node: - var button : BaseButton = load("res://src/UI/PatternButton.tscn").instance() + var button : BaseButton = preload("res://src/UI/PatternButton.tscn").instance() var tex := ImageTexture.new() tex.create_from_image(image, 0) button.get_child(0).texture = tex