Skip to content

Commit 788acd1

Browse files
committed
update file dialog
1 parent bf93d9e commit 788acd1

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

crates/re_ui/src/command.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl UICommand {
8686
"Save data for the current loop selection to a Rerun data file (.rrd)",
8787
),
8888

89-
UICommand::Open => ("Open…", "Open a Rerun Data File (.rrd)"),
89+
UICommand::Open => ("Open…", "Open any supported files (.rrd, images, meshes, …)"),
9090

9191
UICommand::CloseCurrentRecording => (
9292
"Close current Recording",

crates/re_viewer/src/app.rs

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,18 +1269,28 @@ fn file_saver_progress_ui(egui_ctx: &egui::Context, background_tasks: &mut Backg
12691269
#[cfg(not(target_arch = "wasm32"))]
12701270
fn open_file_dialog_native() -> Vec<std::path::PathBuf> {
12711271
re_tracing::profile_function!();
1272-
let supported: Vec<_> = re_data_source::SUPPORTED_RERUN_EXTENSIONS
1273-
.iter()
1274-
.chain(re_data_source::SUPPORTED_IMAGE_EXTENSIONS)
1275-
.chain(re_data_source::SUPPORTED_MESH_EXTENSIONS)
1276-
.chain(re_data_source::SUPPORTED_POINT_CLOUD_EXTENSIONS)
1277-
.chain(re_data_source::SUPPORTED_TEXT_EXTENSIONS)
1278-
.copied()
1279-
.collect();
1280-
rfd::FileDialog::new()
1281-
.add_filter("Supported files", &supported)
1282-
.pick_files()
1283-
.unwrap_or_default()
1272+
1273+
let supported: Vec<_> = if re_data_source::iter_external_loaders().len() == 0 {
1274+
re_data_source::SUPPORTED_RERUN_EXTENSIONS
1275+
.iter()
1276+
.chain(re_data_source::SUPPORTED_IMAGE_EXTENSIONS)
1277+
.chain(re_data_source::SUPPORTED_MESH_EXTENSIONS)
1278+
.chain(re_data_source::SUPPORTED_POINT_CLOUD_EXTENSIONS)
1279+
.chain(re_data_source::SUPPORTED_TEXT_EXTENSIONS)
1280+
.copied()
1281+
.collect()
1282+
} else {
1283+
vec![]
1284+
};
1285+
1286+
let mut dialog = rfd::FileDialog::new();
1287+
1288+
// If there's at least one external loader registered, then literally anything goes!
1289+
if !supported.is_empty() {
1290+
dialog = dialog.add_filter("Supported files", &supported);
1291+
}
1292+
1293+
dialog.pick_files().unwrap_or_default()
12841294
}
12851295

12861296
#[cfg(target_arch = "wasm32")]

0 commit comments

Comments
 (0)