summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2018-11-01 13:59:59 -0300
committerGitHub <noreply@github.com>2018-11-01 13:59:59 -0300
commit74d895425d94334fe5a027c5534d5b60c2bbe0bc (patch)
tree26d1165ef3fe3daae0d8216eb5907408aaa7297f
parent1d301870ac237714a77138bf4cbc0e7b58a22baa (diff)
parent4e9c41122917595e4eb043dd1aaf838c72244b52 (diff)
Merge pull request #23313 from DavidSichma/viewport-reassign
Handling NodePaths in in-place Editor for Resources
-rw-r--r--editor/editor_properties.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 5148c12160..7c3e6dc386 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -1802,8 +1802,13 @@ void EditorPropertyNodePath::_node_selected(const NodePath &p_path) {
NodePath path = p_path;
Node *base_node = Object::cast_to<Node>(get_edited_object());
- if (base_node == NULL && get_edited_object()->has_method("get_root_path")) {
- base_node = get_edited_object()->call("get_root_path");
+ if (base_node == NULL) {
+ if (Object::cast_to<Resource>(get_edited_object())) {
+ Node *to_node = get_node(p_path);
+ path = get_tree()->get_edited_scene_root()->get_path_to(to_node);
+ } else if (get_edited_object()->has_method("get_root_path")) {
+ base_node = get_edited_object()->call("get_root_path");
+ }
}
if (base_node) { // for AnimationTrackKeyEdit
path = base_node->get_path().rel_path_to(p_path);