Skip to content
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
10 changes: 8 additions & 2 deletions src/app/editor_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl App {
.with_hardware_adapter(gpu.adapter.get_info().device_type != wgpu::DeviceType::Cpu)
.warm_thumbnails();

bridge.set_game_pack_path(self.app_state.game_pack.root());
bridge.set_game_pack_path(self.app_state.install.game_pack.root());

self.editor = Some(EditorWindow { surface, bridge });
Ok(())
Expand Down Expand Up @@ -216,7 +216,7 @@ impl App {
.with_instance(gpu.instance.clone())
.with_hardware_adapter(gpu.adapter.get_info().device_type != wgpu::DeviceType::Cpu)
.warm_thumbnails();
bridge.set_game_pack_path(self.app_state.game_pack.root());
bridge.set_game_pack_path(self.app_state.install.game_pack.root());
bridge.set_mode(or_renderer::ShadingMode::Material);
editor.bridge = bridge;
self.device_retry = None;
Expand Down Expand Up @@ -246,6 +246,7 @@ impl App {
let started = Instant::now();
let acquired = surface.surface.get_current_texture();
self.app_state
.perf
.frame_stats
.record(FramePhase::Acquire, started.elapsed());
let output = match acquired {
Expand All @@ -268,6 +269,7 @@ impl App {
let started = Instant::now();
self.app_state.tick_previews();
self.app_state
.perf
.frame_stats
.record(FramePhase::Simulation, started.elapsed());

Expand Down Expand Up @@ -296,6 +298,7 @@ impl App {
.egui_ctx
.tessellate(full_output.shapes, full_output.pixels_per_point);
self.app_state
.perf
.frame_stats
.record(FramePhase::UiLayout, started.elapsed());

Expand Down Expand Up @@ -372,13 +375,15 @@ impl App {
}

self.app_state
.perf
.frame_stats
.record(FramePhase::RenderEncode, started.elapsed());

let started = Instant::now();
queue.submit(std::iter::once(encoder.finish()));
output.present();
self.app_state
.perf
.frame_stats
.record(FramePhase::Submit, started.elapsed());

Expand Down Expand Up @@ -457,6 +462,7 @@ impl App {
editor.bridge.set_game_pack_path(&root);
}
self.app_state
.perf
.frame_stats
.record(FramePhase::Updates, started.elapsed());
self.app_state.tick_frame_stats();
Expand Down
19 changes: 10 additions & 9 deletions src/app/modals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::ui::theme;
/// the same set the window does. The focus ring is last: a dialog paints its
/// frame when it is drawn, over anything drawn into its layer before it.
pub(crate) fn draw_editor_overlays(ctx: &Context, app_state: &mut AppState) {
if app_state.show_error_dialog {
if app_state.error_dialog.is_open() {
draw_error_dialog(ctx, app_state);
}
crate::ui::panels::settings::draw_keys_prompt_modal(ctx, app_state);
Expand Down Expand Up @@ -160,13 +160,13 @@ fn answered(ctx: &Context, key: &str) {
}

pub(super) fn draw_error_dialog(ctx: &Context, app_state: &mut AppState) {
let title = app_state.error_dialog_title.clone();
let title = app_state.error_dialog.title.clone();
let mut close = false;
question_titled(ctx, tr!("Error"), &title, 460.0, |ui| {
ui.add_space(theme::SPACING_SNUG);
// ⚠ The plain sentence when there is one; what the reader said is the details, and the Log's.
let said =
(app_state.error_dialog_plain.as_ref()).unwrap_or(&app_state.error_dialog_message);
(app_state.error_dialog.plain.as_ref()).unwrap_or(&app_state.error_dialog.message);
ui.add(egui::Label::new(said).wrap());
ui.add_space(theme::SPACING_RELAXED);
ui.horizontal(|ui| {
Expand All @@ -178,7 +178,7 @@ pub(super) fn draw_error_dialog(ctx: &Context, app_state: &mut AppState) {
))
.clicked()
{
let details = format!("{title}\n{}", app_state.error_dialog_message);
let details = format!("{title}\n{}", app_state.error_dialog.message);
ui.ctx().copy_text(details);
}
});
Expand All @@ -190,7 +190,7 @@ pub(super) fn draw_error_dialog(ctx: &Context, app_state: &mut AppState) {
}

pub(super) fn draw_retail_edit_confirm_modal(ctx: &Context, app_state: &mut AppState) {
let prompt = match app_state.pending_retail_edit.as_ref() {
let prompt = match app_state.prompts.retail_edit.as_ref() {
Some(p) => p.clone(),
None => return,
};
Expand Down Expand Up @@ -252,7 +252,7 @@ pub(super) fn draw_retail_edit_confirm_modal(ctx: &Context, app_state: &mut AppS
}

pub(super) fn draw_export_fixes_modal(ctx: &Context, app_state: &mut AppState) {
let Some(pending) = app_state.pending_export_fixes.as_ref() else {
let Some(pending) = app_state.prompts.export_fixes.as_ref() else {
return;
};
let drag_out = matches!(pending, PendingExportFixes::DragOut);
Expand Down Expand Up @@ -301,7 +301,7 @@ pub(super) fn draw_export_fixes_modal(ctx: &Context, app_state: &mut AppState) {
}

pub(super) fn draw_enhanced_open_modal(ctx: &Context, app_state: &mut AppState) {
let prompt = match app_state.pending_enhanced_open.as_ref() {
let prompt = match app_state.prompts.enhanced_open.as_ref() {
Some(p) => p.clone(),
None => return,
};
Expand Down Expand Up @@ -381,7 +381,7 @@ const STEPS_LISTED: usize = 3;
/// ⚠ Hidden while the saves a Save answer started run, so the prompts they
/// raise (where an archive entry goes, the edit gate) are the ones on top.
pub(super) fn draw_close_prompt(ctx: &Context, app_state: &mut AppState) {
let Some(pending) = app_state.pending_close.as_ref().filter(|p| !p.saving) else {
let Some(pending) = app_state.prompts.close.as_ref().filter(|p| !p.saving) else {
return;
};
let before = match pending.then {
Expand Down Expand Up @@ -485,12 +485,13 @@ pub(super) fn draw_close_prompt(ctx: &Context, app_state: &mut AppState) {

/// A file changed on disk while it holds unsaved edits: reload over them, or keep them.
pub(super) fn draw_reload_prompt(ctx: &Context, app_state: &mut AppState) {
if app_state.reload_conflicts.is_empty() {
if app_state.prompts.reload_conflicts.is_empty() {
return;
}
let mut answer = None;
// ⚠ A file OpenRage cooked itself from a saved source is refreshed, and nobody else changed it: the words say so.
let (refreshed, changed): (Vec<&std::path::PathBuf>, Vec<&std::path::PathBuf>) = app_state
.prompts
.reload_conflicts
.iter()
.partition(|path| app_state.workbench.refreshed.contains(*path));
Expand Down
Loading
Loading