mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-18 22:42:37 +00:00
Bodies: colour that survives selection, hide that toggles twice, Delete that acts
Three defects behind one report ("bodies cannot be moved or hidden/shown or
deleted, colour does not work"). They are unrelated to each other; only the
symptom was shared.
1. The Color tool wrote a per-body override that was correct end to end —
stored on CadBody, carried across recompute (CadDocument.cpp:3381), read
back by DesignCanvas::body_color() — and then overpainted every frame.
m_body_selected is a DOCUMENT-WIDE flag raised whenever a non-Sketch
feature row is selected, which is the resting state after any modelling
operation, and while it was true every body rendered gold. An explicit
colour now outranks the selection tint; unpainted bodies still tint, which
is all the tint was ever for.
2. The eye toggle re-selected the body row through m_tree, using item ids that
belong to m_parts. The row came back unselected, so the second press found
tree_body_selection() == -1 and fell through to the feature-level branch
instead of un-hiding. Hide worked exactly once. The sibling call in
refresh_parts() had it right.
3. The tree card's Delete button answered a selected body row with "select the
FEATURE that created this body" — an instruction the user cannot act on,
because the tree does not say which feature that is. on_delete_body()
already resolves CadBody::source_feature and confirms by name; it was
reachable only from the right-click offer. The button now routes to it.
Reviewed and compiled (libslic3r_gui, RC=0); not exercised — needs a session at
the machine to confirm all three in the viewport. snaporca-zjvg.
This commit is contained in:
@@ -290,9 +290,17 @@ void DesignCanvas::reload(bool keep_view)
|
||||
if (m_body_hidden) hidden = true;
|
||||
v->is_active = !hidden; // per-body visibility toggle
|
||||
if (!hidden) {
|
||||
// Selection tint wins; otherwise the per-body override (Color tool) or the
|
||||
// auto palette via body_color().
|
||||
ColorRGBA c = m_body_selected ? sel_gold : body_color(b);
|
||||
// An EXPLICIT colour outranks the selection tint. m_body_selected is a
|
||||
// document-wide flag raised whenever a non-Sketch feature row is selected —
|
||||
// the normal resting state after any modelling operation — so painting every
|
||||
// body gold on it made the Color tool look broken: the override was written,
|
||||
// carried across recompute and read back correctly, and then overpainted here
|
||||
// every single frame. A body the user deliberately coloured keeps its colour;
|
||||
// the rest still tint, which is all the tint was ever for.
|
||||
const bool overridden = m_color_bodies != nullptr && b >= 0
|
||||
&& b < int(m_color_bodies->size())
|
||||
&& (*m_color_bodies)[b].has_color;
|
||||
ColorRGBA c = (m_body_selected && !overridden) ? sel_gold : body_color(b);
|
||||
if (b == m_hl_body_target) c = ColorRGBA(0.30f, 0.90f, 0.70f, 1.0f); // target = teal-green
|
||||
else if (b == m_hl_body_tool) c = ColorRGBA(1.00f, 0.55f, 0.15f, 1.0f); // tool = orange
|
||||
if (m_body_translucent) c.a(0.30f);
|
||||
|
||||
Reference in New Issue
Block a user