diff --git a/crates/ui-egui/src/mesh_export_options.rs b/crates/ui-egui/src/mesh_export_options.rs index 95e2bae7..702589b3 100644 --- a/crates/ui-egui/src/mesh_export_options.rs +++ b/crates/ui-egui/src/mesh_export_options.rs @@ -4,6 +4,7 @@ use egui::Ui; use crate::TextureCraftApp; use crate::i18n::tr; +use crate::theme::Tokens; use crate::unavailable; /// Indent of an option's checkbox under its choice @@ -13,7 +14,10 @@ const OPTION_INDENT: f32 = 20.0; const BUTTON_WIDTH: f32 = 110.0; /// The reference dialog's content width -const DIALOG_WIDTH: f32 = 510.0; +const DIALOG_WIDTH: f32 = 500.0; + +/// Width of an info icon's tooltip, as in the reference +const INFO_TOOLTIP_WIDTH: f32 = 250.0; /// Gap between the two option groups, as in the reference const GROUP_GAP: f32 = 25.0; @@ -32,10 +36,26 @@ pub(crate) fn show(app: &mut TextureCraftApp, ctx: &egui::Context) { // TextureCraft exports the mesh as it is: triangulated, without displacement ui.add(egui::RadioButton::new(true, tr("Without displacement/tessellation"))); - option(ui, true, tr("Apply triangulation")); + option( + ui, + true, + tr("Apply triangulation"), + &[ + tr("Triangulation converts all mesh polygons with more than 3 sides to triangles (but doesn't change the triangular ones)."), + tr("Choosing to apply triangulation for export avoids unexpected results when rendering the mesh in another application."), + ], + ); ui.add_space(GROUP_GAP); unavailable::greyed(ui, |ui| ui.add(egui::RadioButton::new(false, tr("With displacement/tessellation")))); - option(ui, true, tr("Recompute vertex normals")); + option( + ui, + true, + tr("Recompute vertex normals"), + &[ + tr("Recomputing vertex normals is recommended if you don't plan on using the normal map in the target application."), + tr("Otherwise, keeping the original vertex normals is recommended if you plan on using the normal map in the target application."), + ], + ); ui.add_space(8.0); // One row keeps the window to its contents; a bare right-to-left layout fills the screen height @@ -56,10 +76,23 @@ pub(crate) fn show(app: &mut TextureCraftApp, ctx: &egui::Context) { } } -/// A greyed option under a choice, ticked as the reference shows it -fn option(ui: &mut Ui, checked: bool, label: &str) { +/// A greyed option under a choice, ticked as the reference shows it, with an info icon at the +/// row's right end whose tooltip has the paragraphs `info` +fn option(ui: &mut Ui, checked: bool, label: &str, info: &[&str]) { ui.horizontal(|ui| { ui.add_space(OPTION_INDENT); unavailable::checkbox(ui, checked, label); + ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { + let icon = ui.label(egui::RichText::new(egui_phosphor::regular::INFO).color(Tokens::get(ui.ctx()).text_dim)); + icon.on_hover_ui(|ui| { + ui.set_max_width(INFO_TOOLTIP_WIDTH); + for (k, paragraph) in info.iter().enumerate() { + if k > 0 { + ui.add_space(ui.text_style_height(&egui::TextStyle::Body)); + } + ui.label(*paragraph); + } + }); + }); }); } diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 49271c38..2c04591e 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -70,7 +70,8 @@ that closes it back onto the bar; the float is saved with the UI state. and *Export shaders parameters* greyed, *Include all*, *Save settings* and "N textures selected for export"). *Export MaterialX* below *Export USD asset* is a TextureCraft addition: it adds `materialX: true` to the export. The prompt's *With displacement/tessellation* choice and both option checkboxes are - greyed; TextureCraft exports the mesh as it is. + greyed; TextureCraft exports the mesh as it is. The two (i) icons carry the reference's + tooltips. - **Window menu:** Views lists *Renderer Settings* (a panel of its own: the tracer in use, the samples so far and a note; it floats when first opened and is not opened by itself in Rendering mode), *Properties - Paint* while a project is open (other tools read "Properties - ", @@ -345,22 +346,26 @@ that numbers hide once a tile is under 40 points on screen. middle reads "Current preset: ", *Output maps* with *Create:* Gray, RGB, R+G+B, RGB+A, R+G+B+A on the same row, and a footer with drag-and-drop guidance and the number of output maps. Each output map is one row: a drag grip (drag it onto another row to move the map), the - file name, "$" with the file name variables ($project, $mesh, $textureSet, $udim, $uvTileName - greyed, $colorSpace, then TextureCraft's $channel), the channel swatches (Gray, RGB or R, G, B, - then A), the file type and bit depth lists ("8 bits + dithering" greyed: templates do not keep - it), duplicate and "×". Dropping a map on a swatch opens "From ": a gray map offers *Gray - Channel* and *A Channel*, a colour map *Gray Channel*, *R Channel*, *G Channel*, *B Channel* - and *A Channel* (TextureCraft has no alpha or gray of a map yet: those are greyed). A colour - map dropped on the RGB swatch fills R, G and B at once. The swatch then takes the map's - colour, and the map lists mark the maps of the output map edited last with that colour. A - click on a swatch offers *Clear channel* and *Split/Collapse RGB*. The right side has the - *Input maps* pane, grouped as in the reference (Base, Specular, Transmission, Subsurface, - Coat, Fuzz/Sheen; then Emission, Geometry and Other for the channels the reference screenshot - cuts off), and a pane with *Mesh maps* above *Converted maps* (highlighted); maps TextureCraft - does not have yet are greyed and cannot be dragged. TextureCraft keeps a few things the - reference does not show, out of the way: Import and Export of template files at the end of a - preset's right-click menu, Invert in a swatch's right-click menu, *Move up* and *Move down* - in the grip's right-click menu (and the arrow keys on a focused grip), the planned file name - in the file name's tooltip, and three converted maps of its own (Normal from height, Roughness - from glossiness, Sheen color × weight) after the reference's. Built-in templates stay - read-only and deleting asks first. + file name, "$" ("Add expressions in the path that will be replaced during export": $project, + $mesh, $textureSet, $udim, $uvTileName greyed, $colorSpace, then TextureCraft's $channel), the + channel swatches (Gr, RGB or R, G, B, then A), the file format ("File format") and bit depth + ("Bit depth"; "8 bits + dithering" greyed, templates do not keep it) lists, duplicate and "×". + Create names new rows "Grayscale", "RGB" and "RGB Alpha", with "_1", "_2" when taken. An + empty swatch reads "Default black" ("Default white" for A), a filled one " ()", + e.g. "Base color (Red)" or "Metallic (Grayscale)". Dropping a map on a swatch opens "From ": + a gray map offers *Gray Channel* and *A Channel*, a colour map *Gray Channel*, *R Channel*, *G + Channel*, *B Channel* and *A Channel*, on the RGB swatch first *RGB Channels*; Escape assigns + nothing. TextureCraft cannot read a map's gray or alpha yet, so those choices are greyed. A + click on a swatch offers *Clear channel*, on RGB, R, G and B also *Split/Collapse RGB*; R, G + and B that read different maps cannot collapse (the item is greyed). The right side has the + *Input maps* pane in the reference's groups and names (Base ... Miscellaneous, User Channels), + and a pane with *Mesh maps* above *Converted maps* (highlighted). Maps the selected template + uses get a square in their swatch's colour. Input and converted maps TextureCraft does not have + are greyed and cannot be dragged (the reference lists them all alike). TextureCraft keeps + some things the reference does not have, out of the way: Import and Export of template files + at the end of a preset's right-click menu; a swatch's right-click menu with Invert (an inverted + swatch has a corner mark), Black, Gray 50%, White, the constant's value and the map's layout + (RGB, RGBA, Gray, Gray + A); *Move up* and *Move down* in the grip's right-click menu and the + arrow keys on a focused grip; the planned file name in the file name's tooltip; and three + converted maps of its own (Normal from height, Roughness from glossiness, Sheen color × weight) + after the reference's. Built-in templates stay read-only and deleting asks first.