feat: modules moved and engine moved to submodule

This commit is contained in:
Jan van der Weide 2025-04-12 18:40:44 +02:00
parent dfb5e645cd
commit c33d2130cc
5136 changed files with 225275 additions and 64485 deletions

View file

@ -136,7 +136,7 @@ void ThemeItemImportTree::_update_items_tree() {
filtered_names.push_back(F);
}
if (filtered_names.size() == 0) {
if (filtered_names.is_empty()) {
continue;
}
@ -240,8 +240,7 @@ void ThemeItemImportTree::_update_items_tree() {
}
if (color_amount > 0) {
Array arr;
arr.push_back(color_amount);
Array arr = { color_amount };
select_colors_label->set_text(TTRN("1 color", "{num} colors", color_amount).format(arr, "{num}"));
select_all_colors_button->set_visible(true);
select_full_colors_button->set_visible(true);
@ -254,8 +253,7 @@ void ThemeItemImportTree::_update_items_tree() {
}
if (constant_amount > 0) {
Array arr;
arr.push_back(constant_amount);
Array arr = { constant_amount };
select_constants_label->set_text(TTRN("1 constant", "{num} constants", constant_amount).format(arr, "{num}"));
select_all_constants_button->set_visible(true);
select_full_constants_button->set_visible(true);
@ -268,8 +266,7 @@ void ThemeItemImportTree::_update_items_tree() {
}
if (font_amount > 0) {
Array arr;
arr.push_back(font_amount);
Array arr = { font_amount };
select_fonts_label->set_text(TTRN("1 font", "{num} fonts", font_amount).format(arr, "{num}"));
select_all_fonts_button->set_visible(true);
select_full_fonts_button->set_visible(true);
@ -282,8 +279,7 @@ void ThemeItemImportTree::_update_items_tree() {
}
if (font_size_amount > 0) {
Array arr;
arr.push_back(font_size_amount);
Array arr = { font_size_amount };
select_font_sizes_label->set_text(TTRN("1 font size", "{num} font sizes", font_size_amount).format(arr, "{num}"));
select_all_font_sizes_button->set_visible(true);
select_full_font_sizes_button->set_visible(true);
@ -296,8 +292,7 @@ void ThemeItemImportTree::_update_items_tree() {
}
if (icon_amount > 0) {
Array arr;
arr.push_back(icon_amount);
Array arr = { icon_amount };
select_icons_label->set_text(TTRN("1 icon", "{num} icons", icon_amount).format(arr, "{num}"));
select_all_icons_button->set_visible(true);
select_full_icons_button->set_visible(true);
@ -312,8 +307,7 @@ void ThemeItemImportTree::_update_items_tree() {
}
if (stylebox_amount > 0) {
Array arr;
arr.push_back(stylebox_amount);
Array arr = { stylebox_amount };
select_styleboxes_label->set_text(TTRN("1 stylebox", "{num} styleboxes", stylebox_amount).format(arr, "{num}"));
select_all_styleboxes_button->set_visible(true);
select_full_styleboxes_button->set_visible(true);
@ -460,8 +454,7 @@ void ThemeItemImportTree::_update_total_selected(Theme::DataType p_data_type) {
if (count == 0) {
total_selected_items_label->hide();
} else {
Array arr;
arr.push_back(count);
Array arr = { count };
total_selected_items_label->set_text(TTRN("{num} currently selected", "{num} currently selected", count).format(arr, "{num}"));
total_selected_items_label->show();
}
@ -741,7 +734,7 @@ void ThemeItemImportTree::_deselect_all_data_type_pressed(int p_data_type) {
}
void ThemeItemImportTree::_import_selected() {
if (selected_items.size() == 0) {
if (selected_items.is_empty()) {
EditorNode::get_singleton()->show_accept(TTR("Nothing was selected for the import."), TTR("OK"));
return;
}
@ -756,9 +749,7 @@ void ThemeItemImportTree::_import_selected() {
// Arbitrary number of items to skip from reporting.
// Reduces the number of UI updates that this causes when copying large themes.
if (idx % 10 == 0) {
Array arr;
arr.push_back(idx + 1);
arr.push_back(selected_items.size());
Array arr = { idx + 1, selected_items.size() };
ProgressDialog::get_singleton()->task_step("import_theme_items", TTR("Importing items {n}/{n}").format(arr, "{n}"), idx);
}
@ -1588,15 +1579,11 @@ void ThemeItemEditorDialog::_add_theme_item(Theme::DataType p_data_type, String
void ThemeItemEditorDialog::_remove_theme_type(const String &p_theme_type) {
Ref<Theme> old_snapshot = edited_theme->duplicate();
Ref<Theme> new_snapshot = edited_theme->duplicate();
EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
ur->create_action(TTR("Remove Theme Type"));
new_snapshot->remove_type(p_theme_type);
ur->add_do_method(*edited_theme, "clear");
ur->add_do_method(*edited_theme, "merge_with", new_snapshot);
ur->add_do_method(*edited_theme, "remove_type", p_theme_type);
// If the type was empty, it cannot be restored with merge, but thankfully we can fake it.
ur->add_undo_method(*edited_theme, "add_type", p_theme_type);
ur->add_undo_method(*edited_theme, "merge_with", old_snapshot);
@ -1970,6 +1957,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito
edit_items_add_color = memnew(Button);
edit_items_add_color->set_tooltip_text(TTR("Add Color Item"));
edit_items_add_color->set_accessibility_name(TTRC("Add Color Item"));
edit_items_add_color->set_flat(true);
edit_items_add_color->set_disabled(true);
edit_items_toolbar->add_child(edit_items_add_color);
@ -1977,6 +1965,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito
edit_items_add_constant = memnew(Button);
edit_items_add_constant->set_tooltip_text(TTR("Add Constant Item"));
edit_items_add_constant->set_accessibility_name(TTRC("Add Constant Item"));
edit_items_add_constant->set_flat(true);
edit_items_add_constant->set_disabled(true);
edit_items_toolbar->add_child(edit_items_add_constant);
@ -1984,6 +1973,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito
edit_items_add_font = memnew(Button);
edit_items_add_font->set_tooltip_text(TTR("Add Font Item"));
edit_items_add_font->set_accessibility_name(TTRC("Add Font Item"));
edit_items_add_font->set_flat(true);
edit_items_add_font->set_disabled(true);
edit_items_toolbar->add_child(edit_items_add_font);
@ -1991,6 +1981,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito
edit_items_add_font_size = memnew(Button);
edit_items_add_font_size->set_tooltip_text(TTR("Add Font Size Item"));
edit_items_add_font_size->set_accessibility_name(TTRC("Add Font Size Item"));
edit_items_add_font_size->set_flat(true);
edit_items_add_font_size->set_disabled(true);
edit_items_toolbar->add_child(edit_items_add_font_size);
@ -1998,6 +1989,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito
edit_items_add_icon = memnew(Button);
edit_items_add_icon->set_tooltip_text(TTR("Add Icon Item"));
edit_items_add_icon->set_accessibility_name(TTRC("Add Icon Item"));
edit_items_add_icon->set_flat(true);
edit_items_add_icon->set_disabled(true);
edit_items_toolbar->add_child(edit_items_add_icon);
@ -2005,6 +1997,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito
edit_items_add_stylebox = memnew(Button);
edit_items_add_stylebox->set_tooltip_text(TTR("Add StyleBox Item"));
edit_items_add_stylebox->set_accessibility_name(TTRC("Add StyleBox Item"));
edit_items_add_stylebox->set_flat(true);
edit_items_add_stylebox->set_disabled(true);
edit_items_toolbar->add_child(edit_items_add_stylebox);
@ -2018,6 +2011,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito
edit_items_remove_class = memnew(Button);
edit_items_remove_class->set_tooltip_text(TTR("Remove Class Items"));
edit_items_remove_class->set_accessibility_name(TTRC("Remove Class Items"));
edit_items_remove_class->set_flat(true);
edit_items_remove_class->set_disabled(true);
edit_items_toolbar->add_child(edit_items_remove_class);
@ -2025,6 +2019,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito
edit_items_remove_custom = memnew(Button);
edit_items_remove_custom->set_tooltip_text(TTR("Remove Custom Items"));
edit_items_remove_custom->set_accessibility_name(TTRC("Remove Custom Items"));
edit_items_remove_custom->set_flat(true);
edit_items_remove_custom->set_disabled(true);
edit_items_toolbar->add_child(edit_items_remove_custom);
@ -2032,6 +2027,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito
edit_items_remove_all = memnew(Button);
edit_items_remove_all->set_tooltip_text(TTR("Remove All Items"));
edit_items_remove_all->set_accessibility_name(TTRC("Remove All Items"));
edit_items_remove_all->set_flat(true);
edit_items_remove_all->set_disabled(true);
edit_items_toolbar->add_child(edit_items_remove_all);
@ -2486,6 +2482,7 @@ HBoxContainer *ThemeTypeEditor::_create_property_control(Theme::DataType p_data_
Button *item_rename_button = memnew(Button);
item_rename_button->set_button_icon(get_editor_theme_icon(SNAME("Edit")));
item_rename_button->set_tooltip_text(TTR("Rename Item"));
item_rename_button->set_accessibility_name(TTRC("Rename Item"));
item_rename_button->set_flat(true);
item_name_container->add_child(item_rename_button);
item_rename_button->connect(SceneStringName(pressed), callable_mp(this, &ThemeTypeEditor::_item_rename_cbk).bind(p_data_type, p_item_name, item_name_container));
@ -2493,6 +2490,7 @@ HBoxContainer *ThemeTypeEditor::_create_property_control(Theme::DataType p_data_
Button *item_remove_button = memnew(Button);
item_remove_button->set_button_icon(get_editor_theme_icon(SNAME("Remove")));
item_remove_button->set_tooltip_text(TTR("Remove Item"));
item_remove_button->set_accessibility_name(TTRC("Remove Item"));
item_remove_button->set_flat(true);
item_name_container->add_child(item_remove_button);
item_remove_button->connect(SceneStringName(pressed), callable_mp(this, &ThemeTypeEditor::_item_remove_cbk).bind(p_data_type, p_item_name));
@ -2500,6 +2498,7 @@ HBoxContainer *ThemeTypeEditor::_create_property_control(Theme::DataType p_data_
Button *item_rename_confirm_button = memnew(Button);
item_rename_confirm_button->set_button_icon(get_editor_theme_icon(SNAME("ImportCheck")));
item_rename_confirm_button->set_tooltip_text(TTR("Confirm Item Rename"));
item_rename_confirm_button->set_accessibility_name(TTRC("Confirm Item Rename"));
item_rename_confirm_button->set_flat(true);
item_name_container->add_child(item_rename_confirm_button);
item_rename_confirm_button->connect(SceneStringName(pressed), callable_mp(this, &ThemeTypeEditor::_item_rename_confirmed).bind(p_data_type, p_item_name, item_name_container));
@ -2508,6 +2507,7 @@ HBoxContainer *ThemeTypeEditor::_create_property_control(Theme::DataType p_data_
Button *item_rename_cancel_button = memnew(Button);
item_rename_cancel_button->set_button_icon(get_editor_theme_icon(SNAME("ImportFail")));
item_rename_cancel_button->set_tooltip_text(TTR("Cancel Item Rename"));
item_rename_cancel_button->set_accessibility_name(TTRC("Cancel Item Rename"));
item_rename_cancel_button->set_flat(true);
item_name_container->add_child(item_rename_cancel_button);
item_rename_cancel_button->connect(SceneStringName(pressed), callable_mp(this, &ThemeTypeEditor::_item_rename_canceled).bind(p_data_type, p_item_name, item_name_container));
@ -2518,6 +2518,7 @@ HBoxContainer *ThemeTypeEditor::_create_property_control(Theme::DataType p_data_
Button *item_override_button = memnew(Button);
item_override_button->set_button_icon(get_editor_theme_icon(SNAME("Add")));
item_override_button->set_tooltip_text(TTR("Override Item"));
item_override_button->set_accessibility_name(TTRC("Override Item"));
item_override_button->set_flat(true);
item_name_container->add_child(item_override_button);
item_override_button->connect(SceneStringName(pressed), callable_mp(this, &ThemeTypeEditor::_item_override_cbk).bind(p_data_type, p_item_name));
@ -2727,6 +2728,7 @@ void ThemeTypeEditor::_update_type_items() {
pin_leader_button->set_pressed(true);
pin_leader_button->set_button_icon(get_editor_theme_icon(SNAME("Pin")));
pin_leader_button->set_tooltip_text(TTR("Unpin this StyleBox as a main style."));
pin_leader_button->set_accessibility_name(TTRC("Unpin StyleBox"));
item_control->add_child(pin_leader_button);
pin_leader_button->connect(SceneStringName(pressed), callable_mp(this, &ThemeTypeEditor::_on_unpin_leader_button_pressed));
@ -2770,6 +2772,7 @@ void ThemeTypeEditor::_update_type_items() {
pin_leader_button->set_toggle_mode(true);
pin_leader_button->set_button_icon(get_editor_theme_icon(SNAME("Pin")));
pin_leader_button->set_tooltip_text(TTR("Pin this StyleBox as a main style. Editing its properties will update the same properties in all other StyleBoxes of this type."));
pin_leader_button->set_accessibility_name(TTRC("Pin StyleBox as a Main Style"));
item_control->add_child(pin_leader_button);
pin_leader_button->connect(SceneStringName(pressed), callable_mp(this, &ThemeTypeEditor::_on_pin_leader_button_pressed).bind(item_editor, E.key));
} else {
@ -3456,11 +3459,13 @@ ThemeTypeEditor::ThemeTypeEditor() {
theme_type_list->set_h_size_flags(SIZE_EXPAND_FILL);
theme_type_list->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_ELLIPSIS);
theme_type_list->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
theme_type_list->set_accessibility_name(TTRC("Type"));
type_list_hb->add_child(theme_type_list);
theme_type_list->connect(SceneStringName(item_selected), callable_mp(this, &ThemeTypeEditor::_list_type_selected));
add_type_button = memnew(Button);
add_type_button->set_tooltip_text(TTR("Add a type from a list of available types or create a new one."));
add_type_button->set_accessibility_name(TTRC("Add Type"));
type_list_hb->add_child(add_type_button);
add_type_button->connect(SceneStringName(pressed), callable_mp(this, &ThemeTypeEditor::_add_type_button_cbk));
@ -3523,9 +3528,11 @@ ThemeTypeEditor::ThemeTypeEditor() {
type_variation_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL);
type_variation_edit->connect(SceneStringName(text_changed), callable_mp(this, &ThemeTypeEditor::_type_variation_changed));
type_variation_edit->connect(SceneStringName(focus_exited), callable_mp(this, &ThemeTypeEditor::_update_type_items));
type_variation_edit->set_accessibility_name(TTRC("Base Type"));
type_variation_button = memnew(Button);
type_variation_hb->add_child(type_variation_button);
type_variation_button->set_tooltip_text(TTR("Select the variation base type from a list of available types."));
type_variation_button->set_accessibility_name(TTRC("Select Base Type"));
type_variation_button->connect(SceneStringName(pressed), callable_mp(this, &ThemeTypeEditor::_add_type_variation_cbk));
type_variation_locked = memnew(Label);
@ -3796,9 +3803,10 @@ ThemeEditor::ThemeEditor() {
main_hs->set_v_size_flags(SIZE_EXPAND_FILL);
add_child(main_hs);
main_hs->set_split_offset(520 * EDSCALE);
VBoxContainer *preview_tabs_vb = memnew(VBoxContainer);
preview_tabs_vb->set_h_size_flags(SIZE_EXPAND_FILL);
preview_tabs_vb->set_custom_minimum_size(Size2(520, 0) * EDSCALE);
preview_tabs_vb->add_theme_constant_override("separation", 2 * EDSCALE);
main_hs->add_child(preview_tabs_vb);
HBoxContainer *preview_tabbar_hb = memnew(HBoxContainer);