summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Alexsander Silva Dias <michaelalexsander@protonmail.com>2018-11-22 15:11:09 -0200
committerMichael Alexsander Silva Dias <michaelalexsander@protonmail.com>2018-11-22 19:41:10 -0200
commit2049efc1e3e7ff1981856e2a9a88ac7382cb09d7 (patch)
treec66ba12d1bc1a2461a8e74f4e9dde95a6dd33f11
parent7a9e4c26024e93fd5ab7a39fd62d63d5ea074d1a (diff)
General fixes for the new unified help search
-rw-r--r--doc/classes/Tree.xml4
-rw-r--r--editor/editor_help_search.cpp12
2 files changed, 11 insertions, 5 deletions
diff --git a/doc/classes/Tree.xml b/doc/classes/Tree.xml
index 14be256d85..1ad8166b91 100644
--- a/doc/classes/Tree.xml
+++ b/doc/classes/Tree.xml
@@ -315,12 +315,12 @@
<argument index="0" name="position" type="Vector2">
</argument>
<description>
- Emitted when an item is selected with right mouse button.
+ Emitted when an item is selected with the right mouse button.
</description>
</signal>
<signal name="item_selected">
<description>
- Emitted when an item is selected with right mouse button.
+ Emitted when an item is selected.
</description>
</signal>
<signal name="multi_selected">
diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp
index f5717ddf2a..55d28871c8 100644
--- a/editor/editor_help_search.cpp
+++ b/editor/editor_help_search.cpp
@@ -53,6 +53,7 @@ void EditorHelpSearch::_load_settings() {
if (enable_rl) {
results_tree->add_constant_override("draw_relationship_lines", 1);
results_tree->add_color_override("relationship_line_color", rl_color);
+ results_tree->add_constant_override("draw_guides", 0);
} else {
results_tree->add_constant_override("draw_relationship_lines", 0);
results_tree->add_constant_override("draw_guides", 1);
@@ -114,10 +115,13 @@ void EditorHelpSearch::_filter_combo_item_selected(int p_option) {
void EditorHelpSearch::_confirmed() {
+ TreeItem *item = results_tree->get_selected();
+ if (!item)
+ return;
+
// Activate the script editor and emit the signal with the documentation link to display.
EditorNode::get_singleton()->set_visible_editor(EditorNode::EDITOR_SCRIPT);
- TreeItem *item = results_tree->get_selected();
emit_signal("go_to_help", item->get_metadata(0));
hide();
@@ -139,6 +143,7 @@ void EditorHelpSearch::_notification(int p_what) {
case NOTIFICATION_POPUP_HIDE: {
results_tree->clear();
+ get_ok()->set_disabled(true);
EditorSettings::get_singleton()->set("interface/dialogs/search_help_bounds", get_rect());
} break;
case NOTIFICATION_PROCESS: {
@@ -147,7 +152,7 @@ void EditorHelpSearch::_notification(int p_what) {
if (search.is_valid()) {
if (search->work()) {
// Search done.
- get_ok()->set_disabled(results_tree->get_root()->get_children() == NULL);
+ get_ok()->set_disabled(!results_tree->get_selected());
search = Ref<Runner>();
set_process(false);
}
@@ -256,6 +261,7 @@ EditorHelpSearch::EditorHelpSearch() {
results_tree->set_hide_root(true);
results_tree->set_select_mode(Tree::SELECT_ROW);
results_tree->connect("item_activated", this, "_confirmed");
+ results_tree->connect("item_selected", get_ok(), "set_disabled", varray(false));
vbox->add_child(results_tree, true);
_load_settings();
@@ -463,7 +469,7 @@ TreeItem *EditorHelpSearch::Runner::_create_class_item(TreeItem *p_parent, const
Ref<Texture> icon = empty_icon;
if (ui_service->has_icon(p_doc->name, "EditorIcons"))
icon = ui_service->get_icon(p_doc->name, "EditorIcons");
- else if (ClassDB::is_parent_class(p_doc->name, "Object"))
+ else if (ClassDB::class_exists(p_doc->name) && ClassDB::is_parent_class(p_doc->name, "Object"))
icon = ui_service->get_icon("Object", "EditorIcons");
String tooltip = p_doc->brief_description.strip_edges();