summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sichma <sichmada@gmail.com>2018-10-25 14:31:59 +0200
committerDavid Sichma <sichmada@gmail.com>2018-10-26 22:16:38 +0200
commit4e9c41122917595e4eb043dd1aaf838c72244b52 (patch)
treef19251985a71565f201e6d7a83a0f2a19ad19e0f
parent81c2ed61f64e1f9d5247293b307690bd312f1be1 (diff)
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 96d482f47e..b53767ba62 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);