Leave the brush tools' Properties without hint lines

The Brush section's two Ctrl+drag lines go (the shortcuts stay in the
keymap), the Smudge section's two lines become the tooltips of Strength
and Channels dragged, and the Clone section's lines become the tooltip
of its source row, which reads Source: none until one is set.
This commit is contained in:
Rebornim committed 2026-11-27 08:25:57 +00:00
1 parent d627b8c004
commit bec8934c80
4 files changed
+81 -21

No files matched your search

-2
View File
@@ -59,8 +59,6 @@ pub(crate) fn brush_section(app: &mut TextureCraftApp, sheet: &mut PropertySheet
if let Some(menu) = menu {
brush_presets_popover(app, sheet.ui, menu);
}
sheet.dim_line(tr("Ctrl+right-drag in a view sets the size and hardness, Ctrl+left-drag the flow and angle."));
sheet.dim_line(tr("Ctrl+Shift+right-drag: size and hardness in fine steps."));
let tokens = Tokens::get(sheet.ui.ctx());
let image = app.session.tool.brush.alpha_image.as_ref().and_then(|name| app.session.images.get(name)).cloned();
+27 -19
View File
@@ -2135,7 +2135,6 @@ fn tool_sections(app: &TextureCraftApp) -> Vec<PaintSection> {
}
fn clone_section(app: &mut TextureCraftApp, ui: &mut Ui) {
let tk = Tokens::get(ui.ctx());
ui.label(caption(tr("Clone")));
ui.horizontal(|ui| {
ui.label(tr("Copy from"));
@@ -2148,6 +2147,7 @@ fn clone_section(app: &mut TextureCraftApp, ui: &mut Ui) {
}
}
});
let mut aligned = app.session.tool.clone_aligned;
if ui
.checkbox(&mut aligned, tr("Aligned"))
@@ -2156,39 +2156,47 @@ fn clone_section(app: &mut TextureCraftApp, ui: &mut Ui) {
{
app.run("tool.brush", json!({"cloneAligned": aligned}));
}
let Some(src) = app.session.tool.clone_source else {
ui.label(RichText::new(tr("Hold V and click the mesh to set the source, then paint elsewhere to copy it.")).color(tk.text_dim));
let Some(source) = app.session.tool.clone_source else {
ui.label(tr("Source: none")).on_hover_text(tr("Hold V and click the mesh to set the source, then paint elsewhere to copy it."));
return;
};
ui.horizontal(|ui| {
ui.label(trf("Source U {u} V {v}", &[("u", &format!("{:.3}", src.uv[0])), ("v", &format!("{:.3}", src.uv[1]))]));
if ui.small_button(tr("Clear")).clicked() {
app.run("tool.cloneSource", json!({"clear": true}));
}
});
let hint = if !app.session.tool.clone_aligned {
tr("Not aligned: every stroke starts at the source. V + click sets a new source.")
} else if src.offset.is_some() {
} else if source.offset.is_some() {
tr("Aligned: the offset set by the first stroke is kept. V + click sets a new source.")
} else {
tr("The first stroke sets the offset from the source.")
};
ui.label(RichText::new(hint).size(10.5).color(tk.text_dim));
ui.horizontal(|ui| {
ui.label(trf("Source U {u} V {v}", &[("u", &format!("{:.3}", source.uv[0])), ("v", &format!("{:.3}", source.uv[1]))])).on_hover_text(hint);
if ui.small_button(tr("Clear")).clicked() {
app.run("tool.cloneSource", json!({"clear": true}));
}
});
}
/// Space between the smudge strength and the channels it drags
const SMUDGE_CHANNELS_GAP: f32 = 4.0;
/// Full value of the smudge strength slider, the 0..100 scale `tool.brush` takes
const SMUDGE_STRENGTH_PERCENT: f32 = 100.0;
fn smudge_section(app: &mut TextureCraftApp, ui: &mut Ui) {
let tk = Tokens::get(ui.ctx());
ui.label(caption(tr("Smudge")));
let mut v = app.session.tool.smudge_strength * 100.0;
if slider(ui, tr("Strength"), &mut v, 0.0..=100.0, 0).changed() {
app.session.tool.smudge_strength = (v / 100.0).clamp(0.0, 1.0);
let mut strength_percent = app.session.tool.smudge_strength * SMUDGE_STRENGTH_PERCENT;
let strength = slider(ui, tr("Strength"), &mut strength_percent, 0.0..=SMUDGE_STRENGTH_PERCENT, 0);
if strength.on_hover_text(tr("Drags the layer stack's values along the stroke into the selected layer.")).changed() {
app.run("tool.brush", json!({"smudgeStrength": strength_percent}));
}
ui.label(RichText::new(tr("Drags the layer stack's values along the stroke into the selected layer.")).size(10.5).color(tk.text_dim));
ui.add_space(4.0);
ui.label(tr("Channels dragged"));
ui.add_space(SMUDGE_CHANNELS_GAP);
ui.label(tr("Channels dragged")).on_hover_text(tr(
"These are the brush's material channels, the same ones Paint writes and the Material tab shows. A channel the selected layer does not have is skipped.",
));
material_channel_chips(app, ui);
ui.label(RichText::new(tr("These are the brush's material channels, the same ones Paint writes and the Material tab shows. A channel the selected layer does not have is skipped.")).size(10.5).color(tk.text_dim));
}
fn path_section(app: &mut TextureCraftApp, ui: &mut Ui) {
+1
View File
@@ -69,6 +69,7 @@ mod nav_buttons;
mod new_project_baked_maps;
mod new_project_window;
mod output_templates;
mod paint_hint_lines;
mod paint_tool_tabs;
mod panel_header;
mod path_in_view;
@@ -0,0 +1,53 @@
//! A brush tool's Properties explain themselves in tooltips: no line of instructions under the controls
use egui::accesskit::Role;
use egui_kittest::Harness;
use egui_kittest::kittest::{NodeT, Queryable};
use serde_json::json;
use texturecraft_engine::execute;
use texturecraft_ui_egui::TextureCraftApp;
use crate::{BAKE_RESOLUTION, FRAME_SECONDS, PROPERTIES_WINDOW, STARTUP_FRAMES, TEXTURE_RESOLUTION};
fn with_tool(tool: &str) -> Harness<'static, TextureCraftApp> {
let mut session = texturecraft_engine::sample_session(TEXTURE_RESOLUTION, BAKE_RESOLUTION).unwrap();
execute(&mut session, "tool.select", &json!({"tool": tool})).unwrap();
let mut harness = Harness::builder()
.with_size(PROPERTIES_WINDOW)
.with_step_dt(FRAME_SECONDS)
.with_context_setup(texturecraft_ui_egui::framework::install_headless)
.build_eframe(|cc| TextureCraftApp::new(cc, session));
harness.state_mut().ui.prefs.language = "en".into();
harness.run_steps(STARTUP_FRAMES);
harness
}
/// The words of every label in the app
fn labels(harness: &Harness<'_, TextureCraftApp>) -> Vec<String> {
harness.query_all_by_role(Role::Label).filter_map(|node| node.accesskit_node().value().map(|value| value.to_string())).collect()
}
#[test]
fn the_brush_section_has_no_shortcut_lines() {
let harness = with_tool("paint");
assert!(harness.query_by_role_and_label(Role::Slider, "Size").is_some(), "the Brush section is on screen");
let labels = labels(&harness);
let shortcut = labels.iter().find(|label| label.contains("drag"));
assert!(shortcut.is_none(), "the view shortcuts are in the keymap, not under the brush: {shortcut:?}");
}
#[test]
fn the_smudge_section_has_no_explanation_lines() {
let labels = labels(&with_tool("smudge"));
assert!(labels.iter().any(|label| label == "Channels dragged"), "the Smudge section is on screen");
let sentence = labels.iter().find(|label| label.ends_with('.'));
assert!(sentence.is_none(), "what Smudge does is in its tooltips: {sentence:?}");
}
#[test]
fn the_clone_section_shows_its_source_state_without_instructions() {
let labels = labels(&with_tool("clone"));
assert!(labels.iter().any(|label| label == "Source: none"), "no source set yet reads as state");
let sentence = labels.iter().find(|label| label.ends_with('.'));
assert!(sentence.is_none(), "how to set the source is in the tooltip: {sentence:?}");
}