summaryrefslogtreecommitdiff
path: root/editor/project_export.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/project_export.cpp')
-rw-r--r--editor/project_export.cpp534
1 files changed, 304 insertions, 230 deletions
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index 8245264e0d..1f553ba0de 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -46,34 +46,36 @@
#include "scene/gui/margin_container.h"
#include "scene/gui/scroll_container.h"
#include "scene/gui/tab_container.h"
+#include "servers/display_server.h"
+
+void ProjectExportDialog::_theme_changed() {
+ duplicate_preset->set_icon(presets->get_theme_icon("Duplicate", "EditorIcons"));
+ delete_preset->set_icon(presets->get_theme_icon("Remove", "EditorIcons"));
+ Control *panel = custom_feature_display->get_parent_control();
+ if (panel) {
+ panel->add_theme_style_override("panel", patches->get_theme_stylebox("bg", "Tree"));
+ }
+}
void ProjectExportDialog::_notification(int p_what) {
-
switch (p_what) {
- case NOTIFICATION_READY: {
- duplicate_preset->set_icon(get_icon("Duplicate", "EditorIcons"));
- delete_preset->set_icon(get_icon("Remove", "EditorIcons"));
- connect("confirmed", this, "_export_pck_zip");
- custom_feature_display->get_parent_control()->add_style_override("panel", get_stylebox("bg", "Tree"));
- } break;
- case NOTIFICATION_POPUP_HIDE: {
- EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "export", get_rect());
+ case NOTIFICATION_VISIBILITY_CHANGED: {
+ if (!is_visible()) {
+ EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "export", Rect2(get_position(), get_size()));
+ }
} break;
- case NOTIFICATION_THEME_CHANGED: {
- duplicate_preset->set_icon(get_icon("Duplicate", "EditorIcons"));
- delete_preset->set_icon(get_icon("Remove", "EditorIcons"));
- Control *panel = custom_feature_display->get_parent_control();
- if (panel)
- panel->add_style_override("panel", get_stylebox("bg", "Tree"));
+ case NOTIFICATION_READY: {
+ duplicate_preset->set_icon(presets->get_theme_icon("Duplicate", "EditorIcons"));
+ delete_preset->set_icon(presets->get_theme_icon("Remove", "EditorIcons"));
+ connect("confirmed", callable_mp(this, &ProjectExportDialog::_export_pck_zip));
+ custom_feature_display->get_parent_control()->add_theme_style_override("panel", patches->get_theme_stylebox("bg", "Tree"));
} break;
}
}
void ProjectExportDialog::popup_export() {
-
add_preset->get_popup()->clear();
for (int i = 0; i < EditorExport::get_singleton()->get_export_platform_count(); i++) {
-
Ref<EditorExportPlatform> plat = EditorExport::get_singleton()->get_export_platform(i);
add_preset->get_popup()->add_icon_item(plat->get_logo(), plat->get_name());
@@ -94,7 +96,6 @@ void ProjectExportDialog::popup_export() {
}
void ProjectExportDialog::_add_preset(int p_platform) {
-
Ref<EditorExportPreset> preset = EditorExport::get_singleton()->get_export_platform(p_platform)->create_preset();
ERR_FAIL_COND(!preset.is_valid());
@@ -102,7 +103,6 @@ void ProjectExportDialog::_add_preset(int p_platform) {
bool make_runnable = true;
int attempt = 1;
while (true) {
-
bool valid = true;
for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); i++) {
@@ -116,33 +116,40 @@ void ProjectExportDialog::_add_preset(int p_platform) {
}
}
- if (valid)
+ if (valid) {
break;
+ }
attempt++;
name = EditorExport::get_singleton()->get_export_platform(p_platform)->get_name() + " " + itos(attempt);
}
preset->set_name(name);
- if (make_runnable)
+ if (make_runnable) {
preset->set_runnable(make_runnable);
+ }
EditorExport::get_singleton()->add_export_preset(preset);
_update_presets();
_edit_preset(EditorExport::get_singleton()->get_export_preset_count() - 1);
}
-void ProjectExportDialog::_update_current_preset() {
+void ProjectExportDialog::_force_update_current_preset_parameters() {
+ // Force the parameters section to refresh its UI.
+ parameters->edit(nullptr);
+ _update_current_preset();
+}
+void ProjectExportDialog::_update_current_preset() {
_edit_preset(presets->get_current());
}
void ProjectExportDialog::_update_presets() {
-
updating = true;
Ref<EditorExportPreset> current;
- if (presets->get_current() >= 0 && presets->get_current() < presets->get_item_count())
+ if (presets->get_current() >= 0 && presets->get_current() < presets->get_item_count()) {
current = get_current_preset();
+ }
int current_idx = -1;
presets->clear();
@@ -153,8 +160,10 @@ void ProjectExportDialog::_update_presets() {
}
String name = preset->get_name();
- if (preset->is_runnable())
+ if (preset->is_runnable()) {
name += " (" + TTR("Runnable") + ")";
+ }
+ preset->update_files_to_export();
presets->add_item(name, preset->get_platform()->get_logo());
}
@@ -166,7 +175,6 @@ void ProjectExportDialog::_update_presets() {
}
void ProjectExportDialog::_update_export_all() {
-
bool can_export = EditorExport::get_singleton()->get_export_preset_count() > 0;
for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); i++) {
@@ -187,13 +195,12 @@ void ProjectExportDialog::_update_export_all() {
}
void ProjectExportDialog::_edit_preset(int p_index) {
-
if (p_index < 0 || p_index >= presets->get_item_count()) {
name->set_text("");
name->set_editable(false);
export_path->hide();
runnable->set_disabled(true);
- parameters->edit(NULL);
+ parameters->edit(nullptr);
presets->unselect_all();
duplicate_preset->set_disabled(true);
delete_preset->set_disabled(true);
@@ -243,36 +250,37 @@ void ProjectExportDialog::_edit_preset(int p_index) {
String file = patchlist[i].get_file();
patch->set_editable(0, true);
patch->set_text(0, file.get_file().replace("*", ""));
- if (file.ends_with("*"))
+ if (file.ends_with("*")) {
patch->set_checked(0, true);
+ }
patch->set_tooltip(0, patchlist[i]);
patch->set_metadata(0, i);
- patch->add_button(0, get_icon("Remove", "EditorIcons"), 0);
- patch->add_button(0, get_icon("folder", "FileDialog"), 1);
+ patch->add_button(0, presets->get_theme_icon("Remove", "EditorIcons"), 0);
+ patch->add_button(0, presets->get_theme_icon("folder", "FileDialog"), 1);
}
TreeItem *patch_add = patches->create_item(patch_root);
patch_add->set_metadata(0, patchlist.size());
- if (patchlist.size() == 0)
+ if (patchlist.size() == 0) {
patch_add->set_text(0, TTR("Add initial export..."));
- else
+ } else {
patch_add->set_text(0, TTR("Add previous patches..."));
+ }
- patch_add->add_button(0, get_icon("folder", "FileDialog"), 1);
+ patch_add->add_button(0, presets->get_theme_icon("folder", "FileDialog"), 1);
_fill_resource_tree();
bool needs_templates;
String error;
if (!current->get_platform()->can_export(current, error, needs_templates)) {
-
if (error != String()) {
-
Vector<String> items = error.split("\n", false);
error = "";
for (int i = 0; i < items.size(); i++) {
- if (i > 0)
+ if (i > 0) {
error += "\n";
+ }
error += " - " + items[i];
}
@@ -281,10 +289,11 @@ void ProjectExportDialog::_edit_preset(int p_index) {
} else {
export_error->hide();
}
- if (needs_templates)
+ if (needs_templates) {
export_templates_error->show();
- else
+ } else {
export_templates_error->hide();
+ }
export_button->set_disabled(true);
get_ok()->set_disabled(true);
@@ -299,7 +308,25 @@ void ProjectExportDialog::_edit_preset(int p_index) {
custom_features->set_text(current->get_custom_features());
_update_feature_list();
_update_export_all();
- minimum_size_changed();
+ child_controls_changed();
+
+ String enc_in_filters_str = current->get_enc_in_filter();
+ String enc_ex_filters_str = current->get_enc_ex_filter();
+ if (!updating_enc_filters) {
+ enc_in_filters->set_text(enc_in_filters_str);
+ enc_ex_filters->set_text(enc_ex_filters_str);
+ }
+
+ bool enc_pck_mode = current->get_enc_pck();
+ enc_pck->set_pressed(enc_pck_mode);
+
+ enc_directory->set_disabled(!enc_pck_mode);
+ enc_in_filters->set_editable(enc_pck_mode);
+ enc_ex_filters->set_editable(enc_pck_mode);
+ script_key->set_editable(enc_pck_mode);
+
+ bool enc_directory_mode = current->get_enc_directory();
+ enc_directory->set_pressed(enc_directory_mode);
int script_export_mode = current->get_script_export_mode();
script_mode->select(script_export_mode);
@@ -308,7 +335,7 @@ void ProjectExportDialog::_edit_preset(int p_index) {
if (!updating_script_key) {
script_key->set_text(key);
}
- if (script_export_mode == EditorExportPreset::MODE_SCRIPT_ENCRYPTED) {
+ if (enc_pck_mode) {
script_key->set_editable(true);
bool key_valid = _validate_script_encryption_key(key);
@@ -326,7 +353,6 @@ void ProjectExportDialog::_edit_preset(int p_index) {
}
void ProjectExportDialog::_update_feature_list() {
-
Ref<EditorExportPreset> current = get_current_preset();
ERR_FAIL_COND(current.is_null());
@@ -360,9 +386,9 @@ void ProjectExportDialog::_update_feature_list() {
}
void ProjectExportDialog::_custom_features_changed(const String &p_text) {
-
- if (updating)
+ if (updating) {
return;
+ }
Ref<EditorExportPreset> current = get_current_preset();
ERR_FAIL_COND(current.is_null());
@@ -376,7 +402,6 @@ void ProjectExportDialog::_tab_changed(int) {
}
void ProjectExportDialog::_patch_button_pressed(Object *p_item, int p_column, int p_id) {
-
TreeItem *ti = (TreeItem *)p_item;
patch_index = ti->get_metadata(0);
@@ -388,17 +413,17 @@ void ProjectExportDialog::_patch_button_pressed(Object *p_item, int p_column, in
Vector<String> patches = current->get_patches();
ERR_FAIL_INDEX(patch_index, patches.size());
patch_erase->set_text(vformat(TTR("Delete patch '%s' from list?"), patches[patch_index].get_file()));
- patch_erase->popup_centered_minsize();
+ patch_erase->popup_centered();
} else {
- patch_dialog->popup_centered_ratio();
+ patch_dialog->popup_file_dialog();
}
}
void ProjectExportDialog::_patch_edited() {
-
TreeItem *item = patches->get_edited();
- if (!item)
+ if (!item) {
return;
+ }
int index = item->get_metadata(0);
Ref<EditorExportPreset> current = get_current_preset();
@@ -418,14 +443,12 @@ void ProjectExportDialog::_patch_edited() {
}
void ProjectExportDialog::_patch_selected(const String &p_path) {
-
Ref<EditorExportPreset> current = get_current_preset();
ERR_FAIL_COND(current.is_null());
Vector<String> patches = current->get_patches();
if (patch_index >= patches.size()) {
-
current->add_patch(ProjectSettings::get_singleton()->get_resource_path().path_to(p_path) + "*");
} else {
String enabled = patches[patch_index].ends_with("*") ? String("*") : String();
@@ -436,33 +459,29 @@ void ProjectExportDialog::_patch_selected(const String &p_path) {
}
void ProjectExportDialog::_patch_deleted() {
-
Ref<EditorExportPreset> current = get_current_preset();
ERR_FAIL_COND(current.is_null());
Vector<String> patches = current->get_patches();
if (patch_index < patches.size()) {
-
current->remove_patch(patch_index);
_update_current_preset();
}
}
void ProjectExportDialog::_update_parameters(const String &p_edited_property) {
-
_update_current_preset();
}
void ProjectExportDialog::_runnable_pressed() {
-
- if (updating)
+ if (updating) {
return;
+ }
Ref<EditorExportPreset> current = get_current_preset();
ERR_FAIL_COND(current.is_null());
if (runnable->is_pressed()) {
-
for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); i++) {
Ref<EditorExportPreset> p = EditorExport::get_singleton()->get_export_preset(i);
if (p->get_platform() == current->get_platform()) {
@@ -470,7 +489,6 @@ void ProjectExportDialog::_runnable_pressed() {
}
}
} else {
-
current->set_runnable(false);
}
@@ -478,9 +496,9 @@ void ProjectExportDialog::_runnable_pressed() {
}
void ProjectExportDialog::_name_changed(const String &p_string) {
-
- if (updating)
+ if (updating) {
return;
+ }
Ref<EditorExportPreset> current = get_current_preset();
ERR_FAIL_COND(current.is_null());
@@ -504,14 +522,13 @@ String ProjectExportDialog::get_export_path() {
}
Ref<EditorExportPreset> ProjectExportDialog::get_current_preset() const {
-
return EditorExport::get_singleton()->get_export_preset(presets->get_current());
}
void ProjectExportDialog::_export_path_changed(const StringName &p_property, const Variant &p_value, const String &p_field, bool p_changing) {
-
- if (updating)
+ if (updating) {
return;
+ }
Ref<EditorExportPreset> current = get_current_preset();
ERR_FAIL_COND(current.is_null());
@@ -520,10 +537,60 @@ void ProjectExportDialog::_export_path_changed(const StringName &p_property, con
_update_presets();
}
-void ProjectExportDialog::_script_export_mode_changed(int p_mode) {
+void ProjectExportDialog::_enc_filters_changed(const String &p_filters) {
+ if (updating) {
+ return;
+ }
+
+ Ref<EditorExportPreset> current = get_current_preset();
+ ERR_FAIL_COND(current.is_null());
- if (updating)
+ current->set_enc_in_filter(enc_in_filters->get_text());
+ current->set_enc_ex_filter(enc_ex_filters->get_text());
+
+ updating_enc_filters = true;
+ _update_current_preset();
+ updating_enc_filters = false;
+}
+
+void ProjectExportDialog::_open_key_help_link() {
+ OS::get_singleton()->shell_open("https://docs.godotengine.org/en/latest/development/compiling/compiling_with_script_encryption_key.html");
+}
+
+void ProjectExportDialog::_enc_pck_changed(bool p_pressed) {
+ if (updating) {
return;
+ }
+
+ Ref<EditorExportPreset> current = get_current_preset();
+ ERR_FAIL_COND(current.is_null());
+
+ current->set_enc_pck(p_pressed);
+ enc_directory->set_disabled(!p_pressed);
+ enc_in_filters->set_editable(p_pressed);
+ enc_ex_filters->set_editable(p_pressed);
+ script_key->set_editable(p_pressed);
+
+ _update_current_preset();
+}
+
+void ProjectExportDialog::_enc_directory_changed(bool p_pressed) {
+ if (updating) {
+ return;
+ }
+
+ Ref<EditorExportPreset> current = get_current_preset();
+ ERR_FAIL_COND(current.is_null());
+
+ current->set_enc_directory(p_pressed);
+
+ _update_current_preset();
+}
+
+void ProjectExportDialog::_script_export_mode_changed(int p_mode) {
+ if (updating) {
+ return;
+ }
Ref<EditorExportPreset> current = get_current_preset();
ERR_FAIL_COND(current.is_null());
@@ -534,9 +601,9 @@ void ProjectExportDialog::_script_export_mode_changed(int p_mode) {
}
void ProjectExportDialog::_script_encryption_key_changed(const String &p_key) {
-
- if (updating)
+ if (updating) {
return;
+ }
Ref<EditorExportPreset> current = get_current_preset();
ERR_FAIL_COND(current.is_null());
@@ -549,7 +616,6 @@ void ProjectExportDialog::_script_encryption_key_changed(const String &p_key) {
}
bool ProjectExportDialog::_validate_script_encryption_key(const String &p_key) {
-
bool is_valid = false;
if (!p_key.empty() && p_key.is_valid_hex_number(false) && p_key.length() == 64) {
@@ -559,10 +625,10 @@ bool ProjectExportDialog::_validate_script_encryption_key(const String &p_key) {
}
void ProjectExportDialog::_duplicate_preset() {
-
Ref<EditorExportPreset> current = get_current_preset();
- if (current.is_null())
+ if (current.is_null()) {
return;
+ }
Ref<EditorExportPreset> preset = current->get_platform()->create_preset();
ERR_FAIL_COND(!preset.is_valid());
@@ -570,7 +636,6 @@ void ProjectExportDialog::_duplicate_preset() {
String name = current->get_name() + " (copy)";
bool make_runnable = true;
while (true) {
-
bool valid = true;
for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); i++) {
@@ -584,15 +649,17 @@ void ProjectExportDialog::_duplicate_preset() {
}
}
- if (valid)
+ if (valid) {
break;
+ }
name += " (copy)";
}
preset->set_name(name);
- if (make_runnable)
+ if (make_runnable) {
preset->set_runnable(make_runnable);
+ }
preset->set_export_filter(current->get_export_filter());
preset->set_include_filter(current->get_include_filter());
preset->set_exclude_filter(current->get_exclude_filter());
@@ -612,17 +679,16 @@ void ProjectExportDialog::_duplicate_preset() {
}
void ProjectExportDialog::_delete_preset() {
-
Ref<EditorExportPreset> current = get_current_preset();
- if (current.is_null())
+ if (current.is_null()) {
return;
+ }
delete_confirm->set_text(vformat(TTR("Delete preset '%s'?"), current->get_name()));
- delete_confirm->popup_centered_minsize();
+ delete_confirm->popup_centered();
}
void ProjectExportDialog::_delete_preset_confirm() {
-
int idx = presets->get_current();
_edit_preset(-1);
export_button->set_disabled(true);
@@ -632,7 +698,6 @@ void ProjectExportDialog::_delete_preset_confirm() {
}
Variant ProjectExportDialog::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
-
if (p_from == presets) {
int pos = presets->get_item_at_position(p_point, true);
@@ -649,16 +714,14 @@ Variant ProjectExportDialog::get_drag_data_fw(const Point2 &p_point, Control *p_
label->set_text(presets->get_item_text(pos));
drag->add_child(label);
- set_drag_preview(drag);
+ presets->set_drag_preview(drag);
return d;
}
} else if (p_from == patches) {
-
TreeItem *item = patches->get_item_at_position(p_point);
if (item && item->get_cell_mode(0) == TreeItem::CELL_MODE_CHECK) {
-
int metadata = item->get_metadata(0);
Dictionary d;
d["type"] = "export_patch";
@@ -666,7 +729,7 @@ Variant ProjectExportDialog::get_drag_data_fw(const Point2 &p_point, Control *p_
Label *label = memnew(Label);
label->set_text(item->get_text(0));
- set_drag_preview(label);
+ patches->set_drag_preview(label);
return d;
}
@@ -676,26 +739,26 @@ Variant ProjectExportDialog::get_drag_data_fw(const Point2 &p_point, Control *p_
}
bool ProjectExportDialog::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const {
-
if (p_from == presets) {
Dictionary d = p_data;
- if (!d.has("type") || String(d["type"]) != "export_preset")
+ if (!d.has("type") || String(d["type"]) != "export_preset") {
return false;
+ }
- if (presets->get_item_at_position(p_point, true) < 0 && !presets->is_pos_at_end_of_items(p_point))
+ if (presets->get_item_at_position(p_point, true) < 0 && !presets->is_pos_at_end_of_items(p_point)) {
return false;
+ }
} else if (p_from == patches) {
-
Dictionary d = p_data;
- if (!d.has("type") || String(d["type"]) != "export_patch")
+ if (!d.has("type") || String(d["type"]) != "export_patch") {
return false;
+ }
patches->set_drop_mode_flags(Tree::DROP_MODE_ON_ITEM);
TreeItem *item = patches->get_item_at_position(p_point);
if (!item) {
-
return false;
}
}
@@ -704,7 +767,6 @@ bool ProjectExportDialog::can_drop_data_fw(const Point2 &p_point, const Variant
}
void ProjectExportDialog::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
-
if (p_from == presets) {
Dictionary d = p_data;
int from_pos = d["preset"];
@@ -715,12 +777,13 @@ void ProjectExportDialog::drop_data_fw(const Point2 &p_point, const Variant &p_d
to_pos = presets->get_item_at_position(p_point, true);
}
- if (to_pos == -1 && !presets->is_pos_at_end_of_items(p_point))
+ if (to_pos == -1 && !presets->is_pos_at_end_of_items(p_point)) {
return;
+ }
- if (to_pos == from_pos)
+ if (to_pos == from_pos) {
return;
- else if (to_pos > from_pos) {
+ } else if (to_pos > from_pos) {
to_pos--;
}
@@ -729,27 +792,29 @@ void ProjectExportDialog::drop_data_fw(const Point2 &p_point, const Variant &p_d
EditorExport::get_singleton()->add_export_preset(preset, to_pos);
_update_presets();
- if (to_pos >= 0)
+ if (to_pos >= 0) {
_edit_preset(to_pos);
- else
+ } else {
_edit_preset(presets->get_item_count() - 1);
+ }
} else if (p_from == patches) {
-
Dictionary d = p_data;
- if (!d.has("type") || String(d["type"]) != "export_patch")
+ if (!d.has("type") || String(d["type"]) != "export_patch") {
return;
+ }
int from_pos = d["patch"];
TreeItem *item = patches->get_item_at_position(p_point);
- if (!item)
+ if (!item) {
return;
+ }
int to_pos = item->get_cell_mode(0) == TreeItem::CELL_MODE_CHECK ? int(item->get_metadata(0)) : -1;
- if (to_pos == from_pos)
+ if (to_pos == from_pos) {
return;
- else if (to_pos > from_pos) {
+ } else if (to_pos > from_pos) {
to_pos--;
}
@@ -763,13 +828,14 @@ void ProjectExportDialog::drop_data_fw(const Point2 &p_point, const Variant &p_d
}
void ProjectExportDialog::_export_type_changed(int p_which) {
-
- if (updating)
+ if (updating) {
return;
+ }
Ref<EditorExportPreset> current = get_current_preset();
- if (current.is_null())
+ if (current.is_null()) {
return;
+ }
current->set_export_filter(EditorExportPreset::ExportFilter(p_which));
updating = true;
@@ -778,27 +844,28 @@ void ProjectExportDialog::_export_type_changed(int p_which) {
}
void ProjectExportDialog::_filter_changed(const String &p_filter) {
-
- if (updating)
+ if (updating) {
return;
+ }
Ref<EditorExportPreset> current = get_current_preset();
- if (current.is_null())
+ if (current.is_null()) {
return;
+ }
current->set_include_filter(include_filters->get_text());
current->set_exclude_filter(exclude_filters->get_text());
}
void ProjectExportDialog::_fill_resource_tree() {
-
include_files->clear();
include_label->hide();
include_margin->hide();
Ref<EditorExportPreset> current = get_current_preset();
- if (current.is_null())
+ if (current.is_null()) {
return;
+ }
EditorExportPreset::ExportFilter f = current->get_export_filter();
@@ -815,13 +882,11 @@ void ProjectExportDialog::_fill_resource_tree() {
}
bool ProjectExportDialog::_fill_tree(EditorFileSystemDirectory *p_dir, TreeItem *p_item, Ref<EditorExportPreset> &current, bool p_only_scenes) {
-
- p_item->set_icon(0, get_icon("folder", "FileDialog"));
+ p_item->set_icon(0, presets->get_theme_icon("folder", "FileDialog"));
p_item->set_text(0, p_dir->get_name() + "/");
bool used = false;
for (int i = 0; i < p_dir->get_subdir_count(); i++) {
-
TreeItem *subdir = include_files->create_item(p_item);
if (_fill_tree(p_dir->get_subdir(i), subdir, current, p_only_scenes)) {
used = true;
@@ -831,10 +896,10 @@ bool ProjectExportDialog::_fill_tree(EditorFileSystemDirectory *p_dir, TreeItem
}
for (int i = 0; i < p_dir->get_file_count(); i++) {
-
String type = p_dir->get_file_type(i);
- if (p_only_scenes && type != "PackedScene")
+ if (p_only_scenes && type != "PackedScene") {
continue;
+ }
TreeItem *file = include_files->create_item(p_item);
file->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
@@ -854,17 +919,19 @@ bool ProjectExportDialog::_fill_tree(EditorFileSystemDirectory *p_dir, TreeItem
}
void ProjectExportDialog::_tree_changed() {
-
- if (updating)
+ if (updating) {
return;
+ }
Ref<EditorExportPreset> current = get_current_preset();
- if (current.is_null())
+ if (current.is_null()) {
return;
+ }
TreeItem *item = include_files->get_edited();
- if (!item)
+ if (!item) {
return;
+ }
String path = item->get_metadata(0);
bool added = item->is_checked(0);
@@ -877,12 +944,10 @@ void ProjectExportDialog::_tree_changed() {
}
void ProjectExportDialog::_export_pck_zip() {
-
- export_pck_zip->popup_centered_ratio();
+ export_pck_zip->popup_file_dialog();
}
void ProjectExportDialog::_export_pck_zip_selected(const String &p_path) {
-
Ref<EditorExportPreset> current = get_current_preset();
ERR_FAIL_COND(current.is_null());
Ref<EditorExportPlatform> platform = current->get_platform();
@@ -896,7 +961,6 @@ void ProjectExportDialog::_export_pck_zip_selected(const String &p_path) {
}
void ProjectExportDialog::_open_export_template_manager() {
-
EditorNode::get_singleton()->open_export_template_manager();
hide();
}
@@ -906,22 +970,23 @@ void ProjectExportDialog::_validate_export_path(const String &p_path) {
bool invalid_path = (p_path.get_file().get_basename() == "");
// Check if state change before needlessly messing with signals
- if (invalid_path && export_project->get_ok()->is_disabled())
+ if (invalid_path && export_project->get_ok()->is_disabled()) {
return;
- if (!invalid_path && !export_project->get_ok()->is_disabled())
+ }
+ if (!invalid_path && !export_project->get_ok()->is_disabled()) {
return;
+ }
if (invalid_path) {
export_project->get_ok()->set_disabled(true);
- export_project->get_line_edit()->disconnect("text_entered", export_project, "_file_entered");
+ export_project->get_line_edit()->disconnect_compat("text_entered", export_project, "_file_entered");
} else {
export_project->get_ok()->set_disabled(false);
- export_project->get_line_edit()->connect("text_entered", export_project, "_file_entered");
+ export_project->get_line_edit()->connect_compat("text_entered", export_project, "_file_entered");
}
}
void ProjectExportDialog::_export_project() {
-
Ref<EditorExportPreset> current = get_current_preset();
ERR_FAIL_COND(current.is_null());
Ref<EditorExportPlatform> platform = current->get_platform();
@@ -945,14 +1010,17 @@ void ProjectExportDialog::_export_project() {
}
}
- // Ensure that signal is connected if previous attempt left it disconnected with _validate_export_path
- if (!export_project->get_line_edit()->is_connected("text_entered", export_project, "_file_entered")) {
+ // Ensure that signal is connected if previous attempt left it disconnected
+ // with _validate_export_path.
+ // FIXME: This is a hack, we should instead change EditorFileDialog to allow
+ // disabling validation by the "text_entered" signal.
+ if (!export_project->get_line_edit()->is_connected_compat("text_entered", export_project, "_file_entered")) {
export_project->get_ok()->set_disabled(false);
- export_project->get_line_edit()->connect("text_entered", export_project, "_file_entered");
+ export_project->get_line_edit()->connect_compat("text_entered", export_project, "_file_entered");
}
- export_project->set_mode(EditorFileDialog::MODE_SAVE_FILE);
- export_project->popup_centered_ratio();
+ export_project->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
+ export_project->popup_file_dialog();
}
void ProjectExportDialog::_export_project_to_path(const String &p_path) {
@@ -974,27 +1042,24 @@ void ProjectExportDialog::_export_project_to_path(const String &p_path) {
error_dialog->set_text(vformat(TTR("Failed to export the project for platform '%s'.\nThis might be due to a configuration issue in the export preset or your export settings."), platform->get_name()));
}
- ERR_PRINTS(vformat("Failed to export the project for platform '%s'.", platform->get_name()));
+ ERR_PRINT(vformat("Failed to export the project for platform '%s'.", platform->get_name()));
error_dialog->show();
- error_dialog->popup_centered_minsize(Size2(300, 80));
+ error_dialog->popup_centered(Size2(300, 80));
}
}
void ProjectExportDialog::_export_all_dialog() {
-
export_all_dialog->show();
- export_all_dialog->popup_centered_minsize(Size2(300, 80));
+ export_all_dialog->popup_centered(Size2(300, 80));
}
void ProjectExportDialog::_export_all_dialog_action(const String &p_str) {
-
export_all_dialog->hide();
_export_all(p_str != "release");
}
void ProjectExportDialog::_export_all(bool p_debug) {
-
String mode = p_debug ? TTR("Debug") : TTR("Release");
EditorProgress ep("exportall", TTR("Exporting All") + " " + mode, EditorExport::get_singleton()->get_export_preset_count(), true);
@@ -1014,46 +1079,17 @@ void ProjectExportDialog::_export_all(bool p_debug) {
error_dialog->set_text(TTR("Export templates for this platform are missing/corrupted:") + " " + platform->get_name());
}
error_dialog->show();
- error_dialog->popup_centered_minsize(Size2(300, 80));
+ error_dialog->popup_centered(Size2(300, 80));
ERR_PRINT("Failed to export project");
}
}
}
void ProjectExportDialog::_bind_methods() {
-
- ClassDB::bind_method("_add_preset", &ProjectExportDialog::_add_preset);
- ClassDB::bind_method("_edit_preset", &ProjectExportDialog::_edit_preset);
- ClassDB::bind_method("_update_parameters", &ProjectExportDialog::_update_parameters);
- ClassDB::bind_method("_runnable_pressed", &ProjectExportDialog::_runnable_pressed);
- ClassDB::bind_method("_name_changed", &ProjectExportDialog::_name_changed);
- ClassDB::bind_method("_duplicate_preset", &ProjectExportDialog::_duplicate_preset);
- ClassDB::bind_method("_delete_preset", &ProjectExportDialog::_delete_preset);
- ClassDB::bind_method("_delete_preset_confirm", &ProjectExportDialog::_delete_preset_confirm);
ClassDB::bind_method("get_drag_data_fw", &ProjectExportDialog::get_drag_data_fw);
ClassDB::bind_method("can_drop_data_fw", &ProjectExportDialog::can_drop_data_fw);
ClassDB::bind_method("drop_data_fw", &ProjectExportDialog::drop_data_fw);
- ClassDB::bind_method("_export_type_changed", &ProjectExportDialog::_export_type_changed);
- ClassDB::bind_method("_filter_changed", &ProjectExportDialog::_filter_changed);
- ClassDB::bind_method("_tree_changed", &ProjectExportDialog::_tree_changed);
- ClassDB::bind_method("_patch_button_pressed", &ProjectExportDialog::_patch_button_pressed);
- ClassDB::bind_method("_patch_selected", &ProjectExportDialog::_patch_selected);
- ClassDB::bind_method("_patch_deleted", &ProjectExportDialog::_patch_deleted);
- ClassDB::bind_method("_patch_edited", &ProjectExportDialog::_patch_edited);
- ClassDB::bind_method("_export_pck_zip", &ProjectExportDialog::_export_pck_zip);
- ClassDB::bind_method("_export_pck_zip_selected", &ProjectExportDialog::_export_pck_zip_selected);
- ClassDB::bind_method("_open_export_template_manager", &ProjectExportDialog::_open_export_template_manager);
- ClassDB::bind_method("_validate_export_path", &ProjectExportDialog::_validate_export_path);
- ClassDB::bind_method("_export_path_changed", &ProjectExportDialog::_export_path_changed);
- ClassDB::bind_method("_script_export_mode_changed", &ProjectExportDialog::_script_export_mode_changed);
- ClassDB::bind_method("_script_encryption_key_changed", &ProjectExportDialog::_script_encryption_key_changed);
- ClassDB::bind_method("_export_project", &ProjectExportDialog::_export_project);
- ClassDB::bind_method("_export_project_to_path", &ProjectExportDialog::_export_project_to_path);
ClassDB::bind_method("_export_all", &ProjectExportDialog::_export_all);
- ClassDB::bind_method("_export_all_dialog", &ProjectExportDialog::_export_all_dialog);
- ClassDB::bind_method("_export_all_dialog_action", &ProjectExportDialog::_export_all_dialog_action);
- ClassDB::bind_method("_custom_features_changed", &ProjectExportDialog::_custom_features_changed);
- ClassDB::bind_method("_tab_changed", &ProjectExportDialog::_tab_changed);
ClassDB::bind_method("set_export_path", &ProjectExportDialog::set_export_path);
ClassDB::bind_method("get_export_path", &ProjectExportDialog::get_export_path);
ClassDB::bind_method("get_current_preset", &ProjectExportDialog::get_current_preset);
@@ -1062,15 +1098,14 @@ void ProjectExportDialog::_bind_methods() {
}
ProjectExportDialog::ProjectExportDialog() {
-
set_title(TTR("Export"));
- set_resizable(true);
VBoxContainer *main_vb = memnew(VBoxContainer);
+ main_vb->connect("theme_changed", callable_mp(this, &ProjectExportDialog::_theme_changed));
add_child(main_vb);
HSplitContainer *hbox = memnew(HSplitContainer);
main_vb->add_child(hbox);
- hbox->set_v_size_flags(SIZE_EXPAND_FILL);
+ hbox->set_v_size_flags(Control::SIZE_EXPAND_FILL);
// Presets list.
@@ -1085,21 +1120,26 @@ ProjectExportDialog::ProjectExportDialog() {
add_preset = memnew(MenuButton);
add_preset->set_text(TTR("Add..."));
- add_preset->get_popup()->connect("index_pressed", this, "_add_preset");
+ add_preset->get_popup()->connect("index_pressed", callable_mp(this, &ProjectExportDialog::_add_preset));
preset_hb->add_child(add_preset);
MarginContainer *mc = memnew(MarginContainer);
preset_vb->add_child(mc);
- mc->set_v_size_flags(SIZE_EXPAND_FILL);
+ mc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
presets = memnew(ItemList);
- presets->set_drag_forwarding(this);
+#ifndef _MSC_VER
+#warning must reimplement drag forward
+#endif
+ //presets->set_drag_forwarding(this);
mc->add_child(presets);
- presets->connect("item_selected", this, "_edit_preset");
- duplicate_preset = memnew(ToolButton);
+ presets->connect("item_selected", callable_mp(this, &ProjectExportDialog::_edit_preset));
+ duplicate_preset = memnew(Button);
+ duplicate_preset->set_flat(true);
preset_hb->add_child(duplicate_preset);
- duplicate_preset->connect("pressed", this, "_duplicate_preset");
- delete_preset = memnew(ToolButton);
+ duplicate_preset->connect("pressed", callable_mp(this, &ProjectExportDialog::_duplicate_preset));
+ delete_preset = memnew(Button);
+ delete_preset->set_flat(true);
preset_hb->add_child(delete_preset);
- delete_preset->connect("pressed", this, "_delete_preset");
+ delete_preset->connect("pressed", callable_mp(this, &ProjectExportDialog::_delete_preset));
// Preset settings.
@@ -1109,11 +1149,11 @@ ProjectExportDialog::ProjectExportDialog() {
name = memnew(LineEdit);
settings_vb->add_margin_child(TTR("Name:"), name);
- name->connect("text_changed", this, "_name_changed");
+ name->connect("text_changed", callable_mp(this, &ProjectExportDialog::_name_changed));
runnable = memnew(CheckButton);
runnable->set_text(TTR("Runnable"));
runnable->set_tooltip(TTR("If checked, the preset will be available for use in one-click deploy.\nOnly one preset per platform may be marked as runnable."));
- runnable->connect("pressed", this, "_runnable_pressed");
+ runnable->connect("pressed", callable_mp(this, &ProjectExportDialog::_runnable_pressed));
settings_vb->add_child(runnable);
export_path = memnew(EditorPropertyPath);
@@ -1121,7 +1161,7 @@ ProjectExportDialog::ProjectExportDialog() {
export_path->set_label(TTR("Export Path"));
export_path->set_object_and_property(this, "export_path");
export_path->set_save_mode();
- export_path->connect("property_changed", this, "_export_path_changed");
+ export_path->connect("property_changed", callable_mp(this, &ProjectExportDialog::_export_path_changed));
// Subsections.
@@ -1129,15 +1169,16 @@ ProjectExportDialog::ProjectExportDialog() {
sections->set_tab_align(TabContainer::ALIGN_LEFT);
sections->set_use_hidden_tabs_for_min_size(true);
settings_vb->add_child(sections);
- sections->set_v_size_flags(SIZE_EXPAND_FILL);
+ sections->set_v_size_flags(Control::SIZE_EXPAND_FILL);
// Main preset parameters.
parameters = memnew(EditorInspector);
sections->add_child(parameters);
parameters->set_name(TTR("Options"));
- parameters->set_v_size_flags(SIZE_EXPAND_FILL);
- parameters->connect("property_edited", this, "_update_parameters");
+ parameters->set_v_size_flags(Control::SIZE_EXPAND_FILL);
+ parameters->connect("property_edited", callable_mp(this, &ProjectExportDialog::_update_parameters));
+ EditorExport::get_singleton()->connect("export_presets_updated", callable_mp(this, &ProjectExportDialog::_force_update_current_preset_parameters));
// Resources export parameters.
@@ -1150,30 +1191,36 @@ ProjectExportDialog::ProjectExportDialog() {
export_filter->add_item(TTR("Export selected scenes (and dependencies)"));
export_filter->add_item(TTR("Export selected resources (and dependencies)"));
resources_vb->add_margin_child(TTR("Export Mode:"), export_filter);
- export_filter->connect("item_selected", this, "_export_type_changed");
+ export_filter->connect("item_selected", callable_mp(this, &ProjectExportDialog::_export_type_changed));
include_label = memnew(Label);
include_label->set_text(TTR("Resources to export:"));
resources_vb->add_child(include_label);
include_margin = memnew(MarginContainer);
- include_margin->set_v_size_flags(SIZE_EXPAND_FILL);
+ include_margin->set_v_size_flags(Control::SIZE_EXPAND_FILL);
resources_vb->add_child(include_margin);
include_files = memnew(Tree);
include_margin->add_child(include_files);
- include_files->connect("item_edited", this, "_tree_changed");
+ include_files->connect("item_edited", callable_mp(this, &ProjectExportDialog::_tree_changed));
include_filters = memnew(LineEdit);
resources_vb->add_margin_child(
TTR("Filters to export non-resource files/folders\n(comma-separated, e.g: *.json, *.txt, docs/*)"),
include_filters);
- include_filters->connect("text_changed", this, "_filter_changed");
+ include_filters->connect("text_changed", callable_mp(this, &ProjectExportDialog::_filter_changed));
exclude_filters = memnew(LineEdit);
resources_vb->add_margin_child(
TTR("Filters to exclude files/folders from project\n(comma-separated, e.g: *.json, *.txt, docs/*)"),
exclude_filters);
- exclude_filters->connect("text_changed", this, "_filter_changed");
+ exclude_filters->connect("text_changed", callable_mp(this, &ProjectExportDialog::_filter_changed));
+
+ script_mode = memnew(OptionButton);
+ resources_vb->add_margin_child(TTR("Script Export Mode:"), script_mode);
+ script_mode->add_item(TTR("Text"), (int)EditorExportPreset::MODE_SCRIPT_TEXT);
+ script_mode->add_item(TTR("Compiled"), (int)EditorExportPreset::MODE_SCRIPT_COMPILED);
+ script_mode->connect("item_selected", callable_mp(this, &ProjectExportDialog::_script_export_mode_changed));
// Patch packages.
@@ -1188,11 +1235,14 @@ ProjectExportDialog::ProjectExportDialog() {
patches = memnew(Tree);
patch_vb->add_child(patches);
- patches->set_v_size_flags(SIZE_EXPAND_FILL);
+ patches->set_v_size_flags(Control::SIZE_EXPAND_FILL);
patches->set_hide_root(true);
- patches->connect("button_pressed", this, "_patch_button_pressed");
- patches->connect("item_edited", this, "_patch_edited");
- patches->set_drag_forwarding(this);
+ patches->connect("button_pressed", callable_mp(this, &ProjectExportDialog::_patch_button_pressed));
+ patches->connect("item_edited", callable_mp(this, &ProjectExportDialog::_patch_edited));
+#ifndef _MSC_VER
+#warning must reimplement drag forward
+#endif
+ //patches->set_drag_forwarding(this);
patches->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true);
HBoxContainer *patches_hb = memnew(HBoxContainer);
@@ -1205,13 +1255,13 @@ ProjectExportDialog::ProjectExportDialog() {
patch_dialog = memnew(EditorFileDialog);
patch_dialog->add_filter("*.pck ; " + TTR("Pack File"));
- patch_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
- patch_dialog->connect("file_selected", this, "_patch_selected");
+ patch_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
+ patch_dialog->connect("file_selected", callable_mp(this, &ProjectExportDialog::_patch_selected));
add_child(patch_dialog);
patch_erase = memnew(ConfirmationDialog);
patch_erase->get_ok()->set_text(TTR("Delete"));
- patch_erase->connect("confirmed", this, "_patch_deleted");
+ patch_erase->connect("confirmed", callable_mp(this, &ProjectExportDialog::_patch_deleted));
add_child(patch_erase);
// Feature tags.
@@ -1219,38 +1269,62 @@ ProjectExportDialog::ProjectExportDialog() {
VBoxContainer *feature_vb = memnew(VBoxContainer);
feature_vb->set_name(TTR("Features"));
custom_features = memnew(LineEdit);
- custom_features->connect("text_changed", this, "_custom_features_changed");
+ custom_features->connect("text_changed", callable_mp(this, &ProjectExportDialog::_custom_features_changed));
feature_vb->add_margin_child(TTR("Custom (comma-separated):"), custom_features);
- Panel *features_panel = memnew(Panel);
custom_feature_display = memnew(RichTextLabel);
- features_panel->add_child(custom_feature_display);
- custom_feature_display->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 10 * EDSCALE);
- custom_feature_display->set_v_size_flags(SIZE_EXPAND_FILL);
- feature_vb->add_margin_child(TTR("Feature List:"), features_panel, true);
+ custom_feature_display->set_v_size_flags(Control::SIZE_EXPAND_FILL);
+ feature_vb->add_margin_child(TTR("Feature List:"), custom_feature_display, true);
sections->add_child(feature_vb);
// Script export parameters.
updating_script_key = false;
+ updating_enc_filters = false;
+
+ VBoxContainer *sec_vb = memnew(VBoxContainer);
+ sec_vb->set_name(TTR("Encryption"));
+
+ enc_pck = memnew(CheckButton);
+ enc_pck->connect("toggled", callable_mp(this, &ProjectExportDialog::_enc_pck_changed));
+ enc_pck->set_text(TTR("Encrypt exported PCK"));
+ sec_vb->add_child(enc_pck);
+
+ enc_directory = memnew(CheckButton);
+ enc_directory->connect("toggled", callable_mp(this, &ProjectExportDialog::_enc_directory_changed));
+ enc_directory->set_text("Encrypt index (file names and info).");
+ sec_vb->add_child(enc_directory);
+
+ enc_in_filters = memnew(LineEdit);
+ enc_in_filters->connect("text_changed", callable_mp(this, &ProjectExportDialog::_enc_filters_changed));
+ sec_vb->add_margin_child(
+ TTR("Filters to include files/folders\n(comma-separated, e.g: *.tscn, *.tres, scenes/*)"),
+ enc_in_filters);
+
+ enc_ex_filters = memnew(LineEdit);
+ enc_ex_filters->connect("text_changed", callable_mp(this, &ProjectExportDialog::_enc_filters_changed));
+ sec_vb->add_margin_child(
+ TTR("Filters to exclude files/folders\n(comma-separated, e.g: *.stex, *.import, music/*)"),
+ enc_ex_filters);
- VBoxContainer *script_vb = memnew(VBoxContainer);
- script_vb->set_name(TTR("Script"));
- script_mode = memnew(OptionButton);
- script_vb->add_margin_child(TTR("Script Export Mode:"), script_mode);
- script_mode->add_item(TTR("Text"), (int)EditorExportPreset::MODE_SCRIPT_TEXT);
- script_mode->add_item(TTR("Compiled"), (int)EditorExportPreset::MODE_SCRIPT_COMPILED);
- script_mode->add_item(TTR("Encrypted (Provide Key Below)"), (int)EditorExportPreset::MODE_SCRIPT_ENCRYPTED);
- script_mode->connect("item_selected", this, "_script_export_mode_changed");
script_key = memnew(LineEdit);
- script_key->connect("text_changed", this, "_script_encryption_key_changed");
+ script_key->connect("text_changed", callable_mp(this, &ProjectExportDialog::_script_encryption_key_changed));
script_key_error = memnew(Label);
script_key_error->set_text("- " + TTR("Invalid Encryption Key (must be 64 characters long)"));
- script_key_error->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"));
- script_vb->add_margin_child(TTR("Script Encryption Key (256-bits as hex):"), script_key);
- script_vb->add_child(script_key_error);
- sections->add_child(script_vb);
+ script_key_error->add_theme_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_theme_color("error_color", "Editor"));
+ sec_vb->add_margin_child(TTR("Encryption Key (256-bits as hex):"), script_key);
+ sec_vb->add_child(script_key_error);
+ sections->add_child(sec_vb);
+
+ Label *sec_info = memnew(Label);
+ sec_info->set_text(TTR("Note: Encryption key needs to be stored in the binary,\nyou need to build the export templates from source."));
+ sec_vb->add_child(sec_info);
+
+ LinkButton *sec_more_info = memnew(LinkButton);
+ sec_more_info->set_text(TTR("More Info..."));
+ sec_more_info->connect("pressed", callable_mp(this, &ProjectExportDialog::_open_key_help_link));
+ sec_vb->add_child(sec_more_info);
- sections->connect("tab_changed", this, "_tab_changed");
+ sections->connect("tab_changed", callable_mp(this, &ProjectExportDialog::_tab_changed));
// Disable by default.
name->set_editable(false);
@@ -1260,14 +1334,14 @@ ProjectExportDialog::ProjectExportDialog() {
delete_preset->set_disabled(true);
script_key_error->hide();
sections->hide();
- parameters->edit(NULL);
+ parameters->edit(nullptr);
// Deletion dialog.
delete_confirm = memnew(ConfirmationDialog);
add_child(delete_confirm);
delete_confirm->get_ok()->set_text(TTR("Delete"));
- delete_confirm->connect("confirmed", this, "_delete_preset_confirm");
+ delete_confirm->connect("confirmed", callable_mp(this, &ProjectExportDialog::_delete_preset_confirm));
// Export buttons, dialogs and errors.
@@ -1275,8 +1349,8 @@ ProjectExportDialog::ProjectExportDialog() {
get_cancel()->set_text(TTR("Close"));
get_ok()->set_text(TTR("Export PCK/Zip"));
- export_button = add_button(TTR("Export Project"), !OS::get_singleton()->get_swap_ok_cancel(), "export");
- export_button->connect("pressed", this, "_export_project");
+ export_button = add_button(TTR("Export Project"), !DisplayServer::get_singleton()->get_swap_cancel_ok(), "export");
+ export_button->connect("pressed", callable_mp(this, &ProjectExportDialog::_export_project));
// Disable initially before we select a valid preset
export_button->set_disabled(true);
get_ok()->set_disabled(true);
@@ -1288,24 +1362,24 @@ ProjectExportDialog::ProjectExportDialog() {
export_all_dialog->get_ok()->hide();
export_all_dialog->add_button(TTR("Debug"), true, "debug");
export_all_dialog->add_button(TTR("Release"), true, "release");
- export_all_dialog->connect("custom_action", this, "_export_all_dialog_action");
+ export_all_dialog->connect("custom_action", callable_mp(this, &ProjectExportDialog::_export_all_dialog_action));
- export_all_button = add_button(TTR("Export All"), !OS::get_singleton()->get_swap_ok_cancel(), "export");
- export_all_button->connect("pressed", this, "_export_all_dialog");
+ export_all_button = add_button(TTR("Export All"), !DisplayServer::get_singleton()->get_swap_cancel_ok(), "export");
+ export_all_button->connect("pressed", callable_mp(this, &ProjectExportDialog::_export_all_dialog));
export_all_button->set_disabled(true);
export_pck_zip = memnew(EditorFileDialog);
export_pck_zip->add_filter("*.zip ; " + TTR("ZIP File"));
export_pck_zip->add_filter("*.pck ; " + TTR("Godot Game Pack"));
export_pck_zip->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
- export_pck_zip->set_mode(EditorFileDialog::MODE_SAVE_FILE);
+ export_pck_zip->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
add_child(export_pck_zip);
- export_pck_zip->connect("file_selected", this, "_export_pck_zip_selected");
+ export_pck_zip->connect("file_selected", callable_mp(this, &ProjectExportDialog::_export_pck_zip_selected));
export_error = memnew(Label);
main_vb->add_child(export_error);
export_error->hide();
- export_error->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"));
+ export_error->add_theme_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_theme_color("error_color", "Editor"));
export_templates_error = memnew(HBoxContainer);
main_vb->add_child(export_templates_error);
@@ -1313,7 +1387,7 @@ ProjectExportDialog::ProjectExportDialog() {
Label *export_error2 = memnew(Label);
export_templates_error->add_child(export_error2);
- export_error2->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"));
+ export_error2->add_theme_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_theme_color("error_color", "Editor"));
export_error2->set_text(" - " + TTR("Export templates for this platform are missing:") + " ");
error_dialog = memnew(AcceptDialog);
@@ -1324,15 +1398,15 @@ ProjectExportDialog::ProjectExportDialog() {
LinkButton *download_templates = memnew(LinkButton);
download_templates->set_text(TTR("Manage Export Templates"));
- download_templates->set_v_size_flags(SIZE_SHRINK_CENTER);
+ download_templates->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
export_templates_error->add_child(download_templates);
- download_templates->connect("pressed", this, "_open_export_template_manager");
+ download_templates->connect("pressed", callable_mp(this, &ProjectExportDialog::_open_export_template_manager));
export_project = memnew(EditorFileDialog);
export_project->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
add_child(export_project);
- export_project->connect("file_selected", this, "_export_project_to_path");
- export_project->get_line_edit()->connect("text_changed", this, "_validate_export_path");
+ export_project->connect("file_selected", callable_mp(this, &ProjectExportDialog::_export_project_to_path));
+ export_project->get_line_edit()->connect("text_changed", callable_mp(this, &ProjectExportDialog::_validate_export_path));
export_debug = memnew(CheckBox);
export_debug->set_text(TTR("Export With Debug"));