This commit is contained in:
Serhii Snitsaruk 2024-07-05 17:50:25 +00:00 committed by GitHub
commit 160d984711
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 40 additions and 4 deletions

View File

@ -12,7 +12,7 @@ config_version=5
config/name="LimboAI Demo"
run/main_scene="res://demo/scenes/showcase.tscn"
config/features=PackedStringArray("4.2", "Forward Plus")
config/features=PackedStringArray("4.3", "Forward Plus")
config/icon="res://demo/assets/icon.svg"
[display]

View File

@ -1294,7 +1294,12 @@ void LimboAIEditor::_notification(int p_what) {
cf.instantiate();
String conf_path = PROJECT_CONFIG_FILE();
cf->load(conf_path);
cf->set_value("bt_editor", "bteditor_hsplit", hsc->get_split_offset());
int split_offset = hsc->get_split_offset();
if (editor_layout != (int)EDITOR_GET("limbo_ai/editor/layout")) {
// Editor layout settings changed - flip split offset.
split_offset *= -1;
}
cf->set_value("bt_editor", "bteditor_hsplit", split_offset);
cf->save(conf_path);
if (task_tree->get_bt().is_valid() &&
@ -1377,6 +1382,20 @@ LimboAIEditor::LimboAIEditor() {
plugin = nullptr;
idx_history = 0;
#ifdef LIMBOAI_MODULE
EDITOR_DEF("limbo_ai/editor/layout", 0);
EDITOR_SETTINGS()->add_property_hint(PropertyInfo(Variant::INT, "limbo_ai/editor/layout", PROPERTY_HINT_ENUM, "Classic:0,Widescreen Optimized:1"));
EDITOR_SETTINGS()->set_restart_if_changed("limbo_ai/editor/layout", true);
#elif LIMBOAI_GDEXTENSION
EDITOR_SETTINGS()->set_initial_value("limbo_ai/editor/layout", 0, false);
Dictionary pinfo;
pinfo["name"] = "limbo_ai/editor/layout";
pinfo["type"] = Variant::INT;
pinfo["hint"] = PROPERTY_HINT_ENUM;
pinfo["hint_string"] = "Classic:0,Widescreen Optimized:1";
EDITOR_SETTINGS()->add_property_info(pinfo);
#endif
LW_SHORTCUT("limbo_ai/rename_task", TTR("Rename"), LW_KEY(F2));
// Todo: Add override support for shortcuts.
// LW_SHORTCUT_OVERRIDE("limbo_ai/rename_task", "macos", Key::ENTER);
@ -1544,9 +1563,20 @@ LimboAIEditor::LimboAIEditor() {
usage_hint->add_child(usage_label);
task_palette = memnew(TaskPalette());
hsc->set_split_offset(-300);
task_palette->hide();
hsc->add_child(task_palette);
editor_layout = (EditorLayout)(int)EDITOR_GET("limbo_ai/editor/layout");
if (editor_layout == EditorLayout::WIDESCREEN_OPTIMIZED) {
VBoxContainer *editor_vbox = memnew(VBoxContainer);
hsc->add_child(editor_vbox);
toolbar->reparent(editor_vbox);
tab_bar_panel->reparent(editor_vbox);
task_tree->reparent(editor_vbox);
usage_hint->reparent(editor_vbox);
hsc->set_split_offset(300);
} else {
hsc->set_split_offset(-300);
}
change_type_popup = memnew(PopupPanel);
add_child(change_type_popup);

View File

@ -26,8 +26,8 @@
#include "core/object/object.h"
#include "core/templates/hash_set.h"
#include "editor/editor_node.h"
#include "editor/plugins/editor_plugin.h"
#include "editor/gui/editor_spin_slider.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/box_container.h"
#include "scene/gui/control.h"
#include "scene/gui/dialogs.h"
@ -111,6 +111,11 @@ private:
TAB_CLOSE_ALL,
};
enum EditorLayout {
CLASSIC,
WIDESCREEN_OPTIMIZED,
};
struct ThemeCache {
Ref<Texture2D> duplicate_task_icon;
Ref<Texture2D> edit_script_icon;
@ -132,6 +137,7 @@ private:
} theme_cache;
EditorPlugin *plugin;
EditorLayout editor_layout;
Vector<Ref<BehaviorTree>> history;
int idx_history;
bool updating_tabs = false;