Reach nodes by unique name instead of long paths

Nodes a script uses through a path of several nodes are marked unique in their
scene and found with %Name. The search list is renamed SearchResults, and the
player row's nodes get their real types.
This commit is contained in:
Sansan committed 2026-10-06 11:44:47 +02:00
1 parent 390da577d7
commit 674604425f
17 files changed
+54 -24

No files matched your search

+10 -1
View File
@@ -58,6 +58,11 @@ const RENAMED_SCENES: Dictionary = {
"Player": "PlayerRow",
}
## Nodes renamed inside a popup: old path from the main window, and new path.
const RENAMED_PATHS: Dictionary = {
"SearchPopup/ScrollContainer/VBoxContainer": "SearchPopup/ScrollContainer/SearchResults",
}
## How far a node may be from its old place, in pixels.
const TOLERANCE: float = 0.5
@@ -96,7 +101,11 @@ static func new_path(old_path: String) -> String:
parts[i] = RENAMED_SCENES.get(parts[i], parts[i])
var first: String = parts[0]
parts[0] = MOVED.get(first, first)
return "/".join(parts)
var path: String = "/".join(parts)
for renamed: String in RENAMED_PATHS:
if path == renamed || path.begins_with(renamed + "/"):
return RENAMED_PATHS[renamed] + path.trim_prefix(renamed)
return path
func _baseline() -> Dictionary: