ui: show fluid results in the viewport with the part, legend and controls

The window built a deformed copy of the model for every results plot,
which drops the geometry surfaces, so after a fluid solve the bracket
vanished and nothing else was drawn.

A fluid step's plot keeps the part as it is and draws the engine's flow
display through it (the same scene as the headless pictures): the
field on a slice, the part coloured by the flow beside it and
streamlines. The legend shows the field with its bands and the cells
of its extremes (Max/Min mark and turn the view to them); the results
panel swaps the deformation rows for the slice's normal and position,
the obstacles' colours, the streamlines and a frame slider, all
running the results.* commands. The status line describes the new
commands.

Part of #193.
This commit is contained in:
Christian Svensson authored and Irakli Kourtis committed 2026-10-17 07:25:04 -04:00
1 parent f7dcd46b2f
commit a0c7d6ce9d
6 files changed
+303 -72

No files matched your search

+12
View File
@@ -133,6 +133,18 @@ pub fn done(command: &str, label: &str, params: &Value, v: &Value) -> String {
Some(f) => format!("Showing {step} frame {f}"),
None => format!("Showing {step}, last frame"),
}),
"results.slice" => Some(match (v["slice"]["axis"].as_str(), v["slice"]["position"].as_f64()) {
(Some(axis), Some(at)) => {
let field = v.pointer("/contour/label").and_then(Value::as_str).unwrap_or("The flow");
format!("{field} on a slice at {axis} = {}", crate::describe::quantity(at))
}
_ => format!("Slice off on {step}"),
}),
"results.surface" => Some(if v["surface"] == true { "Obstacles coloured by the flow" } else { "Obstacles in their own colours" }.to_string()),
"results.streamlines" => Some(match v.pointer("/traced/streamlines").and_then(Value::as_u64) {
Some(n) => format!("Traced {}", plural(n, "streamline")),
None => "Streamlines off".to_string(),
}),
"results.clear" => Some("Back to the model".to_string()),
"results.xy" => {
let points = v.get("points").and_then(Value::as_u64).unwrap_or(0);