diff options
Diffstat (limited to 'editor/property_editor.cpp')
-rw-r--r-- | editor/property_editor.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 0777b6950e..53d94cdb18 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -862,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,7 +1273,18 @@ 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: { @@ -3736,6 +3751,10 @@ void PropertyEditor::_item_selected() { selected_property = item->get_metadata(1); } +void PropertyEditor::_item_rmb_edited() { + _custom_editor_request(true); +} + void PropertyEditor::_edit_set(const String &p_name, const Variant &p_value, bool p_refresh_all, const String &p_changed_field) { if (autoclear) { @@ -4232,6 +4251,7 @@ void PropertyEditor::_bind_methods() { ClassDB::bind_method("_item_edited", &PropertyEditor::_item_edited); ClassDB::bind_method("_item_selected", &PropertyEditor::_item_selected); + ClassDB::bind_method("_item_rmb_edited", &PropertyEditor::_item_rmb_edited); ClassDB::bind_method("_item_folded", &PropertyEditor::_item_folded); ClassDB::bind_method("_custom_editor_request", &PropertyEditor::_custom_editor_request); ClassDB::bind_method("_custom_editor_edited", &PropertyEditor::_custom_editor_edited); @@ -4386,6 +4406,7 @@ PropertyEditor::PropertyEditor() { add_child(tree); tree->connect("item_edited", this, "_item_edited", varray(), CONNECT_DEFERRED); + tree->connect("item_rmb_edited", this, "_item_rmb_edited"); tree->connect("cell_selected", this, "_item_selected"); tree->connect("item_collapsed", this, "_item_folded"); |