Editor: Tab button to inspect blackboard plan

This commit is contained in:
Serhii Snitsaruk 2024-05-28 11:16:37 +02:00
parent a7d4b1e7f7
commit 9e0489a034
No known key found for this signature in database
GPG Key ID: A965EF8799FFEC2D
5 changed files with 17 additions and 0 deletions

View File

@ -1000,6 +1000,9 @@ void LimboAIEditor::_update_tabs() {
tab_name = history[i]->get_path().trim_prefix("res://"); tab_name = history[i]->get_path().trim_prefix("res://");
} }
tab_bar->add_tab(tab_name, LimboUtility::get_singleton()->get_task_icon("BehaviorTree")); tab_bar->add_tab(tab_name, LimboUtility::get_singleton()->get_task_icon("BehaviorTree"));
if (i == idx_history) {
tab_bar->set_tab_button_icon(tab_bar->get_tab_count() - 1, LimboUtility::get_singleton()->get_task_icon("LimboEditBlackboard"));
}
} }
if (idx_history >= 0) { if (idx_history >= 0) {
@ -1090,6 +1093,13 @@ void LimboAIEditor::_tab_menu_option_selected(int p_id) {
} }
} }
void LimboAIEditor::_tab_plan_edited(int p_tab) {
ERR_FAIL_INDEX(p_tab, history.size());
if (history[p_tab]->get_blackboard_plan().is_valid()) {
EDIT_RESOURCE(history[p_tab]->get_blackboard_plan());
}
}
void LimboAIEditor::_reload_modified() { void LimboAIEditor::_reload_modified() {
for (const String &res_path : disk_changed_files) { for (const String &res_path : disk_changed_files) {
Ref<BehaviorTree> res = RESOURCE_LOAD(res_path, "BehaviorTree"); Ref<BehaviorTree> res = RESOURCE_LOAD(res_path, "BehaviorTree");
@ -1319,6 +1329,7 @@ void LimboAIEditor::_notification(int p_what) {
tab_bar->connect("tab_close_pressed", callable_mp(this, &LimboAIEditor::_tab_closed)); tab_bar->connect("tab_close_pressed", callable_mp(this, &LimboAIEditor::_tab_closed));
tab_bar->connect(LW_NAME(gui_input), callable_mp(this, &LimboAIEditor::_tab_input)); tab_bar->connect(LW_NAME(gui_input), callable_mp(this, &LimboAIEditor::_tab_input));
tab_menu->connect(LW_NAME(id_pressed), callable_mp(this, &LimboAIEditor::_tab_menu_option_selected)); tab_menu->connect(LW_NAME(id_pressed), callable_mp(this, &LimboAIEditor::_tab_menu_option_selected));
tab_bar->connect("tab_button_pressed", callable_mp(this, &LimboAIEditor::_tab_plan_edited));
EDITOR_FILE_SYSTEM()->connect("resources_reload", callable_mp(this, &LimboAIEditor::_on_resources_reload)); EDITOR_FILE_SYSTEM()->connect("resources_reload", callable_mp(this, &LimboAIEditor::_on_resources_reload));

View File

@ -204,6 +204,7 @@ private:
void _tab_input(const Ref<InputEvent> &p_input); void _tab_input(const Ref<InputEvent> &p_input);
void _show_tab_context_menu(); void _show_tab_context_menu();
void _tab_menu_option_selected(int p_id); void _tab_menu_option_selected(int p_id);
void _tab_plan_edited(int p_tab);
void _reload_modified(); void _reload_modified();
void _resave_modified(String _str = ""); void _resave_modified(String _str = "");

View File

@ -431,6 +431,7 @@ TaskTree::TaskTree() {
tree->set_anchor(SIDE_RIGHT, ANCHOR_END); tree->set_anchor(SIDE_RIGHT, ANCHOR_END);
tree->set_anchor(SIDE_BOTTOM, ANCHOR_END); tree->set_anchor(SIDE_BOTTOM, ANCHOR_END);
tree->set_allow_rmb_select(true); tree->set_allow_rmb_select(true);
tree->set_allow_reselect(true);
tree->set_drag_forwarding(callable_mp(this, &TaskTree::_get_drag_data_fw), callable_mp(this, &TaskTree::_can_drop_data_fw), callable_mp(this, &TaskTree::_drop_data_fw)); tree->set_drag_forwarding(callable_mp(this, &TaskTree::_get_drag_data_fw), callable_mp(this, &TaskTree::_can_drop_data_fw), callable_mp(this, &TaskTree::_drop_data_fw));
} }

View File

@ -75,6 +75,7 @@ BehaviorTreeView = "res://addons/limboai/icons/BehaviorTreeView.svg"
BlackboardPlan = "res://addons/limboai/icons/BlackboardPlan.svg" BlackboardPlan = "res://addons/limboai/icons/BlackboardPlan.svg"
LimboAI = "res://addons/limboai/icons/LimboAI.svg" LimboAI = "res://addons/limboai/icons/LimboAI.svg"
LimboDeselectAll = "res://addons/limboai/icons/LimboDeselectAll.svg" LimboDeselectAll = "res://addons/limboai/icons/LimboDeselectAll.svg"
LimboEditBlackboard = "res://addons/limboai/icons/LimboEditBlackboard.svg"
LimboExtraBlackboard = "res://addons/limboai/icons/LimboExtraBlackboard.svg" LimboExtraBlackboard = "res://addons/limboai/icons/LimboExtraBlackboard.svg"
LimboExtraClock = "res://addons/limboai/icons/LimboExtraClock.svg" LimboExtraClock = "res://addons/limboai/icons/LimboExtraClock.svg"
LimboExtraVariable = "res://addons/limboai/icons/LimboExtraVariable.svg" LimboExtraVariable = "res://addons/limboai/icons/LimboExtraVariable.svg"
@ -84,6 +85,8 @@ LimboPercent = "res://addons/limboai/icons/LimboPercent.svg"
LimboSelectAll = "res://addons/limboai/icons/LimboSelectAll.svg" LimboSelectAll = "res://addons/limboai/icons/LimboSelectAll.svg"
LimboState = "res://addons/limboai/icons/LimboState.svg" LimboState = "res://addons/limboai/icons/LimboState.svg"
LimboVarAdd = "res://addons/limboai/icons/LimboVarAdd.svg" LimboVarAdd = "res://addons/limboai/icons/LimboVarAdd.svg"
LimboVarEmpty = "res://addons/limboai/icons/LimboVarEmpty.svg"
LimboVarError = "res://addons/limboai/icons/LimboVarError.svg"
LimboVarExists = "res://addons/limboai/icons/LimboVarExists.svg" LimboVarExists = "res://addons/limboai/icons/LimboVarExists.svg"
LimboVarNotFound = "res://addons/limboai/icons/LimboVarNotFound.svg" LimboVarNotFound = "res://addons/limboai/icons/LimboVarNotFound.svg"
LimboVarPrivate = "res://addons/limboai/icons/LimboVarPrivate.svg" LimboVarPrivate = "res://addons/limboai/icons/LimboVarPrivate.svg"

View File

@ -0,0 +1 @@
<svg clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="m0 0h16v16h-16z" fill="none"/><path d="m13 3h1.439c.861 0 1.56.699 1.56 1.56v8.88c0 .861-.699 1.56-1.56 1.56h-12.877c-.828 0-1.507-.647-1.558-1.463-.001.009-.001.017-.002.026-.001-.002 0-.049-.001-.119v-.004c0-.234.001-.591.001-.712v-8.168-1.468c0-1.295 2.999-1.483 2.999-.892v.8h3.999v1h-3.999v9.058c0-.362-1.126-.555-1.999-.35v.732c0 .309.251.56.56.56h12.877c.309 0 .56-.251.56-.56v-8.88c0-.309-.251-.56-.56-.56h-1.439zm-5 7v-6h4v6l-2 2zm2-5h-1v4h1zm-2-3.204c0-.439.896-.796 2-.796s2 .357 2 .796v1.204h-4z" fill="#e0e0e0"/></svg>

After

Width:  |  Height:  |  Size: 686 B