Skip to content

Commit

Permalink
Misc bug fixes (#112)
Browse files Browse the repository at this point in the history
* fix: make archive manager create version 1 archives when "VX" is selected

* docs: mention in PR template that clippy for wasm needs build-std

* fix: align the word "Brush" vertically in the top bar

* fix: justify the width of the filesystem debug window

* fix: show paths with same filename, different extension in filesystem debug

* style: move log to the bottom of the debug menu

This is to group the filesystem debug and the wgpu debug windows
together.

* fix: preserve filesystem debug window width when project is unloaded

* fix: fix database editor visual bugs
  • Loading branch information
white-axe authored Mar 2, 2024
1 parent 490d4e4 commit a341d0b
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 70 deletions.
6 changes: 3 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ person(s) who reviewed your changes. This will make sure it gets re-added to the

- [ ] Run `cargo fmt`.
- [ ] Run `cargo clippy`. If applicable, add:
- [ ] `--target wasm32-unknown-unknown`
- [ ] Run `cargo build --release`
- [ ] If applicable, run `trunk build --release`
- [ ] `--target wasm32-unknown-unknown -Z build-std=std,panic_abort`
- [ ] Run `cargo build --release`
- [ ] If applicable, run `trunk build --release`
73 changes: 41 additions & 32 deletions crates/filesystem/src/path_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,38 +220,47 @@ where
pub fn debug_ui(&self, ui: &mut egui::Ui) {
let cache = self.cache.read();

egui::ScrollArea::vertical()
.id_source("luminol_path_cache_debug_ui")
.show_rows(
ui,
ui.text_style_height(&egui::TextStyle::Body),
cache.cactus.len(),
|ui, rows| {
for (_, (key, extension_trie)) in cache
.trie
.iter_prefix("")
.unwrap()
.enumerate()
.filter(|(index, _)| rows.contains(index))
{
let Some(key) = key.as_str().strip_suffix(&format!("/{TRIE_SUFFIX}"))
else {
continue;
};
ui.horizontal(|ui| {
ui.label(key);
ui.label("➡");
ui.label(
cache
.get_path_from_cactus_index(
*extension_trie.values().next().unwrap(),
)
.as_str(),
);
});
}
},
);
ui.with_layout(
egui::Layout {
cross_justify: true,
..*ui.layout()
},
|ui| {
egui::ScrollArea::vertical()
.id_source("luminol_path_cache_debug_ui")
.show_rows(
ui,
ui.text_style_height(&egui::TextStyle::Body),
cache.cactus.len(),
|ui, rows| {
for (_, (key, cactus_index)) in cache
.trie
.iter_prefix("")
.unwrap()
.filter_map(|(mut key, extension_trie)| {
(key.file_name() == Some(TRIE_SUFFIX)).then(|| {
key.pop();
extension_trie
.values()
.map(move |&cactus_index| (key.clone(), cactus_index))
})
})
.flatten()
.enumerate()
.filter(|(row, _)| rows.contains(row))
{
ui.add(
egui::Label::new(format!(
"{key} ➡ {}",
cache.get_path_from_cactus_index(cactus_index),
))
.truncate(true),
);
}
},
);
},
);
}
}

Expand Down
2 changes: 2 additions & 0 deletions crates/filesystem/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ impl FileSystem {
}

pub fn debug_ui(&self, ui: &mut egui::Ui) {
ui.set_width(ui.available_width());

match self {
FileSystem::Unloaded => {
ui.label("Unloaded");
Expand Down
6 changes: 5 additions & 1 deletion crates/ui/src/windows/archive_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,11 @@ impl Window {

let _ = luminol_filesystem::archiver::FileSystem::from_buffer_and_files(
&mut file,
version,
if version == 2 {
1
} else {
version
},
file_paths.iter().map(|path| {
if is_first {
is_first = false;
Expand Down
19 changes: 2 additions & 17 deletions crates/ui/src/windows/enemies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,8 @@ impl luminol_core::Window for Window {
modified |= columns[1]
.add(luminol_components::Field::new(
"Treasure Probability",
egui::Slider::new(&mut enemy.treasure_prob, 0..=100),
egui::Slider::new(&mut enemy.treasure_prob, 0..=100)
.suffix("%"),
))
.changed();
});
Expand All @@ -470,22 +471,6 @@ impl luminol_core::Window for Window {
enemy.item_id = None;
enemy.weapon_id = None;
enemy.armor_id = None;
ui.add_enabled(
false,
luminol_components::Field::new(
"Treasure",
|ui: &mut egui::Ui| {
egui::ComboBox::from_id_source((enemy.id, "none"))
.wrap(true)
.width(
ui.available_width()
- ui.spacing().item_spacing.x,
)
.show_ui(ui, |_ui| {})
.response
},
),
);
}

TreasureType::Item => {
Expand Down
31 changes: 20 additions & 11 deletions crates/ui/src/windows/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ impl luminol_core::Window for Window {
});

ui.with_padded_stripe(true, |ui| {
ui.columns(2, |columns| {
modified |= columns[0]
if item.parameter_type.is_none() {
modified |= ui
.add(luminol_components::Field::new(
"Parameter",
luminol_components::EnumComboBox::new(
Expand All @@ -236,18 +236,27 @@ impl luminol_core::Window for Window {
),
))
.changed();

modified |= columns[1]
.add_enabled(
!item.parameter_type.is_none(),
luminol_components::Field::new(
} else {
ui.columns(2, |columns| {
modified |= columns[0]
.add(luminol_components::Field::new(
"Parameter",
luminol_components::EnumComboBox::new(
"parameter_type",
&mut item.parameter_type,
),
))
.changed();

modified |= columns[1]
.add(luminol_components::Field::new(
"Parameter Increment",
egui::DragValue::new(&mut item.parameter_points)
.clamp_range(0..=i32::MAX),
),
)
.changed();
});
))
.changed();
});
}
});

ui.with_padded_stripe(false, |ui| {
Expand Down
21 changes: 15 additions & 6 deletions src/app/top_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,16 +337,20 @@ impl TopBar {
.add_window(luminol_ui::windows::misc::FilesystemDebug::default());
}

#[cfg(not(target_arch = "wasm32"))]
if ui.button("Log").clicked() {
self.show_log = true;
}

if ui.button("WGPU Debug Info").clicked() {
update_state
.edit_windows
.add_window(luminol_ui::windows::misc::WgpuDebugInfo::new(update_state));
}

#[cfg(not(target_arch = "wasm32"))]
{
ui.separator();

if ui.button("Log").clicked() {
self.show_log = true;
}
}
});

#[cfg(not(target_arch = "wasm32"))]
Expand Down Expand Up @@ -413,7 +417,12 @@ impl TopBar {

ui.separator();

ui.label("Brush:");
ui.vertical(|ui| {
ui.add_space(ui.spacing().button_padding.y.max(
(ui.spacing().interact_size.y - ui.text_style_height(&egui::TextStyle::Body)) / 2.,
));
ui.label("Brush:");
});

for brush in luminol_core::Pencil::iter() {
ui.selectable_value(&mut update_state.toolbar.pencil, brush, brush.to_string());
Expand Down

0 comments on commit a341d0b

Please sign in to comment.