View backgrounds: reference blend, image adjust, layouts, cleanup, style name

- Gradients: the middle colour sits (horizon - 0.5) viewport widths from the
  centre and blends over height viewport heights each side; two colours
  blend over a viewport height each side.
- Image backgrounds: offset in device pixels (right, down), negative scale
  mirrors, fitted with aspect ratio covers the viewport; the dialog keeps an
  image's offset and scale.
- Layouts: a model-space view restored on a sheet asks for the viewport,
  enters it and gives it the view's camera, background and visual style;
  inside a viewport the view goes there; a paper-space view's background is
  kept on the sheet viewport but not drawn; floating viewports draw their
  background.
- Background objects no view or viewport uses any more are erased; a view
  without a background restored where the viewport already is leaves the
  viewport's background.
- The viewport's named visual style (Realistic, ...) shows by name and the
  render-mode picker records its style on the viewport record.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ramox81andClaude Opus 5.5 committed 2026-10-12 17:31:01 +03:00
1 parent 1cf13971dc
commit 9ef8f4bedf
12 files changed
+349 -70

No files matched your search

+32
View File
@@ -106,6 +106,38 @@ pub fn label_for(mode: Mode) -> &'static str {
.unwrap_or("Wireframe 2D")
}
/// The render mode a named visual style draws as, and whether the name is a
/// style of its own (Realistic, Conceptual, …) rather than one of the modes.
pub fn mode_for_style_name(name: &str) -> Option<(Mode, bool)> {
Some(match name {
"2dWireframe" => (Mode::Wireframe2D, false),
"Wireframe" => (Mode::Wireframe3D, false),
"Hidden" => (Mode::HiddenLine, false),
"Flat" => (Mode::FlatShaded, false),
"FlatWithEdges" => (Mode::FlatShadedWithEdges, false),
"Gouraud" => (Mode::GouraudShaded, false),
"GouraudWithEdges" => (Mode::GouraudShadedWithEdges, false),
"Shaded with edges" => (Mode::GouraudShadedWithEdges, true),
"Realistic" | "Shaded" | "Conceptual" | "Shades of Gray" | "Sketchy" | "X-Ray" => {
(Mode::GouraudShaded, true)
}
_ => return None,
})
}
/// The name of the visual style a render mode is saved as.
pub fn style_name_for(mode: Mode) -> &'static str {
match mode {
Mode::Wireframe2D => "2dWireframe",
Mode::Wireframe3D => "Wireframe",
Mode::HiddenLine => "Hidden",
Mode::FlatShaded => "Flat",
Mode::FlatShadedWithEdges => "FlatWithEdges",
Mode::GouraudShaded => "Gouraud",
Mode::GouraudShadedWithEdges => "GouraudWithEdges",
}
}
/// The style a style keyword names. Only the seven exist; nothing maps onto a
/// nearest neighbour, because there is no longer anything else to map from.
pub fn mode_for_keyword(keyword: &str) -> Option<Mode> {