From: Eduardo Date: Mon, 24 Jun 2024 17:23:59 +0000 (+0200) Subject: tabs, thumbs fixes and some spices X-Git-Url: http://git.edufdez.es/?a=commitdiff_plain;h=ab7a23192fc4fbd52b3b3be4851396c4ee0ecf58;p=local-picrew.git tabs, thumbs fixes and some spices --- diff --git a/assets/bodys/.thumb/C1 (copy).png b/assets/bodys/.thumb/C1 (copy).png index daaba10..bcebe06 100644 Binary files a/assets/bodys/.thumb/C1 (copy).png and b/assets/bodys/.thumb/C1 (copy).png differ diff --git a/assets/bodys/.thumb/C1.png b/assets/bodys/.thumb/C1.png index b8bd784..e02aa34 100644 Binary files a/assets/bodys/.thumb/C1.png and b/assets/bodys/.thumb/C1.png differ diff --git a/assets/ears/.thumb/E1.png b/assets/ears/.thumb/E1.png index f53b73e..9c3930c 100644 Binary files a/assets/ears/.thumb/E1.png and b/assets/ears/.thumb/E1.png differ diff --git a/assets/ears/.thumb/E2.png b/assets/ears/.thumb/E2.png index 17b9d4b..0834c67 100644 Binary files a/assets/ears/.thumb/E2.png and b/assets/ears/.thumb/E2.png differ diff --git a/assets/ears/.thumb/E3.png b/assets/ears/.thumb/E3.png index 169a751..74383b6 100644 Binary files a/assets/ears/.thumb/E3.png and b/assets/ears/.thumb/E3.png differ diff --git a/assets/eyes/.thumb/O1.png b/assets/eyes/.thumb/O1.png index 57b236f..edab589 100644 Binary files a/assets/eyes/.thumb/O1.png and b/assets/eyes/.thumb/O1.png differ diff --git a/assets/eyes/.thumb/O2.png b/assets/eyes/.thumb/O2.png index ef7406e..c59172d 100644 Binary files a/assets/eyes/.thumb/O2.png and b/assets/eyes/.thumb/O2.png differ diff --git a/assets/hair/.thumb/P2.png b/assets/hair/.thumb/P2.png index 3561144..3e64ec7 100644 Binary files a/assets/hair/.thumb/P2.png and b/assets/hair/.thumb/P2.png differ diff --git a/assets/hair/.thumb/P3.png b/assets/hair/.thumb/P3.png index 7177e78..bbf6c76 100644 Binary files a/assets/hair/.thumb/P3.png and b/assets/hair/.thumb/P3.png differ diff --git a/assets/hair/.thumb/p1.png b/assets/hair/.thumb/p1.png index dbb3dde..1641f8e 100644 Binary files a/assets/hair/.thumb/p1.png and b/assets/hair/.thumb/p1.png differ diff --git a/core b/core index b33eaaa..678ecda 100644 Binary files a/core and b/core differ diff --git a/scenes/interface.gd b/scenes/interface.gd deleted file mode 100644 index 50e1ae8..0000000 --- a/scenes/interface.gd +++ /dev/null @@ -1,253 +0,0 @@ -extends Control - - -enum LAYER_MOVEMENT {MOVE_UP, MOVE_DOWN} -enum MOVEMENT {MOVE_UP, MOVE_DOWN, MOVE_RIGHT, MOVE_LEFT} - - -@onready var animation_players: Array[AnimationPlayer] = [ - $AnimationPlayers/AnimationPlayer1, $AnimationPlayers/AnimationPlayer2, $AnimationPlayers/AnimationPlayer3, - $AnimationPlayers/AnimationPlayer4, $AnimationPlayers/AnimationPlayer5, $AnimationPlayers/AnimationPlayer6, - $AnimationPlayers/AnimationPlayer7, $AnimationPlayers/AnimationPlayer8, $AnimationPlayers/AnimationPlayer9, - $AnimationPlayers/AnimationPlayer10] -var finger_mouse = load("res://ui/hand_point.svg") - -@onready var sections_tabs := $SectionsTabContainer -var sections_columns: int = 5 - -var movement_multiplier: int = 1 -@onready var movement_multiplier_label: Label = $MovementControlsNinePatch/MultiplierLabel - -# move window helpers -var _mouse_start_position: Vector2 -var _dragging: bool = false - -# menu animations helpers -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) - - -#region build in funcs - - -func _init(): - Input.set_custom_mouse_cursor(finger_mouse) - - -func _ready(): - _on_section_list(Globals.sections) - _on_section_content(Globals.sections) - - -#endregion - -#region window controls - - -func _on_close_button_pressed(): - get_tree().quit(0) - - -func _on_maximize_button_pressed(): - if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_MAXIMIZED: - DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED) - else: - DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_MAXIMIZED) - - -func _on_default_cursor_rect_mouse_entered(): - Input.set_custom_mouse_cursor(null) - - -func _on_default_cursor_rect_mouse_exited(): - Input.set_custom_mouse_cursor(finger_mouse) - - -#endregion - -#region move window - - -func _input(event: InputEvent): - if event is InputEventMouseButton: - if event.button_index == MOUSE_BUTTON_LEFT && not event.pressed: - _dragging = false - - if event is InputEventMouseMotion and _dragging: - accept_event() - get_window().position = get_global_mouse_position() - _mouse_start_position + (get_window().position as Vector2) - - -func _on_Titlebar_gui_input(event: InputEvent): - if event is InputEventMouseButton: - if event.button_index == MOUSE_BUTTON_LEFT && event.pressed: - accept_event() - _mouse_start_position = get_global_mouse_position() - _dragging = true - - -#endregion - -#region animations - - -func _on_layer_controls_rect_mouse_entered(): - if layer_controls_open: - return - - var animation_player = get_animation_player() - if animation_player != null: - animation_player.play("OpenLayer") - layer_controls_open = true - - -func _on_layer_controls_rect_mouse_exited(): - var animation_player = get_animation_player() - if animation_player != null: - add_timer_with_timeout(animation_player.play_backwards.bind("OpenLayer")) - layer_controls_open = false - - -func _on_movement_controls_rect_mouse_entered(): - if movement_controls_open: - return - - var animation_player = get_animation_player() - if animation_player != null: - animation_player.play("openPosition") - movement_controls_open = true - - -func _on_movement_controls_mouse_exited(): - var animation_player = get_animation_player() - if animation_player != null: - add_timer_with_timeout(animation_player.play_backwards.bind("openPosition")) - movement_controls_open = false - - -func _on_colors_mouse_entered(): - if colors_menu_open: - return - - var animation_player = get_animation_player() - if animation_player != null: - animation_player.play("openColor") - colors_menu_open = true - - -func _on_colors_mouse_exited(): - var animation_player = get_animation_player() - if animation_player != null: - add_timer_with_timeout(animation_player.play_backwards.bind("openColor")) - colors_menu_open = false - - -#endregion - -#region buttons - - -func _on_layer_up_button_pressed(): - move_layer.emit(LAYER_MOVEMENT.MOVE_UP) - - -func _on_layer_down_button_pressed(): - move_layer.emit(LAYER_MOVEMENT.MOVE_DOWN) - - -func _on_movement_up_button_pressed(): - move_drawing.emit(MOVEMENT.MOVE_UP, movement_multiplier) - - -func _on_movement_down_button_pressed(): - move_drawing.emit(MOVEMENT.MOVE_DOWN, movement_multiplier) - - -func _on_movement_left_button_pressed(): - move_drawing.emit(MOVEMENT.MOVE_LEFT, movement_multiplier) - - -func _on_movement_right_button_pressed(): - move_drawing.emit(MOVEMENT.MOVE_RIGHT, movement_multiplier) - - -func _on_multiplier_button_pressed(): - if movement_multiplier == 1: - movement_multiplier = 10 - else: - movement_multiplier = 1 - - movement_multiplier_label.text = " " + str(movement_multiplier) - - -#endregion - -#region utils - - -func get_animation_player() -> AnimationPlayer: - for ap in animation_players: - if not ap.is_playing(): - return ap - - return null - - -func add_timer_with_timeout(function: Callable, seconds: float = 2): - var timer = Timer.new() - timer.autostart = true - timer.one_shot = true - timer.wait_time = seconds - timer.timeout.connect(function) - timer.timeout.connect(timer.queue_free) - add_child(timer) - -#endregion - -#region signal callbacks - - -#endregion - -#region initial content drawing - - -func _on_section_list(sections: Array[Globals.Section]): - # TODO: remove: debug only - for child in sections_tabs.get_children(): - sections_tabs.remove_child(child) - child.queue_free() - - for section in sections: - var container = GridContainer.new() - container.name = section.name - container.columns = sections_columns - sections_tabs.add_child(container) - - -func _on_section_content(sections: Array[Globals.Section]): - for section in sections: - for file_path in section.image_paths: - var file_name := file_path.split("/")[-1] - var miniature_file_path := file_path.trim_suffix(file_name) + ".thumb/" + file_name - - var texture_button := TextureButton.new() - texture_button.set_meta("file_path", file_path) - texture_button.stretch_mode = TextureButton.StretchMode.STRETCH_KEEP_ASPECT - texture_button.ignore_texture_size = true - texture_button.custom_minimum_size = Vector2(100, 100) - - var image = Image.load_from_file(miniature_file_path) - var texture = ImageTexture.create_from_image(image) - texture_button.texture_normal = texture - - for child in sections_tabs.get_children(): - if child.name == section.name: - child.add_child(texture_button) - - -#endregion diff --git a/scenes/interface.tscn b/scenes/interface.tscn index 2bb4311..90bd028 100644 --- a/scenes/interface.tscn +++ b/scenes/interface.tscn @@ -1,7 +1,7 @@ -[gd_scene load_steps=34 format=3 uid="uid://bfqis7iljniu4"] +[gd_scene load_steps=37 format=3 uid="uid://bfqis7iljniu4"] [ext_resource type="Texture2D" uid="uid://bh8r1544r4w0a" path="res://ui/button_square_depth_line.svg" id="1_4tdiw"] -[ext_resource type="Script" path="res://scenes/interface.gd" id="1_u68dg"] +[ext_resource type="Script" path="res://scripts/interface.gd" id="1_u68dg"] [ext_resource type="Texture2D" uid="uid://2ksj38qp50ka" path="res://ui/icon_cross.svg" id="2_wpbrs"] [ext_resource type="PackedScene" uid="uid://bl5au3ffuw4pn" path="res://scenes/main_window.tscn" id="3_rbdes"] [ext_resource type="Texture2D" uid="uid://d2ynbocejw2m7" path="res://ui/resize_a_cross_diagonal.svg" id="3_xkt53"] @@ -18,7 +18,10 @@ [ext_resource type="Texture2D" uid="uid://ct60e6ip1847v" path="res://ui/navigation_e.svg" id="9_cw217"] [ext_resource type="Texture2D" uid="uid://b40puvvid5axi" path="res://ui/button_round_line.svg" id="10_1tmay"] [ext_resource type="Texture2D" uid="uid://bs230jvbr3gbm" path="res://ui/drawing_picker.svg" id="11_ct4lx"] -[ext_resource type="Texture2D" uid="uid://dhbbx653ihne6" path="res://ui/button_square_line.svg" id="19_rjy61"] +[ext_resource type="Texture2D" uid="uid://dwyr2pa2kvpu6" path="res://ui/save_transparentDark32.png" id="17_e3qu3"] +[ext_resource type="Texture2D" uid="uid://5qonnbx3tie8" path="res://ui/button_rectangle_depth_line.svg" id="20_dm01o"] +[ext_resource type="Theme" uid="uid://ba300xn4cvkke" path="res://themes/grid_container_theme.tres" id="21_fqc5r"] +[ext_resource type="Texture2D" uid="uid://tmikywrrcq54" path="res://ui/button_rectangle_line.svg" id="21_tly76"] [sub_resource type="LabelSettings" id="LabelSettings_o5aan"] line_spacing = 0.0 @@ -123,45 +126,64 @@ _data = { font_names = PackedStringArray("Monospace") font_weight = 500 -[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_4qoqa"] +[sub_resource type="StyleBoxLine" id="StyleBoxLine_5wa6t"] +color = Color(0, 0, 0, 0) +grow_begin = 0.0 +grow_end = 0.0 +thickness = 25 -[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_c50r3"] +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_xwgme"] +texture = ExtResource("20_dm01o") +texture_margin_left = 15.0 +texture_margin_top = 10.0 +texture_margin_right = 15.0 +texture_margin_bottom = 10.0 +modulate_color = Color(0.442911, 0.442911, 0.442911, 1) -[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_57r7d"] -texture = ExtResource("1_4tdiw") +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_tfvpg"] +texture = ExtResource("20_dm01o") texture_margin_left = 15.0 texture_margin_top = 10.0 texture_margin_right = 15.0 texture_margin_bottom = 10.0 -[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_swuan"] -texture = ExtResource("19_rjy61") +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_cxerp"] +texture = ExtResource("20_dm01o") texture_margin_left = 15.0 texture_margin_top = 10.0 texture_margin_right = 15.0 texture_margin_bottom = 10.0 -[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_8tjt5"] -load_path = "res://.godot/imported/button_square_depth_line.svg-1cc590086494f495d62bde393b0a61c8.ctex" +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_4mb4s"] +texture = ExtResource("21_tly76") +texture_margin_left = 15.0 +texture_margin_top = 10.0 +texture_margin_right = 15.0 +texture_margin_bottom = 10.0 -[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_rd6hx"] -texture = SubResource("CompressedTexture2D_8tjt5") +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_fgu15"] +texture = ExtResource("20_dm01o") texture_margin_left = 15.0 texture_margin_top = 10.0 texture_margin_right = 15.0 texture_margin_bottom = 10.0 -[sub_resource type="Theme" id="Theme_jeoki"] +[sub_resource type="Theme" id="Theme_xu50c"] +GridContainer/constants/h_separation = 10 +GridContainer/constants/v_separation = 10 +TabContainer/colors/font_disabled_color = Color(0, 0, 0, 0.5) TabContainer/colors/font_hovered_color = Color(0, 0, 0, 1) TabContainer/colors/font_outline_color = Color(0, 0, 0, 0) TabContainer/colors/font_selected_color = Color(0, 0, 0, 1) -TabContainer/colors/font_unselected_color = Color(0.314316, 0.314316, 0.314316, 1) +TabContainer/colors/font_unselected_color = Color(0.313726, 0.313726, 0.313726, 1) +TabContainer/constants/side_margin = 0 TabContainer/fonts/font = SubResource("SystemFont_brntw") -TabContainer/styles/panel = SubResource("StyleBoxEmpty_4qoqa") -TabContainer/styles/tab_focus = SubResource("StyleBoxEmpty_c50r3") -TabContainer/styles/tab_hovered = SubResource("StyleBoxTexture_57r7d") -TabContainer/styles/tab_selected = SubResource("StyleBoxTexture_swuan") -TabContainer/styles/tab_unselected = SubResource("StyleBoxTexture_rd6hx") +TabContainer/styles/panel = SubResource("StyleBoxLine_5wa6t") +TabContainer/styles/tab_disabled = SubResource("StyleBoxTexture_xwgme") +TabContainer/styles/tab_focus = SubResource("StyleBoxTexture_tfvpg") +TabContainer/styles/tab_hovered = SubResource("StyleBoxTexture_cxerp") +TabContainer/styles/tab_selected = SubResource("StyleBoxTexture_4mb4s") +TabContainer/styles/tab_unselected = SubResource("StyleBoxTexture_fgu15") [node name="Interface" type="Control"] layout_mode = 3 @@ -449,14 +471,22 @@ texture_normal = ExtResource("3_xkt53") stretch_mode = 5 metadata/_edit_lock_ = true -[node name="ResetButton" type="TextureButton" parent="."] -layout_mode = 1 +[node name="ResetButton" type="TextureButton" parent="Buttons"] offset_left = 556.0 -offset_top = 47.0 +offset_top = 81.0 offset_right = 588.0 -offset_bottom = 79.0 +offset_bottom = 113.0 texture_normal = ExtResource("6_3hxsm") +[node name="SaveButton" type="TextureButton" parent="Buttons"] +offset_left = 552.0 +offset_top = 38.0 +offset_right = 590.0 +offset_bottom = 78.0 +texture_normal = ExtResource("17_e3qu3") +ignore_texture_size = true +stretch_mode = 5 + [node name="Divider" type="Node" parent="."] [node name="Divider" type="TextureRect" parent="Divider"] @@ -554,21 +584,24 @@ libraries = { [node name="SectionsTabContainer" type="TabContainer" parent="."] layout_mode = 0 -offset_left = 7.0 +offset_left = 25.0 offset_top = 510.0 -offset_right = 592.0 +offset_right = 575.0 offset_bottom = 990.0 -theme = SubResource("Theme_jeoki") +theme = ExtResource("21_fqc5r") current_tab = 1 [node name="Example1" type="GridContainer" parent="SectionsTabContainer"] visible = false layout_mode = 2 +theme = SubResource("Theme_xu50c") +theme_override_constants/h_separation = 0 columns = 5 metadata/_tab_index = 0 [node name="Example2" type="GridContainer" parent="SectionsTabContainer"] layout_mode = 2 +theme = SubResource("Theme_xu50c") metadata/_tab_index = 1 [connection signal="mouse_entered" from="DefaultCursorColorRect" to="." method="_on_default_cursor_rect_mouse_entered"] diff --git a/scripts/globals.gd b/scripts/globals.gd index e18f1c1..69098ef 100644 --- a/scripts/globals.gd +++ b/scripts/globals.gd @@ -61,7 +61,7 @@ func _load_texture(image_file_path: String): var new_img = Image.create(last_w - first_w, last_h - first_h, true, image.get_format()) new_img.blit_rect(image, Rect2(first_w, first_h, last_w - first_w, last_h - first_h), Vector2i(0, 0)) - new_img.resize(100, 100, Image.INTERPOLATE_LANCZOS) + new_img.resize(100, (100 * new_img.get_height()) / new_img.get_width(), Image.INTERPOLATE_LANCZOS) new_img.save_png(miniature_file_path) # remove work from queue diff --git a/scripts/interface.gd b/scripts/interface.gd new file mode 100644 index 0000000..d13759e --- /dev/null +++ b/scripts/interface.gd @@ -0,0 +1,254 @@ +extends Control + + +enum LAYER_MOVEMENT {MOVE_UP, MOVE_DOWN} +enum MOVEMENT {MOVE_UP, MOVE_DOWN, MOVE_RIGHT, MOVE_LEFT} + + +@onready var animation_players: Array[AnimationPlayer] = [ + $AnimationPlayers/AnimationPlayer1, $AnimationPlayers/AnimationPlayer2, $AnimationPlayers/AnimationPlayer3, + $AnimationPlayers/AnimationPlayer4, $AnimationPlayers/AnimationPlayer5, $AnimationPlayers/AnimationPlayer6, + $AnimationPlayers/AnimationPlayer7, $AnimationPlayers/AnimationPlayer8, $AnimationPlayers/AnimationPlayer9, + $AnimationPlayers/AnimationPlayer10] +var finger_mouse = load("res://ui/hand_point.svg") + +@onready var sections_tabs := $SectionsTabContainer +var sections_columns: int = 5 + +var movement_multiplier: int = 1 +@onready var movement_multiplier_label: Label = $MovementControlsNinePatch/MultiplierLabel + +# move window helpers +var _mouse_start_position: Vector2 +var _dragging: bool = false + +# menu animations helpers +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) + + +#region build in funcs + + +func _init(): + Input.set_custom_mouse_cursor(finger_mouse) + + +func _ready(): + _on_section_list(Globals.sections) + _on_section_content(Globals.sections) + + +#endregion + +#region window controls + + +func _on_close_button_pressed(): + get_tree().quit(0) + + +func _on_maximize_button_pressed(): + if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_MAXIMIZED: + DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED) + else: + DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_MAXIMIZED) + + +func _on_default_cursor_rect_mouse_entered(): + Input.set_custom_mouse_cursor(null) + + +func _on_default_cursor_rect_mouse_exited(): + Input.set_custom_mouse_cursor(finger_mouse) + + +#endregion + +#region move window + + +func _input(event: InputEvent): + if event is InputEventMouseButton: + if event.button_index == MOUSE_BUTTON_LEFT && not event.pressed: + _dragging = false + + if event is InputEventMouseMotion and _dragging: + accept_event() + get_window().position = get_global_mouse_position() - _mouse_start_position + (get_window().position as Vector2) + + +func _on_Titlebar_gui_input(event: InputEvent): + if event is InputEventMouseButton: + if event.button_index == MOUSE_BUTTON_LEFT && event.pressed: + accept_event() + _mouse_start_position = get_global_mouse_position() + _dragging = true + + +#endregion + +#region animations + + +func _on_layer_controls_rect_mouse_entered(): + if layer_controls_open: + return + + var animation_player = get_animation_player() + if animation_player != null: + animation_player.play("OpenLayer") + layer_controls_open = true + + +func _on_layer_controls_rect_mouse_exited(): + var animation_player = get_animation_player() + if animation_player != null: + add_timer_with_timeout(animation_player.play_backwards.bind("OpenLayer")) + layer_controls_open = false + + +func _on_movement_controls_rect_mouse_entered(): + if movement_controls_open: + return + + var animation_player = get_animation_player() + if animation_player != null: + animation_player.play("openPosition") + movement_controls_open = true + + +func _on_movement_controls_mouse_exited(): + var animation_player = get_animation_player() + if animation_player != null: + add_timer_with_timeout(animation_player.play_backwards.bind("openPosition")) + movement_controls_open = false + + +func _on_colors_mouse_entered(): + if colors_menu_open: + return + + var animation_player = get_animation_player() + if animation_player != null: + animation_player.play("openColor") + colors_menu_open = true + + +func _on_colors_mouse_exited(): + var animation_player = get_animation_player() + if animation_player != null: + add_timer_with_timeout(animation_player.play_backwards.bind("openColor")) + colors_menu_open = false + + +#endregion + +#region buttons + + +func _on_layer_up_button_pressed(): + move_layer.emit(LAYER_MOVEMENT.MOVE_UP) + + +func _on_layer_down_button_pressed(): + move_layer.emit(LAYER_MOVEMENT.MOVE_DOWN) + + +func _on_movement_up_button_pressed(): + move_drawing.emit(MOVEMENT.MOVE_UP, movement_multiplier) + + +func _on_movement_down_button_pressed(): + move_drawing.emit(MOVEMENT.MOVE_DOWN, movement_multiplier) + + +func _on_movement_left_button_pressed(): + move_drawing.emit(MOVEMENT.MOVE_LEFT, movement_multiplier) + + +func _on_movement_right_button_pressed(): + move_drawing.emit(MOVEMENT.MOVE_RIGHT, movement_multiplier) + + +func _on_multiplier_button_pressed(): + if movement_multiplier == 1: + movement_multiplier = 10 + else: + movement_multiplier = 1 + + movement_multiplier_label.text = " " + str(movement_multiplier) + + +#endregion + +#region utils + + +func get_animation_player() -> AnimationPlayer: + for ap in animation_players: + if not ap.is_playing(): + return ap + + return null + + +func add_timer_with_timeout(function: Callable, seconds: float = 2): + var timer = Timer.new() + timer.autostart = true + timer.one_shot = true + timer.wait_time = seconds + timer.timeout.connect(function) + timer.timeout.connect(timer.queue_free) + add_child(timer) + +#endregion + +#region signal callbacks + + +#endregion + +#region initial content drawing + + +func _on_section_list(sections: Array[Globals.Section]): + # TODO: remove: debug only + for child in sections_tabs.get_children(): + sections_tabs.remove_child(child) + child.queue_free() + + for section in sections: + var container = GridContainer.new() + container.name = section.name + container.columns = sections_columns + container.theme = load("res://themes/grid_container_theme.tres") + sections_tabs.add_child(container) + + +func _on_section_content(sections: Array[Globals.Section]): + for section in sections: + for file_path in section.image_paths: + var file_name := file_path.split("/")[-1] + var miniature_file_path := file_path.trim_suffix(file_name) + ".thumb/" + file_name + + var texture_button := TextureButton.new() + texture_button.set_meta("file_path", file_path) + texture_button.stretch_mode = TextureButton.StretchMode.STRETCH_KEEP_ASPECT_CENTERED + texture_button.ignore_texture_size = true + texture_button.custom_minimum_size = Vector2(100, 100) + + var image = Image.load_from_file(miniature_file_path) + var texture = ImageTexture.create_from_image(image) + texture_button.texture_normal = texture + + for child in sections_tabs.get_children(): + if child.name == section.name: + child.add_child(texture_button) + + +#endregion diff --git a/themes/grid_container_theme.tres b/themes/grid_container_theme.tres new file mode 100644 index 0000000..32f186c --- /dev/null +++ b/themes/grid_container_theme.tres @@ -0,0 +1,62 @@ +[gd_resource type="Theme" load_steps=10 format=3 uid="uid://ba300xn4cvkke"] + +[ext_resource type="Texture2D" uid="uid://5qonnbx3tie8" path="res://ui/button_rectangle_depth_line.svg" id="1_i0q6t"] +[ext_resource type="Texture2D" uid="uid://tmikywrrcq54" path="res://ui/button_rectangle_line.svg" id="2_0td2s"] + +[sub_resource type="SystemFont" id="SystemFont_brntw"] +font_names = PackedStringArray("Monospace") +font_weight = 500 + +[sub_resource type="StyleBoxLine" id="StyleBoxLine_5wa6t"] +color = Color(0, 0, 0, 0) +grow_begin = 0.0 +grow_end = 0.0 +thickness = 25 + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_xwgme"] +texture = ExtResource("1_i0q6t") +texture_margin_left = 15.0 +texture_margin_top = 10.0 +texture_margin_right = 15.0 +texture_margin_bottom = 10.0 +modulate_color = Color(0.442911, 0.442911, 0.442911, 1) + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_meslh"] + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_cxerp"] +texture = ExtResource("1_i0q6t") +texture_margin_left = 15.0 +texture_margin_top = 10.0 +texture_margin_right = 15.0 +texture_margin_bottom = 10.0 + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_4mb4s"] +texture = ExtResource("2_0td2s") +texture_margin_left = 15.0 +texture_margin_top = 10.0 +texture_margin_right = 15.0 +texture_margin_bottom = 10.0 + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_fgu15"] +texture = ExtResource("1_i0q6t") +texture_margin_left = 15.0 +texture_margin_top = 10.0 +texture_margin_right = 15.0 +texture_margin_bottom = 10.0 + +[resource] +GridContainer/constants/h_separation = 10 +GridContainer/constants/v_separation = 10 +TabContainer/colors/font_disabled_color = Color(0, 0, 0, 0.5) +TabContainer/colors/font_hovered_color = Color(0, 0, 0, 1) +TabContainer/colors/font_outline_color = Color(0, 0, 0, 0) +TabContainer/colors/font_selected_color = Color(0, 0, 0, 1) +TabContainer/colors/font_unselected_color = Color(0.313726, 0.313726, 0.313726, 1) +TabContainer/constants/side_margin = 0 +TabContainer/fonts/font = SubResource("SystemFont_brntw") +TabContainer/styles/panel = SubResource("StyleBoxLine_5wa6t") +TabContainer/styles/tab_disabled = SubResource("StyleBoxTexture_xwgme") +TabContainer/styles/tab_focus = SubResource("StyleBoxEmpty_meslh") +TabContainer/styles/tab_hovered = SubResource("StyleBoxTexture_cxerp") +TabContainer/styles/tab_selected = SubResource("StyleBoxTexture_4mb4s") +TabContainer/styles/tab_unselected = SubResource("StyleBoxTexture_fgu15") diff --git a/ui/saveTransparentDark32.png b/ui/saveTransparentDark32.png deleted file mode 100644 index 8f4c00e..0000000 Binary files a/ui/saveTransparentDark32.png and /dev/null differ diff --git a/ui/save_transparentDark32.png b/ui/save_transparentDark32.png new file mode 100644 index 0000000..5df6b1f Binary files /dev/null and b/ui/save_transparentDark32.png differ diff --git a/ui/save_transparentDark32.png.import b/ui/save_transparentDark32.png.import new file mode 100644 index 0000000..509dd82 --- /dev/null +++ b/ui/save_transparentDark32.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dwyr2pa2kvpu6" +path="res://.godot/imported/save_transparentDark32.png-36f8321ae97a2696024aa196801a51dc.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ui/save_transparentDark32.png" +dest_files=["res://.godot/imported/save_transparentDark32.png-36f8321ae97a2696024aa196801a51dc.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1