|
35 | 35 | #include "core/config/project_settings.h" |
36 | 36 | #include "core/crypto/crypto_core.h" |
37 | 37 | #include "core/extension/gdextension.h" |
| 38 | +#include "core/io/dir_access.h" |
38 | 39 | #include "core/io/file_access_encrypted.h" |
39 | 40 | #include "core/io/file_access_pack.h" // PACK_HEADER_MAGIC, PACK_FORMAT_VERSION |
| 41 | +#include "core/io/image.h" |
40 | 42 | #include "core/io/image_loader.h" |
41 | 43 | #include "core/io/resource_uid.h" |
42 | | -#include "core/io/zip_io.h" |
43 | 44 | #include "core/math/random_pcg.h" |
| 45 | +#include "core/os/shared_object.h" |
44 | 46 | #include "core/version.h" |
45 | 47 | #include "editor/editor_node.h" |
46 | 48 | #include "editor/editor_string_names.h" |
|
51 | 53 | #include "editor/settings/editor_settings.h" |
52 | 54 | #include "editor/themes/editor_scale.h" |
53 | 55 | #include "editor_export_plugin.h" |
54 | | -#include "scene/resources/image_texture.h" |
| 56 | +#include "scene/gui/rich_text_label.h" |
| 57 | +#include "scene/main/node.h" |
55 | 58 | #include "scene/resources/packed_scene.h" |
| 59 | +#include "scene/resources/texture.h" |
56 | 60 |
|
57 | 61 | class EditorExportSaveProxy { |
58 | 62 | HashSet<String> saved_paths; |
@@ -84,7 +88,7 @@ static int _get_pad(int p_alignment, int p_n) { |
84 | 88 | return pad; |
85 | 89 | } |
86 | 90 |
|
87 | | -#define PCK_PADDING 16 |
| 91 | +static constexpr int PCK_PADDING = 16; |
88 | 92 |
|
89 | 93 | Ref<Image> EditorExportPlatform::_load_icon_or_splash_image(const String &p_path, Error *r_error) const { |
90 | 94 | Ref<Image> image; |
@@ -311,11 +315,7 @@ Error EditorExportPlatform::_save_pack_file(void *p_userdata, const String &p_pa |
311 | 315 |
|
312 | 316 | PackData *pd = (PackData *)p_userdata; |
313 | 317 |
|
314 | | - String simplified_path = p_path.simplify_path(); |
315 | | - if (simplified_path.begins_with("uid://")) { |
316 | | - simplified_path = ResourceUID::uid_to_path(simplified_path).simplify_path(); |
317 | | - print_verbose(vformat(R"(UID referenced exported file name "%s" was replaced with "%s".)", p_path, simplified_path)); |
318 | | - } |
| 318 | + const String simplified_path = simplify_path(p_path); |
319 | 319 |
|
320 | 320 | Ref<FileAccess> ftmp; |
321 | 321 | if (pd->use_sparse_pck) { |
@@ -374,13 +374,7 @@ Error EditorExportPlatform::_save_pack_patch_file(void *p_userdata, const String |
374 | 374 | Error EditorExportPlatform::_save_zip_file(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total, const Vector<String> &p_enc_in_filters, const Vector<String> &p_enc_ex_filters, const Vector<uint8_t> &p_key, uint64_t p_seed) { |
375 | 375 | ERR_FAIL_COND_V_MSG(p_total < 1, ERR_PARAMETER_RANGE_ERROR, "Must select at least one file to export."); |
376 | 376 |
|
377 | | - String path = p_path.simplify_path(); |
378 | | - if (path.begins_with("uid://")) { |
379 | | - path = ResourceUID::uid_to_path(path).simplify_path(); |
380 | | - print_verbose(vformat(R"(UID referenced exported file name "%s" was replaced with "%s".)", p_path, path)); |
381 | | - } |
382 | | - |
383 | | - path = path.replace_first("res://", ""); |
| 377 | + const String path = simplify_path(p_path).replace_first("res://", ""); |
384 | 378 |
|
385 | 379 | ZipData *zd = (ZipData *)p_userdata; |
386 | 380 |
|
@@ -1046,11 +1040,7 @@ Error EditorExportPlatform::_script_save_file(void *p_userdata, const String &p_ |
1046 | 1040 | Callable cb = ((ScriptCallbackData *)p_userdata)->file_cb; |
1047 | 1041 | ERR_FAIL_COND_V(!cb.is_valid(), FAILED); |
1048 | 1042 |
|
1049 | | - String simplified_path = p_path.simplify_path(); |
1050 | | - if (simplified_path.begins_with("uid://")) { |
1051 | | - simplified_path = ResourceUID::uid_to_path(simplified_path).simplify_path(); |
1052 | | - print_verbose(vformat(R"(UID referenced exported file name "%s" was replaced with "%s".)", p_path, simplified_path)); |
1053 | | - } |
| 1043 | + const String simplified_path = simplify_path(p_path); |
1054 | 1044 |
|
1055 | 1045 | Variant path = simplified_path; |
1056 | 1046 | Variant data = p_data; |
@@ -2494,6 +2484,16 @@ Array EditorExportPlatform::get_current_presets() const { |
2494 | 2484 | return ret; |
2495 | 2485 | } |
2496 | 2486 |
|
| 2487 | +String EditorExportPlatform::simplify_path(const String &p_path) { |
| 2488 | + if (p_path.begins_with("uid://")) { |
| 2489 | + const String path = ResourceUID::uid_to_path(p_path); |
| 2490 | + print_verbose(vformat(R"(UID-referenced exported file name "%s" was replaced with "%s".)", p_path, path)); |
| 2491 | + return path.simplify_path(); |
| 2492 | + } else { |
| 2493 | + return p_path.simplify_path(); |
| 2494 | + } |
| 2495 | +} |
| 2496 | + |
2497 | 2497 | Variant EditorExportPlatform::get_project_setting(const Ref<EditorExportPreset> &p_preset, const StringName &p_name) { |
2498 | 2498 | if (p_preset.is_valid()) { |
2499 | 2499 | return p_preset->get_project_setting(p_name); |
|
0 commit comments