godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.11k stars 20.2k forks source link

Root path is counterintuitive; path debugging tools are lacking #85429

Open rpahut opened 9 months ago

rpahut commented 9 months ago

Godot version

v3.5.2.stable.mono.official [170ba337a]

System information

Windows 10

Issue description

The path of the root node is counterintuitive; when a wrong path is used, the tools available are of little help in identifying and resoving the mistake.

In a normal path logic, a "/" would have been the path for a root. It makes no sense to specify "/root" unless there can also exist a "/nonroot" or other sibling nodes (but in that case a "/root" would not have been a root).

When a wrong absolute path with no "root" in it is used by mistake, no nodes can be accessed. Neither reading into the error message, nor visually inspecting the path, nor inspecting the remote scene in the editor reveals what the mistake is.

Ideally, if there is a root node it should be addresable by "/". Alternatively, if multiple nodes should coexist at "/", calling any one of them a "root" better be avoided as misleading. Copying path in the remote scene inspector should yield a complete absolute path, for any node there, including root. Checks in path handling code should identify when an impossible path such as "/" is used and report it as such, rather than simply reporting there is no node.

The issue is likely not version or OS specific.

Steps to reproduce

Pass the root path "/" into GetNode() GetNode("/") observe no node returned, and no part of the error message explaining why there is no node at / .

Run any scene, switch to Remote tab in the editor and Copy Node Path on any non-root node. Observe the initial "/root" part missing in the copied path. Copy Node Path on a root node. Observe it having a useless value of "." .

A valid complete absolute path can only be seen from Node.GetPath() .

Minimal reproduction project

-

Calinou commented 9 months ago

Ideally, if there is a root node it should be addresable by "/".

This is godot-proposals territory :slightly_smiling_face: