From 87b881c6fd6401c98a493360fedfc5829cb5890e Mon Sep 17 00:00:00 2001 From: Jakub Grzesik Date: Wed, 2 Aug 2017 19:40:17 +0200 Subject: [PATCH] NodePath option to find target in editor node tree --- editor/property_editor.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 42485317c15..ec085ea9f20 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -45,7 +45,6 @@ #include "pair.h" #include "print_string.h" #include "project_settings.h" -#include "project_settings.h" #include "property_selector.h" #include "scene/gui/label.h" #include "scene/main/viewport.h" @@ -863,6 +862,10 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: List names; names.push_back(TTR("Assign")); names.push_back(TTR("Clear")); + + if (owner->is_class("Node") && (v.get_type() == Variant::NODE_PATH) && owner->cast_to()->has_node(v)) + names.push_back(TTR("Select Node")); + config_action_buttons(names); } break; @@ -1269,8 +1272,19 @@ void CustomPropertyEditor::_action_pressed(int p_which) { v = NodePath(); emit_signal("variant_changed"); + hide(); + } else if (p_which == 2) { + + if (owner->is_class("Node") && (v.get_type() == Variant::NODE_PATH) && owner->cast_to()->has_node(v)) { + + Node *target_node = owner->cast_to()->get_node(v); + EditorNode::get_singleton()->get_editor_selection()->clear(); + EditorNode::get_singleton()->get_scene_tree_dock()->set_selected(target_node); + } + hide(); } + } break; case Variant::OBJECT: {