diff options
| author | Juan Linietsky | 2017-06-04 20:35:08 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2017-06-04 20:35:45 -0300 |
| commit | 01198cb896297da2b6d853caf583cf9e5bbba730 (patch) | |
| tree | 5575b51107111a0d14b3be3a3e385451736f40bf /editor/property_editor.cpp | |
| parent | 5aa66d03d8b4d66ccdcfbc6c5c20e7bb510ac87a (diff) | |
| download | godot-01198cb896297da2b6d853caf583cf9e5bbba730.tar.gz godot-01198cb896297da2b6d853caf583cf9e5bbba730.tar.zst godot-01198cb896297da2b6d853caf583cf9e5bbba730.zip | |
Removed stupid right arrow to edit resource. Now simply click it..
Diffstat (limited to 'editor/property_editor.cpp')
| -rw-r--r-- | editor/property_editor.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 1c8a1c0ee..b113d1b7a 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -2310,6 +2310,7 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String &p if (obj->get(p_name).get_type() == Variant::NIL || obj->get(p_name).operator RefPtr().is_null()) { p_item->set_text(1, "<null>"); p_item->set_icon(1, Ref<Texture>()); + p_item->set_custom_as_button(1, false); Dictionary d = p_item->get_metadata(0); int hint = d.has("hint") ? d["hint"].operator int() : -1; @@ -2319,6 +2320,7 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String &p } } else { + p_item->set_custom_as_button(1, true); RES res = obj->get(p_name).operator RefPtr(); if (res->is_class("Texture")) { int tw = EditorSettings::get_singleton()->get("docks/property_editor/texture_preview_width"); @@ -3540,17 +3542,21 @@ void PropertyEditor::update_tree() { item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM); item->set_editable(1, !read_only); - item->add_button(1, get_icon("EditResource", "EditorIcons")); + //item->add_button(1, get_icon("EditResource", "EditorIcons")); String type; if (p.hint == PROPERTY_HINT_RESOURCE_TYPE) type = p.hint_string; - if (obj->get(p.name).get_type() == Variant::NIL || obj->get(p.name).operator RefPtr().is_null()) { + RES res = obj->get(p.name).operator RefPtr(); + + if (obj->get(p.name).get_type() == Variant::NIL || res.is_null()) { item->set_text(1, "<null>"); item->set_icon(1, Ref<Texture>()); + item->set_custom_as_button(1, false); - } else { - RES res = obj->get(p.name).operator RefPtr(); + } else if (res.is_valid()) { + + item->set_custom_as_button(1, true); if (res->is_class("Texture")) { int tw = EditorSettings::get_singleton()->get("docks/property_editor/texture_preview_width"); @@ -3854,6 +3860,16 @@ void PropertyEditor::_item_edited() { _edit_set(name, NodePath(item->get_text(1)), refresh_all); } break; + case Variant::OBJECT: { + if (!item->is_custom_set_as_button(1)) + break; + + RES res = obj->get(name); + if (res.is_valid()) { + emit_signal("resource_selected", res.get_ref_ptr(), name); + } + + } break; case Variant::DICTIONARY: { |
