[Export] Use project settings overrides with the target preset features instead of current platform features.
This commit is contained in:
parent
4248411baf
commit
c6739f64df
22 changed files with 251 additions and 123 deletions
41
editor/export/editor_export_platform.compat.inc
Normal file
41
editor/export/editor_export_platform.compat.inc
Normal 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
|
||||
|
|
@ -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"
|
||||
|
|
@ -948,7 +950,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()) {
|
||||
|
|
@ -994,13 +996,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);
|
||||
}
|
||||
|
|
@ -1112,7 +1114,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);
|
||||
|
|
@ -1255,7 +1257,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
|
||||
|
|
@ -1567,7 +1569,7 @@ 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]) {
|
||||
|
|
@ -2466,6 +2468,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);
|
||||
|
||||
|
|
@ -2504,7 +2514,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);
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
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"
|
||||
|
|
@ -203,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 {
|
||||
|
|
@ -280,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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -125,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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue