|
42 | 42 | #include "editor/themes/editor_scale.h" |
43 | 43 | #include "scene/gui/center_container.h" |
44 | 44 | #include "scene/gui/check_box.h" |
| 45 | +#include "scene/gui/flow_container.h" |
45 | 46 | #include "scene/gui/grid_container.h" |
46 | 47 | #include "scene/gui/label.h" |
47 | 48 | #include "scene/gui/option_button.h" |
@@ -1951,30 +1952,38 @@ void EditorFileDialog::_update_option_controls() { |
1951 | 1952 | } |
1952 | 1953 | options_dirty = false; |
1953 | 1954 |
|
1954 | | - while (grid_options->get_child_count() > 0) { |
1955 | | - Node *child = grid_options->get_child(0); |
1956 | | - grid_options->remove_child(child); |
| 1955 | + while (flow_checkbox_options->get_child_count() > 0) { |
| 1956 | + Node *child = flow_checkbox_options->get_child(0); |
| 1957 | + flow_checkbox_options->remove_child(child); |
1957 | 1958 | child->queue_free(); |
1958 | 1959 | } |
| 1960 | + while (grid_select_options->get_child_count() > 0) { |
| 1961 | + Node *child = grid_select_options->get_child(0); |
| 1962 | + grid_select_options->remove_child(child); |
| 1963 | + child->queue_free(); |
| 1964 | + } |
| 1965 | + |
1959 | 1966 | selected_options.clear(); |
1960 | 1967 |
|
1961 | 1968 | for (const EditorFileDialog::Option &opt : options) { |
1962 | | - Label *lbl = memnew(Label); |
1963 | | - lbl->set_text(opt.name); |
1964 | | - grid_options->add_child(lbl); |
1965 | 1969 | if (opt.values.is_empty()) { |
1966 | 1970 | CheckBox *cb = memnew(CheckBox); |
1967 | 1971 | cb->set_pressed(opt.default_idx); |
1968 | | - grid_options->add_child(cb); |
| 1972 | + cb->set_text(opt.name); |
| 1973 | + flow_checkbox_options->add_child(cb); |
1969 | 1974 | cb->connect(SceneStringName(toggled), callable_mp(this, &EditorFileDialog::_option_changed_checkbox_toggled).bind(opt.name)); |
1970 | 1975 | selected_options[opt.name] = (bool)opt.default_idx; |
1971 | 1976 | } else { |
| 1977 | + Label *lbl = memnew(Label); |
| 1978 | + lbl->set_text(opt.name); |
| 1979 | + grid_select_options->add_child(lbl); |
| 1980 | + |
1972 | 1981 | OptionButton *ob = memnew(OptionButton); |
1973 | 1982 | for (const String &val : opt.values) { |
1974 | 1983 | ob->add_item(val); |
1975 | 1984 | } |
1976 | 1985 | ob->select(opt.default_idx); |
1977 | | - grid_options->add_child(ob); |
| 1986 | + grid_select_options->add_child(ob); |
1978 | 1987 | ob->connect(SceneStringName(item_selected), callable_mp(this, &EditorFileDialog::_option_changed_item_selected).bind(opt.name)); |
1979 | 1988 | selected_options[opt.name] = opt.default_idx; |
1980 | 1989 | } |
@@ -2266,11 +2275,13 @@ void EditorFileDialog::add_side_menu(Control *p_menu, const String &p_title) { |
2266 | 2275 | void EditorFileDialog::_update_side_menu_visibility(bool p_native_dlg) { |
2267 | 2276 | if (p_native_dlg) { |
2268 | 2277 | pathhb->set_visible(false); |
2269 | | - grid_options->set_visible(false); |
| 2278 | + flow_checkbox_options->set_visible(false); |
| 2279 | + grid_select_options->set_visible(false); |
2270 | 2280 | list_hb->set_visible(false); |
2271 | 2281 | } else { |
2272 | 2282 | pathhb->set_visible(true); |
2273 | | - grid_options->set_visible(true); |
| 2283 | + flow_checkbox_options->set_visible(true); |
| 2284 | + grid_select_options->set_visible(true); |
2274 | 2285 | list_hb->set_visible(true); |
2275 | 2286 | } |
2276 | 2287 | } |
@@ -2372,10 +2383,15 @@ EditorFileDialog::EditorFileDialog() { |
2372 | 2383 | body_hsplit->set_v_size_flags(Control::SIZE_EXPAND_FILL); |
2373 | 2384 | vbc->add_child(body_hsplit); |
2374 | 2385 |
|
2375 | | - grid_options = memnew(GridContainer); |
2376 | | - grid_options->set_h_size_flags(Control::SIZE_SHRINK_CENTER); |
2377 | | - grid_options->set_columns(2); |
2378 | | - vbc->add_child(grid_options); |
| 2386 | + flow_checkbox_options = memnew(HFlowContainer); |
| 2387 | + flow_checkbox_options->set_h_size_flags(Control::SIZE_EXPAND_FILL); |
| 2388 | + flow_checkbox_options->set_alignment(FlowContainer::ALIGNMENT_CENTER); |
| 2389 | + vbc->add_child(flow_checkbox_options); |
| 2390 | + |
| 2391 | + grid_select_options = memnew(GridContainer); |
| 2392 | + grid_select_options->set_h_size_flags(Control::SIZE_SHRINK_CENTER); |
| 2393 | + grid_select_options->set_columns(2); |
| 2394 | + vbc->add_child(grid_select_options); |
2379 | 2395 |
|
2380 | 2396 | list_hb = memnew(HSplitContainer); |
2381 | 2397 | list_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL); |
|
0 commit comments