Add "Open Debugger" menu option and "Misc" menu
This commit is contained in:
parent
e851011678
commit
2afdb4bc95
|
@ -32,9 +32,10 @@
|
||||||
#include "scene/gui/label.h"
|
#include "scene/gui/label.h"
|
||||||
#include "scene/gui/line_edit.h"
|
#include "scene/gui/line_edit.h"
|
||||||
#include "scene/gui/split_container.h"
|
#include "scene/gui/split_container.h"
|
||||||
|
#include "scene/gui/tab_container.h"
|
||||||
#include "scene/gui/texture_rect.h"
|
#include "scene/gui/texture_rect.h"
|
||||||
|
|
||||||
/////////////////////// LimboDebuggerTab
|
//**** LimboDebuggerTab
|
||||||
|
|
||||||
void LimboDebuggerTab::start_session() {
|
void LimboDebuggerTab::start_session() {
|
||||||
bt_player_list->clear();
|
bt_player_list->clear();
|
||||||
|
@ -209,7 +210,9 @@ LimboDebuggerTab::LimboDebuggerTab(Ref<EditorDebuggerSession> p_session, WindowW
|
||||||
stop_session();
|
stop_session();
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////// LimboDebuggerPlugin
|
//**** LimboDebuggerPlugin
|
||||||
|
|
||||||
|
LimboDebuggerPlugin *LimboDebuggerPlugin::singleton = nullptr;
|
||||||
|
|
||||||
void LimboDebuggerPlugin::_window_visibility_changed(bool p_visible) {
|
void LimboDebuggerPlugin::_window_visibility_changed(bool p_visible) {
|
||||||
}
|
}
|
||||||
|
@ -259,8 +262,23 @@ bool LimboDebuggerPlugin::has_capture(const String &p_capture) const {
|
||||||
return p_capture == "limboai";
|
return p_capture == "limboai";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WindowWrapper *LimboDebuggerPlugin::get_session_tab() const {
|
||||||
|
return window_wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
int LimboDebuggerPlugin::get_session_tab_index() const {
|
||||||
|
TabContainer *c = Object::cast_to<TabContainer>(window_wrapper->get_parent());
|
||||||
|
ERR_FAIL_COND_V(c == nullptr, -1);
|
||||||
|
return c->get_tab_idx_from_control(window_wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
LimboDebuggerPlugin::LimboDebuggerPlugin() {
|
LimboDebuggerPlugin::LimboDebuggerPlugin() {
|
||||||
tab = nullptr;
|
tab = nullptr;
|
||||||
|
singleton = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
LimboDebuggerPlugin::~LimboDebuggerPlugin() {
|
||||||
|
singleton = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TOOLS_ENABLED
|
#endif // TOOLS_ENABLED
|
||||||
|
|
|
@ -70,17 +70,25 @@ class LimboDebuggerPlugin : public EditorDebuggerPlugin {
|
||||||
GDCLASS(LimboDebuggerPlugin, EditorDebuggerPlugin);
|
GDCLASS(LimboDebuggerPlugin, EditorDebuggerPlugin);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static LimboDebuggerPlugin *singleton;
|
||||||
|
|
||||||
LimboDebuggerTab *tab = nullptr;
|
LimboDebuggerTab *tab = nullptr;
|
||||||
WindowWrapper *window_wrapper = nullptr;
|
WindowWrapper *window_wrapper = nullptr;
|
||||||
|
|
||||||
void _window_visibility_changed(bool p_visible);
|
void _window_visibility_changed(bool p_visible);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static _FORCE_INLINE_ LimboDebuggerPlugin *get_singleton() { return singleton; }
|
||||||
|
|
||||||
void setup_session(int p_idx) override;
|
void setup_session(int p_idx) override;
|
||||||
bool has_capture(const String &p_capture) const override;
|
bool has_capture(const String &p_capture) const override;
|
||||||
bool capture(const String &p_message, const Array &p_data, int p_session) override;
|
bool capture(const String &p_message, const Array &p_data, int p_session) override;
|
||||||
|
|
||||||
|
WindowWrapper *get_session_tab() const;
|
||||||
|
int get_session_tab_index() const;
|
||||||
|
|
||||||
LimboDebuggerPlugin();
|
LimboDebuggerPlugin();
|
||||||
|
~LimboDebuggerPlugin();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LIMBO_DEBUGGER_PLUGIN
|
#endif // LIMBO_DEBUGGER_PLUGIN
|
||||||
|
|
|
@ -50,6 +50,8 @@
|
||||||
#include "core/variant/callable.h"
|
#include "core/variant/callable.h"
|
||||||
#include "core/variant/dictionary.h"
|
#include "core/variant/dictionary.h"
|
||||||
#include "core/variant/variant.h"
|
#include "core/variant/variant.h"
|
||||||
|
#include "editor/debugger/editor_debugger_node.h"
|
||||||
|
#include "editor/debugger/script_editor_debugger.h"
|
||||||
#include "editor/editor_file_system.h"
|
#include "editor/editor_file_system.h"
|
||||||
#include "editor/editor_inspector.h"
|
#include "editor/editor_inspector.h"
|
||||||
#include "editor/editor_node.h"
|
#include "editor/editor_node.h"
|
||||||
|
@ -1064,6 +1066,21 @@ void LimboAIEditor::_action_selected(int p_id) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LimboAIEditor::_misc_option_selected(int p_id) {
|
||||||
|
switch (p_id) {
|
||||||
|
case MISC_OPEN_DEBUGGER: {
|
||||||
|
ERR_FAIL_COND(LimboDebuggerPlugin::get_singleton() == nullptr);
|
||||||
|
if (LimboDebuggerPlugin::get_singleton()->get_session_tab()->get_window_enabled()) {
|
||||||
|
LimboDebuggerPlugin::get_singleton()->get_session_tab()->set_window_enabled(true);
|
||||||
|
} else {
|
||||||
|
EditorNode::get_singleton()->make_bottom_panel_item_visible(EditorDebuggerNode::get_singleton());
|
||||||
|
EditorDebuggerNode::get_singleton()->get_default_debugger()->switch_to_debugger(
|
||||||
|
LimboDebuggerPlugin::get_singleton()->get_session_tab_index());
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void LimboAIEditor::_on_tree_task_selected(const Ref<BTTask> &p_task) {
|
void LimboAIEditor::_on_tree_task_selected(const Ref<BTTask> &p_task) {
|
||||||
EditorNode::get_singleton()->edit_resource(p_task);
|
EditorNode::get_singleton()->edit_resource(p_task);
|
||||||
}
|
}
|
||||||
|
@ -1279,6 +1296,12 @@ void LimboAIEditor::_notification(int p_what) {
|
||||||
new_script_btn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("ScriptCreate"), SNAME("EditorIcons")));
|
new_script_btn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("ScriptCreate"), SNAME("EditorIcons")));
|
||||||
history_back->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("Back"), SNAME("EditorIcons")));
|
history_back->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("Back"), SNAME("EditorIcons")));
|
||||||
history_forward->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("Forward"), SNAME("EditorIcons")));
|
history_forward->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("Forward"), SNAME("EditorIcons")));
|
||||||
|
|
||||||
|
misc_btn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("Tools"), SNAME("EditorIcons")));
|
||||||
|
PopupMenu *misc_menu = misc_btn->get_popup();
|
||||||
|
misc_menu->clear();
|
||||||
|
misc_menu->add_icon_item(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("Debug"), SNAME("EditorIcons")), TTR("Open Debugger"), MISC_OPEN_DEBUGGER);
|
||||||
|
|
||||||
_update_favorite_tasks();
|
_update_favorite_tasks();
|
||||||
_update_header();
|
_update_header();
|
||||||
}
|
}
|
||||||
|
@ -1393,6 +1416,16 @@ LimboAIEditor::LimboAIEditor() {
|
||||||
new_script_btn->set_focus_mode(Control::FOCUS_NONE);
|
new_script_btn->set_focus_mode(Control::FOCUS_NONE);
|
||||||
toolbar->add_child(new_script_btn);
|
toolbar->add_child(new_script_btn);
|
||||||
|
|
||||||
|
// toolbar->add_child(memnew(VSeparator));
|
||||||
|
|
||||||
|
misc_btn = memnew(MenuButton);
|
||||||
|
misc_btn->set_text(TTR("Misc"));
|
||||||
|
misc_btn->set_flat(true);
|
||||||
|
misc_btn->get_popup()->connect("index_pressed", callable_mp(this, &LimboAIEditor::_misc_option_selected));
|
||||||
|
toolbar->add_child(misc_btn);
|
||||||
|
|
||||||
|
// toolbar->add_child(memnew(VSeparator));
|
||||||
|
|
||||||
HBoxContainer *nav = memnew(HBoxContainer);
|
HBoxContainer *nav = memnew(HBoxContainer);
|
||||||
nav->set_h_size_flags(SIZE_EXPAND | SIZE_SHRINK_END);
|
nav->set_h_size_flags(SIZE_EXPAND | SIZE_SHRINK_END);
|
||||||
toolbar->add_child(nav);
|
toolbar->add_child(nav);
|
||||||
|
|
|
@ -155,6 +155,10 @@ private:
|
||||||
ACTION_REMOVE,
|
ACTION_REMOVE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum MiscMenu {
|
||||||
|
MISC_OPEN_DEBUGGER,
|
||||||
|
};
|
||||||
|
|
||||||
Vector<Ref<BehaviorTree>> history;
|
Vector<Ref<BehaviorTree>> history;
|
||||||
int idx_history;
|
int idx_history;
|
||||||
HashSet<Ref<BehaviorTree>> dirty;
|
HashSet<Ref<BehaviorTree>> dirty;
|
||||||
|
@ -176,6 +180,7 @@ private:
|
||||||
Button *load_btn;
|
Button *load_btn;
|
||||||
Button *save_btn;
|
Button *save_btn;
|
||||||
Button *new_script_btn;
|
Button *new_script_btn;
|
||||||
|
MenuButton *misc_btn;
|
||||||
|
|
||||||
ConfirmationDialog *rename_dialog;
|
ConfirmationDialog *rename_dialog;
|
||||||
LineEdit *rename_edit;
|
LineEdit *rename_edit;
|
||||||
|
@ -203,6 +208,7 @@ private:
|
||||||
|
|
||||||
void _on_tree_rmb(const Vector2 &p_menu_pos);
|
void _on_tree_rmb(const Vector2 &p_menu_pos);
|
||||||
void _action_selected(int p_id);
|
void _action_selected(int p_id);
|
||||||
|
void _misc_option_selected(int p_id);
|
||||||
void _on_tree_task_selected(const Ref<BTTask> &p_task);
|
void _on_tree_task_selected(const Ref<BTTask> &p_task);
|
||||||
void _on_tree_task_double_clicked();
|
void _on_tree_task_double_clicked();
|
||||||
void _on_visibility_changed();
|
void _on_visibility_changed();
|
||||||
|
|
Loading…
Reference in New Issue