From cff4626b2ddb97f5ea77a1a9a01b52fa1039957a Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Sat, 26 Aug 2023 10:08:01 +0200 Subject: [PATCH] Extract TaskPanel code => TaskPalette --- editor/limbo_ai_editor_plugin.cpp | 348 +---------------------------- editor/limbo_ai_editor_plugin.h | 73 +----- editor/task_palette.cpp | 354 ++++++++++++++++++++++++++++++ editor/task_palette.h | 91 ++++++++ 4 files changed, 454 insertions(+), 412 deletions(-) create mode 100644 editor/task_palette.cpp create mode 100644 editor/task_palette.h diff --git a/editor/limbo_ai_editor_plugin.cpp b/editor/limbo_ai_editor_plugin.cpp index accccdb..c77a0c5 100644 --- a/editor/limbo_ai_editor_plugin.cpp +++ b/editor/limbo_ai_editor_plugin.cpp @@ -357,340 +357,6 @@ TaskTree::~TaskTree() { //**** TaskTree ^ -//**** 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 ^ - -//**** TaskSection - -void TaskSection::_on_task_button_pressed(const String &p_task) { - emit_signal(SNAME("task_button_pressed"), p_task); -} - -void TaskSection::_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 TaskSection::_on_header_pressed() { - set_collapsed(!is_collapsed()); -} - -void TaskSection::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