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

Allow skipping imported resource files from export #90365

Merged
merged 1 commit into from
May 30, 2024
Merged
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
2 changes: 1 addition & 1 deletion doc/classes/EditorExportPlugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@
<method name="skip">
<return type="void" />
<description>
To be called inside [method _export_file]. Skips the current file, so it's not included in the export.
To be called inside [method _export_file], [method _customize_resource], or [method _customize_scene]. Skips the current file, so it's not included in the export.
</description>
</method>
</methods>
Expand Down
12 changes: 12 additions & 0 deletions editor/export/editor_export_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,10 @@ String EditorExportPlatform::_export_customize(const String &p_path, LocalVector
if (!customize_scenes_plugins.is_empty()) {
for (Ref<EditorExportPlugin> &plugin : customize_scenes_plugins) {
Node *customized = plugin->_customize_scene(node, p_path);
if (plugin->skipped) {
plugin->_clear();
return String();
}
if (customized != nullptr) {
node = customized;
modified = true;
Expand Down Expand Up @@ -824,6 +828,10 @@ String EditorExportPlatform::_export_customize(const String &p_path, LocalVector
if (!customize_resources_plugins.is_empty()) {
for (Ref<EditorExportPlugin> &plugin : customize_resources_plugins) {
Ref<Resource> new_res = plugin->_customize_resource(res, p_path);
if (plugin->skipped) {
plugin->_clear();
return String();
}
if (new_res.is_valid()) {
modified = true;
if (new_res != res) {
Expand Down Expand Up @@ -1139,6 +1147,10 @@ Error EditorExportPlatform::export_project_files(bool p_main_pack, const Ref<Edi
// Before doing this, try to see if it can be customized.

String export_path = _export_customize(path, customize_resources_plugins, customize_scenes_plugins, export_cache, export_base_path, false);
if (export_path.is_empty()) {
// Skipped from plugin.
continue;
}

if (export_path != path) {
// It was actually customized.
Expand Down
Loading