|
@@ -42,6 +42,7 @@
|
|
|
#include "editor/themes/editor_scale.h"
|
|
|
#include "scene/gui/center_container.h"
|
|
|
#include "scene/gui/check_box.h"
|
|
|
+#include "scene/gui/flow_container.h"
|
|
|
#include "scene/gui/grid_container.h"
|
|
|
#include "scene/gui/label.h"
|
|
|
#include "scene/gui/option_button.h"
|
|
@@ -1951,30 +1952,38 @@ void EditorFileDialog::_update_option_controls() {
|
|
|
}
|
|
|
options_dirty = false;
|
|
|
|
|
|
- while (grid_options->get_child_count() > 0) {
|
|
|
- Node *child = grid_options->get_child(0);
|
|
|
- grid_options->remove_child(child);
|
|
|
+ while (flow_checkbox_options->get_child_count() > 0) {
|
|
|
+ Node *child = flow_checkbox_options->get_child(0);
|
|
|
+ flow_checkbox_options->remove_child(child);
|
|
|
child->queue_free();
|
|
|
}
|
|
|
+ while (grid_select_options->get_child_count() > 0) {
|
|
|
+ Node *child = grid_select_options->get_child(0);
|
|
|
+ grid_select_options->remove_child(child);
|
|
|
+ child->queue_free();
|
|
|
+ }
|
|
|
+
|
|
|
selected_options.clear();
|
|
|
|
|
|
for (const EditorFileDialog::Option &opt : options) {
|
|
|
- Label *lbl = memnew(Label);
|
|
|
- lbl->set_text(opt.name);
|
|
|
- grid_options->add_child(lbl);
|
|
|
if (opt.values.is_empty()) {
|
|
|
CheckBox *cb = memnew(CheckBox);
|
|
|
cb->set_pressed(opt.default_idx);
|
|
|
- grid_options->add_child(cb);
|
|
|
+ cb->set_text(opt.name);
|
|
|
+ flow_checkbox_options->add_child(cb);
|
|
|
cb->connect(SceneStringName(toggled), callable_mp(this, &EditorFileDialog::_option_changed_checkbox_toggled).bind(opt.name));
|
|
|
selected_options[opt.name] = (bool)opt.default_idx;
|
|
|
} else {
|
|
|
+ Label *lbl = memnew(Label);
|
|
|
+ lbl->set_text(opt.name);
|
|
|
+ grid_select_options->add_child(lbl);
|
|
|
+
|
|
|
OptionButton *ob = memnew(OptionButton);
|
|
|
for (const String &val : opt.values) {
|
|
|
ob->add_item(val);
|
|
|
}
|
|
|
ob->select(opt.default_idx);
|
|
|
- grid_options->add_child(ob);
|
|
|
+ grid_select_options->add_child(ob);
|
|
|
ob->connect(SceneStringName(item_selected), callable_mp(this, &EditorFileDialog::_option_changed_item_selected).bind(opt.name));
|
|
|
selected_options[opt.name] = opt.default_idx;
|
|
|
}
|
|
@@ -2266,11 +2275,13 @@ void EditorFileDialog::add_side_menu(Control *p_menu, const String &p_title) {
|
|
|
void EditorFileDialog::_update_side_menu_visibility(bool p_native_dlg) {
|
|
|
if (p_native_dlg) {
|
|
|
pathhb->set_visible(false);
|
|
|
- grid_options->set_visible(false);
|
|
|
+ flow_checkbox_options->set_visible(false);
|
|
|
+ grid_select_options->set_visible(false);
|
|
|
list_hb->set_visible(false);
|
|
|
} else {
|
|
|
pathhb->set_visible(true);
|
|
|
- grid_options->set_visible(true);
|
|
|
+ flow_checkbox_options->set_visible(true);
|
|
|
+ grid_select_options->set_visible(true);
|
|
|
list_hb->set_visible(true);
|
|
|
}
|
|
|
}
|
|
@@ -2372,10 +2383,15 @@ EditorFileDialog::EditorFileDialog() {
|
|
|
body_hsplit->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
|
|
vbc->add_child(body_hsplit);
|
|
|
|
|
|
- grid_options = memnew(GridContainer);
|
|
|
- grid_options->set_h_size_flags(Control::SIZE_SHRINK_CENTER);
|
|
|
- grid_options->set_columns(2);
|
|
|
- vbc->add_child(grid_options);
|
|
|
+ flow_checkbox_options = memnew(HFlowContainer);
|
|
|
+ flow_checkbox_options->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
|
|
+ flow_checkbox_options->set_alignment(FlowContainer::ALIGNMENT_CENTER);
|
|
|
+ vbc->add_child(flow_checkbox_options);
|
|
|
+
|
|
|
+ grid_select_options = memnew(GridContainer);
|
|
|
+ grid_select_options->set_h_size_flags(Control::SIZE_SHRINK_CENTER);
|
|
|
+ grid_select_options->set_columns(2);
|
|
|
+ vbc->add_child(grid_select_options);
|
|
|
|
|
|
list_hb = memnew(HSplitContainer);
|
|
|
list_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|