2023-07-21 09:50:06 +00:00
|
|
|
/**
|
|
|
|
* limbo_debugger_plugin.h
|
|
|
|
* =============================================================================
|
|
|
|
* 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.
|
|
|
|
* =============================================================================
|
|
|
|
*/
|
2023-04-13 07:29:45 +00:00
|
|
|
|
2023-04-16 09:30:31 +00:00
|
|
|
#ifdef TOOLS_ENABLED
|
|
|
|
|
2023-04-13 07:29:45 +00:00
|
|
|
#ifndef LIMBO_DEBUGGER_PLUGIN_H
|
|
|
|
#define LIMBO_DEBUGGER_PLUGIN_H
|
|
|
|
|
2023-07-20 16:35:36 +00:00
|
|
|
#include "modules/limboai/editor/debugger/behavior_tree_data.h"
|
|
|
|
#include "modules/limboai/editor/debugger/behavior_tree_view.h"
|
|
|
|
|
2023-04-13 07:29:45 +00:00
|
|
|
#include "core/object/class_db.h"
|
|
|
|
#include "core/object/object.h"
|
|
|
|
#include "core/typedefs.h"
|
|
|
|
#include "editor/plugins/editor_debugger_plugin.h"
|
|
|
|
#include "scene/gui/box_container.h"
|
|
|
|
#include "scene/gui/item_list.h"
|
|
|
|
#include "scene/gui/panel_container.h"
|
|
|
|
#include "scene/gui/split_container.h"
|
|
|
|
#include "scene/gui/texture_rect.h"
|
|
|
|
|
|
|
|
class LimboDebuggerTab : public PanelContainer {
|
|
|
|
GDCLASS(LimboDebuggerTab, PanelContainer);
|
|
|
|
|
|
|
|
private:
|
2023-04-15 07:01:37 +00:00
|
|
|
List<String> active_bt_players;
|
2023-04-13 07:29:45 +00:00
|
|
|
Ref<EditorDebuggerSession> session;
|
|
|
|
HSplitContainer *hsc;
|
2023-04-15 07:01:37 +00:00
|
|
|
Label *info_message;
|
|
|
|
ItemList *bt_player_list;
|
2023-04-13 07:29:45 +00:00
|
|
|
BehaviorTreeView *bt_view;
|
|
|
|
VBoxContainer *view_box;
|
2023-04-15 07:01:37 +00:00
|
|
|
HBoxContainer *alert_box;
|
|
|
|
TextureRect *alert_icon;
|
|
|
|
Label *alert_message;
|
|
|
|
LineEdit *filter_players;
|
2023-04-13 07:29:45 +00:00
|
|
|
|
2023-04-15 07:01:37 +00:00
|
|
|
void _show_alert(const String &p_message);
|
|
|
|
void _update_bt_player_list(const List<String> &p_node_paths, const String &p_filter);
|
2023-04-13 07:29:45 +00:00
|
|
|
void _bt_selected(int p_idx);
|
2023-04-15 07:01:37 +00:00
|
|
|
void _filter_changed(String p_text);
|
2023-04-13 07:29:45 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
void start_session();
|
|
|
|
void stop_session();
|
2023-04-15 07:01:37 +00:00
|
|
|
void update_active_bt_players(const Array &p_node_paths);
|
2023-04-14 08:28:33 +00:00
|
|
|
BehaviorTreeView *get_behavior_tree_view() const { return bt_view; }
|
2023-04-15 07:01:37 +00:00
|
|
|
String get_selected_bt_player();
|
|
|
|
void update_behavior_tree(const BehaviorTreeData &p_data);
|
2023-04-13 07:29:45 +00:00
|
|
|
|
|
|
|
LimboDebuggerTab(Ref<EditorDebuggerSession> p_session);
|
|
|
|
};
|
|
|
|
|
|
|
|
class LimboDebuggerPlugin : public EditorDebuggerPlugin {
|
|
|
|
GDCLASS(LimboDebuggerPlugin, EditorDebuggerPlugin);
|
|
|
|
|
|
|
|
private:
|
|
|
|
LimboDebuggerTab *tab;
|
|
|
|
|
|
|
|
public:
|
|
|
|
void setup_session(int p_idx) override;
|
|
|
|
bool has_capture(const String &p_capture) const override;
|
|
|
|
bool capture(const String &p_message, const Array &p_data, int p_session) override;
|
|
|
|
|
|
|
|
LimboDebuggerPlugin();
|
|
|
|
};
|
|
|
|
|
2023-04-16 09:30:31 +00:00
|
|
|
#endif // LIMBO_DEBUGGER_PLUGIN
|
|
|
|
|
|
|
|
#endif // TOOLS_ENABLED
|