From 872f7a453201e209b587edd6e04ce72c45ba673d Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Tue, 2 Jul 2024 11:55:22 +0200 Subject: [PATCH 1/3] Editor: Add setting for task palette placement --- editor/limbo_ai_editor_plugin.cpp | 11 ++++++++++- editor/limbo_ai_editor_plugin.h | 7 ++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/editor/limbo_ai_editor_plugin.cpp b/editor/limbo_ai_editor_plugin.cpp index 980bd21..11efd50 100644 --- a/editor/limbo_ai_editor_plugin.cpp +++ b/editor/limbo_ai_editor_plugin.cpp @@ -1544,9 +1544,15 @@ 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); + TaskPalettePlacement palette_placement = (TaskPalettePlacement)(int)EDITOR_GET("limbo_ai/editor/task_palette_placement"); + if (palette_placement == TaskPalettePlacement::LEFT_SIDE) { + hsc->move_child(task_palette, 0); + hsc->set_split_offset(300); + } else { + hsc->set_split_offset(-300); + } change_type_popup = memnew(PopupPanel); add_child(change_type_popup); @@ -1654,6 +1660,9 @@ LimboAIEditor::LimboAIEditor() { GLOBAL_DEF(PropertyInfo(Variant::STRING, "limbo_ai/behavior_tree/user_task_dir_2", PROPERTY_HINT_DIR), ""); GLOBAL_DEF(PropertyInfo(Variant::STRING, "limbo_ai/behavior_tree/user_task_dir_3", PROPERTY_HINT_DIR), ""); + EDITOR_DEF("limbo_ai/editor/task_palette_placement", 0); + EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "limbo_ai/editor/task_palette_placement", PROPERTY_HINT_ENUM, "Right Side:0,Left Side:1")); + String bt_default_dir = GLOBAL_GET("limbo_ai/behavior_tree/behavior_tree_default_dir"); save_dialog->set_current_dir(bt_default_dir); load_dialog->set_current_dir(bt_default_dir); diff --git a/editor/limbo_ai_editor_plugin.h b/editor/limbo_ai_editor_plugin.h index 8d5f8f1..3475200 100644 --- a/editor/limbo_ai_editor_plugin.h +++ b/editor/limbo_ai_editor_plugin.h @@ -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 TaskPalettePlacement { + RIGHT_SIDE, + LEFT_SIDE, + }; + struct ThemeCache { Ref duplicate_task_icon; Ref edit_script_icon; From 7d6cc1a828468fec950008f254bdb102ea4ea94f Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Thu, 4 Jul 2024 21:16:35 +0200 Subject: [PATCH 2/3] Editor: Adjust layout to work better with task palette on the left --- editor/limbo_ai_editor_plugin.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/editor/limbo_ai_editor_plugin.cpp b/editor/limbo_ai_editor_plugin.cpp index 11efd50..9e93b61 100644 --- a/editor/limbo_ai_editor_plugin.cpp +++ b/editor/limbo_ai_editor_plugin.cpp @@ -1548,7 +1548,12 @@ LimboAIEditor::LimboAIEditor() { hsc->add_child(task_palette); TaskPalettePlacement palette_placement = (TaskPalettePlacement)(int)EDITOR_GET("limbo_ai/editor/task_palette_placement"); if (palette_placement == TaskPalettePlacement::LEFT_SIDE) { - hsc->move_child(task_palette, 0); + 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); From b305041f2888cb0827a9ea8bfaca09f2ae7f427e Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Thu, 4 Jul 2024 21:25:00 +0200 Subject: [PATCH 3/3] Bump demo version --- demo/project.godot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/project.godot b/demo/project.godot index 32ef28a..91d00b8 100644 --- a/demo/project.godot +++ b/demo/project.godot @@ -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]