mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-26 18:31:11 +00:00
Design: Text and SVG draw INTO the open sketch instead of beside it
Mirror of snaporca 1fb7786d9a (DesignPanel.cpp and DesignCanvas.cpp applied as patches; parity 30 / 16, shared files byte-identical). With a sketch open, Text/SVG outlines become ordinary Line entities via push_closed_lines() instead of a separate Sketch feature carrying rigid imported_regions — so the letters can be constrained, trimmed and extruded like anything drawn by hand. The buttons and offer actions arm Select first when in Sketch mode, since begin_sketch() does not run until a tool is armed. add_imported_regions() calls reset_autoedit(): without it the glyph contours entered the draw-then-edit queue and opened a Length field on the first segment, which freezes the canvas. Caught on the rig, not by reading. No sketch open: unchanged — a new Sketch feature, still dropped on a picked face. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LyRwbuq6fjn3VV9U9UvhBM
This commit is contained in:
co-authored by
Claude Opus 5
parent
447c71a0d2
commit
bc4fb3b680
@@ -2317,6 +2317,29 @@ void DesignSketchTool::push_line(const Vec2d& a, const Vec2d& b)
|
||||
m_entities.push_back(e);
|
||||
}
|
||||
|
||||
bool DesignSketchTool::add_imported_regions(
|
||||
const std::vector<std::vector<std::vector<Vec2d>>>& regions)
|
||||
{
|
||||
if (!m_active) return false; // no session to draw into; caller makes a feature
|
||||
const bool saved = m_construction;
|
||||
m_construction = false; // art is real geometry, never construction lines
|
||||
size_t before = m_entities.size();
|
||||
for (const auto& region : regions)
|
||||
for (const auto& loop : region)
|
||||
push_closed_lines(loop); // every glyph contour, holes included
|
||||
m_construction = saved;
|
||||
if (m_entities.size() == before) return false; // nothing importable — say so, do not lie
|
||||
// Art is not "just drawn", so it must NOT enter the draw-then-edit queue. Without this the
|
||||
// glyph contours are treated as fresh entities and a Length field opens on the first of
|
||||
// them — on a word, that is one value editor per segment, and an open field freezes the
|
||||
// canvas (snaporca-yce). reset_autoedit() marks every entity as already seen.
|
||||
reset_autoedit();
|
||||
// The new lines carry no constraints, so the solver has nothing to move; resolve anyway so
|
||||
// the degrees-of-freedom readout counts them instead of going stale.
|
||||
resolve_live();
|
||||
return true;
|
||||
}
|
||||
|
||||
void DesignSketchTool::push_closed_lines(const std::vector<Vec2d>& corners)
|
||||
{
|
||||
const size_t n = corners.size();
|
||||
|
||||
Reference in New Issue
Block a user