Compare commits

...

6 Commits

Author SHA1 Message Date
Serhii Snitsaruk 160d984711
Merge 2973590533 into 4d0d2c0507 2024-07-05 17:50:25 +00:00
Serhii Snitsaruk 2973590533
Flip split offset setting if editor layout changed 2024-07-05 17:53:35 +02:00
Serhii Snitsaruk b74f664da6
Fix compilation issue with GDExtension 2024-07-05 17:24:32 +02:00
Serhii Snitsaruk 7baa395d3f
Rename to editor_layout 2024-07-05 17:02:29 +02:00
Serhii Snitsaruk 4d0d2c0507
Merge pull request #155 from dpalais/auto_translate_deprecated
Replace deprecated set_auto_translate call with set_auto_translate_mode
2024-07-02 20:25:11 +02:00
Dave Palais 4cba3b39db Replace deprecated set_auto_translate call with set_auto_translate_mode 2024-07-02 12:50:56 -05:00
2 changed files with 27 additions and 10 deletions

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);
@ -1506,7 +1525,7 @@ LimboAIEditor::LimboAIEditor() {
tab_bar->set_select_with_rmb(true);
tab_bar->set_drag_to_rearrange_enabled(true);
tab_bar->set_max_tab_width(int(EDITOR_GET("interface/scene_tabs/maximum_width")) * EDSCALE);
tab_bar->set_auto_translate(false);
tab_bar->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
tab_bar->set_tab_close_display_policy(TabBar::CLOSE_BUTTON_SHOW_ACTIVE_ONLY);
tab_bar->set_h_size_flags(Control::SIZE_EXPAND_FILL);
tab_bar->set_focus_mode(FocusMode::FOCUS_NONE);
@ -1546,8 +1565,8 @@ LimboAIEditor::LimboAIEditor() {
task_palette = memnew(TaskPalette());
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) {
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);
@ -1665,9 +1684,6 @@ 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);

View File

@ -111,9 +111,9 @@ private:
TAB_CLOSE_ALL,
};
enum TaskPalettePlacement {
RIGHT_SIDE,
LEFT_SIDE,
enum EditorLayout {
CLASSIC,
WIDESCREEN_OPTIMIZED,
};
struct ThemeCache {
@ -137,6 +137,7 @@ private:
} theme_cache;
EditorPlugin *plugin;
EditorLayout editor_layout;
Vector<Ref<BehaviorTree>> history;
int idx_history;
bool updating_tabs = false;