From 7a7f8489867120f5cfa8401b2f8e82799e0d9c39 Mon Sep 17 00:00:00 2001 From: Jian-Hong Pan Date: Thu, 10 Oct 2024 11:46:51 +0200 Subject: [PATCH] Util: Fix getting sub-scene's root path Cuurently, it prepends the "/root/" to the node's name as the path, if the node is the scene's root node. But, the absolute path reference points to nothing and leads NULL accessment. So, do not reform the path for the root node of the scene. --- addons/block_code/ui/util.gd | 5 ----- 1 file changed, 5 deletions(-) diff --git a/addons/block_code/ui/util.gd b/addons/block_code/ui/util.gd index 1a9c6ea5..70c84781 100644 --- a/addons/block_code/ui/util.gd +++ b/addons/block_code/ui/util.gd @@ -39,11 +39,6 @@ static func node_scene_path(node: Node, reference: Node, path_root: Node = null) if node.unique_name_in_owner: # With unique_name_in_owner, just use the % prefixed name. return NodePath("%%%s" % node.name) - elif node.is_ancestor_of(reference): - # If the node is an ancestor of the reference, it would begin - # with an ugly ../. Use an absolute path where /root is the - # path_root node. - return NodePath("/root/%s" % path_root.get_path_to(node)) else: # The node is reference or a child of it. Use a relative path. return reference.get_path_to(node)