1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-19 01:29:49 +00:00

Preload more resources

Had to remove references to Brushes and Patterns classes from BrushesButton.gd and PatternButton.gd due to GDScript's cyclic reference bug
This commit is contained in:
Manolis Papadeas 2021-07-21 18:29:52 +03:00
parent 763a063de7
commit 9bec8f1b09
7 changed files with 12 additions and 11 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -1,7 +1,7 @@
extends BaseButton
var pattern := Patterns.Pattern.new()
var pattern = Global.patterns_popup.Pattern.new()
func _on_PatternButton_pressed() -> void:

View file

@ -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