mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-24 17:26:47 +00:00
Hide the Design tab behind an experimental CAD preference
The tab is now gated on a new enable_cad_feature app-config key, off by default, exposed in Preferences under General > Features. When off, the page is never created, so the Design-only camera option is hidden too. Takes effect on restart, like the other feature toggles.
This commit is contained in:
@@ -311,6 +311,11 @@ void AppConfig::set_defaults()
|
||||
set_bool("zoom_to_mouse", false);
|
||||
|
||||
#ifdef SLIC3R_CAD
|
||||
// Experimental parametric Design tab. Off by default: the tab is not created at all
|
||||
// until this is turned on, so nothing it builds reaches an unsuspecting user.
|
||||
if (get("enable_cad_feature").empty())
|
||||
set_bool("enable_cad_feature", false);
|
||||
|
||||
// Design tab: draw a mate connector as a face rather than as the abstract disc + roll
|
||||
// quadrant. Defaults ON — face orientation is hardwired perception, so the roll and the
|
||||
// verse read without being learned, which no abstract glyph achieves. Turning it off
|
||||
|
||||
@@ -349,6 +349,9 @@ public:
|
||||
int OnExit() override;
|
||||
bool initialized() const { return m_initialized; }
|
||||
inline bool is_enable_multi_machine() { return this->app_config&& this->app_config->get("enable_multi_machine") == "true"; }
|
||||
#ifdef SLIC3R_CAD
|
||||
inline bool is_enable_cad_feature() { return this->app_config && this->app_config->get_bool("enable_cad_feature"); }
|
||||
#endif
|
||||
|
||||
std::map<std::string, bool> test_url_state;
|
||||
|
||||
|
||||
@@ -1025,8 +1025,11 @@ void MainFrame::update_layout()
|
||||
size_t prepare_pos = (home_idx == wxNOT_FOUND) ? 0 : static_cast<size_t>(home_idx) + 1;
|
||||
#ifdef SLIC3R_CAD
|
||||
// Design sits between Home and Prepare, so it goes in first and pushes Prepare along.
|
||||
m_design_page->Reparent(m_tabpanel);
|
||||
m_tabpanel->InsertPage(prepare_pos++, TAB_ID_DESIGN, m_design_page, _L("Design"), "tab_design_active");
|
||||
// The page only exists when the experimental CAD feature is enabled.
|
||||
if (m_design_page != nullptr) {
|
||||
m_design_page->Reparent(m_tabpanel);
|
||||
m_tabpanel->InsertPage(prepare_pos++, TAB_ID_DESIGN, m_design_page, _L("Design"), "tab_design_active");
|
||||
}
|
||||
#endif
|
||||
m_tabpanel->InsertPage(prepare_pos, TAB_ID_PREPARE, m_plater, _L("Prepare"), "tab_3d_active");
|
||||
m_tabpanel->InsertPage(prepare_pos + 1, TAB_ID_PREVIEW, m_plater, _L("Preview"), "tab_preview_active");
|
||||
@@ -1299,7 +1302,7 @@ void MainFrame::init_tabpanel() {
|
||||
//else if (panel == m_param_panel)
|
||||
// m_param_panel->OnActivate();
|
||||
#ifdef SLIC3R_CAD
|
||||
else if (panel == m_design_page) {
|
||||
else if (m_design_page != nullptr && panel == m_design_page) {
|
||||
// Built on first activation, never at startup: the panel creates several hundred
|
||||
// controls and its own GL canvas, which a user who does not open the tab should
|
||||
// not pay for.
|
||||
@@ -1351,11 +1354,15 @@ void MainFrame::init_tabpanel() {
|
||||
#ifdef SLIC3R_CAD
|
||||
// Stand-in page for the Design tab. The real DesignPanel is built into it the first time
|
||||
// the tab is selected (see the page-changed handler above), so nothing it constructs sits
|
||||
// on the startup path.
|
||||
m_design_page = new wxPanel(this);
|
||||
m_design_page->SetSizer(new wxBoxSizer(wxVERTICAL));
|
||||
m_design_page->Hide();
|
||||
start_mcp_control_if_enabled(); // opens the MCP socket iff SNAPORCA_MCP is set
|
||||
// on the startup path. The experimental feature is off by default, and when it is off the
|
||||
// page is never created, so the tab does not appear at all (the preference takes effect on
|
||||
// the next start, like the other feature toggles).
|
||||
if (wxGetApp().is_enable_cad_feature()) {
|
||||
m_design_page = new wxPanel(this);
|
||||
m_design_page->SetSizer(new wxBoxSizer(wxVERTICAL));
|
||||
m_design_page->Hide();
|
||||
start_mcp_control_if_enabled(); // opens the MCP socket iff SNAPORCA_MCP is set
|
||||
}
|
||||
#endif
|
||||
|
||||
create_preset_tabs();
|
||||
|
||||
@@ -1741,6 +1741,14 @@ void PreferencesDialog::create_items()
|
||||
auto item_multi_machine = create_item_checkbox(_L("Multi device management"), _L("With this option enabled, you can send a task to multiple devices at the same time and manage multiple devices."), "enable_multi_machine", _L("(Requires restart)"));
|
||||
g_sizer->Add(item_multi_machine);
|
||||
|
||||
#ifdef SLIC3R_CAD
|
||||
auto item_cad_feature = create_item_checkbox(_L("CAD feature (experimental)"),
|
||||
_L("With this option enabled, the Design tab is shown, where models can be built and edited "
|
||||
"parametrically. This feature is experimental and still under development."),
|
||||
"enable_cad_feature", _L("(Requires restart)"));
|
||||
g_sizer->Add(item_cad_feature);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
g_sizer->Add(create_item_title(_L("Filament Grouping")), 1, wxEXPAND);
|
||||
//temporarily disable it
|
||||
@@ -1818,11 +1826,14 @@ void PreferencesDialog::create_items()
|
||||
g_sizer->Add(reverse_mouse_zoom);
|
||||
|
||||
#ifdef SLIC3R_CAD
|
||||
auto item_connector_face_glyph = create_item_checkbox(_L("Draw mate connectors as a face"),
|
||||
_L("In the Design tab, draw a mate connector as a small face instead of the conventional "
|
||||
"disc with a roll quadrant. A face's orientation is read without being learned. "
|
||||
"Turn this off for the conventional CAD representation."), "design_connector_face_glyph");
|
||||
g_sizer->Add(item_connector_face_glyph);
|
||||
// Design-tab only, so it stays out of the way while the CAD feature is switched off.
|
||||
if (wxGetApp().is_enable_cad_feature()) {
|
||||
auto item_connector_face_glyph = create_item_checkbox(_L("Draw mate connectors as a face"),
|
||||
_L("In the Design tab, draw a mate connector as a small face instead of the conventional "
|
||||
"disc with a roll quadrant. A face's orientation is read without being learned. "
|
||||
"Turn this off for the conventional CAD representation."), "design_connector_face_glyph");
|
||||
g_sizer->Add(item_connector_face_glyph);
|
||||
}
|
||||
#endif
|
||||
|
||||
std::vector<wxString> ButtonDragActions = {_L("None"), _L("Pan"), _L("Rotate")};
|
||||
|
||||
Reference in New Issue
Block a user