Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate texture format selection when exporting to Windows or Linux #84913

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions editor/export/editor_export_platform_pc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,14 @@
#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/bptc") || p_preset->get("texture_format/s3tc")) {
r_features->push_back("bptc");
}
if (p_preset->get("texture_format/s3tc")) {
r_features->push_back("s3tc");
}
if (p_preset->get("texture_format/etc")) {
r_features->push_back("etc");
}

if (p_preset->get("texture_format/etc2")) {
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.
Expand Down Expand Up @@ -103,6 +100,21 @@ bool EditorExportPlatformPC::has_valid_export_configuration(const Ref<EditorExpo
valid = dvalid || rvalid;
r_missing_templates = !valid;

bool uses_s3tc = p_preset->get("texture_format/s3tc");
bool uses_bptc = p_preset->get("texture_format/bptc");

if (uses_s3tc != uses_bptc) {
valid = false;
err += TTR("If using either s3tc or bptc texture format, you must use both s3tc and bptc.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
err += TTR("If using either s3tc or bptc texture format, you must use both s3tc and bptc.");
err += TTR("If using either S3TC or BPTC texture format, you must enable both.");

}

bool uses_etc2 = p_preset->get("texture_format/etc2");

if (!uses_s3tc && !uses_bptc && !uses_etc2) {
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@
- [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.
If [code]true[/code], project textures are exported in the BPTC format. If used, [member texture_format/s3tc] must be used as well.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If [code]true[/code], project textures are exported in the BPTC format. If used, [member texture_format/s3tc] must be used as well.
If [code]true[/code], project textures are exported in the BPTC format. If enabled, [member texture_format/s3tc] must be enabled as well.

Same for all these

</member>
<member name="texture_format/etc" type="bool" setter="" getter="">
If [code]true[/code], project textures are exported in the ETC format.
This option does not do anything and may be removed in the future.
</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.
If [code]true[/code], project textures are exported in the S3TC format. If used, [member texture_format/bptc] must be used as well.
</member>
</members>
</class>
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,16 @@
- [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.
If [code]true[/code], project textures are exported in the BPTC format. If used, [member texture_format/s3tc] must be used as well.
</member>
<member name="texture_format/etc" type="bool" setter="" getter="">
If [code]true[/code], project textures are exported in the ETC format.
This option does not do anything and may be removed in the future.
</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.
If [code]true[/code], project textures are exported in the S3TC format. If used, [member texture_format/bptc] must be used as well.
</member>
</members>
</class>
Loading