mirror of
https://github.com/storytold/texturecraft.git
synced 2026-12-01 10:34:00 +01:00
Align menus, tool shelf, right bar and blank-screen states with the reference order
This commit is contained in:
1 parent
18c8538c3d
commit
ba26b11d85
10 files changed
+185
-41
No files matched your search
@@ -98,6 +98,7 @@ fn works_without_project(id: &str) -> bool {
|
||||
| "project.new"
|
||||
| "project.sample"
|
||||
| "project.inspect"
|
||||
| "viewport.frame"
|
||||
| "project.templates"
|
||||
| "export.presets"
|
||||
| "export.preset.get"
|
||||
|
||||
@@ -215,11 +215,15 @@ impl TextureCraftApp {
|
||||
|
||||
// The first run speaks the OS (or browser) language
|
||||
let mut ui_store = ui_state_store::UiStateStore::new(ui_state_store::FILE.get().cloned());
|
||||
let ui = ui_store.load(cc.storage).unwrap_or_else(|| {
|
||||
let mut ui = ui_store.load(cc.storage).unwrap_or_else(|| {
|
||||
let mut ui = UiState::default();
|
||||
ui.prefs.language = i18n::os_language().into();
|
||||
ui
|
||||
});
|
||||
// No window opens by itself with no project (a saved layout may have left Export open)
|
||||
if !session.project_open {
|
||||
ui.windows.export = false;
|
||||
}
|
||||
let next_autosave = ui.prefs.autosave_minutes as f64 * 60.0;
|
||||
ui.prefs.apply_resource_limits();
|
||||
|
||||
@@ -306,6 +310,7 @@ impl TextureCraftApp {
|
||||
// The empty state has no baking or rendering to show
|
||||
if id == "file.close" {
|
||||
self.ui.mode = state::Mode::Painting;
|
||||
self.ui.windows.export = false;
|
||||
}
|
||||
if let Some(from) = glide_from.filter(|f| *f != self.session.camera) {
|
||||
self.camera_glide = Some(CameraGlide { from, to: self.session.camera, start: self.last_time });
|
||||
|
||||
@@ -38,12 +38,14 @@ pub const TOP: [&str; 6] = ["File", "Edit", "Mode", "Window", "Viewport", "Help"
|
||||
pub const CATALOG: &[Item] = &[
|
||||
it("File", "New project...", "ui.newProject", Some("Ctrl+N")),
|
||||
it("File", "Open...", "file.open", Some("Ctrl+O")),
|
||||
sep("File"),
|
||||
it("File", "Open sample project...", "project.sample", None),
|
||||
sep("File"),
|
||||
it("File", "Close", "file.close", Some("Ctrl+F4")),
|
||||
sep("File"),
|
||||
it("File", "Save", "file.save", Some("Ctrl+S")),
|
||||
it("File", "Save as...", "file.saveAs", Some("Ctrl+Shift+S")),
|
||||
it("File", "Save a copy...", "file.saveCopy", None),
|
||||
sub("File", "More save options", "Save a copy...", "file.saveCopy", None),
|
||||
it("File", "Remove unused resources...", "file.removeUnused", None),
|
||||
sep("File"),
|
||||
it("File", "Import resources...", "resource.import", None),
|
||||
@@ -57,7 +59,6 @@ pub const CATALOG: &[Item] = &[
|
||||
it("File", "Quit", "ui.quit", Some("Ctrl+Q")),
|
||||
it("Edit", "Undo", "edit.undo", Some("Ctrl+Z")),
|
||||
it("Edit", "Redo", "edit.redo", Some("Ctrl+Y")),
|
||||
sep("Edit"),
|
||||
it("Edit", "Project Configuration...", "ui.projectConfig", None),
|
||||
it("Edit", "Reimport mesh", "file.reimportMesh", Some("Ctrl+Shift+R")),
|
||||
it("Edit", "Settings...", "ui.settings", None),
|
||||
@@ -76,8 +77,10 @@ pub const CATALOG: &[Item] = &[
|
||||
sub("Window", "Views", "Shader Settings", "ui.view.shader", None),
|
||||
sub("Window", "Views", "Texture Sets", "ui.view.textureSetList", None),
|
||||
sub("Window", "Views", "Texture Set Settings", "ui.view.textureSetSettings", None),
|
||||
sep("Window"),
|
||||
sub("Window", "Save UI Layout", "Save current layout...", "ui.layout.save", None),
|
||||
it("Window", "Load UI Layout", "ui.layout.load", None),
|
||||
sep("Window"),
|
||||
it("Window", "Hide UI", "ui.hideUi", Some("Tab")),
|
||||
it("Window", "Reset UI", "ui.resetUi", None),
|
||||
it("Viewport", "Display material", "viewport.displayMaterial", Some("M")),
|
||||
@@ -98,11 +101,12 @@ pub const CATALOG: &[Item] = &[
|
||||
it("Viewport", "Invert quick mask", "viewport.quickMask.invert", Some("Ctrl+Shift+I")),
|
||||
it("Help", "Documentation...", "ui.help.docs", None),
|
||||
it("Help", "Shortcuts list...", "ui.help.shortcuts", None),
|
||||
sep("Help"),
|
||||
it("Help", "Join the community (Discord)...", "ui.help.discord", None),
|
||||
it("Help", "ArtCraft website...", "ui.help.website", None),
|
||||
it("Help", "Report a bug...", "ui.help.bug", None),
|
||||
sep("Help"),
|
||||
it("Help", "Show log...", "ui.view.log", None),
|
||||
sep("Help"),
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
it("Help", "Check for Updates...", "ui.help.checkForUpdates", None),
|
||||
it("Help", "About TextureCraft...", "ui.about", None),
|
||||
@@ -115,7 +119,7 @@ fn is_ui(id: &str) -> bool {
|
||||
|
||||
/// Shell items that act on the open project: greyed while none is open
|
||||
fn ui_needs_project(id: &str) -> bool {
|
||||
matches!(id, "ui.export" | "ui.projectConfig" | "ui.uvChecker" | "ui.mode.bake" | "ui.mode.render")
|
||||
matches!(id, "ui.export" | "ui.projectConfig" | "ui.uvChecker" | "ui.mode.bake" | "ui.mode.paint" | "ui.mode.render")
|
||||
}
|
||||
|
||||
/// Whether an item can run now
|
||||
|
||||
@@ -12,11 +12,11 @@ use crate::widgets::icon_button;
|
||||
|
||||
/// The rail's panels, top to bottom, with their icons and Window ▸ Views ids
|
||||
pub(crate) const RAIL_PANELS: [(Panel, &str, &str); 5] = [
|
||||
(Panel::TextureSetSettings, ic::STACK, "ui.view.textureSetSettings"),
|
||||
(Panel::Log, ic::FILE_TEXT, "ui.view.log"),
|
||||
(Panel::Display, ic::MONITOR, "ui.view.display"),
|
||||
(Panel::Shader, ic::SLIDERS_HORIZONTAL, "ui.view.shader"),
|
||||
(Panel::History, ic::CLOCK_COUNTER_CLOCKWISE, "ui.view.history"),
|
||||
(Panel::Log, ic::FILE_TEXT, "ui.view.log"),
|
||||
(Panel::TextureSetSettings, ic::STACK, "ui.view.textureSetSettings"),
|
||||
];
|
||||
|
||||
/// The popup reaches this far into the viewport, so it covers the panels between the viewport and the rail
|
||||
|
||||
@@ -76,33 +76,29 @@ pub fn paint_bar(app: &mut TextureCraftApp, ui: &mut egui::Ui) {
|
||||
|
||||
/// Width of `view_buttons`, so the bar knows when to move them into the scrolling strip
|
||||
fn view_buttons_width(button_size: f32, spacing: f32) -> f32 {
|
||||
// Two icons, two dropdowns, two separators and the five gaps between them
|
||||
2.0 * button_size + 2.0 * icon_dropdown_button_width(button_size) + 2.0 * BAR_SEPARATOR_WIDTH + 5.0 * spacing
|
||||
// Two icons, two dropdowns, one separator and the four gaps between them
|
||||
2.0 * button_size + 2.0 * icon_dropdown_button_width(button_size) + BAR_SEPARATOR_WIDTH + 4.0 * spacing
|
||||
}
|
||||
|
||||
/// View buttons in a right-to-left layout, with the screenshot button at the end
|
||||
/// View buttons in a right-to-left layout: the layout, then the camera type, then the screenshot and UV checker
|
||||
fn view_buttons(app: &mut TextureCraftApp, ui: &mut egui::Ui) {
|
||||
// Screenshot, projection and UV checker act on the project: greyed while none is open
|
||||
let project_open = app.session.project_open;
|
||||
ui.add_enabled_ui(project_open, |ui| view_buttons_enabled(app, ui));
|
||||
}
|
||||
|
||||
fn view_buttons_enabled(app: &mut TextureCraftApp, ui: &mut egui::Ui) {
|
||||
let button_size = ui.spacing().interact_size.y;
|
||||
if icon_button(ui, ic::CAMERA, tr("Screenshot of the viewport"), false, button_size).clicked() {
|
||||
app.toast(tr("Use the control channel or `texturecraft-cli render` for screenshots"), false);
|
||||
}
|
||||
|
||||
// Only the layout works without a project: the others act on it
|
||||
let project_open = app.session.project_open;
|
||||
// Right-to-left: the UV checker is added first and sits rightmost
|
||||
ui.add_enabled_ui(project_open, |ui| {
|
||||
let checker = app.session.view == texturecraft_engine::ViewMode::UvChecker;
|
||||
if icon_button(ui, ic::CHECKERBOARD, &tip(&app.ui.keymap, tr("UV checker"), "ui.uvChecker"), checker, button_size).clicked() {
|
||||
let mode = if checker { "material" } else { "uvChecker" };
|
||||
app.run("viewport.view", json!({"mode": mode}));
|
||||
}
|
||||
if icon_button(ui, ic::CAMERA, tr("Screenshot of the viewport"), false, button_size).clicked() {
|
||||
app.toast(tr("Use the control channel or `texturecraft-cli render` for screenshots"), false);
|
||||
}
|
||||
});
|
||||
ui.add(egui::Separator::default().spacing(BAR_SEPARATOR_WIDTH));
|
||||
projection_dropdown(app, ui);
|
||||
ui.add_enabled_ui(project_open, |ui| projection_dropdown(app, ui));
|
||||
layout_dropdown(app, ui);
|
||||
|
||||
ui.add(egui::Separator::default().spacing(BAR_SEPARATOR_WIDTH));
|
||||
let checker = app.session.view == texturecraft_engine::ViewMode::UvChecker;
|
||||
if icon_button(ui, ic::CHECKERBOARD, &tip(&app.ui.keymap, tr("UV checker"), "ui.uvChecker"), checker, button_size).clicked() {
|
||||
let mode = if checker { "material" } else { "uvChecker" };
|
||||
app.run("viewport.view", json!({"mode": mode}));
|
||||
}
|
||||
}
|
||||
|
||||
/// The 3D/2D, 3D-only and 2D-only layouts, showing the current one's icon
|
||||
@@ -317,7 +313,10 @@ fn mode_buttons(app: &mut TextureCraftApp, ui: &mut egui::Ui) {
|
||||
(Mode::Painting, ic::PALETTE, tr("Painting"), "ui.mode.paint"),
|
||||
(Mode::Baking, ic::ATOM, tr("Bake Mesh Maps"), "ui.mode.bake"),
|
||||
] {
|
||||
if icon_button(ui, icon, &tip(&app.ui.keymap, label, command), app.ui.mode == mode, button_size).clicked() {
|
||||
// Greyed (Painting stays shown as the current mode) while no project is open
|
||||
let on = crate::menus::enabled(app, command);
|
||||
let button = ui.add_enabled_ui(on, |ui| icon_button(ui, icon, &tip(&app.ui.keymap, label, command), app.ui.mode == mode, button_size)).inner;
|
||||
if button.clicked() {
|
||||
crate::menus::invoke(app, &ui.ctx().clone(), command);
|
||||
}
|
||||
}
|
||||
@@ -472,11 +471,7 @@ pub fn rail(app: &mut TextureCraftApp, ui: &mut egui::Ui) {
|
||||
card(ui, &tokens, egui::Margin { left: 0, right: GUTTER, top: GUTTER, bottom: GUTTER }, RAIL_CARD_PADDING, |ui| {
|
||||
ui.spacing_mut().item_spacing.y = RAIL_ICON_GAP;
|
||||
crate::rail_popup::begin_rail(ui.ctx(), ui.max_rect());
|
||||
let export_on = crate::menus::enabled(app, "ui.export");
|
||||
let export = ui.add_enabled_ui(export_on, |ui| {
|
||||
icon_button(ui, ic::EXPORT, &tip(&app.ui.keymap, tr("Export textures"), "ui.export"), app.ui.windows.export, RAIL_ICON_SIZE)
|
||||
});
|
||||
if export.inner.clicked() {
|
||||
if icon_button(ui, ic::EXPORT, &tip(&app.ui.keymap, tr("Export textures"), "ui.export"), app.ui.windows.export, RAIL_ICON_SIZE).clicked() {
|
||||
app.ui.windows.export = !app.ui.windows.export;
|
||||
}
|
||||
|
||||
|
||||
@@ -486,7 +486,8 @@ fn view_header(app: &mut TextureCraftApp, ui: &mut Ui, rect: Rect, id: &str) {
|
||||
_ => app.session.view.label(),
|
||||
};
|
||||
let channels = app.session.doc.project.texture_set(app.session.ts()).map(|texture_set| texture_set.channel_list()).unwrap_or_default();
|
||||
egui::ComboBox::from_id_salt(format!("{id}_mode")).width(VIEW_PICKER_WIDTH).selected_text(tr(&label)).show_ui(&mut child, |ui| {
|
||||
// The picker is greyed with no project: it has nothing to show a project's maps of
|
||||
child.add_enabled_ui(project_open, |child| egui::ComboBox::from_id_salt(format!("{id}_mode")).width(VIEW_PICKER_WIDTH).selected_text(tr(&label)).show_ui(child, |ui| {
|
||||
if baking && ui.selectable_label(neutral, tr("Neutral Material")).clicked() {
|
||||
app.ui.bake_visualization.neutral_shown = true;
|
||||
app.run("viewport.view", json!({"mode": "material"}));
|
||||
@@ -517,7 +518,7 @@ fn view_header(app: &mut TextureCraftApp, ui: &mut Ui, rect: Rect, id: &str) {
|
||||
if ui.selectable_label(app.session.view == ViewMode::UvChecker, tr("UV checker")).clicked() {
|
||||
app.run("viewport.view", json!({"mode": "uvChecker"}));
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
/// The view picker's entries that show one baked mesh map
|
||||
|
||||
@@ -1140,10 +1140,6 @@ fn export_settings_tab(app: &mut TextureCraftApp, ui: &mut Ui, presets: &[textur
|
||||
|
||||
pub fn export(app: &mut TextureCraftApp, ctx: &egui::Context) {
|
||||
let tk = Tokens::get(ctx);
|
||||
// Nothing to export without a project (closed, or a saved layout that left it open)
|
||||
if !app.session.project_open {
|
||||
app.ui.windows.export = false;
|
||||
}
|
||||
if !app.ui.windows.export {
|
||||
return;
|
||||
}
|
||||
@@ -1151,6 +1147,11 @@ pub fn export(app: &mut TextureCraftApp, ctx: &egui::Context) {
|
||||
let mut do_export = false;
|
||||
let presets = texturecraft_engine::formats::builtin_presets();
|
||||
dialog("export_textures", tr("Export textures"), &mut open).fixed_size(vec2(820.0, 430.0)).show(ctx, |ui| {
|
||||
// Nothing to export without a project
|
||||
if !app.session.project_open {
|
||||
ui.label(tr("No project is open"));
|
||||
return;
|
||||
}
|
||||
ui.horizontal(|ui| {
|
||||
for (i, t) in [tr("Settings"), tr("Output templates"), tr("List of exports")].iter().enumerate() {
|
||||
if ui.selectable_label(app.ui.export.tab == i as u8, caption(t)).clicked() {
|
||||
|
||||
@@ -84,7 +84,7 @@ fn project_items_are_disabled_without_a_project() {
|
||||
] {
|
||||
assert!(!menus::enabled(app, id), "{id} needs a project");
|
||||
}
|
||||
for id in ["ui.newProject", "file.open", "project.sample", "ui.settings", "ui.about", "ui.quit", "ui.mode.paint", "ui.layout.split"] {
|
||||
for id in ["ui.newProject", "file.open", "project.sample", "ui.settings", "ui.about", "ui.quit", "ui.hideUi", "ui.resetUi", "viewport.frame", "ui.layout.split"] {
|
||||
assert!(menus::enabled(app, id), "{id} works without a project");
|
||||
}
|
||||
let open = open_project();
|
||||
|
||||
@@ -12,6 +12,7 @@ mod curvature_generator;
|
||||
mod effect_rows;
|
||||
mod effect_sliders;
|
||||
mod empty_start;
|
||||
mod reference_order;
|
||||
mod file_dialogs;
|
||||
mod fill_channel_image;
|
||||
mod fill_projection_section;
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
//! The order of the menus, the tool shelf and the right bar, and what is enabled with no project open,
|
||||
//! follow the reference app's measured layout. Items TextureCraft has no equivalent of are absent.
|
||||
|
||||
use egui::accesskit::Role;
|
||||
use egui_kittest::Harness;
|
||||
use egui_kittest::kittest::Queryable;
|
||||
use texturecraft_engine::Session;
|
||||
use texturecraft_ui_egui::{TextureCraftApp, menus};
|
||||
|
||||
fn harness(session: Session) -> Harness<'static, TextureCraftApp> {
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1600.0, 960.0)).build_eframe(|cc| TextureCraftApp::new(cc, session));
|
||||
h.state_mut().ui.prefs.language = "en".into();
|
||||
h.run_steps(4);
|
||||
h
|
||||
}
|
||||
|
||||
fn buttons_in(h: &Harness<'static, TextureCraftApp>, x: std::ops::Range<f32>) -> Vec<(f32, String, bool)> {
|
||||
let mut found: Vec<(f32, String, bool)> = h
|
||||
.get_all_by_role(Role::Button)
|
||||
.filter(|button| x.contains(&button.rect().min.x))
|
||||
.filter_map(|button| {
|
||||
let node = button.accesskit_node();
|
||||
node.label().map(|label| (button.rect().min.y, label.to_string(), node.is_disabled()))
|
||||
})
|
||||
.collect();
|
||||
found.sort_by(|a, b| a.0.total_cmp(&b.0));
|
||||
found
|
||||
}
|
||||
|
||||
fn named<'a>(found: &'a [(f32, String, bool)], name: &str) -> Option<&'a (f32, String, bool)> {
|
||||
found.iter().find(|(_, label, _)| label == name || label.starts_with(&format!("{name} (")))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_menu_lists_its_items_in_the_reference_order() {
|
||||
// Items the reference has and TextureCraft lacks are absent; TextureCraft's own sit where they fit
|
||||
let expected = [
|
||||
"File: New project... | Open... | - | Open sample project... | - | Close | - | Save | Save as... | More save options > Save a copy... | Remove unused resources... | - | Import resources... | Import MaterialX material... | Import PBR texture folder... | Import material... | Export Textures... | Export Mesh... | - | Quit",
|
||||
"Edit: Undo | Redo | Project Configuration... | Reimport mesh | Settings...",
|
||||
"Mode: Bake Mesh Maps | Painting | Rendering (path traced)",
|
||||
"Window: Views > Assets | Views > Common Settings | Views > Display Settings | Views > History | Views > Layers | Views > Log | Views > Mesh Map Bakers | Views > Mesh Map Settings | Views > Properties | Views > Shader Settings | Views > Texture Sets | Views > Texture Set Settings | - | Save UI Layout > Save current layout... | Load UI Layout | - | Hide UI | Reset UI",
|
||||
"Viewport: Display material | Display next channel | Display previous channel | Display next mesh map | Display previous mesh map | UV checker | - | Show entire mesh | - | 3D/2D views | 3D view only | 2D view only | - | Enable quick mask | Edit quick mask | Invert quick mask",
|
||||
"Help: Documentation... | Shortcuts list... | - | Join the community (Discord)... | ArtCraft website... | Report a bug... | Show log... | - | Check for Updates... | About TextureCraft...",
|
||||
];
|
||||
let actual: Vec<String> = menus::TOP
|
||||
.iter()
|
||||
.map(|top| {
|
||||
let items: Vec<String> = menus::CATALOG
|
||||
.iter()
|
||||
.filter(|item| item.menu == *top)
|
||||
.map(|item| match item.sub {
|
||||
Some(sub) => format!("{sub} > {}", item.label),
|
||||
None => item.label.to_string(),
|
||||
})
|
||||
.collect();
|
||||
format!("{top}: {}", items.join(" | "))
|
||||
})
|
||||
.collect();
|
||||
for (expected, actual) in expected.iter().zip(&actual) {
|
||||
assert_eq!(expected, actual);
|
||||
}
|
||||
assert_eq!(menus::TOP, ["File", "Edit", "Mode", "Window", "Viewport", "Help"], "the reference's top menus, minus the scripting ones");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_tool_shelf_keeps_the_reference_order() {
|
||||
let h = harness(texturecraft_engine::sample_session(256, 64).unwrap());
|
||||
let shelf = buttons_in(&h, 0.0..60.0);
|
||||
let order = ["Paint", "Eraser", "Path", "Projection", "Polygon fill", "Smudge", "Clone", "Material picker", "Geometry mask"];
|
||||
let ys: Vec<f32> = order.iter().map(|name| named(&shelf, name).unwrap_or_else(|| panic!("{name} on the shelf: {shelf:?}")).0).collect();
|
||||
assert!(ys.windows(2).all(|pair| pair[0] < pair[1]), "{ys:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_right_bar_keeps_the_reference_order() {
|
||||
let h = harness(texturecraft_engine::sample_session(256, 64).unwrap());
|
||||
let bar = buttons_in(&h, 1562.0..1600.0);
|
||||
let order = ["Export textures", "Log", "Display Settings", "Shader Settings", "History"];
|
||||
let ys: Vec<f32> = order.iter().map(|name| named(&bar, name).unwrap_or_else(|| panic!("{name} on the bar: {bar:?}")).0).collect();
|
||||
assert!(ys.windows(2).all(|pair| pair[0] < pair[1]), "{ys:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_blank_screen_enables_what_the_reference_enables() {
|
||||
let h = harness(Session::closed().unwrap());
|
||||
let shelf = buttons_in(&h, 0.0..60.0);
|
||||
for name in ["Paint", "Eraser", "Path", "Projection", "Polygon fill", "Smudge", "Clone", "Geometry mask"] {
|
||||
assert!(named(&shelf, name).unwrap().2, "{name} is disabled with no project");
|
||||
}
|
||||
let bar = buttons_in(&h, 1562.0..1600.0);
|
||||
for name in ["Export textures", "Log", "Display Settings", "Shader Settings", "History"] {
|
||||
assert!(!named(&bar, name).unwrap().2, "{name} on the right bar stays enabled");
|
||||
}
|
||||
|
||||
// Top bar: layout stays on; camera type and the three modes are greyed, Painting shown as the current mode
|
||||
let top = buttons_in(&h, 600.0..1562.0);
|
||||
let on = |name: &str| !named(&top, name).unwrap_or_else(|| panic!("{name}: {top:?}")).2;
|
||||
assert!(on("3D/2D views"), "the layout selector works without a project");
|
||||
assert!(!on("Perspective") && !on("Painting") && !on("Bake Mesh Maps") && !on("Rendering (path traced)"));
|
||||
let painting = h.get_all_by_role(Role::Button).find(|button| button.accesskit_node().label().is_some_and(|label| label.starts_with("Painting"))).unwrap();
|
||||
assert_eq!(painting.accesskit_node().toggled(), Some(egui::accesskit::Toggled::True), "Painting is the shown mode");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_blank_screen_menus_match_the_measured_enabled_states() {
|
||||
let h = harness(Session::closed().unwrap());
|
||||
let app = h.state();
|
||||
let disabled = [
|
||||
"file.close", "file.save", "file.saveAs", "file.saveCopy", "file.removeUnused", "ui.export", "file.exportMesh", "edit.undo", "edit.redo", "ui.projectConfig",
|
||||
"file.reimportMesh", "ui.mode.bake", "ui.mode.paint", "ui.mode.render", "viewport.displayMaterial", "viewport.nextChannel", "viewport.previousChannel",
|
||||
"viewport.nextMeshMap", "viewport.previousMeshMap", "viewport.quickMask", "viewport.quickMask.edit", "viewport.quickMask.invert",
|
||||
];
|
||||
for id in disabled {
|
||||
assert!(!menus::enabled(app, id), "{id} is disabled on the blank screen");
|
||||
}
|
||||
let enabled = [
|
||||
"ui.newProject", "file.open", "project.sample", "ui.quit", "ui.settings", "ui.view.assets", "ui.view.layers", "ui.view.properties", "ui.view.textureSetList",
|
||||
"ui.view.textureSetSettings", "ui.view.display", "ui.view.history", "ui.view.log", "ui.view.shader", "ui.hideUi", "ui.resetUi", "ui.layout.save",
|
||||
"ui.layout.load", "viewport.frame", "ui.help.docs", "ui.help.shortcuts", "ui.help.bug", "ui.about",
|
||||
];
|
||||
for id in enabled {
|
||||
assert!(menus::enabled(app, id), "{id} is enabled on the blank screen");
|
||||
}
|
||||
for id in ["ui.view.bakeSettings", "ui.view.bakeMaps", "ui.view.meshMapBakers"] {
|
||||
assert!(!menus::enabled(app, id), "{id} belongs to Baking mode");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn opening_a_project_enables_the_same_items() {
|
||||
let h = harness(texturecraft_engine::sample_session(256, 64).unwrap());
|
||||
let app = h.state();
|
||||
for id in ["file.close", "file.save", "file.saveAs", "file.saveCopy", "ui.export", "file.exportMesh", "ui.projectConfig", "ui.mode.bake", "ui.mode.paint", "ui.mode.render", "viewport.displayMaterial", "viewport.quickMask"] {
|
||||
assert!(menus::enabled(app, id), "{id} is enabled with a project");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user