From 3a5227d32edcb4ec3e27ea7823845023cfc2367e Mon Sep 17 00:00:00 2001 From: Sofox Date: Sun, 13 Oct 2024 13:44:28 +0100 Subject: [PATCH] Fix using Edit on exported Node property --- editor/editor_properties.cpp | 13 +++++++++---- editor/editor_properties.h | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index c5a35e466c91..7c50eac79966 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -2662,14 +2662,19 @@ void EditorPropertyNodePath::_node_selected(const NodePath &p_path) { path = base_node->get_path().rel_path_to(p_path); } + _submit_relative_node_path(path); +} + +void EditorPropertyNodePath::_submit_relative_node_path(const NodePath &p_path) { + Node *base_node = get_base_node(); if (editing_node) { if (!base_node) { - emit_changed(get_edited_property(), get_tree()->get_edited_scene_root()->get_node(path)); + emit_changed(get_edited_property(), get_tree()->get_edited_scene_root()->get_node(p_path)); } else { - emit_changed(get_edited_property(), base_node->get_node(path)); + emit_changed(get_edited_property(), base_node->get_node(p_path)); } } else { - emit_changed(get_edited_property(), path); + emit_changed(get_edited_property(), p_path); } update_property(); } @@ -2748,7 +2753,7 @@ void EditorPropertyNodePath::_accept_text() { void EditorPropertyNodePath::_text_submitted(const String &p_text) { NodePath np = p_text; - emit_changed(get_edited_property(), np); + _submit_relative_node_path(np); edit->hide(); assign->show(); menu->show(); diff --git a/editor/editor_properties.h b/editor/editor_properties.h index 004630da3e22..dd2c808cb6bb 100644 --- a/editor/editor_properties.h +++ b/editor/editor_properties.h @@ -630,6 +630,7 @@ class EditorPropertyNodePath : public EditorProperty { Vector valid_types; void _node_selected(const NodePath &p_path); void _node_assign(); + void _submit_relative_node_path(const NodePath &p_path); Node *get_base_node(); void _update_menu(); void _menu_option(int p_idx);