Restore a view's visual style; no background in 2D wireframe

Restoring a named view gives the model viewport the view's visual style
(the closest render mode), and a 2D wireframe viewport shows no
background, as in the reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ramox81andClaude Opus 5.5 committed 2026-10-12 11:24:07 +03:00
1 parent c8167c54ee
commit 8055fa710d
5 files changed
+63 -8

No files matched your search

+7
View File
@@ -219,6 +219,13 @@ impl Scene {
if self.current_layout == "Model" {
let background = copy_background(&mut self.document, view.background_handle);
self.set_active_background(background);
if view.visual_style_handle.is_valid() {
if let Some(handle) = self.active_tile_vport_handle() {
if let Some(value) = self.document.vports.iter_mut().find(|v| v.handle == handle) {
value.visual_style_handle = view.visual_style_handle;
}
}
}
}
let cam = &mut *self.camera.borrow_mut();
// The stored direction points from the target toward the eye.
+5 -1
View File
@@ -2571,11 +2571,15 @@ impl Scene {
} else if self.current_layout == "Model" {
let index = viewport.tile_idx.unwrap_or(0);
if let Some(value) = self.model_tile_vport(index) {
// A 2D wireframe view shows no background, as in the reference.
let flat = self.model_tiles.borrow().get(index).is_some_and(|tile| {
tile.render_mode == codec::entities::ViewportRenderMode::Wireframe2D
});
return build(
value.visual_style_handle,
value.brightness,
value.contrast,
value.background_handle,
if flat { Handle::NULL } else { value.background_handle },
);
}
}