Skip to content

Commit

Permalink
Merge pull request #43550 from KoBeWi/resourcism
Browse files Browse the repository at this point in the history
Add option to exclude selected resources on export
  • Loading branch information
akien-mga authored Mar 31, 2021
2 parents c2b7c69 + eb4082b commit 7db85ff
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions editor/editor_export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,12 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
if (p_preset->get_export_filter() == EditorExportPreset::EXPORT_ALL_RESOURCES) {
//find stuff
_export_find_resources(EditorFileSystem::get_singleton()->get_filesystem(), paths);
} else if (p_preset->get_export_filter() == EditorExportPreset::EXCLUDE_SELECTED_RESOURCES) {
_export_find_resources(EditorFileSystem::get_singleton()->get_filesystem(), paths);
Vector<String> files = p_preset->get_files_to_export();
for (int i = 0; i < files.size(); i++) {
paths.erase(files[i]);
}
} else {
bool scenes_only = p_preset->get_export_filter() == EditorExportPreset::EXPORT_SELECTED_SCENES;

Expand Down Expand Up @@ -1394,6 +1400,10 @@ void EditorExport::_save() {
config->set_value(section, "export_filter", "resources");
save_files = true;
} break;
case EditorExportPreset::EXCLUDE_SELECTED_RESOURCES: {
config->set_value(section, "export_filter", "exclude");
save_files = true;
} break;
}

if (save_files) {
Expand Down Expand Up @@ -1572,6 +1582,9 @@ void EditorExport::load_config() {
} else if (export_filter == "resources") {
preset->set_export_filter(EditorExportPreset::EXPORT_SELECTED_RESOURCES);
get_files = true;
} else if (export_filter == "exclude") {
preset->set_export_filter(EditorExportPreset::EXCLUDE_SELECTED_RESOURCES);
get_files = true;
}

if (get_files) {
Expand Down
1 change: 1 addition & 0 deletions editor/editor_export.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class EditorExportPreset : public Reference {
EXPORT_ALL_RESOURCES,
EXPORT_SELECTED_SCENES,
EXPORT_SELECTED_RESOURCES,
EXCLUDE_SELECTED_RESOURCES,
};

enum ScriptExportMode {
Expand Down
1 change: 1 addition & 0 deletions editor/project_export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,7 @@ ProjectExportDialog::ProjectExportDialog() {
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)"));
export_filter->add_item(TTR("Export all resources in the project except resources checked below"));
resources_vb->add_margin_child(TTR("Export Mode:"), export_filter);
export_filter->connect("item_selected", callable_mp(this, &ProjectExportDialog::_export_type_changed));

Expand Down

0 comments on commit 7db85ff

Please sign in to comment.