Skip to content

Commit

Permalink
Move back to a lighter file dialog implementation
Browse files Browse the repository at this point in the history
Turns out tinyfiledialogs didn't open file pickers on my Ubuntu+sway
dev setup because popen seemed to fail silently while running in the
lldb vscode debugger. The 'official' cppdbg seems to work fine.

Let's revert back the file dialogs and use cppdbg in the launch commands.
Rfd is pretty heavy on linux at least and added >20% to compile times.
  • Loading branch information
sndels committed Jun 3, 2023
1 parent 7694735 commit a9498e8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
14 changes: 7 additions & 7 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,31 +55,31 @@
"preLaunchTask": ""
},
{
"name": "(LLDB) yuki release",
"type": "lldb",
"name": "(GDB) yuki release",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/target/release/yuki",
"args": [],
"cwd": "${workspaceFolder}",
"preLaunchTask": ""
},
{
"name": "(LLDB) yuki dev-optimized",
"type": "lldb",
"name": "(GDB) yuki dev-optimized",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/target/dev-optimized/yuki",
"args": [],
"cwd": "${workspaceFolder}",
"preLaunchTask": ""
},
{
"name": "(LLDB) yuki debug",
"type": "lldb",
"name": "(GDB) yuki debug",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/target/debug/yuki",
"args": [],
"cwd": "${workspaceFolder}",
"preLaunchTask": ""
}
]
}
}
6 changes: 1 addition & 5 deletions yuki/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,12 @@ num_cpus = "1.15"
rand = "0.8"
rand_pcg = "0.3"
rayon = "1.7"
# TODO:
# This is really bloaty, 110 extra deps for a file dialog on Ubuntu!
# But the tinyfiledialog rs wrapper doesn't seem to work on ubuntu now, so let's
# have this until I figure out a better solution
rfd = { version="0.11", features=["xdg-portal"], default-features=false }
ply-rs = { git = "https://github.com/sndels/ply-rs.git", rev = "7a4f625" }
serde = "1.0"
serde_yaml = "0.9"
strum = { version = "0.24", features = ["derive"] }
superluminal-perf = "0.2.0"
tinyfiledialogs = "3.9"
win_dbg_logger = "0.1"
xml-rs = "0.8"
yuki_derive = { path = "../yuki_derive" }
13 changes: 7 additions & 6 deletions yuki/src/app/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use imgui::Context;
use imgui::{FontConfig, FontSource};
use imgui_glium_renderer::Renderer;
use imgui_winit_support::{HiDpiMode, WinitPlatform};
use rfd::FileDialog;
use std::{path::PathBuf, str::FromStr, sync::Arc, time::Duration};
use strum::VariantNames;
use tinyfiledialogs::open_file_dialog;

use super::renderpasses::{FilmicParams, HeatmapParams, ToneMapType};

Expand Down Expand Up @@ -450,11 +450,12 @@ fn generate_scene_settings(

if ui.button("Change scene") {
let open_path = &scene.load_settings.path.to_str().unwrap();
let path = FileDialog::new()
.add_filter("Supported scene formats", &["ply", "xml", "pbrt"])
.set_directory(open_path)
.pick_file()
.map_or_else(PathBuf::new, PathBuf::from);
let path = open_file_dialog(
"Open scene",
open_path,
Some((&["*.ply", "*.xml", "*.pbrt"], "Supported scene formats")),
)
.map_or_else(PathBuf::new, PathBuf::from);
(*load_settings).path = path;
}
ui.same_line();
Expand Down

0 comments on commit a9498e8

Please sign in to comment.