mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-15 20:01:31 +00:00
* Option: Show/ Hide inactive plates * Hide inactive plate volumes by bounds Switch inactive-plate volume hiding to use geometric overlap with the current plate bounding box instead of object and wipe tower ID mapping. This also guards against a missing current plate and keeps any active volume visible when its transformed bounds overlap the current plate footprint. * Hide inactive plates per instance and keep them unpickable Decide what is shown per object instance, from its footprint over the current plate, so the parts of an object are never split; a selected instance stays visible. Keep the hidden state between frames instead of restoring it after each one. GLVolume::on_hidden_plate records what this update hid, so it only shows that again and leaves the volumes gizmos hide alone, and the raycasts made while handling the mouse see the same scene as the frame. Nothing runs while the inactive plates are shown. Deactivate the raycasters of the other plates, whose icons still took clicks where nothing was drawn, move the axes to the current plate, and limit the option to Prepare, as Preview already shows the current plate alone. * Follow the selected plate with the camera while the others are hidden Selecting a plate in Prepare while the inactive plates are hidden moves the camera target over it and keeps the angle, distance and height, so the plate comes into view where the previous one was. A zoom to all plates, as after loading a project or adding a plate, frames the current plate instead. * Add a compact plate switcher while inactive plates are hidden The hidden plates can no longer be clicked, and the object list gets crowded on large projects. While they are hidden in Prepare, a column of numbered buttons in the top left corner, a compact counterpart of the Preview plate toolbar, selects the plate to show. It highlights the current plate, dims the empty ones and gives the plate name in the tooltip. * Simplify the inactive plates update and the plate switcher layout Decide and apply each volume's state in one pass instead of filling a per-volume vector first, and hoist the switcher's loop-invariant colors. Keep the height the bottom-left corner takes next to the constants it is made of, with the canvas toolbar's button spacing named, rather than repeating that layout in the switcher. * Rename the option to Focus mode The canvas menu entry reads Focus mode, lit while the other plates are hidden, and is off by default, so nothing changes until it is turned on. The app config key is focus_mode. Turning it on zooms to the current plate, so the plate fills the view. * Show plate thumbnails in the plate switcher The switcher shows the thumbnails of the Preview plate toolbar instead of numbered buttons, with rounded corners concentric with the window's. Plater::plate_toolbar_image_version() lets it refresh them without clearing the Preview toolbar's dirty flag. * Don't draw the sinking contours of inactive volumes GLVolume::render() skips an inactive volume, but its sinking contour was still drawn, so an object on a hidden plate left its outline behind. * Show the plate switcher's scrollbar only on hover, as in Preview The plate switcher now shares the Preview plate toolbar's scrollbar: the same width and colors, shown only while the mouse is over the column or drags the bar, with the mouse wheel scrolling it either way, and tighter window corners while it shows. Both toolbars draw it through the same helpers, so they cannot drift apart; the Preview toolbar behaves as before. Drop the frame style the switcher no longer uses since it draws thumbnails instead of buttons. * Make the plate switcher's thumbnails cheaper and match the Preview toolbar The thumbnail version moves after almost every edit, and the switcher redrew both thumbnails of every plate each time. It now redraws only the current plate's, the only one edited while the others are hidden, and the other plates' once their thumbnails are invalidated, through the new Plater::update_plate_thumbnails(). IMToolbarItem::set_thumbnail() uploads a plate thumbnail without keeping a copy of its pixels, a megabyte per plate, and replaces the item setup the Preview toolbar and the switcher each repeated. The switcher's hover border takes the Preview toolbar's color. --------- Co-authored-by: Ian Bassi <ian.bassi@outlook.com>
67 lines
4.6 KiB
Markdown
67 lines
4.6 KiB
Markdown
# Focus mode (hiding inactive plates) — High Level Design
|
|
|
|
## Purpose and scope
|
|
|
|
"Focus mode" is an entry of the canvas menu in the bottom left corner of Prepare. Turned on (eye
|
|
lit), the 3D view hides the inactive plates and shows the current plate alone, so a project with
|
|
many plates can be worked on one plate at a time. Turned off, every plate is shown. It is a view
|
|
setting: it changes nothing in the model, the slice or the project file, and it does not reach
|
|
plate thumbnails. The choice is kept in the app config as `focus_mode`, off by default.
|
|
|
|
Preview needs no such option, as it already draws the current plate alone and has its own plate
|
|
toolbar. The assembly view and the Design tab do not lay objects out on plates, so the entry is
|
|
disabled there.
|
|
|
|
## What is shown
|
|
|
|
The current plate is drawn with its bed, label and icons; the other plates are not drawn at all. The
|
|
world axes, which Prepare draws at the corner of the first plate, move to the corner of the current
|
|
plate, where Preview draws them.
|
|
|
|
An object instance is shown when its footprint, the XY bounding box of the convex hulls of its
|
|
volumes, overlaps the current plate, or when it is selected. The test is made per instance, so the
|
|
parts of an object are shown or hidden together, and a wipe tower follows its plate the same way.
|
|
It is geometric rather than the plate membership `PartPlateList` keeps, because an instance stays on
|
|
the plate it was first placed on: an object of another plate that reaches over this one, or one too
|
|
large for any plate, would otherwise be invisible while it takes room on the current plate. A
|
|
selected instance stays visible so that what a selection or a gizmo acts on is never hidden, for
|
|
instance an object picked in the object list on another plate.
|
|
|
|
## Hiding
|
|
|
|
A hidden object is neither drawn nor picked. `GLCanvas3D::_update_inactive_plates_visibility()`
|
|
runs at the start of each frame of Prepare. It clears `GLVolume::is_active` on the volumes of the
|
|
hidden instances and deactivates their raycasters, which every render pass, the hover and rectangle
|
|
selection, the shadow and center of mass markers already respect. It also deactivates the raycasters
|
|
of the other plates, whose icons would otherwise still take clicks where nothing is drawn. The state
|
|
persists between frames, so the raycasts made while handling the mouse, such as the anchor of a pan,
|
|
see the same scene as the frame.
|
|
|
|
Other features clear `is_active` too: gizmos hide the objects they do not edit and show them all
|
|
again when they close. `GLVolume::on_hidden_plate` records which volumes this update hid, so it only
|
|
shows again what it hid itself, and it waits for a gizmo that hides objects to close before doing
|
|
so. A volume another feature made active again is hidden again on the next frame. While Focus mode
|
|
is off and nothing is left hidden, the update returns at once.
|
|
|
|
## Switching plates
|
|
|
|
The other plates cannot be clicked while Focus mode hides them, so a compact counterpart of the Preview
|
|
plate toolbar takes their place: a column of plate thumbnails in the top left corner, below the top
|
|
toolbar, shown when the project has more than one plate and no gizmo is open. The thumbnails are the
|
|
ones the Preview toolbar shows (`PartPlate::thumbnail_data`); the canvas rebuilds its textures when
|
|
`Plater::plate_toolbar_image_version()` changes, a counter each consumer tracks on its own so that the
|
|
Preview toolbar's dirty flag is left alone. That counter moves after almost every edit, so the
|
|
thumbnail of the current plate, the only one edited while the others are hidden, is drawn again each
|
|
time, and the other plates' only once an edit to them has invalidated theirs. The current plate has an
|
|
accent border, a hovered one the gray border of the Preview toolbar, empty plates are dimmed and the
|
|
plate number sits in the corner; the tooltip gives the plate name. A click selects the plate and
|
|
clears the selection, as a click on a plate row of the object list does. The column scrolls when it
|
|
does not fit above the 3D navigator or the canvas toolbar. Its scrollbar works as the Preview
|
|
toolbar's, with which it shares its style: it shows only while the mouse is over the column or drags
|
|
the bar, and the mouse wheel scrolls the column either way.
|
|
|
|
Whatever selects a plate while the others are hidden, the camera moves its target over the new plate
|
|
and keeps its angle, distance and height (`PartPlateList::select_plate()`), so the plate comes into
|
|
view where the previous one was. A zoom to all plates, as after loading a project or adding a plate,
|
|
frames the current plate instead. Turning Focus mode on does the same, so the current plate fills the view.
|