Reparent banners if using new layout

This commit is contained in:
Serhii Snitsaruk 2024-07-06 09:29:09 +02:00
parent da9d80d110
commit 7c0d49bafa
No known key found for this signature in database
GPG Key ID: A965EF8799FFEC2D
1 changed files with 5 additions and 4 deletions

View File

@ -1291,7 +1291,7 @@ void LimboAIEditor::_update_banners() {
EditorLayout saved_layout = (EditorLayout)(int)EDITOR_GET("limbo_ai/editor/layout"); EditorLayout saved_layout = (EditorLayout)(int)EDITOR_GET("limbo_ai/editor/layout");
if (saved_layout != editor_layout) { if (saved_layout != editor_layout) {
ActionBanner *banner = memnew(ActionBanner); ActionBanner *banner = memnew(ActionBanner);
banner->set_text(TTR("Restart required to apply changes to editor layout.")); 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->add_action(TTR("Save & Restart"), callable_mp(this, &LimboAIEditor::_save_and_restart), true);
banner->set_meta(LW_NAME(managed), Variant(true)); banner->set_meta(LW_NAME(managed), Variant(true));
banners->call_deferred(LW_NAME(add_child), banner); banners->call_deferred(LW_NAME(add_child), banner);
@ -1608,6 +1608,9 @@ 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 == LAYOUT_WIDESCREEN_OPTIMIZED) { if (editor_layout == LAYOUT_WIDESCREEN_OPTIMIZED) {
// * Alternative layout optimized for wide screen. // * Alternative layout optimized for wide screen.
@ -1637,6 +1640,7 @@ 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 == LAYOUT_CLASSIC ? -320 : 320) * EDSCALE); hsc->set_split_offset((editor_layout == LAYOUT_CLASSIC ? -320 : 320) * EDSCALE);
@ -1659,9 +1663,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);