You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-12 13:20:55 +00:00
NodePath option to find target in editor node tree
This commit is contained in:
@@ -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<String> 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<Node>()->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<Node>()->has_node(v)) {
|
||||
|
||||
Node *target_node = owner->cast_to<Node>()->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: {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user