From 9f1d06c7f893394bdda4496089a3537b9f4ba877 Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 26 Jan 2022 22:09:47 +0100 Subject: [PATCH] Now clicking the fodler entries will again pass the relevant informations to the resource panel. --- .../data_manager/panels/FolderEntryButton.gd | 12 --------- .../panels/FolderEntryButton.tscn | 10 -------- game/addons/data_manager/panels/MainPanel.gd | 25 ++++++++++--------- .../addons/data_manager/panels/MainPanel.tscn | 4 +-- 4 files changed, 14 insertions(+), 37 deletions(-) delete mode 100644 game/addons/data_manager/panels/FolderEntryButton.gd delete mode 100644 game/addons/data_manager/panels/FolderEntryButton.tscn diff --git a/game/addons/data_manager/panels/FolderEntryButton.gd b/game/addons/data_manager/panels/FolderEntryButton.gd deleted file mode 100644 index 8fc59cbe..00000000 --- a/game/addons/data_manager/panels/FolderEntryButton.gd +++ /dev/null @@ -1,12 +0,0 @@ -tool -extends Button - -export(int) var tab = 0 - -var _panel - -func _pressed(): - _panel.set_tab(tab) - -func set_main_panel(panel): - _panel = panel diff --git a/game/addons/data_manager/panels/FolderEntryButton.tscn b/game/addons/data_manager/panels/FolderEntryButton.tscn deleted file mode 100644 index b720fb52..00000000 --- a/game/addons/data_manager/panels/FolderEntryButton.tscn +++ /dev/null @@ -1,10 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://addons/data_manager/panels/FolderEntryButton.gd" type="Script" id=1] - - -[node name="FolderEntryButton" type="Button"] -margin_right = 210.0 -margin_bottom = 20.0 -size_flags_horizontal = 3 -script = ExtResource( 1 ) diff --git a/game/addons/data_manager/panels/MainPanel.gd b/game/addons/data_manager/panels/MainPanel.gd index b2d5cbd3..969ca52e 100644 --- a/game/addons/data_manager/panels/MainPanel.gd +++ b/game/addons/data_manager/panels/MainPanel.gd @@ -4,11 +4,9 @@ extends Control const DataManagerAddonSettings = preload("res://addons/data_manager/resources/data_manager_addon_settings.gd") const add_icon = preload("res://addons/data_manager/icons/icon_add.png") - signal inspect_data export(PackedScene) var resource_scene : PackedScene -export(PackedScene) var folder_entry_button_scene : PackedScene export(String) var base_folder : String = "res://" export(NodePath) var main_container : NodePath export(NodePath) var module_entry_container_path : NodePath @@ -92,8 +90,11 @@ func generate_folder_entry_list() -> void: var module_dir_base : String = module.resource_path.get_base_dir() var index = 0 - for f in _settings.folders: - if !dir.dir_exists(module_dir_base + "/" + f.folder): + for j in range(_settings.get_folder_count()): + var f = _settings.folder_get(j) + var full_folder_path : String = module_dir_base + "/" + f.folder + + if !dir.dir_exists(full_folder_path): continue if f.header != "": @@ -102,14 +103,10 @@ func generate_folder_entry_list() -> void: _folder_entry_container.add_child(h) h.text = f.header - var fe : Node = folder_entry_button_scene.instance() - - _folder_entry_container.add_child(fe) - + var fe : Button = Button.new() fe.text = f.name - fe.tab = index - - fe.set_main_panel(self) + fe.connect("pressed", self, "on_folder_entry_button_pressed", [ module, full_folder_path, j ]) + _folder_entry_container.add_child(fe) index += 1 @@ -123,7 +120,11 @@ func generate_folder_entry_list() -> void: _folder_entry_container.add_child(add_folder_button) add_folder_button.connect("pressed", self, "on_add_folder_button_pressed", [ module ]) - set_tab(0) + #set_tab(0) + +func on_folder_entry_button_pressed(module, full_folder_path : String, folder_index : int) -> void: + #_resource_scene.show() + _resource_scene.set_resource_type(full_folder_path, _settings.folder_get_type(folder_index)) func on_module_entry_button_toggled(on : bool, module) -> void: if on: diff --git a/game/addons/data_manager/panels/MainPanel.tscn b/game/addons/data_manager/panels/MainPanel.tscn index 8fcd5321..9b6c7182 100644 --- a/game/addons/data_manager/panels/MainPanel.tscn +++ b/game/addons/data_manager/panels/MainPanel.tscn @@ -1,7 +1,6 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=4 format=2] [ext_resource path="res://addons/data_manager/panels/MainPanel.gd" type="Script" id=1] -[ext_resource path="res://addons/data_manager/panels/FolderEntryButton.tscn" type="PackedScene" id=2] [ext_resource path="res://addons/data_manager/panels/ResourcePanel.tscn" type="PackedScene" id=3] [ext_resource path="res://addons/data_manager/panels/AddFolderDialog.gd" type="Script" id=4] @@ -15,7 +14,6 @@ __meta__ = { "_edit_use_anchors_": false } resource_scene = ExtResource( 3 ) -folder_entry_button_scene = ExtResource( 2 ) base_folder = "res://data/" main_container = NodePath("HSplitContainer/MarginContainer") module_entry_container_path = NodePath("HSplitContainer/TabContainer/Modules/VBoxContainer")