summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-09-13 14:05:14 +0200
committerGitHub <noreply@github.com>2021-09-13 14:05:14 +0200
commit1994525fc285f903e8603ea5403c6062c112ce7d (patch)
tree9cb80571fdc86076c6ee883fde2fded8f9e4745e
parentdde48ebed6303b53a912005570179382e3bd250b (diff)
parent5260fd8f3eac1c0ac2e50b13ff1fa10f44823e3e (diff)
Merge pull request #51981 from kleonc/multi-node-edit-node_path-fix
MultiNodeEdit Fix setting NodePath
-rw-r--r--editor/multi_node_edit.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/editor/multi_node_edit.cpp b/editor/multi_node_edit.cpp
index fd4a4334fc..1e707c1a60 100644
--- a/editor/multi_node_edit.cpp
+++ b/editor/multi_node_edit.cpp
@@ -49,6 +49,11 @@ bool MultiNodeEdit::_set_impl(const StringName &p_name, const Variant &p_value,
name = "script";
}
+ Node *node_path_target = nullptr;
+ if (p_value.get_type() == Variant::NODE_PATH && p_value != NodePath()) {
+ node_path_target = es->get_node(p_value);
+ }
+
UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("MultiNode Set") + " " + String(name), UndoRedo::MERGE_ENDS);
@@ -63,9 +68,11 @@ bool MultiNodeEdit::_set_impl(const StringName &p_name, const Variant &p_value,
}
if (p_value.get_type() == Variant::NODE_PATH) {
- Node *tonode = n->get_node(p_value);
- NodePath p_path = n->get_path_to(tonode);
- ur->add_do_property(n, name, p_path);
+ NodePath path;
+ if (node_path_target) {
+ path = n->get_path_to(node_path_target);
+ }
+ ur->add_do_property(n, name, path);
} else {
Variant new_value;
if (p_field == "") {