refactor: rename SnapOrca references to Orca in CAD components to avoid confusion and update recipe versioning

This commit is contained in:
SoftFever
2026-08-27 18:49:50 +08:00
parent 0aeb6df122
commit 5a170520d3
13 changed files with 36 additions and 36 deletions
+5 -5
View File
@@ -3741,7 +3741,7 @@ std::string CadDocument::serialize_recipe() const
std::ostringstream oss;
{
cereal::BinaryOutputArchive ar(oss);
uint32_t v = SNAPORCA_CAD_RECIPE_VERSION;
uint32_t v = ORCA_CAD_RECIPE_VERSION;
ar(v);
uint32_t n = static_cast<uint32_t>(features.size());
ar(n);
@@ -3802,10 +3802,10 @@ bool CadDocument::deserialize_recipe(const std::string& blob)
cereal::BinaryInputArchive ar(iss);
uint32_t v;
ar(v);
if (v > SNAPORCA_CAD_RECIPE_VERSION) {
error = "saved with a newer version of SnapOrca CAD (format v"
if (v > ORCA_CAD_RECIPE_VERSION) {
error = "saved with a newer version of the Design tab (format v"
+ std::to_string(v) + ", this build reads up to v"
+ std::to_string(SNAPORCA_CAD_RECIPE_VERSION) + ")";
+ std::to_string(ORCA_CAD_RECIPE_VERSION) + ")";
return false;
}
if (v == 5) {
@@ -3882,7 +3882,7 @@ bool CadDocument::deserialize_recipe(const std::string& blob)
}
// v < 4: the field lists for v2/v3 no longer exist in this code, so those files
// cannot be recovered here. This fix is for the future, not the past.
error = "saved with an older version of SnapOrca CAD (format v"
error = "saved with an older version of the Design tab (format v"
+ std::to_string(v) + "); this project cannot be opened by this build";
return false;
} catch (const Standard_Failure& e) {
+1 -1
View File
@@ -640,7 +640,7 @@ public:
// the tail of a newer one. This is the LAST version that has to break anything — from here a
// new field only needs appending to save/load, with no bump and no orphaned projects.
// v4 is still read, by the pre-framing flat path, so existing projects keep opening.
static constexpr uint32_t SNAPORCA_CAD_RECIPE_VERSION = 5;
static constexpr uint32_t ORCA_CAD_RECIPE_VERSION = 5;
std::string serialize_recipe() const;
bool deserialize_recipe(const std::string& blob);
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef slic3r_SketchSolver_hpp_
#define slic3r_SketchSolver_hpp_
// Bridge from SnapOrca's SketchEntity / SketchEntityConstraintDef model onto the
// Bridge from the Design tab's SketchEntity / SketchEntityConstraintDef model onto the
// vendored SolveSpace constraint solver (src/libslic3r/slvs, libslvs). Replaces the
// hand-rolled SketchConstraints: full constraint set, real DoF counting, and
// over-constrained (bad-constraint) detection. Solves on a fixed 2D XY workplane.
+2 -2
View File
@@ -73,7 +73,7 @@ const std::string THUMBNAIL_FILE = "Metadata/thumbnail.png";
const std::string PRINT_CONFIG_FILE = "Metadata/Slic3r_PE.config";
const std::string MODEL_CONFIG_FILE = "Metadata/Slic3r_PE_model.config";
const std::string LAYER_HEIGHTS_PROFILE_FILE = "Metadata/Slic3r_PE_layer_heights_profile.txt";
const std::string CAD_RECIPE_FILE = "Metadata/SnapOrca_cad.bin";
const std::string CAD_RECIPE_FILE = "Metadata/orca_cad.bin";
const std::string LAYER_CONFIG_RANGES_FILE = "Metadata/Prusa_Slicer_layer_config_ranges.xml";
const std::string SLA_SUPPORT_POINTS_FILE = "Metadata/Slic3r_PE_sla_support_points.txt";
const std::string SLA_DRAIN_HOLES_FILE = "Metadata/Slic3r_PE_sla_drain_holes.txt";
@@ -2400,7 +2400,7 @@ ModelVolumeType type_from_string(const std::string &s)
return false;
}
// Adds CAD recipe file ("Metadata/SnapOrca_cad.bin").
// Adds CAD recipe file ("Metadata/orca_cad.bin").
if (!_add_cad_recipe_file_to_archive(archive, model)) {
close_zip_writer(&archive);
boost::filesystem::remove(filename);
+4 -4
View File
@@ -214,7 +214,7 @@ const std::string BBS_MODEL_CONFIG_RELS_FILE = "Metadata/_rels/model_settings.co
const std::string SLICE_INFO_CONFIG_FILE = "Metadata/slice_info.config";
const std::string FILAMENT_SEQUENCE_FILE = "Metadata/filament_sequence.json";
const std::string BBS_LAYER_HEIGHTS_PROFILE_FILE = "Metadata/layer_heights_profile.txt";
const std::string BBS_CAD_RECIPE_FILE = "Metadata/SnapOrca_cad.bin";
const std::string ORCA_CAD_RECIPE_FILE = "Metadata/orca_cad.bin";
const std::string LAYER_CONFIG_RANGES_FILE = "Metadata/layer_config_ranges.xml";
const std::string BRIM_EAR_POINTS_FILE = "Metadata/brim_ear_points.txt";
/*const std::string SLA_SUPPORT_POINTS_FILE = "Metadata/Slic3r_PE_sla_support_points.txt";
@@ -1971,8 +1971,8 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
// extract slic3r print config file
_extract_project_config_from_archive(archive, stat, config, config_substitutions, model);
}
else if (boost::algorithm::iequals(name, BBS_CAD_RECIPE_FILE)) {
// SnapOrca: restore the editable CAD recipe (optional; absent in non-CAD projects).
else if (boost::algorithm::iequals(name, ORCA_CAD_RECIPE_FILE)) {
// Restore the editable CAD recipe (optional; absent in non-CAD projects).
if (stat.m_uncomp_size > 0) {
std::string buf((size_t)stat.m_uncomp_size, '\0');
if (mz_zip_reader_extract_to_mem(&archive, stat.m_file_index, buf.data(), buf.size(), 0))
@@ -7667,7 +7667,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
{
if (model.cad_recipe.empty())
return true;
if (!mz_zip_writer_add_mem(&archive, BBS_CAD_RECIPE_FILE.c_str(),
if (!mz_zip_writer_add_mem(&archive, ORCA_CAD_RECIPE_FILE.c_str(),
(const void*)model.cad_recipe.data(), model.cad_recipe.length(),
MZ_DEFAULT_COMPRESSION)) {
add_error("Unable to add CAD recipe file to archive");
+2 -2
View File
@@ -1565,8 +1565,8 @@ public:
std::vector<std::string> md_name;
std::vector<std::string> md_value;
// SnapOrca: opaque parametric CAD recipe (CadDocument::serialize_recipe()),
// round-tripped through the 3MF as Metadata/SnapOrca_cad.bin. Empty for non-CAD projects.
// Opaque parametric CAD recipe (CadDocument::serialize_recipe()), round-tripped through
// the 3MF as Metadata/orca_cad.bin. Empty for non-CAD projects.
std::string cad_recipe;
void SetDesigner(std::string designer, std::string designer_user_id) {
+4 -4
View File
@@ -4587,7 +4587,7 @@ static void run_off_ui_thread(wxWindow* parent, const wxString& message, const s
int elapsed_ms = 0;
while (!done.load(std::memory_order_acquire)) {
if (dlg == nullptr && elapsed_ms >= 300)
dlg = std::make_unique<wxProgressDialog>(_L("SnapOrca"), message, 100, parent,
dlg = std::make_unique<wxProgressDialog>(_L("Design"), message, 100, parent,
wxPD_AUTO_HIDE | wxPD_SMOOTH);
if (dlg != nullptr)
dlg->Pulse();
@@ -6947,7 +6947,7 @@ void DesignPanel::on_tab_shown()
}
// Rehydrate the parametric model from a freshly loaded project (the 3MF carried the
// recipe in Metadata/SnapOrca_cad.bin). Only when nothing is in progress here, so we
// recipe in Metadata/orca_cad.bin). Only when nothing is in progress here, so we
// never clobber an active design when the user just toggles back to the Design tab.
if (m_doc.features.empty()) {
if (Plater* plater = wxGetApp().plater()) {
@@ -6982,7 +6982,7 @@ void DesignPanel::load_recipe(const std::string& blob)
// Carry the kernel's reason. deserialize_recipe distinguishes three cases that matter
// very differently to the person reading this — saved by a NEWER build, saved by an
// OLDER one, or genuinely unreadable — and replacing all three with one sentence left
// the user unable to tell "update SnapOrca" from "your file is damaged". Same
// the user unable to tell "update OrcaSlicer" from "your file is damaged". Same
// error-loss class as the 31 McpControl sites (1de72de9ed): the message exists, it was
// simply not passed on.
m_status->SetForegroundColour(wxColour(235, 110, 110));
@@ -7005,7 +7005,7 @@ void DesignPanel::refresh_tree()
// the sync in recompute_guarded instead tied it to "a solid was built", and CadDocument::
// recompute() returns FALSE for a document that has no solid ("no solid-producing features",
// CadDocument.cpp) — which is precisely a document the user has only drawn sketches in. So
// drawing a profile, pressing Confirm and saving wrote a 3MF with no SnapOrca_cad.bin in it
// drawing a profile, pressing Confirm and saving wrote a 3MF with no orca_cad.bin in it
// at all, and the app reported success: the whole design was gone on reopen (snaporca-mtav).
// The three sites that say "a lone sketch yields an empty body; that is expected" call
// m_doc.recompute() directly and so never reached the sync either. One hook here covers all
+1 -1
View File
@@ -196,7 +196,7 @@ private:
void on_commit();
void on_export_step(); // write all bodies to a .step file (native B-rep)
// Rehydrate the parametric model from a project's saved recipe (3MF
// Metadata/SnapOrca_cad.bin): deserialize -> recompute -> refresh viewport + tree.
// Metadata/orca_cad.bin): deserialize -> recompute -> refresh viewport + tree.
void load_recipe(const std::string& blob);
void refresh_tree();
void set_status_ok();
+8 -8
View File
@@ -1,7 +1,7 @@
#include "libslic3r/libslic3r.h"
#include "GLCanvas3D.hpp"
#ifdef SLIC3R_CAD
#include "slic3r/GUI/CAD/DesignSketchTool.hpp" // SnapOrca Design: interactive 2D sketch tool
#include "slic3r/GUI/CAD/DesignSketchTool.hpp" // Design tab: interactive 2D sketch tool
#endif
#include <igl/unproject.h>
@@ -2162,7 +2162,7 @@ void GLCanvas3D::render(bool only_init)
if (_is_fxaa_enabled())
_render_fxaa_pass(static_cast<unsigned int>(cnv_size.get_width()), static_cast<unsigned int>(cnv_size.get_height()));
// SnapOrca Design: interactive 2D sketch overlay, drawn over the scene but
// Design tab: interactive 2D sketch overlay, drawn over the scene but
// beneath the UI overlays (toolbars, labels).
#ifdef SLIC3R_CAD
if (m_design_sketch_tool != nullptr && m_design_sketch_tool->has_display())
@@ -3322,7 +3322,7 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
return;
}
// SnapOrca Design: Delete/Backspace removes the selected sketch entities while a
// Design tab: Delete/Backspace removes the selected sketch entities while a
// sketch tool is active and the canvas has focus (dialog text fields are separate
// wx controls, so this never eats their editing keys).
#ifdef SLIC3R_CAD
@@ -3348,7 +3348,7 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
}
#endif
// SnapOrca Design: Ctrl+Z / Ctrl+Shift+Z (and Ctrl+Y) undo/redo the Design feature
// Design tab: Ctrl+Z / Ctrl+Shift+Z (and Ctrl+Y) undo/redo the Design feature
// history. Scoped by m_design_sketch_tool — only the Design canvas owns one — so the
// main 3D editor's undo/redo (the CanvasView3D-gated cases further below) is untouched.
// Handled here, before the generic Ctrl block, so it takes precedence and early-returns.
@@ -3366,7 +3366,7 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
}
#endif
// SnapOrca Design: F = Place on Face (Prepare's lay-flat), when the Design viewport is up
// Design tab: F = Place on Face (Prepare's lay-flat), when the Design viewport is up
// and a body face is selected. The tool forwards to DesignPanel::place_on_face; it returns
// false (no face picked) so F falls through to the default handler below.
#ifdef SLIC3R_CAD
@@ -3757,7 +3757,7 @@ public:
void GLCanvas3D::on_key(wxKeyEvent& evt)
{
// SnapOrca Design: Delete/Backspace removes selected sketch entities. GTK delivers
// Design tab: Delete/Backspace removes selected sketch entities. GTK delivers
// these as KEY_DOWN rather than CHAR, so handle it here too.
#ifdef SLIC3R_CAD
if (evt.GetEventType() == wxEVT_KEY_DOWN
@@ -4334,7 +4334,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
return;
}
// SnapOrca Design: the interactive sketch tool owns the mouse whenever it has
// Design tab: the interactive sketch tool owns the mouse whenever it has
// something on screen — an active session OR committed sketch overlays that the user
// can click to select. It runs after ImGui (so dialogs still work) but before
// camera/toolbar/gizmo handling; on_mouse returns false for events it doesn't consume
@@ -8084,7 +8084,7 @@ void GLCanvas3D::_render_bed(const Transform3d& view_matrix, const Transform3d&
//bool show_texture = true;
//BBS set axes mode
if (m_axes_at_bed_center) {
// SnapOrca Design: triad at the bed centre = modeling origin (set every frame because
// Design tab: triad at the bed centre = modeling origin (set every frame because
// set_shape/set_axes_mode otherwise reset it to the bed corner).
const Vec2d bc = m_bed.build_volume().bed_center();
m_bed.set_axes_origin(Vec3d(bc.x(), bc.y(), 0.0));
+3 -3
View File
@@ -58,7 +58,7 @@ namespace GUI {
class Bed3D;
class PartPlateList;
#ifdef SLIC3R_CAD
class DesignSketchTool; // SnapOrca Design: interactive 2D sketch tool
class DesignSketchTool; // Design tab: interactive 2D sketch tool
#endif
#if ENABLE_RETINA_GL
@@ -549,10 +549,10 @@ private:
mutable float m_paint_toolbar_width;
bool m_collapse_toolbar_enabled{true};
bool m_plate_chrome_enabled{true};
// SnapOrca Design: render the world-axis triad at the bed centre (= modeling origin) instead of
// Design tab: render the world-axis triad at the bed centre (= modeling origin) instead of
// the bed corner. Default false preserves the main editor's corner triad.
bool m_axes_at_bed_center{false};
// SnapOrca Design: draw the printer bed and its plate grid at all. Default true, so the
// Design tab: draw the printer bed and its plate grid at all. Default true, so the
// main editor is untouched; the Design tab lets the user hide it to model without a bed.
bool m_show_bed{true};
#ifdef SLIC3R_CAD
+2 -2
View File
@@ -9291,7 +9291,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
obj_idxs.insert(obj_idxs.end(), loaded_idxs.begin(), loaded_idxs.end());
// load_model_objects only transfers ModelObjects; carry the Model-level CAD
// recipe (Metadata/SnapOrca_cad.bin) onto the plater model so the Design tab
// recipe (Metadata/orca_cad.bin) onto the plater model so the Design tab
// can rehydrate the editable feature tree on reopen.
if (!model.cad_recipe.empty())
q->model().cad_recipe = model.cad_recipe;
@@ -9513,7 +9513,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
//}
// A CAD project legitimately carries no mesh: the model lives in the feature tree
// (Metadata/SnapOrca_cad.bin) until it is committed to the plate. Warning "no geometry data"
// (Metadata/orca_cad.bin) until it is committed to the plate. Warning "no geometry data"
// for one is false, and it is the LAST thing a user sees after opening a design they spent an
// hour on — it reads as "your work is gone" when the recipe has in fact just been loaded and
// the Design tab will rehydrate it. Count the recipe as geometry.
+2 -2
View File
@@ -183,7 +183,7 @@ SCENARIO("CAD recipe blob survives a 3mf save/load cycle", "[3mf]") {
// The GUI saves/loads projects via the BBS-native 3mf backend (store_bbs_3mf /
// load_bbs_3mf), NOT the PrusaSlicer 3mf.cpp. This locks in that store_bbs_3mf embeds the
// CAD recipe (Metadata/SnapOrca_cad.bin) byte-for-byte, read back the same iterate-and-match
// CAD recipe (Metadata/orca_cad.bin) byte-for-byte, read back the same iterate-and-match
// way load_bbs_3mf does. The full GUI reopen is verified live on the Design tab.
SCENARIO("CAD recipe is embedded in the BBS 3mf archive", "[3mf]") {
GIVEN("a model carrying a binary cad_recipe") {
@@ -229,7 +229,7 @@ SCENARIO("CAD recipe is embedded in the BBS 3mf archive", "[3mf]") {
if (!mz_zip_reader_file_stat(&zip, i, &st)) continue;
std::string name(st.m_filename);
std::replace(name.begin(), name.end(), '\\', '/');
if (boost::algorithm::iequals(name, std::string("Metadata/SnapOrca_cad.bin"))) {
if (boost::algorithm::iequals(name, std::string("Metadata/orca_cad.bin"))) {
got.resize(st.m_uncomp_size);
mz_zip_reader_extract_to_mem(&zip, i, got.data(), got.size(), 0);
break;
+1 -1
View File
@@ -3987,7 +3987,7 @@ TEST_CASE("golden recipe v1 still deserialises", "[CadDocument]")
cereal::BinaryInputArchive ar(iss);
uint32_t v;
ar(v);
REQUIRE(v <= CadDocument::SNAPORCA_CAD_RECIPE_VERSION);
REQUIRE(v <= CadDocument::ORCA_CAD_RECIPE_VERSION);
ar(features);
}