Skip to content

Commit

Permalink
Fix using Edit on exported Node property
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSofox committed Oct 13, 2024
1 parent 842f982 commit 3a5227d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
13 changes: 9 additions & 4 deletions editor/editor_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions editor/editor_properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ class EditorPropertyNodePath : public EditorProperty {
Vector<StringName> 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);
Expand Down

0 comments on commit 3a5227d

Please sign in to comment.