Debugger: Add making debugger window floating
This commit is contained in:
parent
c31f47fe3d
commit
e2b0bd91e2
|
@ -133,15 +133,38 @@ void LimboDebuggerTab::_filter_changed(String p_text) {
|
||||||
_update_bt_player_list(active_bt_players, p_text);
|
_update_bt_player_list(active_bt_players, p_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
LimboDebuggerTab::LimboDebuggerTab(Ref<EditorDebuggerSession> p_session) {
|
void LimboDebuggerTab::_window_visibility_changed(bool p_visible) {
|
||||||
|
make_floating->set_visible(!p_visible);
|
||||||
|
}
|
||||||
|
|
||||||
|
LimboDebuggerTab::LimboDebuggerTab(Ref<EditorDebuggerSession> p_session, WindowWrapper *p_wrapper) {
|
||||||
session = p_session;
|
session = p_session;
|
||||||
|
window_wrapper = p_wrapper;
|
||||||
|
|
||||||
|
root_vb = memnew(VBoxContainer);
|
||||||
|
add_child(root_vb);
|
||||||
|
|
||||||
|
toolbar = memnew(HBoxContainer);
|
||||||
|
root_vb->add_child(toolbar);
|
||||||
|
|
||||||
hsc = memnew(HSplitContainer);
|
hsc = memnew(HSplitContainer);
|
||||||
add_child(hsc);
|
hsc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
|
hsc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
|
root_vb->add_child(hsc);
|
||||||
|
|
||||||
VBoxContainer *list_box = memnew(VBoxContainer);
|
VBoxContainer *list_box = memnew(VBoxContainer);
|
||||||
hsc->add_child(list_box);
|
hsc->add_child(list_box);
|
||||||
|
|
||||||
|
if (p_wrapper->is_window_available()) {
|
||||||
|
make_floating = memnew(ScreenSelect);
|
||||||
|
make_floating->set_flat(true);
|
||||||
|
make_floating->set_h_size_flags(Control::SIZE_EXPAND | Control::SIZE_SHRINK_END);
|
||||||
|
make_floating->set_tooltip_text(TTR("Make the LimboAI Debugger floating."));
|
||||||
|
make_floating->connect(SNAME("request_open_in_screen"), callable_mp(window_wrapper, &WindowWrapper::enable_window_on_screen).bind(true));
|
||||||
|
toolbar->add_child(make_floating);
|
||||||
|
p_wrapper->connect(SNAME("window_visibility_changed"), callable_mp(this, &LimboDebuggerTab::_window_visibility_changed));
|
||||||
|
}
|
||||||
|
|
||||||
filter_players = memnew(LineEdit);
|
filter_players = memnew(LineEdit);
|
||||||
filter_players->set_placeholder(TTR("Filter Players"));
|
filter_players->set_placeholder(TTR("Filter Players"));
|
||||||
filter_players->connect(SNAME("text_changed"), callable_mp(this, &LimboDebuggerTab::_filter_changed));
|
filter_players->connect(SNAME("text_changed"), callable_mp(this, &LimboDebuggerTab::_filter_changed));
|
||||||
|
@ -188,13 +211,32 @@ LimboDebuggerTab::LimboDebuggerTab(Ref<EditorDebuggerSession> p_session) {
|
||||||
|
|
||||||
//////////////////////// LimboDebuggerPlugin
|
//////////////////////// LimboDebuggerPlugin
|
||||||
|
|
||||||
|
void LimboDebuggerPlugin::_window_visibility_changed(bool p_visible) {
|
||||||
|
}
|
||||||
|
|
||||||
void LimboDebuggerPlugin::setup_session(int p_idx) {
|
void LimboDebuggerPlugin::setup_session(int p_idx) {
|
||||||
Ref<EditorDebuggerSession> session = get_session(p_idx);
|
Ref<EditorDebuggerSession> session = get_session(p_idx);
|
||||||
tab = memnew(LimboDebuggerTab(session));
|
|
||||||
|
if (tab != nullptr) {
|
||||||
|
tab->queue_free();
|
||||||
|
window_wrapper->queue_free();
|
||||||
|
}
|
||||||
|
|
||||||
|
window_wrapper = memnew(WindowWrapper);
|
||||||
|
window_wrapper->set_window_title(vformat(TTR("%s - Godot Engine"), TTR("LimboAI Debugger")));
|
||||||
|
window_wrapper->set_margins_enabled(true);
|
||||||
|
window_wrapper->set_name("LimboAI");
|
||||||
|
|
||||||
|
tab = memnew(LimboDebuggerTab(session, window_wrapper));
|
||||||
tab->set_name("LimboAI");
|
tab->set_name("LimboAI");
|
||||||
|
window_wrapper->set_wrapped_control(tab);
|
||||||
|
|
||||||
|
window_wrapper->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
|
window_wrapper->connect(SNAME("window_visibility_changed"), callable_mp(this, &LimboDebuggerPlugin::_window_visibility_changed));
|
||||||
|
|
||||||
session->connect(SNAME("started"), callable_mp(tab, &LimboDebuggerTab::start_session));
|
session->connect(SNAME("started"), callable_mp(tab, &LimboDebuggerTab::start_session));
|
||||||
session->connect(SNAME("stopped"), callable_mp(tab, &LimboDebuggerTab::stop_session));
|
session->connect(SNAME("stopped"), callable_mp(tab, &LimboDebuggerTab::stop_session));
|
||||||
session->add_session_tab(tab);
|
session->add_session_tab(window_wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LimboDebuggerPlugin::capture(const String &p_message, const Array &p_data, int p_session) {
|
bool LimboDebuggerPlugin::capture(const String &p_message, const Array &p_data, int p_session) {
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "core/object/object.h"
|
#include "core/object/object.h"
|
||||||
#include "core/typedefs.h"
|
#include "core/typedefs.h"
|
||||||
#include "editor/plugins/editor_debugger_plugin.h"
|
#include "editor/plugins/editor_debugger_plugin.h"
|
||||||
|
#include "editor/window_wrapper.h"
|
||||||
#include "scene/gui/box_container.h"
|
#include "scene/gui/box_container.h"
|
||||||
#include "scene/gui/item_list.h"
|
#include "scene/gui/item_list.h"
|
||||||
#include "scene/gui/panel_container.h"
|
#include "scene/gui/panel_container.h"
|
||||||
|
@ -33,20 +34,26 @@ class LimboDebuggerTab : public PanelContainer {
|
||||||
private:
|
private:
|
||||||
List<String> active_bt_players;
|
List<String> active_bt_players;
|
||||||
Ref<EditorDebuggerSession> session;
|
Ref<EditorDebuggerSession> session;
|
||||||
HSplitContainer *hsc;
|
VBoxContainer *root_vb = nullptr;
|
||||||
Label *info_message;
|
HBoxContainer *toolbar = nullptr;
|
||||||
ItemList *bt_player_list;
|
HSplitContainer *hsc = nullptr;
|
||||||
BehaviorTreeView *bt_view;
|
Label *info_message = nullptr;
|
||||||
VBoxContainer *view_box;
|
ItemList *bt_player_list = nullptr;
|
||||||
HBoxContainer *alert_box;
|
BehaviorTreeView *bt_view = nullptr;
|
||||||
TextureRect *alert_icon;
|
VBoxContainer *view_box = nullptr;
|
||||||
Label *alert_message;
|
HBoxContainer *alert_box = nullptr;
|
||||||
LineEdit *filter_players;
|
TextureRect *alert_icon = nullptr;
|
||||||
|
Label *alert_message = nullptr;
|
||||||
|
LineEdit *filter_players = nullptr;
|
||||||
|
|
||||||
|
Button *make_floating = nullptr;
|
||||||
|
WindowWrapper *window_wrapper = nullptr;
|
||||||
|
|
||||||
void _show_alert(const String &p_message);
|
void _show_alert(const String &p_message);
|
||||||
void _update_bt_player_list(const List<String> &p_node_paths, const String &p_filter);
|
void _update_bt_player_list(const List<String> &p_node_paths, const String &p_filter);
|
||||||
void _bt_selected(int p_idx);
|
void _bt_selected(int p_idx);
|
||||||
void _filter_changed(String p_text);
|
void _filter_changed(String p_text);
|
||||||
|
void _window_visibility_changed(bool p_visible);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void start_session();
|
void start_session();
|
||||||
|
@ -56,14 +63,17 @@ public:
|
||||||
String get_selected_bt_player();
|
String get_selected_bt_player();
|
||||||
void update_behavior_tree(const BehaviorTreeData &p_data);
|
void update_behavior_tree(const BehaviorTreeData &p_data);
|
||||||
|
|
||||||
LimboDebuggerTab(Ref<EditorDebuggerSession> p_session);
|
LimboDebuggerTab(Ref<EditorDebuggerSession> p_session, WindowWrapper *p_wrapper);
|
||||||
};
|
};
|
||||||
|
|
||||||
class LimboDebuggerPlugin : public EditorDebuggerPlugin {
|
class LimboDebuggerPlugin : public EditorDebuggerPlugin {
|
||||||
GDCLASS(LimboDebuggerPlugin, EditorDebuggerPlugin);
|
GDCLASS(LimboDebuggerPlugin, EditorDebuggerPlugin);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LimboDebuggerTab *tab;
|
LimboDebuggerTab *tab = nullptr;
|
||||||
|
WindowWrapper *window_wrapper = nullptr;
|
||||||
|
|
||||||
|
void _window_visibility_changed(bool p_visible);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void setup_session(int p_idx) override;
|
void setup_session(int p_idx) override;
|
||||||
|
|
Loading…
Reference in New Issue