summaryrefslogtreecommitdiff
path: root/editor/export
diff options
context:
space:
mode:
authorDavid Snopek <dsnopek@gmail.com>2023-01-30 14:34:05 -0600
committerDavid Snopek <dsnopek@gmail.com>2023-01-30 15:10:44 -0600
commit0e2af4b73d03e89bd974538ea909b46e2eb7326c (patch)
tree3fb7314d3f63cf971cd087b0b0fcd87684c6cb5d /editor/export
parent551f5191e5dbc1d1a43f99b13d5dbbf7f598dc58 (diff)
Make it clearer that file modes propagate to children in the dedicated server export
Diffstat (limited to 'editor/export')
-rw-r--r--editor/export/project_export.cpp36
-rw-r--r--editor/export/project_export.h1
2 files changed, 31 insertions, 6 deletions
diff --git a/editor/export/project_export.cpp b/editor/export/project_export.cpp
index 52c192164f..e9ea0012be 100644
--- a/editor/export/project_export.cpp
+++ b/editor/export/project_export.cpp
@@ -754,22 +754,27 @@ void ProjectExportDialog::_fill_resource_tree() {
include_margin->show();
_fill_tree(EditorFileSystem::get_singleton()->get_filesystem(), root, current, f);
+
+ if (f == EditorExportPreset::EXPORT_CUSTOMIZED) {
+ _propagate_file_export_mode(include_files->get_root(), EditorExportPreset::MODE_FILE_NOT_CUSTOMIZED);
+ }
}
void ProjectExportDialog::_setup_item_for_file_mode(TreeItem *p_item, EditorExportPreset::FileExportMode p_mode) {
if (p_mode == EditorExportPreset::MODE_FILE_NOT_CUSTOMIZED) {
p_item->set_checked(0, false);
p_item->set_cell_mode(1, TreeItem::CELL_MODE_STRING);
- p_item->set_text(1, "");
p_item->set_editable(1, false);
p_item->set_selectable(1, false);
+ p_item->set_custom_color(1, get_theme_color(SNAME("disabled_font_color"), SNAME("Editor")));
} else {
p_item->set_checked(0, true);
p_item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- p_item->set_text(1, file_mode_popup->get_item_text(file_mode_popup->get_item_index(p_mode)));
p_item->set_editable(1, true);
p_item->set_selectable(1, true);
+ p_item->clear_custom_color(1);
}
+ p_item->set_metadata(1, p_mode);
}
bool ProjectExportDialog::_fill_tree(EditorFileSystemDirectory *p_dir, TreeItem *p_item, Ref<EditorExportPreset> &current, EditorExportPreset::ExportFilter p_export_filter) {
@@ -824,6 +829,23 @@ bool ProjectExportDialog::_fill_tree(EditorFileSystemDirectory *p_dir, TreeItem
return used;
}
+void ProjectExportDialog::_propagate_file_export_mode(TreeItem *p_item, EditorExportPreset::FileExportMode p_inherited_export_mode) {
+ EditorExportPreset::FileExportMode file_export_mode = (EditorExportPreset::FileExportMode)(int)p_item->get_metadata(1);
+ if (file_export_mode == EditorExportPreset::MODE_FILE_NOT_CUSTOMIZED) {
+ file_export_mode = p_inherited_export_mode;
+ }
+
+ if (file_export_mode == EditorExportPreset::MODE_FILE_NOT_CUSTOMIZED) {
+ p_item->set_text(1, "");
+ } else {
+ p_item->set_text(1, file_mode_popup->get_item_text(file_mode_popup->get_item_index(file_export_mode)));
+ }
+
+ for (int i = 0; i < p_item->get_child_count(); i++) {
+ _propagate_file_export_mode(p_item->get_child(i), file_export_mode);
+ }
+}
+
void ProjectExportDialog::_tree_changed() {
if (updating) {
return;
@@ -847,8 +869,9 @@ void ProjectExportDialog::_tree_changed() {
file_mode = current->get_file_export_mode(path, EditorExportPreset::MODE_FILE_STRIP);
}
- _setup_item_for_file_mode(item, file_mode);
current->set_file_export_mode(path, file_mode);
+ _setup_item_for_file_mode(item, file_mode);
+ _propagate_file_export_mode(include_files->get_root(), EditorExportPreset::MODE_FILE_NOT_CUSTOMIZED);
} else {
item->propagate_check(0);
}
@@ -890,9 +913,10 @@ void ProjectExportDialog::_set_file_export_mode(int p_id) {
TreeItem *item = include_files->get_edited();
String path = item->get_metadata(0);
- current->set_file_export_mode(path, (EditorExportPreset::FileExportMode)p_id);
-
- item->set_text(1, file_mode_popup->get_item_text(file_mode_popup->get_item_index(p_id)));
+ EditorExportPreset::FileExportMode file_export_mode = (EditorExportPreset::FileExportMode)p_id;
+ current->set_file_export_mode(path, file_export_mode);
+ item->set_metadata(1, file_export_mode);
+ _propagate_file_export_mode(include_files->get_root(), EditorExportPreset::MODE_FILE_NOT_CUSTOMIZED);
}
void ProjectExportDialog::_export_pck_zip() {
diff --git a/editor/export/project_export.h b/editor/export/project_export.h
index 63f8fc4a2e..e53e393432 100644
--- a/editor/export/project_export.h
+++ b/editor/export/project_export.h
@@ -118,6 +118,7 @@ private:
void _fill_resource_tree();
void _setup_item_for_file_mode(TreeItem *p_item, EditorExportPreset::FileExportMode p_mode);
bool _fill_tree(EditorFileSystemDirectory *p_dir, TreeItem *p_item, Ref<EditorExportPreset> &current, EditorExportPreset::ExportFilter p_export_filter);
+ void _propagate_file_export_mode(TreeItem *p_item, EditorExportPreset::FileExportMode p_inherited_export_mode);
void _tree_changed();
void _check_propagated_to_item(Object *p_obj, int column);
void _tree_popup_edited(bool p_arrow_clicked);