Now clicking the fodler entries will again pass the relevant informations to the resource panel.

This commit is contained in:
Relintai 2022-01-26 22:09:47 +01:00
parent 1ee8220992
commit 9f1d06c7f8
4 changed files with 14 additions and 37 deletions

View File

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

View File

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

View File

@ -4,11 +4,9 @@ extends Control
const DataManagerAddonSettings = preload("res://addons/data_manager/resources/data_manager_addon_settings.gd") 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") const add_icon = preload("res://addons/data_manager/icons/icon_add.png")
signal inspect_data signal inspect_data
export(PackedScene) var resource_scene : PackedScene export(PackedScene) var resource_scene : PackedScene
export(PackedScene) var folder_entry_button_scene : PackedScene
export(String) var base_folder : String = "res://" export(String) var base_folder : String = "res://"
export(NodePath) var main_container : NodePath export(NodePath) var main_container : NodePath
export(NodePath) var module_entry_container_path : 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 module_dir_base : String = module.resource_path.get_base_dir()
var index = 0 var index = 0
for f in _settings.folders: for j in range(_settings.get_folder_count()):
if !dir.dir_exists(module_dir_base + "/" + f.folder): var f = _settings.folder_get(j)
var full_folder_path : String = module_dir_base + "/" + f.folder
if !dir.dir_exists(full_folder_path):
continue continue
if f.header != "": if f.header != "":
@ -102,14 +103,10 @@ func generate_folder_entry_list() -> void:
_folder_entry_container.add_child(h) _folder_entry_container.add_child(h)
h.text = f.header h.text = f.header
var fe : Node = folder_entry_button_scene.instance() var fe : Button = Button.new()
_folder_entry_container.add_child(fe)
fe.text = f.name fe.text = f.name
fe.tab = index fe.connect("pressed", self, "on_folder_entry_button_pressed", [ module, full_folder_path, j ])
_folder_entry_container.add_child(fe)
fe.set_main_panel(self)
index += 1 index += 1
@ -123,7 +120,11 @@ func generate_folder_entry_list() -> void:
_folder_entry_container.add_child(add_folder_button) _folder_entry_container.add_child(add_folder_button)
add_folder_button.connect("pressed", self, "on_add_folder_button_pressed", [ module ]) 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: func on_module_entry_button_toggled(on : bool, module) -> void:
if on: if on:

View File

@ -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/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/ResourcePanel.tscn" type="PackedScene" id=3]
[ext_resource path="res://addons/data_manager/panels/AddFolderDialog.gd" type="Script" id=4] [ext_resource path="res://addons/data_manager/panels/AddFolderDialog.gd" type="Script" id=4]
@ -15,7 +14,6 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
resource_scene = ExtResource( 3 ) resource_scene = ExtResource( 3 )
folder_entry_button_scene = ExtResource( 2 )
base_folder = "res://data/" base_folder = "res://data/"
main_container = NodePath("HSplitContainer/MarginContainer") main_container = NodePath("HSplitContainer/MarginContainer")
module_entry_container_path = NodePath("HSplitContainer/TabContainer/Modules/VBoxContainer") module_entry_container_path = NodePath("HSplitContainer/TabContainer/Modules/VBoxContainer")