Export: Unify settings for PC texture formats

S3TC and BPTC should always be used together, and likewise for ETC2 and ASTC.
This commit is contained in:
Rémi Verschelde 2024-02-14 14:50:14 +01:00
parent e457f41f9b
commit a10b4bdb81
No known key found for this signature in database
GPG key ID: C3336907360768E1
3 changed files with 24 additions and 25 deletions

View file

@ -34,14 +34,13 @@
#include "scene/resources/image_texture.h"
void EditorExportPlatformPC::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) const {
if (p_preset->get("texture_format/bptc")) {
if (p_preset->get("texture_format/s3tc_bptc")) {
r_features->push_back("s3tc");
r_features->push_back("bptc");
}
if (p_preset->get("texture_format/s3tc")) {
r_features->push_back("s3tc");
}
if (p_preset->get("texture_format/etc2")) {
if (p_preset->get("texture_format/etc2_astc")) {
r_features->push_back("etc2");
r_features->push_back("astc");
}
// PC platforms only have one architecture per export, since
// we export a single executable instead of a bundle.
@ -57,9 +56,8 @@ void EditorExportPlatformPC::get_export_options(List<ExportOption> *r_options) c
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "binary_format/embed_pck"), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/bptc"), true));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/s3tc"), true));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc2"), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/s3tc_bptc"), true));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc2_astc"), false));
}
String EditorExportPlatformPC::get_name() const {
@ -99,6 +97,14 @@ bool EditorExportPlatformPC::has_valid_export_configuration(const Ref<EditorExpo
valid = dvalid || rvalid;
r_missing_templates = !valid;
bool uses_s3tc_bptc = p_preset->get("texture_format/s3tc_bptc");
bool uses_etc2_astc = p_preset->get("texture_format/etc2_astc");
if (!uses_s3tc_bptc && !uses_etc2_astc) {
valid = false;
err += TTR("A texture format must be selected to export the project. Please select at least one texture format.");
}
if (!err.is_empty()) {
r_error = err;
}
@ -233,9 +239,8 @@ void EditorExportPlatformPC::set_logo(const Ref<Texture2D> &p_logo) {
}
void EditorExportPlatformPC::get_platform_features(List<String> *r_features) const {
r_features->push_back("pc"); //all pcs support "pc"
r_features->push_back("s3tc"); //all pcs support "s3tc" compression
r_features->push_back(get_os_name().to_lower()); //OS name is a feature
r_features->push_back("pc"); // Identify PC platforms as such.
r_features->push_back(get_os_name().to_lower()); // OS name is a feature.
}
void EditorExportPlatformPC::resolve_platform_feature_priorities(const Ref<EditorExportPreset> &p_preset, HashSet<String> &p_features) {

View file

@ -57,14 +57,11 @@
- [code]{exe_name}[/code] - Name of application executable.
- [code]{cmd_args}[/code] - Array of the command line argument for the application.
</member>
<member name="texture_format/bptc" type="bool" setter="" getter="">
If [code]true[/code], project textures are exported in the BPTC format.
<member name="texture_format/etc2_astc" type="bool" setter="" getter="">
If [code]true[/code], project textures are exported in the ETC2/ASTC format.
</member>
<member name="texture_format/etc2" type="bool" setter="" getter="">
If [code]true[/code], project textures are exported in the ETC2 format.
</member>
<member name="texture_format/s3tc" type="bool" setter="" getter="">
If [code]true[/code], project textures are exported in the S3TC format.
<member name="texture_format/s3tc_bptc" type="bool" setter="" getter="">
If [code]true[/code], project textures are exported in the S3TC/BPTC format.
</member>
</members>
</class>

View file

@ -123,14 +123,11 @@
- [code]{exe_name}[/code] - Name of application executable.
- [code]{cmd_args}[/code] - Array of the command line argument for the application.
</member>
<member name="texture_format/bptc" type="bool" setter="" getter="">
If [code]true[/code], project textures are exported in the BPTC format.
<member name="texture_format/etc2_astc" type="bool" setter="" getter="">
If [code]true[/code], project textures are exported in the ETC2/ASTC format.
</member>
<member name="texture_format/etc2" type="bool" setter="" getter="">
If [code]true[/code], project textures are exported in the ETC2 format.
</member>
<member name="texture_format/s3tc" type="bool" setter="" getter="">
If [code]true[/code], project textures are exported in the S3TC format.
<member name="texture_format/s3tc_bptc" type="bool" setter="" getter="">
If [code]true[/code], project textures are exported in the S3TC/BPTC format.
</member>
</members>
</class>