|
|
@ -34,6 +34,7 @@
|
|
|
|
#include "editor/debugger/script_editor_debugger.h"
|
|
|
|
#include "editor/debugger/script_editor_debugger.h"
|
|
|
|
#include "editor/editor_file_system.h"
|
|
|
|
#include "editor/editor_file_system.h"
|
|
|
|
#include "editor/editor_help.h"
|
|
|
|
#include "editor/editor_help.h"
|
|
|
|
|
|
|
|
#include "editor/editor_interface.h"
|
|
|
|
#include "editor/editor_paths.h"
|
|
|
|
#include "editor/editor_paths.h"
|
|
|
|
#include "editor/editor_settings.h"
|
|
|
|
#include "editor/editor_settings.h"
|
|
|
|
#include "editor/editor_undo_redo_manager.h"
|
|
|
|
#include "editor/editor_undo_redo_manager.h"
|
|
|
@ -316,6 +317,12 @@ void LimboAIEditor::_remove_task_from_favorite(const String &p_task) {
|
|
|
|
ProjectSettings::get_singleton()->save();
|
|
|
|
ProjectSettings::get_singleton()->save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void LimboAIEditor::_save_and_restart() {
|
|
|
|
|
|
|
|
ProjectSettings::get_singleton()->save();
|
|
|
|
|
|
|
|
EditorInterface::get_singleton()->save_all_scenes();
|
|
|
|
|
|
|
|
EditorInterface::get_singleton()->restart_editor(true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LimboAIEditor::_extract_subtree(const String &p_path) {
|
|
|
|
void LimboAIEditor::_extract_subtree(const String &p_path) {
|
|
|
|
Ref<BTTask> selected = task_tree->get_selected();
|
|
|
|
Ref<BTTask> selected = task_tree->get_selected();
|
|
|
|
ERR_FAIL_COND(selected.is_null());
|
|
|
|
ERR_FAIL_COND(selected.is_null());
|
|
|
@ -699,6 +706,16 @@ void LimboAIEditor::_misc_option_selected(int p_id) {
|
|
|
|
case MISC_PROJECT_SETTINGS: {
|
|
|
|
case MISC_PROJECT_SETTINGS: {
|
|
|
|
_edit_project_settings();
|
|
|
|
_edit_project_settings();
|
|
|
|
} break;
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case MISC_LAYOUT_CLASSIC: {
|
|
|
|
|
|
|
|
EDITOR_SETTINGS()->set_setting("limbo_ai/editor/layout", LAYOUT_CLASSIC);
|
|
|
|
|
|
|
|
EDITOR_SETTINGS()->mark_setting_changed("limbo_ai/editor/layout");
|
|
|
|
|
|
|
|
_update_banners();
|
|
|
|
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case MISC_LAYOUT_WIDESCREEN_OPTIMIZED: {
|
|
|
|
|
|
|
|
EDITOR_SETTINGS()->set_setting("limbo_ai/editor/layout", LAYOUT_WIDESCREEN_OPTIMIZED);
|
|
|
|
|
|
|
|
EDITOR_SETTINGS()->mark_setting_changed("limbo_ai/editor/layout");
|
|
|
|
|
|
|
|
_update_banners();
|
|
|
|
|
|
|
|
} break;
|
|
|
|
case MISC_CREATE_SCRIPT_TEMPLATE: {
|
|
|
|
case MISC_CREATE_SCRIPT_TEMPLATE: {
|
|
|
|
String template_path = _get_script_template_path();
|
|
|
|
String template_path = _get_script_template_path();
|
|
|
|
String template_dir = template_path.get_base_dir();
|
|
|
|
String template_dir = template_path.get_base_dir();
|
|
|
@ -1217,6 +1234,20 @@ void LimboAIEditor::_update_misc_menu() {
|
|
|
|
#endif // LIMBOAI_MODULE
|
|
|
|
#endif // LIMBOAI_MODULE
|
|
|
|
misc_menu->add_item(TTR("Project Settings..."), MISC_PROJECT_SETTINGS);
|
|
|
|
misc_menu->add_item(TTR("Project Settings..."), MISC_PROJECT_SETTINGS);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PopupMenu *layout_menu = Object::cast_to<PopupMenu>(misc_menu->get_node_or_null(NodePath("LayoutMenu")));
|
|
|
|
|
|
|
|
if (layout_menu == nullptr) {
|
|
|
|
|
|
|
|
layout_menu = memnew(PopupMenu);
|
|
|
|
|
|
|
|
layout_menu->set_name("LayoutMenu");
|
|
|
|
|
|
|
|
layout_menu->connect(LW_NAME(id_pressed), callable_mp(this, &LimboAIEditor::_misc_option_selected));
|
|
|
|
|
|
|
|
misc_menu->add_child(layout_menu);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
layout_menu->add_radio_check_item(TTR("Classic"), MISC_LAYOUT_CLASSIC);
|
|
|
|
|
|
|
|
layout_menu->add_radio_check_item(TTR("Widescreen Optimized"), MISC_LAYOUT_WIDESCREEN_OPTIMIZED);
|
|
|
|
|
|
|
|
misc_menu->add_submenu_item(TTR("Layout"), "LayoutMenu");
|
|
|
|
|
|
|
|
EditorLayout saved_layout = (EditorLayout)(int)EDITOR_GET("limbo_ai/editor/layout");
|
|
|
|
|
|
|
|
layout_menu->set_item_checked(0, saved_layout == LAYOUT_CLASSIC);
|
|
|
|
|
|
|
|
layout_menu->set_item_checked(1, saved_layout == LAYOUT_WIDESCREEN_OPTIMIZED);
|
|
|
|
|
|
|
|
|
|
|
|
misc_menu->add_separator();
|
|
|
|
misc_menu->add_separator();
|
|
|
|
misc_menu->add_item(
|
|
|
|
misc_menu->add_item(
|
|
|
|
FILE_EXISTS(_get_script_template_path()) ? TTR("Edit Script Template") : TTR("Create Script Template"),
|
|
|
|
FILE_EXISTS(_get_script_template_path()) ? TTR("Edit Script Template") : TTR("Create Script Template"),
|
|
|
@ -1257,6 +1288,15 @@ void LimboAIEditor::_update_banners() {
|
|
|
|
banners->call_deferred(LW_NAME(add_child), banner);
|
|
|
|
banners->call_deferred(LW_NAME(add_child), banner);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EditorLayout saved_layout = (EditorLayout)(int)EDITOR_GET("limbo_ai/editor/layout");
|
|
|
|
|
|
|
|
if (saved_layout != editor_layout) {
|
|
|
|
|
|
|
|
ActionBanner *banner = memnew(ActionBanner);
|
|
|
|
|
|
|
|
banner->set_text(TTR("Restart required to apply changes to editor layout"));
|
|
|
|
|
|
|
|
banner->add_action(TTR("Save & Restart"), callable_mp(this, &LimboAIEditor::_save_and_restart), true);
|
|
|
|
|
|
|
|
banner->set_meta(LW_NAME(managed), Variant(true));
|
|
|
|
|
|
|
|
banners->call_deferred(LW_NAME(add_child), banner);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LimboAIEditor::_do_update_theme_item_cache() {
|
|
|
|
void LimboAIEditor::_do_update_theme_item_cache() {
|
|
|
@ -1362,7 +1402,12 @@ void LimboAIEditor::_notification(int p_what) {
|
|
|
|
BUTTON_SET_ICON(misc_btn, get_theme_icon(LW_NAME(Tools), LW_NAME(EditorIcons)));
|
|
|
|
BUTTON_SET_ICON(misc_btn, get_theme_icon(LW_NAME(Tools), LW_NAME(EditorIcons)));
|
|
|
|
|
|
|
|
|
|
|
|
_update_favorite_tasks();
|
|
|
|
_update_favorite_tasks();
|
|
|
|
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
|
|
|
|
|
|
|
if (is_visible_in_tree()) {
|
|
|
|
|
|
|
|
_update_banners();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1569,8 +1614,11 @@ LimboAIEditor::LimboAIEditor() {
|
|
|
|
task_palette->hide();
|
|
|
|
task_palette->hide();
|
|
|
|
hsc->add_child(task_palette);
|
|
|
|
hsc->add_child(task_palette);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
banners = memnew(VBoxContainer);
|
|
|
|
|
|
|
|
vbox->add_child(banners);
|
|
|
|
|
|
|
|
|
|
|
|
editor_layout = (EditorLayout)(int)EDITOR_GET("limbo_ai/editor/layout");
|
|
|
|
editor_layout = (EditorLayout)(int)EDITOR_GET("limbo_ai/editor/layout");
|
|
|
|
if (editor_layout == EditorLayout::WIDESCREEN_OPTIMIZED) {
|
|
|
|
if (editor_layout == LAYOUT_WIDESCREEN_OPTIMIZED) {
|
|
|
|
// * Alternative layout optimized for wide screen.
|
|
|
|
// * Alternative layout optimized for wide screen.
|
|
|
|
VBoxContainer *sidebar_vbox = memnew(VBoxContainer);
|
|
|
|
VBoxContainer *sidebar_vbox = memnew(VBoxContainer);
|
|
|
|
hsc->add_child(sidebar_vbox);
|
|
|
|
hsc->add_child(sidebar_vbox);
|
|
|
@ -1598,9 +1646,10 @@ LimboAIEditor::LimboAIEditor() {
|
|
|
|
tab_bar_panel->reparent(editor_vbox);
|
|
|
|
tab_bar_panel->reparent(editor_vbox);
|
|
|
|
task_tree->reparent(editor_vbox);
|
|
|
|
task_tree->reparent(editor_vbox);
|
|
|
|
usage_hint->reparent(editor_vbox);
|
|
|
|
usage_hint->reparent(editor_vbox);
|
|
|
|
|
|
|
|
banners->reparent(editor_vbox);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
hsc->set_split_offset((editor_layout == EditorLayout::CLASSIC ? -320 : 320) * EDSCALE);
|
|
|
|
hsc->set_split_offset((editor_layout == LAYOUT_CLASSIC ? -320 : 320) * EDSCALE);
|
|
|
|
|
|
|
|
|
|
|
|
change_type_popup = memnew(PopupPanel);
|
|
|
|
change_type_popup = memnew(PopupPanel);
|
|
|
|
add_child(change_type_popup);
|
|
|
|
add_child(change_type_popup);
|
|
|
@ -1620,9 +1669,6 @@ LimboAIEditor::LimboAIEditor() {
|
|
|
|
change_type_palette->set_v_size_flags(SIZE_EXPAND_FILL);
|
|
|
|
change_type_palette->set_v_size_flags(SIZE_EXPAND_FILL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
banners = memnew(VBoxContainer);
|
|
|
|
|
|
|
|
vbox->add_child(banners);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
menu = memnew(PopupMenu);
|
|
|
|
menu = memnew(PopupMenu);
|
|
|
|
add_child(menu);
|
|
|
|
add_child(menu);
|
|
|
|
|
|
|
|
|
|
|
|