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

@ -469,13 +469,10 @@ _FORCE_INLINE_ void CodeSignRequirements::_parse_certificate_slot(uint32_t &r_po
_FORCE_INLINE_ void CodeSignRequirements::_parse_key(uint32_t &r_pos, String &r_out, uint32_t p_rq_size) const {
#define _R(x) BSWAP32(*(uint32_t *)(blob.ptr() + x))
ERR_FAIL_COND_MSG(r_pos >= p_rq_size, "CodeSign/Requirements: Out of bounds.");
uint32_t key_size = _R(r_pos);
const uint32_t key_size = _R(r_pos);
ERR_FAIL_COND_MSG(r_pos + key_size > p_rq_size, "CodeSign/Requirements: Out of bounds.");
CharString key;
key.resize(key_size);
memcpy(key.ptrw(), blob.ptr() + r_pos + 4, key_size);
r_pos += 4 + key_size + PAD(key_size, 4);
r_out += "[" + String::utf8(key, key_size) + "]";
r_out += "[" + String::utf8((const char *)blob.ptr() + r_pos + 4, key_size) + "]";
#undef _R
}
@ -515,10 +512,7 @@ _FORCE_INLINE_ void CodeSignRequirements::_parse_hash_string(uint32_t &r_pos, St
ERR_FAIL_COND_MSG(r_pos >= p_rq_size, "CodeSign/Requirements: Out of bounds.");
uint32_t tag_size = _R(r_pos);
ERR_FAIL_COND_MSG(r_pos + tag_size > p_rq_size, "CodeSign/Requirements: Out of bounds.");
PackedByteArray data;
data.resize(tag_size);
memcpy(data.ptrw(), blob.ptr() + r_pos + 4, tag_size);
r_out += "H\"" + String::hex_encode_buffer(data.ptr(), data.size()) + "\"";
r_out += "H\"" + String::hex_encode_buffer(blob.ptr() + r_pos + 4, tag_size) + "\"";
r_pos += 4 + tag_size + PAD(tag_size, 4);
#undef _R
}
@ -526,13 +520,10 @@ _FORCE_INLINE_ void CodeSignRequirements::_parse_hash_string(uint32_t &r_pos, St
_FORCE_INLINE_ void CodeSignRequirements::_parse_value(uint32_t &r_pos, String &r_out, uint32_t p_rq_size) const {
#define _R(x) BSWAP32(*(uint32_t *)(blob.ptr() + x))
ERR_FAIL_COND_MSG(r_pos >= p_rq_size, "CodeSign/Requirements: Out of bounds.");
uint32_t key_size = _R(r_pos);
const uint32_t key_size = _R(r_pos);
ERR_FAIL_COND_MSG(r_pos + key_size > p_rq_size, "CodeSign/Requirements: Out of bounds.");
CharString key;
key.resize(key_size);
memcpy(key.ptrw(), blob.ptr() + r_pos + 4, key_size);
r_pos += 4 + key_size + PAD(key_size, 4);
r_out += "\"" + String::utf8(key, key_size) + "\"";
r_out += "\"" + String::utf8((const char *)blob.ptr() + r_pos + 4, key_size) + "\"";
#undef _R
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef CODESIGN_H
#define CODESIGN_H
#pragma once
// macOS code signature creation utility.
//
@ -114,6 +113,8 @@ public:
/*************************************************************************/
class CodeSignBlob : public RefCounted {
GDSOFTCLASS(CodeSignBlob, RefCounted);
public:
virtual PackedByteArray get_hash_sha1() const = 0;
virtual PackedByteArray get_hash_sha256() const = 0;
@ -351,5 +352,3 @@ class CodeSign {
public:
static Error codesign(bool p_use_hardened_runtime, bool p_force, const String &p_path, const String &p_ent_path, String &r_error_msg);
};
#endif // CODESIGN_H

View file

@ -453,6 +453,3 @@ EditorExport::EditorExport() {
singleton = this;
set_process(true);
}
EditorExport::~EditorExport() {
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef EDITOR_EXPORT_H
#define EDITOR_EXPORT_H
#pragma once
#include "editor_export_platform.h"
#include "editor_export_plugin.h"
@ -84,7 +83,4 @@ public:
void connect_presets_runnable_updated(const Callable &p_target);
EditorExport();
~EditorExport();
};
#endif // EDITOR_EXPORT_H

View file

@ -0,0 +1,41 @@
/**************************************************************************/
/* editor_export_platform.compat.inc */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef DISABLE_DEPRECATED
Vector<String> EditorExportPlatform::_get_forced_export_files_bind_compat_71542() {
return get_forced_export_files(Ref<EditorExportPreset>());
}
void EditorExportPlatform::_bind_compatibility_methods() {
ClassDB::bind_compatibility_static_method("EditorExportPlatform", D_METHOD("get_forced_export_files"), &EditorExportPlatform::_get_forced_export_files_bind_compat_71542);
}
#endif

View file

@ -30,6 +30,8 @@
#include "editor_export_platform.h"
#include "editor_export_platform.compat.inc"
#include "core/config/project_settings.h"
#include "core/crypto/crypto_core.h"
#include "core/extension/gdextension.h"
@ -38,6 +40,7 @@
#include "core/io/image_loader.h"
#include "core/io/resource_uid.h"
#include "core/io/zip_io.h"
#include "core/math/random_pcg.h"
#include "core/version.h"
#include "editor/editor_file_system.h"
#include "editor/editor_node.h"
@ -255,6 +258,10 @@ Error EditorExportPlatform::_save_pack_file(void *p_userdata, const String &p_pa
PackData *pd = (PackData *)p_userdata;
String simplified_path = p_path.simplify_path();
if (simplified_path.begins_with("uid://")) {
simplified_path = ResourceUID::uid_to_path(simplified_path).simplify_path();
print_verbose(vformat(R"(UID referenced exported file name "%s" was replaced with "%s".)", p_path, simplified_path));
}
SavedData sd;
sd.path_utf8 = simplified_path.trim_prefix("res://").utf8();
@ -290,7 +297,7 @@ Error EditorExportPlatform::_save_pack_file(void *p_userdata, const String &p_pa
seed = ((seed << 5) + seed) ^ ptr[i];
}
RandomPCG rng = RandomPCG(seed, RandomPCG::DEFAULT_INC);
RandomPCG rng = RandomPCG(seed);
iv.resize(16);
for (int i = 0; i < 16; i++) {
iv.write[i] = rng.rand() % 256;
@ -349,7 +356,13 @@ Error EditorExportPlatform::_save_pack_patch_file(void *p_userdata, const String
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) {
ERR_FAIL_COND_V_MSG(p_total < 1, ERR_PARAMETER_RANGE_ERROR, "Must select at least one file to export.");
String path = p_path.replace_first("res://", "");
String path = p_path.simplify_path();
if (path.begins_with("uid://")) {
path = ResourceUID::uid_to_path(path).simplify_path();
print_verbose(vformat(R"(UID referenced exported file name "%s" was replaced with "%s".)", p_path, path));
}
path = path.replace_first("res://", "");
ZipData *zd = (ZipData *)p_userdata;
@ -393,7 +406,7 @@ Ref<ImageTexture> EditorExportPlatform::get_option_icon(int p_index) const {
}
String EditorExportPlatform::find_export_template(const String &template_file_name, String *err) const {
String current_version = VERSION_FULL_CONFIG;
String current_version = GODOT_VERSION_FULL_CONFIG;
String template_path = EditorPaths::get_singleton()->get_export_templates_dir().path_join(current_version).path_join(template_file_name);
if (FileAccess::exists(template_path)) {
@ -488,7 +501,7 @@ void EditorExportPlatform::_export_find_dependencies(const String &p_path, HashS
void EditorExportPlatform::_edit_files_with_filter(Ref<DirAccess> &da, const Vector<String> &p_filters, HashSet<String> &r_list, bool exclude) {
da->list_dir_begin();
String cur_dir = da->get_current_dir().replace("\\", "/");
String cur_dir = da->get_current_dir().replace_char('\\', '/');
if (!cur_dir.ends_with("/")) {
cur_dir += "/";
}
@ -627,9 +640,7 @@ EditorExportPlatform::ExportNotifier::~ExportNotifier() {
bool EditorExportPlatform::_export_customize_dictionary(Dictionary &dict, LocalVector<Ref<EditorExportPlugin>> &customize_resources_plugins) {
bool changed = false;
List<Variant> keys;
dict.get_key_list(&keys);
for (const Variant &K : keys) {
for (const Variant &K : dict.get_key_list()) {
Variant v = dict[K];
switch (v.get_type()) {
case Variant::OBJECT: {
@ -937,7 +948,7 @@ Dictionary EditorExportPlatform::get_internal_export_files(const Ref<EditorExpor
Dictionary files;
// Text server support data.
if (TS->has_feature(TextServer::FEATURE_USE_SUPPORT_DATA) && (bool)GLOBAL_GET("internationalization/locale/include_text_server_data")) {
if (TS->has_feature(TextServer::FEATURE_USE_SUPPORT_DATA) && (bool)get_project_setting(p_preset, "internationalization/locale/include_text_server_data")) {
String ts_name = TS->get_support_data_filename();
String ts_target = "res://" + ts_name;
if (!ts_name.is_empty()) {
@ -950,7 +961,7 @@ Dictionary EditorExportPlatform::get_internal_export_files(const Ref<EditorExpor
export_ok = true;
}
} else {
String current_version = VERSION_FULL_CONFIG;
String current_version = GODOT_VERSION_FULL_CONFIG;
String template_path = EditorPaths::get_singleton()->get_export_templates_dir().path_join(current_version);
if (p_debug && p_preset->has("custom_template/debug") && p_preset->get("custom_template/debug") != "") {
template_path = p_preset->get("custom_template/debug").operator String().get_base_dir();
@ -983,13 +994,13 @@ Dictionary EditorExportPlatform::get_internal_export_files(const Ref<EditorExpor
return files;
}
Vector<String> EditorExportPlatform::get_forced_export_files() {
Vector<String> EditorExportPlatform::get_forced_export_files(const Ref<EditorExportPreset> &p_preset) {
Vector<String> files;
files.push_back(ProjectSettings::get_singleton()->get_global_class_list_path());
String icon = ResourceUID::ensure_path(GLOBAL_GET("application/config/icon"));
String splash = ResourceUID::ensure_path(GLOBAL_GET("application/boot_splash/image"));
String icon = ResourceUID::ensure_path(get_project_setting(p_preset, "application/config/icon"));
String splash = ResourceUID::ensure_path(get_project_setting(p_preset, "application/boot_splash/image"));
if (!icon.is_empty() && FileAccess::exists(icon)) {
files.push_back(icon);
}
@ -1013,7 +1024,13 @@ Error EditorExportPlatform::_script_save_file(void *p_userdata, const String &p_
Callable cb = ((ScriptCallbackData *)p_userdata)->file_cb;
ERR_FAIL_COND_V(!cb.is_valid(), FAILED);
Variant path = p_path;
String simplified_path = p_path.simplify_path();
if (simplified_path.begins_with("uid://")) {
simplified_path = ResourceUID::uid_to_path(simplified_path).simplify_path();
print_verbose(vformat(R"(UID referenced exported file name "%s" was replaced with "%s".)", p_path, simplified_path));
}
Variant path = simplified_path;
Variant data = p_data;
Variant file = p_file;
Variant total = p_total;
@ -1095,7 +1112,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
continue;
}
String autoload_path = GLOBAL_GET(pi.name);
String autoload_path = get_project_setting(p_preset, pi.name);
if (autoload_path.begins_with("*")) {
autoload_path = autoload_path.substr(1);
@ -1238,7 +1255,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
HashMap<String, FileExportCache> export_cache;
String export_base_path = ProjectSettings::get_singleton()->get_project_data_path().path_join("exported/") + itos(custom_resources_hash);
bool convert_text_to_binary = GLOBAL_GET("editor/export/convert_text_resources_to_binary");
bool convert_text_to_binary = get_project_setting(p_preset, "editor/export/convert_text_resources_to_binary");
if (convert_text_to_binary || !customize_resources_plugins.is_empty() || !customize_scenes_plugins.is_empty()) {
// See if we have something to open
@ -1404,7 +1421,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
for (const String &F : remaps) {
String remap = F;
String feature = remap.get_slice(".", 1);
String feature = remap.get_slicec('.', 1);
if (features.has(feature)) {
remap_features.insert(feature);
}
@ -1423,7 +1440,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
Vector<uint8_t> array = FileAccess::get_file_as_bytes(remapped_path);
err = save_proxy.save_file(p_udata, remapped_path, array, idx, total, enc_in_filters, enc_ex_filters, key, seed);
} else if (remap.begins_with("path.")) {
String feature = remap.get_slice(".", 1);
String feature = remap.get_slicec('.', 1);
if (remap_features.has(feature)) {
String remapped_path = config->get_value("remap", remap);
@ -1550,12 +1567,12 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
}
}
Vector<String> forced_export = get_forced_export_files();
Vector<String> forced_export = get_forced_export_files(p_preset);
for (int i = 0; i < forced_export.size(); i++) {
Vector<uint8_t> array;
if (GDExtension::get_extension_list_config_file() == forced_export[i]) {
array = _filter_extension_list_config_file(forced_export[i], paths);
if (array.size() == 0) {
if (array.is_empty()) {
continue;
}
} else {
@ -1568,9 +1585,9 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
}
Dictionary int_export = get_internal_export_files(p_preset, p_debug);
for (const Variant &int_name : int_export.keys()) {
const PackedByteArray &array = int_export[int_name];
err = save_proxy.save_file(p_udata, int_name, array, idx, total, enc_in_filters, enc_ex_filters, key, seed);
for (const KeyValue<Variant, Variant> &int_export_kv : int_export) {
const PackedByteArray &array = int_export_kv.value;
err = save_proxy.save_file(p_udata, int_export_kv.key, array, idx, total, enc_in_filters, enc_ex_filters, key, seed);
if (err != OK) {
return err;
}
@ -1642,8 +1659,7 @@ Error EditorExportPlatform::_remove_pack_file(void *p_userdata, const String &p_
pd->f->store_8(0);
}
sd.md5.resize(16);
sd.md5.fill(0);
sd.md5.resize_zeroed(16);
pd->file_ofs.push_back(sd);
@ -1946,9 +1962,9 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, b
f->store_32(PACK_HEADER_MAGIC);
f->store_32(PACK_FORMAT_VERSION);
f->store_32(VERSION_MAJOR);
f->store_32(VERSION_MINOR);
f->store_32(VERSION_PATCH);
f->store_32(GODOT_VERSION_MAJOR);
f->store_32(GODOT_VERSION_MINOR);
f->store_32(GODOT_VERSION_PATCH);
uint32_t pack_flags = 0;
bool enc_pck = p_preset->get_enc_pck();
@ -2023,7 +2039,7 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, b
seed = ((seed << 5) + seed) ^ pd.file_ofs[i].size;
}
RandomPCG rng = RandomPCG(seed, RandomPCG::DEFAULT_INC);
RandomPCG rng = RandomPCG(seed);
iv.resize(16);
for (int i = 0; i < 16; i++) {
iv.write[i] = rng.rand() % 256;
@ -2344,7 +2360,7 @@ Error EditorExportPlatform::ssh_run_on_remote(const String &p_host, const String
print_verbose(vformat("Exit code: %d, Output: %s", exit_code, out.replace("\r\n", "\n")));
}
if (r_out) {
*r_out = out.replace("\r\n", "\n").get_slice("\n", 0);
*r_out = out.replace("\r\n", "\n").get_slicec('\n', 0);
}
if (err != OK) {
return err;
@ -2450,6 +2466,14 @@ Array EditorExportPlatform::get_current_presets() const {
return ret;
}
Variant EditorExportPlatform::get_project_setting(const Ref<EditorExportPreset> &p_preset, const StringName &p_name) {
if (p_preset.is_valid()) {
return p_preset->get_project_setting(p_name);
} else {
return GLOBAL_GET(p_name);
}
}
void EditorExportPlatform::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_os_name"), &EditorExportPlatform::get_os_name);
@ -2488,7 +2512,7 @@ void EditorExportPlatform::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_internal_export_files", "preset", "debug"), &EditorExportPlatform::get_internal_export_files);
ClassDB::bind_static_method("EditorExportPlatform", D_METHOD("get_forced_export_files"), &EditorExportPlatform::get_forced_export_files);
ClassDB::bind_static_method("EditorExportPlatform", D_METHOD("get_forced_export_files", "preset"), &EditorExportPlatform::get_forced_export_files);
BIND_ENUM_CONSTANT(EXPORT_MESSAGE_NONE);
BIND_ENUM_CONSTANT(EXPORT_MESSAGE_INFO);
@ -2501,6 +2525,3 @@ void EditorExportPlatform::_bind_methods() {
BIND_BITFIELD_FLAG(DEBUG_FLAG_VIEW_COLLISIONS);
BIND_BITFIELD_FLAG(DEBUG_FLAG_VIEW_NAVIGATION);
}
EditorExportPlatform::EditorExportPlatform() {
}

View file

@ -28,12 +28,12 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef EDITOR_EXPORT_PLATFORM_H
#define EDITOR_EXPORT_PLATFORM_H
#pragma once
class EditorFileSystemDirectory;
struct EditorProgress;
#include "core/config/project_settings.h"
#include "core/io/dir_access.h"
#include "core/io/zip_io.h"
#include "core/os/shared_object.h"
@ -204,7 +204,13 @@ protected:
Ref<Image> _load_icon_or_splash_image(const String &p_path, Error *r_error) const;
#ifndef DISABLE_DEPRECATED
static Vector<String> _get_forced_export_files_bind_compat_71542();
static void _bind_compatibility_methods();
#endif
public:
static Variant get_project_setting(const Ref<EditorExportPreset> &p_preset, const StringName &p_name);
virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) const = 0;
struct ExportOption {
@ -281,7 +287,7 @@ public:
Dictionary get_internal_export_files(const Ref<EditorExportPreset> &p_preset, bool p_debug);
static Vector<String> get_forced_export_files();
static Vector<String> get_forced_export_files(const Ref<EditorExportPreset> &p_preset);
virtual bool fill_log_messages(RichTextLabel *p_log, Error p_err);
@ -337,11 +343,7 @@ public:
virtual void resolve_platform_feature_priorities(const Ref<EditorExportPreset> &p_preset, HashSet<String> &p_features) {}
virtual String get_debug_protocol() const { return "tcp://"; }
virtual HashMap<String, Variant> get_custom_project_settings(const Ref<EditorExportPreset> &p_preset) const { return HashMap<String, Variant>(); }
EditorExportPlatform();
};
VARIANT_ENUM_CAST(EditorExportPlatform::ExportMessageType)
VARIANT_BITFIELD_CAST(EditorExportPlatform::DebugFlags);
#endif // EDITOR_EXPORT_PLATFORM_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef EDITOR_EXPORT_PLATFORM_EXTENSION_H
#define EDITOR_EXPORT_PLATFORM_EXTENSION_H
#pragma once
#include "editor_export_platform.h"
#include "editor_export_preset.h"
@ -151,5 +150,3 @@ public:
EditorExportPlatformExtension();
~EditorExportPlatformExtension();
};
#endif // EDITOR_EXPORT_PLATFORM_EXTENSION_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef EDITOR_EXPORT_PLATFORM_PC_H
#define EDITOR_EXPORT_PLATFORM_PC_H
#pragma once
#include "editor_export_platform.h"
@ -78,5 +77,3 @@ public:
return Error::OK;
}
};
#endif // EDITOR_EXPORT_PLATFORM_PC_H

View file

@ -264,6 +264,12 @@ String EditorExportPlugin::get_android_manifest_element_contents(const Ref<Edito
return ret;
}
PackedByteArray EditorExportPlugin::update_android_prebuilt_manifest(const Ref<EditorExportPlatform> &p_export_platform, const PackedByteArray &p_manifest_data) const {
PackedByteArray ret;
GDVIRTUAL_CALL(_update_android_prebuilt_manifest, p_export_platform, p_manifest_data, ret);
return ret;
}
PackedStringArray EditorExportPlugin::_get_export_features(const Ref<EditorExportPlatform> &p_platform, bool p_debug) const {
PackedStringArray ret;
GDVIRTUAL_CALL(_get_export_features, p_platform, p_debug, ret);
@ -369,4 +375,5 @@ void EditorExportPlugin::_bind_methods() {
GDVIRTUAL_BIND(_get_android_manifest_activity_element_contents, "platform", "debug");
GDVIRTUAL_BIND(_get_android_manifest_application_element_contents, "platform", "debug");
GDVIRTUAL_BIND(_get_android_manifest_element_contents, "platform", "debug");
GDVIRTUAL_BIND(_update_android_prebuilt_manifest, "platform", "manifest_data");
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef EDITOR_EXPORT_PLUGIN_H
#define EDITOR_EXPORT_PLUGIN_H
#pragma once
#include "core/os/shared_object.h"
#include "editor_export_platform.h"
@ -144,6 +143,7 @@ protected:
GDVIRTUAL2RC(String, _get_android_manifest_activity_element_contents, const Ref<EditorExportPlatform> &, bool);
GDVIRTUAL2RC(String, _get_android_manifest_application_element_contents, const Ref<EditorExportPlatform> &, bool);
GDVIRTUAL2RC(String, _get_android_manifest_element_contents, const Ref<EditorExportPlatform> &, bool);
GDVIRTUAL2RC(PackedByteArray, _update_android_prebuilt_manifest, const Ref<EditorExportPlatform> &, const PackedByteArray &);
virtual bool _begin_customize_resources(const Ref<EditorExportPlatform> &p_platform, const Vector<String> &p_features); // Return true if this plugin does property export customization
virtual Ref<Resource> _customize_resource(const Ref<Resource> &p_resource, const String &p_path); // If nothing is returned, it means do not touch (nothing changed). If something is returned (either the same or a different resource) it means changes are made.
@ -175,6 +175,7 @@ public:
virtual String get_android_manifest_activity_element_contents(const Ref<EditorExportPlatform> &p_export_platform, bool p_debug) const;
virtual String get_android_manifest_application_element_contents(const Ref<EditorExportPlatform> &p_export_platform, bool p_debug) const;
virtual String get_android_manifest_element_contents(const Ref<EditorExportPlatform> &p_export_platform, bool p_debug) const;
virtual PackedByteArray update_android_prebuilt_manifest(const Ref<EditorExportPlatform> &p_export_platform, const PackedByteArray &p_manifest_data) const;
Vector<String> get_ios_frameworks() const;
Vector<String> get_ios_embedded_frameworks() const;
@ -186,5 +187,3 @@ public:
const Vector<String> &get_macos_plugin_files() const;
Variant get_option(const StringName &p_name) const;
};
#endif // EDITOR_EXPORT_PLUGIN_H

View file

@ -60,6 +60,29 @@ bool EditorExportPreset::_get(const StringName &p_name, Variant &r_ret) const {
return false;
}
Variant EditorExportPreset::get_project_setting(const StringName &p_name) {
List<String> ftr_list;
platform->get_platform_features(&ftr_list);
platform->get_preset_features(this, &ftr_list);
Vector<String> features;
for (const String &E : ftr_list) {
features.push_back(E);
}
if (!get_custom_features().is_empty()) {
Vector<String> tmp_custom_list = get_custom_features().split(",");
for (int i = 0; i < tmp_custom_list.size(); i++) {
String f = tmp_custom_list[i].strip_edges();
if (!f.is_empty()) {
features.push_back(f);
}
}
}
return ProjectSettings::get_singleton()->get_setting_with_override_and_custom_features(p_name, features);
}
void EditorExportPreset::_bind_methods() {
ClassDB::bind_method(D_METHOD("_get_property_warning", "name"), &EditorExportPreset::_get_property_warning);
@ -70,6 +93,7 @@ void EditorExportPreset::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_customized_files_count"), &EditorExportPreset::get_customized_files_count);
ClassDB::bind_method(D_METHOD("has_export_file", "path"), &EditorExportPreset::has_export_file);
ClassDB::bind_method(D_METHOD("get_file_export_mode", "path", "default"), &EditorExportPreset::get_file_export_mode, DEFVAL(MODE_FILE_NOT_CUSTOMIZED));
ClassDB::bind_method(D_METHOD("get_project_setting", "name"), &EditorExportPreset::get_project_setting);
ClassDB::bind_method(D_METHOD("get_preset_name"), &EditorExportPreset::get_name);
ClassDB::bind_method(D_METHOD("is_runnable"), &EditorExportPreset::is_runnable);
@ -208,10 +232,9 @@ void EditorExportPreset::update_value_overrides() {
Dictionary plugin_overrides = export_plugins[i]->_get_export_options_overrides(platform);
if (!plugin_overrides.is_empty()) {
Array keys = plugin_overrides.keys();
for (int x = 0; x < keys.size(); x++) {
StringName key = keys[x];
Variant value = plugin_overrides[key];
for (const KeyValue<Variant, Variant> &kv : plugin_overrides) {
const StringName &key = kv.key;
const Variant &value = kv.value;
if (new_value_overrides.has(key) && new_value_overrides[key] != value) {
WARN_PRINT_ED(vformat("Editor export plugin '%s' overrides pre-existing export option override '%s' with new value.", export_plugins[i]->get_name(), key));
}
@ -561,5 +584,3 @@ String EditorExportPreset::get_version(const StringName &p_preset_string, bool p
return result;
}
EditorExportPreset::EditorExportPreset() {}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef EDITOR_EXPORT_PRESET_H
#define EDITOR_EXPORT_PRESET_H
#pragma once
class EditorExportPlatform;
@ -126,6 +125,8 @@ public:
void set_file_export_mode(const String &p_path, FileExportMode p_mode);
FileExportMode get_file_export_mode(const String &p_path, FileExportMode p_default = MODE_FILE_NOT_CUSTOMIZED) const;
Variant get_project_setting(const StringName &p_name);
void set_name(const String &p_name);
String get_name() const;
@ -195,12 +196,8 @@ public:
const HashMap<StringName, PropertyInfo> &get_properties() const { return properties; }
const HashMap<StringName, Variant> &get_values() const { return values; }
EditorExportPreset();
};
VARIANT_ENUM_CAST(EditorExportPreset::ExportFilter);
VARIANT_ENUM_CAST(EditorExportPreset::FileExportMode);
VARIANT_ENUM_CAST(EditorExportPreset::ScriptExportMode);
#endif // EDITOR_EXPORT_PRESET_H

View file

@ -43,6 +43,7 @@
#include "editor/progress_dialog.h"
#include "editor/themes/editor_scale.h"
#include "scene/gui/file_dialog.h"
#include "scene/gui/link_button.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/separator.h"
#include "scene/gui/tree.h"
@ -52,25 +53,31 @@ enum DownloadsAvailability {
DOWNLOADS_AVAILABLE,
DOWNLOADS_NOT_AVAILABLE_IN_OFFLINE_MODE,
DOWNLOADS_NOT_AVAILABLE_FOR_DEV_BUILDS,
DOWNLOADS_NOT_AVAILABLE_FOR_DOUBLE_BUILDS,
};
static DownloadsAvailability _get_downloads_availability() {
const int network_mode = EDITOR_GET("network/connection/network_mode");
if (network_mode == EditorSettings::NETWORK_OFFLINE) {
return DOWNLOADS_NOT_AVAILABLE_IN_OFFLINE_MODE;
}
// Downloadable export templates are only available for stable and official alpha/beta/RC builds
// (which always have a number following their status, e.g. "alpha1").
// Therefore, don't display download-related features when using a development version
// (whose builds aren't numbered).
if (String(VERSION_STATUS) == String("dev") ||
String(VERSION_STATUS) == String("alpha") ||
String(VERSION_STATUS) == String("beta") ||
String(VERSION_STATUS) == String("rc")) {
if (String(GODOT_VERSION_STATUS) == String("dev") ||
String(GODOT_VERSION_STATUS) == String("alpha") ||
String(GODOT_VERSION_STATUS) == String("beta") ||
String(GODOT_VERSION_STATUS) == String("rc")) {
return DOWNLOADS_NOT_AVAILABLE_FOR_DEV_BUILDS;
}
#ifdef REAL_T_IS_DOUBLE
return DOWNLOADS_NOT_AVAILABLE_FOR_DOUBLE_BUILDS;
#endif
if (network_mode == EditorSettings::NETWORK_OFFLINE) {
return DOWNLOADS_NOT_AVAILABLE_IN_OFFLINE_MODE;
}
return DOWNLOADS_AVAILABLE;
}
@ -96,7 +103,7 @@ void ExportTemplateManager::_update_template_status() {
da->list_dir_end();
// Update the state of the current version.
String current_version = VERSION_FULL_CONFIG;
String current_version = GODOT_VERSION_FULL_CONFIG;
current_value->set_text(current_version);
if (templates.has(current_version)) {
@ -264,7 +271,7 @@ void ExportTemplateManager::_refresh_mirrors() {
}
is_refreshing_mirrors = true;
String current_version = VERSION_FULL_CONFIG;
String current_version = GODOT_VERSION_FULL_CONFIG;
const String mirrors_metadata_url = "https://godotengine.org/mirrorlist/" + current_version + ".json";
request_mirrors->request(mirrors_metadata_url);
}
@ -279,11 +286,7 @@ void ExportTemplateManager::_refresh_mirrors_completed(int p_status, int p_code,
return;
}
String response_json;
{
const uint8_t *r = p_data.ptr();
response_json.parse_utf8((const char *)r, p_data.size());
}
String response_json = String::utf8((const char *)p_data.ptr(), p_data.size());
JSON json;
Error err = json.parse(response_json);
@ -335,6 +338,14 @@ void ExportTemplateManager::_refresh_mirrors_completed(int p_status, int p_code,
}
}
void ExportTemplateManager::_force_online_mode() {
EditorSettings::get_singleton()->set_setting("network/connection/network_mode", EditorSettings::NETWORK_ONLINE);
EditorSettings::get_singleton()->notify_changes();
EditorSettings::get_singleton()->save();
popup_manager();
}
bool ExportTemplateManager::_humanize_http_status(HTTPRequest *p_request, String *r_status, int *r_downloaded_bytes, int *r_total_bytes) {
*r_status = "";
*r_downloaded_bytes = -1;
@ -454,8 +465,7 @@ bool ExportTemplateManager::_install_file_selected(const String &p_file, bool p_
ERR_BREAK_MSG(ret < 0, vformat("An error occurred while attempting to read from file: %s. This file will not be used.", file));
unzCloseCurrentFile(pkg);
String data_str;
data_str.parse_utf8((const char *)uncomp_data.ptr(), uncomp_data.size());
String data_str = String::utf8((const char *)uncomp_data.ptr(), uncomp_data.size());
data_str = data_str.strip_edges();
// Version number should be of the form major.minor[.patch].status[.module_config]
@ -694,6 +704,8 @@ void ExportTemplateManager::popup_manager() {
if (!is_downloading_templates) {
_refresh_mirrors();
}
enable_online_hb->hide();
} break;
case DOWNLOADS_NOT_AVAILABLE_IN_OFFLINE_MODE: {
@ -708,6 +720,8 @@ void ExportTemplateManager::popup_manager() {
download_current_button->set_disabled(true);
download_current_button->set_tooltip_text(TTR("Template downloading is disabled in offline mode."));
enable_online_hb->show();
} break;
case DOWNLOADS_NOT_AVAILABLE_FOR_DEV_BUILDS: {
@ -722,7 +736,23 @@ void ExportTemplateManager::popup_manager() {
download_current_button->set_disabled(true);
download_current_button->set_tooltip_text(TTR("Official export templates aren't available for development builds."));
enable_online_hb->hide();
} break;
case DOWNLOADS_NOT_AVAILABLE_FOR_DOUBLE_BUILDS: {
current_missing_label->set_text(TTR("Export templates are missing. Install them from a file."));
mirrors_list->clear();
mirrors_list->add_item(TTR("No templates for double-precision builds"), 0);
mirrors_list->set_disabled(true);
mirrors_list->set_tooltip_text(TTR("Official export templates aren't available for double-precision builds."));
mirror_options_button->set_disabled(true);
download_current_button->set_disabled(true);
download_current_button->set_tooltip_text(TTR("Official export templates aren't available for double-precision builds."));
}
}
popup_centered(Size2(720, 280) * EDSCALE);
@ -759,7 +789,7 @@ String ExportTemplateManager::get_android_source_zip(const Ref<EditorExportPrese
}
}
const String templates_dir = EditorPaths::get_singleton()->get_export_templates_dir().path_join(VERSION_FULL_CONFIG);
const String templates_dir = EditorPaths::get_singleton()->get_export_templates_dir().path_join(GODOT_VERSION_FULL_CONFIG);
return templates_dir.path_join("android_source.zip");
}
@ -771,7 +801,7 @@ String ExportTemplateManager::get_android_template_identifier(const Ref<EditorEx
return android_source_zip + String(" [") + FileAccess::get_md5(android_source_zip) + String("]");
}
}
return VERSION_FULL_CONFIG;
return GODOT_VERSION_FULL_CONFIG;
}
bool ExportTemplateManager::is_android_template_installed(const Ref<EditorExportPreset> &p_preset) {
@ -987,6 +1017,7 @@ ExportTemplateManager::ExportTemplateManager() {
current_installed_path = memnew(LineEdit);
current_installed_path->set_editable(false);
current_installed_path->set_h_size_flags(Control::SIZE_EXPAND_FILL);
current_installed_path->set_accessibility_name(TTRC("Installed Path"));
current_installed_hb->add_child(current_installed_path);
#ifndef ANDROID_ENABLED
@ -994,14 +1025,14 @@ ExportTemplateManager::ExportTemplateManager() {
current_open_button->set_text(TTR("Open Folder"));
current_open_button->set_tooltip_text(TTR("Open the folder containing installed templates for the current version."));
current_installed_hb->add_child(current_open_button);
current_open_button->connect(SceneStringName(pressed), callable_mp(this, &ExportTemplateManager::_open_template_folder).bind(VERSION_FULL_CONFIG));
current_open_button->connect(SceneStringName(pressed), callable_mp(this, &ExportTemplateManager::_open_template_folder).bind(GODOT_VERSION_FULL_CONFIG));
#endif
current_uninstall_button = memnew(Button);
current_uninstall_button->set_text(TTR("Uninstall"));
current_uninstall_button->set_tooltip_text(TTR("Uninstall templates for the current version."));
current_installed_hb->add_child(current_uninstall_button);
current_uninstall_button->connect(SceneStringName(pressed), callable_mp(this, &ExportTemplateManager::_uninstall_template).bind(VERSION_FULL_CONFIG));
current_uninstall_button->connect(SceneStringName(pressed), callable_mp(this, &ExportTemplateManager::_uninstall_template).bind(GODOT_VERSION_FULL_CONFIG));
main_vb->add_child(memnew(HSeparator));
@ -1022,6 +1053,7 @@ ExportTemplateManager::ExportTemplateManager() {
download_install_hb->add_child(mirrors_label);
mirrors_list = memnew(OptionButton);
mirrors_list->set_accessibility_name(TTRC("Mirror"));
mirrors_list->set_custom_minimum_size(Size2(280, 0) * EDSCALE);
download_install_hb->add_child(mirrors_list);
@ -1030,6 +1062,7 @@ ExportTemplateManager::ExportTemplateManager() {
request_mirrors->connect("request_completed", callable_mp(this, &ExportTemplateManager::_refresh_mirrors_completed));
mirror_options_button = memnew(MenuButton);
mirror_options_button->set_accessibility_name(TTRC("Mirror Options"));
mirror_options_button->get_popup()->add_item(TTR("Open in Web Browser"), VISIT_WEB_MIRROR);
mirror_options_button->get_popup()->add_item(TTR("Copy Mirror URL"), COPY_MIRROR_URL);
download_install_hb->add_child(mirror_options_button);
@ -1053,6 +1086,19 @@ ExportTemplateManager::ExportTemplateManager() {
install_file_hb->add_child(install_file_button);
install_file_button->connect(SceneStringName(pressed), callable_mp(this, &ExportTemplateManager::_install_file));
enable_online_hb = memnew(HBoxContainer);
install_options_vb->add_child(enable_online_hb);
Label *enable_online_label = memnew(Label);
enable_online_label->set_text(TTR("Online mode is needed to download the templates."));
enable_online_hb->add_child(enable_online_label);
LinkButton *enable_online_button = memnew(LinkButton);
enable_online_button->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
enable_online_button->set_text(TTR("Go Online"));
enable_online_hb->add_child(enable_online_button);
enable_online_button->connect(SceneStringName(pressed), callable_mp(this, &ExportTemplateManager::_force_online_mode));
// Templates are being downloaded; buttons unavailable.
download_progress_hb = memnew(HBoxContainer);
download_progress_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL);

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef EXPORT_TEMPLATE_MANAGER_H
#define EXPORT_TEMPLATE_MANAGER_H
#pragma once
#include "scene/gui/dialogs.h"
@ -68,6 +67,7 @@ class ExportTemplateManager : public AcceptDialog {
};
MenuButton *mirror_options_button = nullptr;
HBoxContainer *enable_online_hb = nullptr;
HBoxContainer *download_progress_hb = nullptr;
ProgressBar *download_progress_bar = nullptr;
Label *download_progress_label = nullptr;
@ -96,6 +96,7 @@ class ExportTemplateManager : public AcceptDialog {
void _cancel_template_download();
void _refresh_mirrors();
void _refresh_mirrors_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data);
void _force_online_mode();
bool _humanize_http_status(HTTPRequest *p_request, String *r_status, int *r_downloaded_bytes, int *r_total_bytes);
void _set_current_progress_status(const String &p_status, bool p_error = false);
@ -134,5 +135,3 @@ public:
ExportTemplateManager();
};
#endif // EXPORT_TEMPLATE_MANAGER_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef LIPO_H
#define LIPO_H
#pragma once
// Universal / Universal 2 fat binary file creator and extractor.
@ -68,5 +67,3 @@ public:
~LipO();
};
#endif // LIPO_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef MACHO_H
#define MACHO_H
#pragma once
// Mach-O binary object file format parser and editor.
@ -222,5 +221,3 @@ public:
uint64_t get_signature_size();
bool set_signature_size(uint64_t p_size);
};
#endif // MACHO_H

View file

@ -73,7 +73,7 @@ void ProjectExportTextureFormatError::_notification(int p_what) {
}
void ProjectExportTextureFormatError::show_for_texture_format(const String &p_friendly_name, const String &p_setting_identifier) {
texture_format_error_label->set_text(vformat(TTR("Target platform requires '%s' texture compression. Enable 'Import %s' to fix."), p_friendly_name, p_friendly_name.replace("/", " ")));
texture_format_error_label->set_text(vformat(TTR("Target platform requires '%s' texture compression. Enable 'Import %s' to fix."), p_friendly_name, p_friendly_name.replace_char('/', ' ')));
setting_identifier = p_setting_identifier;
show();
}
@ -576,7 +576,7 @@ void ProjectExportDialog::_enc_filters_changed(const String &p_filters) {
}
void ProjectExportDialog::_open_key_help_link() {
OS::get_singleton()->shell_open(vformat("%s/contributing/development/compiling/compiling_with_script_encryption_key.html", VERSION_DOCS_URL));
OS::get_singleton()->shell_open(vformat("%s/contributing/development/compiling/compiling_with_script_encryption_key.html", GODOT_VERSION_DOCS_URL));
}
void ProjectExportDialog::_enc_pck_changed(bool p_pressed) {
@ -745,7 +745,14 @@ 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);
int pos = -1;
if (p_point == Vector2(Math::INF, Math::INF)) {
if (presets->is_anything_selected()) {
pos = presets->get_selected_items()[0];
}
} else {
pos = presets->get_item_at_position(p_point, true);
}
if (pos >= 0) {
Dictionary d;
@ -766,7 +773,7 @@ Variant ProjectExportDialog::get_drag_data_fw(const Point2 &p_point, Control *p_
return d;
}
} else if (p_from == patches) {
TreeItem *item = patches->get_item_at_position(p_point);
TreeItem *item = (p_point == Vector2(Math::INF, Math::INF)) ? patches->get_selected() : patches->get_item_at_position(p_point);
if (item) {
int item_metadata = item->get_metadata(0);
@ -791,7 +798,18 @@ bool ProjectExportDialog::can_drop_data_fw(const Point2 &p_point, const Variant
return false;
}
if (presets->get_item_at_position(p_point, true) < 0 && !presets->is_pos_at_end_of_items(p_point)) {
int pos = -1;
bool end = true;
if (p_point == Vector2(Math::INF, Math::INF)) {
if (presets->is_anything_selected()) {
pos = presets->get_selected_items()[0];
}
} else {
pos = presets->get_item_at_position(p_point, true);
end = presets->is_pos_at_end_of_items(p_point);
}
if (pos < 0 && !end) {
return false;
}
} else if (p_from == patches) {
@ -800,7 +818,7 @@ bool ProjectExportDialog::can_drop_data_fw(const Point2 &p_point, const Variant
return false;
}
TreeItem *item = patches->get_item_at_position(p_point);
TreeItem *item = (p_point == Vector2(Math::INF, Math::INF)) ? patches->get_selected() : patches->get_item_at_position(p_point);
if (!item) {
return false;
}
@ -818,11 +836,22 @@ void ProjectExportDialog::drop_data_fw(const Point2 &p_point, const Variant &p_d
int to_pos = -1;
if (presets->get_item_at_position(p_point, true) >= 0) {
to_pos = presets->get_item_at_position(p_point, true);
int pos = -1;
bool end = true;
if (p_point == Vector2(Math::INF, Math::INF)) {
if (presets->is_anything_selected()) {
pos = presets->get_selected_items()[0];
}
} else {
pos = presets->get_item_at_position(p_point, true);
end = presets->is_pos_at_end_of_items(p_point);
}
if (to_pos == -1 && !presets->is_pos_at_end_of_items(p_point)) {
if (pos >= 0) {
to_pos = pos;
}
if (to_pos == -1 && !end) {
return;
}
@ -846,14 +875,20 @@ void ProjectExportDialog::drop_data_fw(const Point2 &p_point, const Variant &p_d
Dictionary d = p_data;
int from_pos = d["patch"];
TreeItem *item = patches->get_item_at_position(p_point);
TreeItem *item = (p_point == Vector2(Math::INF, Math::INF)) ? patches->get_selected() : patches->get_item_at_position(p_point);
if (!item) {
return;
}
int to_pos = item->get_metadata(0);
if (patches->get_drop_section_at_position(p_point) > 0) {
int pos = -1;
if (p_point == Vector2(Math::INF, Math::INF)) {
pos = patches->get_drop_section_at_position(patches->get_item_rect(item).position);
} else {
pos = patches->get_drop_section_at_position(p_point);
}
if (pos > 0) {
to_pos++;
}
@ -1428,11 +1463,13 @@ ProjectExportDialog::ProjectExportDialog() {
presets->connect(SceneStringName(item_selected), callable_mp(this, &ProjectExportDialog::_edit_preset));
duplicate_preset = memnew(Button);
duplicate_preset->set_tooltip_text(TTR("Duplicate"));
duplicate_preset->set_accessibility_name(TTRC("Duplicate"));
duplicate_preset->set_flat(true);
preset_hb->add_child(duplicate_preset);
duplicate_preset->connect(SceneStringName(pressed), callable_mp(this, &ProjectExportDialog::_duplicate_preset));
delete_preset = memnew(Button);
delete_preset->set_tooltip_text(TTR("Delete"));
delete_preset->set_accessibility_name(TTRC("Delete"));
delete_preset->set_flat(true);
preset_hb->add_child(delete_preset);
delete_preset->connect(SceneStringName(pressed), callable_mp(this, &ProjectExportDialog::_delete_preset));
@ -1501,6 +1538,7 @@ ProjectExportDialog::ProjectExportDialog() {
resources_scroll_container->add_child(resources_vb);
export_filter = memnew(OptionButton);
export_filter->set_accessibility_name(TTRC("Export Mode"));
export_filter->add_item(TTR("Export all resources in the project"));
export_filter->add_item(TTR("Export selected scenes (and dependencies)"));
export_filter->add_item(TTR("Export selected resources (and dependencies)"));
@ -1531,8 +1569,8 @@ ProjectExportDialog::ProjectExportDialog() {
resources_vb->add_child(server_strip_message);
{
List<StringName> resource_names;
ClassDB::get_inheriters_from_class("Resource", &resource_names);
LocalVector<StringName> resource_names;
ClassDB::get_inheriters_from_class("Resource", resource_names);
PackedStringArray strippable;
for (const StringName &resource_name : resource_names) {
@ -1555,12 +1593,14 @@ ProjectExportDialog::ProjectExportDialog() {
file_mode_popup->connect(SceneStringName(id_pressed), callable_mp(this, &ProjectExportDialog::_set_file_export_mode));
include_filters = memnew(LineEdit);
include_filters->set_accessibility_name(TTRC("Include Filters"));
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(SceneStringName(text_changed), callable_mp(this, &ProjectExportDialog::_filter_changed));
exclude_filters = memnew(LineEdit);
exclude_filters->set_accessibility_name(TTRC("Exclude Filters"));
resources_vb->add_margin_child(
TTR("Filters to exclude files/folders from project\n(comma-separated, e.g: *.json, *.txt, docs/*)"),
exclude_filters);
@ -1635,18 +1675,21 @@ ProjectExportDialog::ProjectExportDialog() {
sec_vb->add_child(enc_directory);
enc_in_filters = memnew(LineEdit);
enc_in_filters->set_accessibility_name(TTRC("Include Filters"));
enc_in_filters->connect(SceneStringName(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->set_accessibility_name(TTRC("Exclude Filters"));
enc_ex_filters->connect(SceneStringName(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: *.ctex, *.import, music/*)"),
enc_ex_filters);
script_key = memnew(LineEdit);
script_key->set_accessibility_name(TTRC("Encryption Key"));
script_key->connect(SceneStringName(text_changed), callable_mp(this, &ProjectExportDialog::_script_encryption_key_changed));
script_key_error = memnew(Label);
script_key_error->set_text(String::utf8("") + TTR("Invalid Encryption Key (must be 64 hexadecimal characters long)"));
@ -1656,6 +1699,7 @@ ProjectExportDialog::ProjectExportDialog() {
sections->add_child(sec_scroll_container);
seed_input = memnew(LineEdit);
seed_input->set_accessibility_name(TTRC("Encryption Seed"));
seed_input->connect(SceneStringName(text_changed), callable_mp(this, &ProjectExportDialog::_seed_input_changed));
sec_vb->add_margin_child(TTR("Initialization vector seed"), seed_input);
@ -1674,6 +1718,7 @@ ProjectExportDialog::ProjectExportDialog() {
script_vb->set_name(TTR("Scripts"));
script_mode = memnew(OptionButton);
script_mode->set_accessibility_name(TTRC("GDScript Export Mode"));
script_vb->add_margin_child(TTR("GDScript Export Mode:"), script_mode);
script_mode->add_item(TTR("Text (easier debugging)"), (int)EditorExportPreset::MODE_SCRIPT_TEXT);
script_mode->add_item(TTR("Binary tokens (faster loading)"), (int)EditorExportPreset::MODE_SCRIPT_BINARY_TOKENS);
@ -1746,11 +1791,13 @@ ProjectExportDialog::ProjectExportDialog() {
export_error = memnew(Label);
main_vb->add_child(export_error);
export_error->hide();
export_error->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_WORD_ELLIPSIS);
export_error->add_theme_color_override(SceneStringName(font_color), EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("error_color"), EditorStringName(Editor)));
export_warning = memnew(Label);
main_vb->add_child(export_warning);
export_warning->hide();
export_warning->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_WORD_ELLIPSIS);
export_warning->add_theme_color_override(SceneStringName(font_color), EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("warning_color"), EditorStringName(Editor)));
export_templates_error = memnew(HBoxContainer);
@ -1759,6 +1806,7 @@ ProjectExportDialog::ProjectExportDialog() {
Label *export_error2 = memnew(Label);
export_templates_error->add_child(export_error2);
export_error2->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_WORD_ELLIPSIS);
export_error2->add_theme_color_override(SceneStringName(font_color), EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("error_color"), EditorStringName(Editor)));
export_error2->set_text(String::utf8("") + TTR("Export templates for this platform are missing:") + " ");
@ -1801,6 +1849,3 @@ ProjectExportDialog::ProjectExportDialog() {
}
}
}
ProjectExportDialog::~ProjectExportDialog() {
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef PROJECT_EXPORT_H
#define PROJECT_EXPORT_H
#pragma once
#include "editor/export/editor_export_preset.h"
#include "scene/gui/dialogs.h"
@ -222,7 +221,4 @@ public:
bool is_exporting() const { return exporting; }
ProjectExportDialog();
~ProjectExportDialog();
};
#endif // PROJECT_EXPORT_H

View file

@ -42,9 +42,9 @@ String ProjectZIPPacker::get_project_zip_safe_name() {
// In the project name, all invalid characters become an empty string so that a name
// like "Platformer 2: Godette's Revenge" becomes "platformer_2-_godette-s_revenge".
const String project_name = GLOBAL_GET("application/config/name");
const String project_name_safe = project_name.to_lower().replace(" ", "_");
const String project_name_safe = project_name.to_lower().replace_char(' ', '_');
const String datetime_safe =
Time::get_singleton()->get_datetime_string_from_system(false, true).replace(" ", "_");
Time::get_singleton()->get_datetime_string_from_system(false, true).replace_char(' ', '_');
const String output_name = OS::get_singleton()->get_safe_dir_name(vformat("%s_%s.zip", project_name_safe, datetime_safe));
return output_name;
}

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef PROJECT_ZIP_PACKER_H
#define PROJECT_ZIP_PACKER_H
#pragma once
#include "core/io/zip_io.h"
#include "core/variant/variant.h"
@ -42,5 +41,3 @@ public:
static String get_project_zip_safe_name();
static void pack_project_zip(const String &p_path);
};
#endif // PROJECT_ZIP_PACKER_H