From 0bbabd05de75f575865e914f6167b5b1e98eb1e2 Mon Sep 17 00:00:00 2001 From: Eduardo Date: Tue, 25 Jun 2024 20:16:43 +0200 Subject: [PATCH] added assets button press signal --- scripts/interface.gd | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/interface.gd b/scripts/interface.gd index 7860721..f3f4874 100644 --- a/scripts/interface.gd +++ b/scripts/interface.gd @@ -27,8 +27,10 @@ var layer_controls_open: bool = false var movement_controls_open: bool = false var colors_menu_open: bool = false + signal move_layer(LAYER_MOVEMENT) signal move_drawing(MOVEMENT, multiplier: int) +signal asset_selected(asset_path: String) #region build in funcs @@ -184,6 +186,10 @@ func _on_multiplier_button_pressed(): movement_multiplier_label.text = " " + str(movement_multiplier) +func _on_asset_selected(file_path: String): + asset_selected.emit(file_path) + + #endregion #region utils @@ -206,6 +212,7 @@ func add_timer_with_timeout(function: Callable, seconds: float = 2): timer.timeout.connect(timer.queue_free) add_child(timer) + #endregion #region signal callbacks @@ -253,6 +260,8 @@ func _on_section_content(sections: Array[Globals.Section]): texture_button.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT, Control.PRESET_MODE_KEEP_SIZE, ASSET_MARGIN) texture_button.ignore_texture_size = true texture_button.custom_minimum_size = ASSET_MIN_SIZE + + texture_button.pressed.connect(_on_asset_selected.bind(file_path)) var image = Image.load_from_file(miniature_file_path) var texture = ImageTexture.create_from_image(image) -- 2.30.2