refactored the way levels are listed in the toolbox
Some checks failed
Create tag and build when new code gets to main / BumpTag (push) Successful in 19s
Create tag and build when new code gets to main / Export (push) Has been cancelled
Create tag and build when new code gets to main / Test (push) Has been cancelled

This commit is contained in:
2026-02-04 11:57:30 +01:00
parent cd519e528f
commit fad528faa1
12 changed files with 1220 additions and 319 deletions

View File

@@ -3,6 +3,8 @@ extends Node
class_name SceneLister
## Helper class for listing all the scenes in a directory.
@export_tool_button("Refresh files", "Callable") var refresh_files = _refresh_files
## List of paths to scene files.
## Prefilled in the editor by selecting a directory.
@export var files : Array[String]
@@ -14,10 +16,20 @@ class_name SceneLister
func _refresh_files():
if not is_inside_tree() or directory.is_empty(): return
var dir_access = DirAccess.open(directory)
files.clear()
find_files_in_dir(directory)
func find_files_in_dir(current_dir: String) -> void:
if not is_inside_tree() or directory.is_empty():
return
var dir_access = DirAccess.open(current_dir)
if dir_access:
files.clear()
for file in dir_access.get_files():
print(current_dir + "/" + file)
if not file.ends_with(".tscn"):
continue
files.append(directory + "/" + file)
files.append(current_dir + "/" + file)
for sub_directory in dir_access.get_directories():
if sub_directory.begins_with("_"):
continue
find_files_in_dir(directory + "/" + sub_directory)