/** * task_palette.cpp * ============================================================================= * Copyright 2021-2023 Serhii Snitsaruk * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= */ #include "task_palette.h" #include "modules/limboai/util/limbo_task_db.h" #include "modules/limboai/util/limbo_utility.h" #include "core/config/project_settings.h" #include "core/error/error_macros.h" #include "editor/editor_help.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" #include "editor/editor_scale.h" #include "editor/plugins/script_editor_plugin.h" #include "scene/gui/check_box.h" //**** TaskButton Control *TaskButton::make_custom_tooltip(const String &p_text) const { EditorHelpBit *help_bit = memnew(EditorHelpBit); help_bit->get_rich_text()->set_custom_minimum_size(Size2(360 * EDSCALE, 1)); String help_text; if (!p_text.is_empty()) { help_text = p_text; } else { help_text = "[i]" + TTR("No description.") + "[/i]"; } help_bit->set_text(help_text); return help_bit; } //**** TaskButton ^ //**** TaskPaletteSection void TaskPaletteSection::_on_task_button_pressed(const String &p_task) { emit_signal(SNAME("task_button_pressed"), p_task); } void TaskPaletteSection::_on_task_button_gui_input(const Ref &p_event, const String &p_task) { if (!p_event->is_pressed()) { return; } Ref mb = p_event; if (mb.is_valid() && mb->get_button_index() == MouseButton::RIGHT) { emit_signal(SNAME("task_button_rmb"), p_task); } } void TaskPaletteSection::_on_header_pressed() { set_collapsed(!is_collapsed()); } void TaskPaletteSection::set_filter(String p_filter_text) { int num_hidden = 0; if (p_filter_text.is_empty()) { for (int i = 0; i < tasks_container->get_child_count(); i++) { Object::cast_to