Merge branch 'main' into dev/outline-2

This commit is contained in:
Noisyfox 2024-08-30 21:43:26 +08:00
commit 445dc2b0f1
109 changed files with 10594 additions and 10481 deletions

View file

@ -4122,13 +4122,13 @@ wxBoxSizer *ExportConfigsDialog::create_select_printer(wxWindow *parent)
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
m_scrolled_preset_window = new wxScrolledWindow(parent);
m_scrolled_preset_window->SetScrollRate(5, 5);
m_scrolled_preset_window->SetBackgroundColour(PRINTER_LIST_COLOUR);
m_scrolled_preset_window->SetBackgroundColour(*wxWHITE);
m_scrolled_preset_window->SetMaxSize(wxSize(FromDIP(660), FromDIP(400)));
m_scrolled_preset_window->SetSize(wxSize(FromDIP(660), FromDIP(400)));
wxBoxSizer *scrolled_window = new wxBoxSizer(wxHORIZONTAL);
m_presets_window = new wxPanel(m_scrolled_preset_window, wxID_ANY);
m_presets_window->SetBackgroundColour(PRINTER_LIST_COLOUR);
m_presets_window->SetBackgroundColour(*wxWHITE);
wxBoxSizer *select_printer_sizer = new wxBoxSizer(wxVERTICAL);
m_preset_sizer = new wxGridSizer(3, FromDIP(5), FromDIP(5));

View file

@ -5662,7 +5662,7 @@ void DeviceManager::parse_user_print_info(std::string body)
}
}
}
catch (std::exception& e) {
catch (std::exception&) {
;
}
}

View file

@ -666,8 +666,9 @@ void GLCanvas3D::LayersEditing::update_slicing_parameters()
{
if (m_slicing_parameters == nullptr) {
m_slicing_parameters = new SlicingParameters();
*m_slicing_parameters = PrintObject::slicing_parameters(*m_config, *m_model_object, m_object_max_z);
*m_slicing_parameters = PrintObject::slicing_parameters(*m_config, *m_model_object, m_object_max_z, m_shrinkage_compensation);
}
}
float GLCanvas3D::LayersEditing::thickness_bar_width(const GLCanvas3D & canvas)
@ -1489,6 +1490,11 @@ void GLCanvas3D::set_config(const DynamicPrintConfig* config)
{
m_config = config;
m_layers_editing.set_config(config);
// Orca: Filament shrinkage compensation
const Print *print = fff_print();
if (print != nullptr)
m_layers_editing.set_shrinkage_compensation(fff_print()->shrinkage_compensation());
}
void GLCanvas3D::set_process(BackgroundSlicingProcess *process)
@ -8440,7 +8446,6 @@ void GLCanvas3D::_render_assemble_info() const
auto canvas_h = float(get_canvas_size().get_height());
float space_size = imgui->get_style_scaling() * 8.0f;
float caption_max = imgui->calc_text_size(_L("Total Volume:")).x + 3 * space_size;
char buf[3][64];
ImGuiIO& io = ImGui::GetIO();
ImFont* font = io.Fonts->Fonts[0];

View file

@ -216,6 +216,9 @@ class GLCanvas3D
};
static const float THICKNESS_BAR_WIDTH;
// Orca: Shrinkage compensation
void set_shrinkage_compensation(const Vec3d &shrinkage_compensation) { m_shrinkage_compensation = shrinkage_compensation; };
private:
bool m_enabled{ false };
@ -229,6 +232,9 @@ class GLCanvas3D
// Owned by LayersEditing.
SlicingParameters* m_slicing_parameters{ nullptr };
std::vector<double> m_layer_height_profile;
// Orca: Shrinkage compensation to apply when we need to use object_max_z with Z compensation.
Vec3d m_shrinkage_compensation{ Vec3d::Ones() };
mutable float m_adaptive_quality{ 0.5f };
mutable HeightProfileSmoothingParams m_smooth_params;

View file

@ -470,7 +470,6 @@ void GLTexture::reset()
bool GLTexture::generate_from_text_string(const std::string& text_str, wxFont &font, wxColor background, wxColor foreground)
{
int w,h,hl;
return generate_from_text(text_str, font, background, foreground);
}

View file

@ -1026,7 +1026,7 @@ void GUI_App::post_init()
try {
std::time_t lw_t = boost::filesystem::last_write_time(temp_path) ;
files_vec.push_back({ lw_t, temp_path.filename().string() });
} catch (const std::exception &ex) {
} catch (const std::exception &) {
}
}
std::sort(files_vec.begin(), files_vec.end(), [](
@ -3365,7 +3365,7 @@ if (res) {
mainframe->refresh_plugin_tips();
// BBS: remove SLA related message
}
} catch (std::exception &e) {
} catch (std::exception &) {
// wxMessageBox(e.what(), "", MB_OK);
}
}
@ -3379,7 +3379,7 @@ void GUI_App::ShowDownNetPluginDlg() {
return;
DownloadProgressDialog dlg(_L("Downloading Bambu Network Plug-in"));
dlg.ShowModal();
} catch (std::exception &e) {
} catch (std::exception &) {
;
}
}
@ -3396,7 +3396,7 @@ void GUI_App::ShowUserLogin(bool show)
login_dlg = new ZUserLogin();
}
login_dlg->ShowModal();
} catch (std::exception &e) {
} catch (std::exception &) {
;
}
} else {
@ -3418,7 +3418,7 @@ void GUI_App::ShowOnlyFilament() {
// BBS: remove SLA related message
}
} catch (std::exception &e) {
} catch (std::exception &) {
// wxMessageBox(e.what(), "", MB_OK);
}
}
@ -6507,8 +6507,6 @@ static bool del_win_registry(HKEY hkeyHive, const wchar_t *pszVar, const wchar_t
return false;
if (!bDidntExist) {
DWORD dwDisposition;
HKEY hkey;
iRC = ::RegDeleteKeyExW(hkeyHive, pszVar, KEY_ALL_ACCESS, 0);
if (iRC == ERROR_SUCCESS) {
return true;

View file

@ -1977,7 +1977,6 @@ void MenuFactory::append_menu_item_set_printable(wxMenu* menu)
for (wxDataViewItem item : sels) {
ItemType type = list->GetModel()->GetItemType(item);
bool check;
if (type != itInstance && type != itObject)
continue;
else {

View file

@ -2006,7 +2006,7 @@ void ObjectList::load_modifier(const wxArrayString& input_files, ModelObject& mo
try {
model = Model::read_from_file(input_file, nullptr, nullptr, LoadStrategy::LoadModel);
}
catch (std::exception& e) {
catch (std::exception&) {
// auto msg = _L("Error!") + " " + input_file + " : " + e.what() + ".";
auto msg = _L("Error!") + " " + _L("Failed to get the model data in the current file.");
show_error(parent, msg);

View file

@ -150,7 +150,6 @@ void PrintJob::process(Ctl &ctl)
ctl.call_on_main_thread([this] { prepare(); }).wait();
int result = -1;
unsigned int http_code;
std::string http_body;
int total_plate_num = plate_data.plate_count;
@ -312,7 +311,7 @@ void PrintJob::process(Ctl &ctl)
try {
stl_design_id = std::stoi(wxGetApp().model().stl_design_id);
}
catch (const std::exception& e) {
catch (const std::exception&) {
stl_design_id = 0;
}
params.stl_design_id = stl_design_id;

View file

@ -111,7 +111,6 @@ void SendJob::process(Ctl &ctl)
NetworkAgent* m_agent = wxGetApp().getAgent();
AppConfig* config = wxGetApp().app_config;
int result = -1;
unsigned int http_code;
std::string http_body;
if (this->connection_type == "lan") {

View file

@ -2822,10 +2822,17 @@ void MainFrame::init_menubar_as_editor()
auto flowrate_menu = new wxMenu();
append_menu_item(
flowrate_menu, wxID_ANY, _L("Pass 1"), _L("Flow rate test - Pass 1"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(1); }, "", nullptr,
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(false, 1); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_menu_item(flowrate_menu, wxID_ANY, _L("Pass 2"), _L("Flow rate test - Pass 2"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(2); }, "", nullptr,
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(false, 2); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
flowrate_menu->AppendSeparator();
append_menu_item(flowrate_menu, wxID_ANY, _L("YOLO (Recommended)"), _L("Orca YOLO flowrate calibration, 0.01 step"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(true, 1); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_menu_item(flowrate_menu, wxID_ANY, _L("YOLO (perfectionist version)"), _L("Orca YOLO flowrate calibration, 0.005 step"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(true, 2); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
m_topbar->GetCalibMenu()->AppendSubMenu(flowrate_menu, _L("Flow rate"));
append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Pressure advance"), _L("Pressure advance"),
@ -2909,13 +2916,20 @@ void MainFrame::init_menubar_as_editor()
// Flowrate
auto flowrate_menu = new wxMenu();
append_menu_item(flowrate_menu, wxID_ANY, _L("Pass 1"), _L("Flow rate test - Pass 1"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(1); }, "", nullptr,
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(false, 1); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_menu_item(flowrate_menu, wxID_ANY, _L("Pass 2"), _L("Flow rate test - Pass 2"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(2); }, "", nullptr,
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(false, 2); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_submenu(calib_menu,flowrate_menu,wxID_ANY,_L("Flow rate"),_L("Flow rate"),"",
[this]() {return m_plater->is_view3D_shown();; });
flowrate_menu->AppendSeparator();
append_menu_item(flowrate_menu, wxID_ANY, _L("YOLO (Recommended)"), _L("Orca YOLO flowrate calibration, 0.01 step"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(true, 1); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_menu_item(flowrate_menu, wxID_ANY, _L("YOLO (perfectionist version)"), _L("Orca YOLO flowrate calibration, 0.005 step"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(true, 2); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
// PA
append_menu_item(calib_menu, wxID_ANY, _L("Pressure advance"), _L("Pressure advance"),

View file

@ -133,7 +133,7 @@ namespace GUI {
}
}
catch (std::exception& e) {
catch (std::exception&) {
// wxMessageBox(e.what(), "json Exception", MB_OK);
}
}

View file

@ -492,13 +492,16 @@ bool OG_CustomCtrl::update_visibility(ConfigOptionMode mode)
wxCoord h_pos2 = get_title_width() * m_em_unit;
wxCoord v_pos = 0;
size_t invisible_lines = 0;
bool has_visible_lines = false;
for (CtrlLine& line : ctrl_lines) {
line.update_visibility(mode);
if (line.is_visible)
if (line.is_visible) {
v_pos += (wxCoord)line.height;
else
invisible_lines++;
if (!line.is_separator()) { // Ignore separators
has_visible_lines = true;
}
}
}
// BBS: multi-line title
SetFont(Label::Head_16);
@ -513,7 +516,7 @@ bool OG_CustomCtrl::update_visibility(ConfigOptionMode mode)
this->SetMinSize(wxSize(h_pos, v_pos));
return invisible_lines != ctrl_lines.size();
return has_visible_lines;
}
// BBS: call by Tab/Page

View file

@ -470,7 +470,7 @@ void PartPlate::calc_gridlines(const ExPolygon& poly, const BoundingBox& pp_bbox
int count = 0;
int step = 10;
// Orca: use 500 x 500 bed size as baseline.
auto grid_counts = pp_bbox.size() / ((coord_t) scale_(step * 50));
const Point grid_counts = pp_bbox.size() / ((coord_t) scale_(step * 50));
// if the grid is too dense, we increase the step
if (grid_counts.minCoeff() > 1) {
step = static_cast<int>(grid_counts.minCoeff() + 1) * 10;
@ -2522,7 +2522,7 @@ void PartPlate::generate_print_polygon(ExPolygon &print_polygon)
{
auto compute_points = [&print_polygon](Vec2d& center, double radius, double start_angle, double stop_angle, int count)
{
double angle, angle_steps;
double angle_steps;
angle_steps = (stop_angle - start_angle) / (count - 1);
for(int j = 0; j < count; j++ )
{
@ -2541,7 +2541,7 @@ void PartPlate::generate_print_polygon(ExPolygon &print_polygon)
{
const Vec2d& p = m_shape[i];
Vec2d center;
double start_angle, stop_angle, angle_steps, radius_x, radius_y, radius;
double start_angle, stop_angle, radius_x, radius_y, radius;
switch (i) {
case 0:
radius = 5.f;
@ -2592,7 +2592,7 @@ void PartPlate::generate_exclude_polygon(ExPolygon &exclude_polygon)
{
auto compute_exclude_points = [&exclude_polygon](Vec2d& center, double radius, double start_angle, double stop_angle, int count)
{
double angle, angle_steps;
double angle_steps;
angle_steps = (stop_angle - start_angle) / (count - 1);
for(int j = 0; j < count; j++ )
{
@ -2611,7 +2611,7 @@ void PartPlate::generate_exclude_polygon(ExPolygon &exclude_polygon)
{
const Vec2d& p = m_exclude_area[i];
Vec2d center;
double start_angle, stop_angle, angle_steps, radius_x, radius_y, radius;
double start_angle, stop_angle, radius;
switch (i) {
case 0:
radius = 5.f;

View file

@ -9083,7 +9083,7 @@ void Plater::import_model_id(wxString download_info)
}
}
catch (const std::exception& error)
catch (const std::exception&)
{
//wxString sError = error.what();
}
@ -9125,7 +9125,6 @@ void Plater::import_model_id(wxString download_info)
// if (!m_agent) return;
int res = 0;
unsigned int http_code;
std::string http_body;
msg = _L("prepare 3mf file...");
@ -9164,7 +9163,7 @@ void Plater::import_model_id(wxString download_info)
if (sFile == filename) is_already_exist = true;
}
}
catch (const std::exception& error)
catch (const std::exception&)
{
//wxString sError = error.what();
}
@ -9646,21 +9645,11 @@ void Plater::_calib_pa_select_added_objects() {
}
}
void Plater::calib_flowrate(int pass) {
if (pass != 1 && pass != 2)
return;
const auto calib_name = wxString::Format(L"Flowrate Test - Pass%d", pass);
if (new_project(false, false, calib_name) == wxID_CANCEL)
return;
wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor));
if(pass == 1)
add_model(false, (boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "flowrate-test-pass1.3mf").string());
else
add_model(false, (boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "flowrate-test-pass2.3mf").string());
auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
// Adjust settings for flowrate calibration
// For linear mode, pass 1 means normal version while pass 2 mean "for perfectionists" version
void adjust_settings_for_flowrate_calib(ModelObjectPtrs& objects, bool linear, int pass)
{
auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
auto printerConfig = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config;
@ -9670,37 +9659,47 @@ void Plater::calib_flowrate(int pass) {
assert(nozzle_diameter_config->values.size() > 0);
float nozzle_diameter = nozzle_diameter_config->values[0];
float xyScale = nozzle_diameter / 0.6;
//scale z to have 7 layers
//scale z to have 10 layers
// 2 bottom, 5 top, 3 sparse infill
double first_layer_height = print_config->option<ConfigOptionFloat>("initial_layer_print_height")->value;
double layer_height = nozzle_diameter / 2.0; // prefer 0.2 layer height for 0.4 nozzle
first_layer_height = std::max(first_layer_height, layer_height);
float zscale = (first_layer_height + 6 * layer_height) / 1.4;
float zscale = (first_layer_height + 9 * layer_height) / 2;
// only enlarge
if (xyScale > 1.2) {
for (auto _obj : model().objects)
for (auto _obj : objects)
_obj->scale(xyScale, xyScale, zscale);
}
else {
for (auto _obj : model().objects)
for (auto _obj : objects)
_obj->scale(1, 1, zscale);
}
auto cur_flowrate = filament_config->option<ConfigOptionFloats>("filament_flow_ratio")->get_at(0);
Flow infill_flow = Flow(nozzle_diameter * 1.2f, layer_height, nozzle_diameter);
double filament_max_volumetric_speed = filament_config->option<ConfigOptionFloats>("filament_max_volumetric_speed")->get_at(0);
double max_infill_speed = filament_max_volumetric_speed / (infill_flow.mm3_per_mm() * (pass == 1 ? 1.2 : 1));
double max_infill_speed;
if (linear)
max_infill_speed = filament_max_volumetric_speed /
(infill_flow.mm3_per_mm() * (cur_flowrate + (pass == 2 ? 0.035 : 0.05)) / cur_flowrate);
else
max_infill_speed = filament_max_volumetric_speed / (infill_flow.mm3_per_mm() * (pass == 1 ? 1.2 : 1));
double internal_solid_speed = std::floor(std::min(print_config->opt_float("internal_solid_infill_speed"), max_infill_speed));
double top_surface_speed = std::floor(std::min(print_config->opt_float("top_surface_speed"), max_infill_speed));
// adjust parameters
for (auto _obj : model().objects) {
for (auto _obj : objects) {
_obj->ensure_on_bed();
_obj->config.set_key_value("wall_loops", new ConfigOptionInt(3));
_obj->config.set_key_value("wall_loops", new ConfigOptionInt(1));
_obj->config.set_key_value("only_one_wall_top", new ConfigOptionBool(true));
_obj->config.set_key_value("thick_internal_bridges", new ConfigOptionBool(false));
_obj->config.set_key_value("sparse_infill_density", new ConfigOptionPercent(35));
_obj->config.set_key_value("min_width_top_surface", new ConfigOptionFloatOrPercent(100,true));
_obj->config.set_key_value("bottom_shell_layers", new ConfigOptionInt(1));
_obj->config.set_key_value("bottom_shell_layers", new ConfigOptionInt(2));
_obj->config.set_key_value("top_shell_layers", new ConfigOptionInt(5));
_obj->config.set_key_value("top_shell_thickness", new ConfigOptionFloat(0));
_obj->config.set_key_value("bottom_shell_thickness", new ConfigOptionFloat(0));
_obj->config.set_key_value("detect_thin_wall", new ConfigOptionBool(true));
_obj->config.set_key_value("filter_out_gap_fill", new ConfigOptionFloat(0));
_obj->config.set_key_value("sparse_infill_pattern", new ConfigOptionEnum<InfillPattern>(ipRectilinear));
@ -9724,14 +9723,18 @@ void Plater::calib_flowrate(int pass) {
if (obj_name[0] == 'm')
obj_name[0] = '-';
auto modifier = stof(obj_name);
_obj->config.set_key_value("print_flow_ratio", new ConfigOptionFloat(1.0f + modifier/100.f));
if(linear)
_obj->config.set_key_value("print_flow_ratio", new ConfigOptionFloat((cur_flowrate + modifier)/cur_flowrate));
else
_obj->config.set_key_value("print_flow_ratio", new ConfigOptionFloat(1.0f + modifier/100.f));
}
print_config->set_key_value("layer_height", new ConfigOptionFloat(layer_height));
print_config->set_key_value("alternate_extra_wall", new ConfigOptionBool(false));
print_config->set_key_value("initial_layer_print_height", new ConfigOptionFloat(first_layer_height));
print_config->set_key_value("reduce_crossing_wall", new ConfigOptionBool(true));
//filament_config->set_key_value("filament_max_volumetric_speed", new ConfigOptionFloats{ 9. });
wxGetApp().get_tab(Preset::TYPE_PRINT)->update_dirty();
wxGetApp().get_tab(Preset::TYPE_FILAMENT)->update_dirty();
@ -9741,6 +9744,43 @@ void Plater::calib_flowrate(int pass) {
wxGetApp().get_tab(Preset::TYPE_PRINTER)->reload_config();
}
void Plater::calib_flowrate(bool is_linear, int pass) {
if (pass != 1 && pass != 2)
return;
wxString calib_name;
if (is_linear) {
calib_name = L"Orca YOLO Flow Calibration";
if (pass == 2)
calib_name += L" - Perfectionist version";
} else
calib_name = wxString::Format(L"Flowrate Test - Pass%d", pass);
if (new_project(false, false, calib_name) == wxID_CANCEL)
return;
wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor));
if (is_linear) {
if (pass == 1)
add_model(false,
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "Orca-LinearFlow.3mf").string());
else
add_model(false,
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "Orca-LinearFlow_fine.3mf").string());
} else {
if (pass == 1)
add_model(false,
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "flowrate-test-pass1.3mf").string());
else
add_model(false,
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "flowrate-test-pass2.3mf").string());
}
adjust_settings_for_flowrate_calib(model().objects, is_linear, pass);
wxGetApp().get_tab(Preset::TYPE_PRINTER)->reload_config();
}
void Plater::calib_temp(const Calib_Params& params) {
const auto calib_temp_name = wxString::Format(L"Nozzle temperature test");
new_project(false, false, calib_temp_name);
@ -12563,7 +12603,7 @@ int Plater::send_gcode(int plate_idx, Export3mfProgressFn proFn)
p->m_print_job_data._3mf_path = fs::path(plate->get_tmp_gcode_path());
p->m_print_job_data._3mf_path.replace_extension("3mf");
}
catch (std::exception& e) {
catch (std::exception&) {
BOOST_LOG_TRIVIAL(error) << "generate 3mf path failed";
return -1;
}
@ -12596,7 +12636,7 @@ int Plater::export_config_3mf(int plate_idx, Export3mfProgressFn proFn)
try {
p->m_print_job_data._3mf_config_path = fs::path(plate->get_temp_config_3mf_path());
}
catch (std::exception& e) {
catch (std::exception&) {
BOOST_LOG_TRIVIAL(error) << "generate 3mf path failed";
return -1;
}

View file

@ -259,7 +259,7 @@ public:
// SoftFever
void calib_pa(const Calib_Params& params);
void calib_flowrate(int pass);
void calib_flowrate(bool is_linear, int pass);
void calib_temp(const Calib_Params& params);
void calib_max_vol_speed(const Calib_Params& params);
void calib_retraction(const Calib_Params& params);

View file

@ -799,8 +799,10 @@ bool PlaterPresetComboBox::switch_to_tab()
//BBS Select NoteBook Tab params
if (tab->GetParent() == wxGetApp().params_panel())
wxGetApp().mainframe->select_tab(MainFrame::tp3DEditor);
else
else {
wxGetApp().params_dialog()->Popup();
tab->OnActivate();
}
tab->restore_last_select_item();
const Preset* selected_filament_preset = nullptr;

View file

@ -266,7 +266,7 @@ void ProjectPanel::OnScriptMessage(wxWebViewEvent& evt)
}
}
catch (std::exception& e) {
catch (std::exception&) {
// wxMessageBox(e.what(), "json Exception", MB_OK);
}
}

View file

@ -816,7 +816,6 @@ void SearchDialog::OnCheck(wxCommandEvent &event)
void SearchDialog::OnMotion(wxMouseEvent &event)
{
wxDataViewItem item;
wxDataViewColumn *col;
wxWindow * win = this;
// search_list->HitTest(wxGetMousePosition() - win->GetScreenPosition(), item, col);

View file

@ -468,14 +468,7 @@ void Tab::create_preset_tab()
// so that the cursor jumps to the last item.
// BBS: bold selection
m_tabctrl->Bind(wxEVT_TAB_SEL_CHANGING, [this](wxCommandEvent& event) {
if (m_disable_tree_sel_changed_event)
return;
const auto sel_item = m_tabctrl->GetSelection();
//OutputDebugStringA("wxEVT_TAB_SEL_CHANGING ");
//OutputDebugStringA(m_title.c_str());
//const auto selection = sel_item >= 0 ? m_tabctrl->GetItemText(sel_item) : "";
//OutputDebugString(selection);
//OutputDebugStringA("\n");
m_tabctrl->SetItemBold(sel_item, false);
});
m_tabctrl->Bind(wxEVT_TAB_SEL_CHANGED, [this](wxCommandEvent& event) {
@ -2010,23 +2003,23 @@ void TabPrint::build()
auto page = add_options_page(L("Quality"), "custom-gcode_quality"); // ORCA: icon only visible on placeholders
auto optgroup = page->new_optgroup(L("Layer height"), L"param_layer_height");
optgroup->append_single_option_line("layer_height");
optgroup->append_single_option_line("initial_layer_print_height");
optgroup->append_single_option_line("layer_height","quality_settings_layer_height");
optgroup->append_single_option_line("initial_layer_print_height","quality_settings_layer_height");
optgroup = page->new_optgroup(L("Line width"), L"param_line_width");
optgroup->append_single_option_line("line_width");
optgroup->append_single_option_line("initial_layer_line_width");
optgroup->append_single_option_line("outer_wall_line_width");
optgroup->append_single_option_line("inner_wall_line_width");
optgroup->append_single_option_line("top_surface_line_width");
optgroup->append_single_option_line("sparse_infill_line_width");
optgroup->append_single_option_line("internal_solid_infill_line_width");
optgroup->append_single_option_line("support_line_width");
optgroup->append_single_option_line("line_width","quality_settings_line_width");
optgroup->append_single_option_line("initial_layer_line_width","quality_settings_line_width");
optgroup->append_single_option_line("outer_wall_line_width","quality_settings_line_width");
optgroup->append_single_option_line("inner_wall_line_width","quality_settings_line_width");
optgroup->append_single_option_line("top_surface_line_width","quality_settings_line_width");
optgroup->append_single_option_line("sparse_infill_line_width","quality_settings_line_width");
optgroup->append_single_option_line("internal_solid_infill_line_width","quality_settings_line_width");
optgroup->append_single_option_line("support_line_width","quality_settings_line_width");
optgroup = page->new_optgroup(L("Seam"), L"param_seam");
optgroup->append_single_option_line("seam_position", "seam");
optgroup->append_single_option_line("staggered_inner_seams", "seam");
optgroup->append_single_option_line("seam_gap","seam");
optgroup->append_single_option_line("seam_position", "quality_settings_seam");
optgroup->append_single_option_line("staggered_inner_seams", "quality_settings_seam");
optgroup->append_single_option_line("seam_gap","quality_settings_seam");
optgroup->append_single_option_line("seam_slope_type", "seam#scarf-joint-seam");
optgroup->append_single_option_line("seam_slope_conditional", "seam#scarf-joint-seam");
optgroup->append_single_option_line("scarf_angle_threshold", "seam#scarf-joint-seam");
@ -2038,10 +2031,10 @@ void TabPrint::build()
optgroup->append_single_option_line("seam_slope_steps", "seam#scarf-joint-seam");
optgroup->append_single_option_line("scarf_joint_flow_ratio", "seam#scarf-joint-seam");
optgroup->append_single_option_line("seam_slope_inner_walls", "seam#scarf-joint-seam");
optgroup->append_single_option_line("role_based_wipe_speed","seam");
optgroup->append_single_option_line("wipe_speed", "seam");
optgroup->append_single_option_line("wipe_on_loops","seam");
optgroup->append_single_option_line("wipe_before_external_loop","seam");
optgroup->append_single_option_line("role_based_wipe_speed","quality_settings_seam");
optgroup->append_single_option_line("wipe_speed", "quality_settings_seam");
optgroup->append_single_option_line("wipe_on_loops","quality_settings_seam");
optgroup->append_single_option_line("wipe_before_external_loop","quality_settings_seam");
optgroup = page->new_optgroup(L("Precision"), L"param_precision");
@ -3252,6 +3245,7 @@ void TabFilament::build()
optgroup->append_single_option_line("filament_density");
optgroup->append_single_option_line("filament_shrink");
optgroup->append_single_option_line("filament_shrinkage_compensation_z");
optgroup->append_single_option_line("filament_cost");
//BBS
optgroup->append_single_option_line("temperature_vitrification");
@ -4746,19 +4740,28 @@ void Tab::rebuild_page_tree()
// To avoid redundant clear/activate functions call
// suppress activate page before page_tree rebuilding
m_disable_tree_sel_changed_event = true;
m_tabctrl->DeleteAllItems();
int curr_item = 0;
for (auto p : m_pages)
{
if (!p->get_show())
continue;
auto itemId = m_tabctrl->AppendItem(translate_category(p->title(), m_type), p->iconID());
m_tabctrl->SetItemTextColour(itemId, p->get_item_colour() == m_modified_label_clr ? p->get_item_colour() : StateColor(
if (m_tabctrl->GetCount() <= curr_item) {
m_tabctrl->AppendItem(translate_category(p->title(), m_type), p->iconID());
} else {
m_tabctrl->SetItemText(curr_item, translate_category(p->title(), m_type));
}
m_tabctrl->SetItemTextColour(curr_item, p->get_item_colour() == m_modified_label_clr ? p->get_item_colour() : StateColor(
std::make_pair(0x6B6B6C, (int) StateColor::NotChecked),
std::make_pair(p->get_item_colour(), (int) StateColor::Normal)));
if (translate_category(p->title(), m_type) == selected)
item = itemId;
item = curr_item;
curr_item++;
}
while (m_tabctrl->GetCount() > curr_item) {
m_tabctrl->DeleteItem(m_tabctrl->GetCount() - 1);
}
// BBS: on mac, root is selected, this fix it
m_tabctrl->Unselect();
// BBS: not select on hide tab
@ -5273,10 +5276,10 @@ bool Tab::update_current_page_in_background(int& item)
// clear pages from the controlls
// BBS: fix after new layout, clear page in backgroud
if (m_parent->is_active_and_shown_tab((wxPanel*)this))
m_parent->clear_page();
for (auto p : m_pages)
p->clear();
if (m_parent->is_active_and_shown_tab((wxPanel*)this))
m_parent->clear_page();
update_undo_buttons();

View file

@ -41,7 +41,7 @@ int UserManager::parse_json(std::string payload)
//bind
if (j_pre["bind"]["command"].get<std::string>() == "bind") {
std::string dev_id;
std:; string result;
std::string result;
if (j_pre["bind"].contains("dev_id")) {
dev_id = j_pre["bind"]["dev_id"].get<std::string>();

View file

@ -227,7 +227,7 @@ void DownPluginFrame::OnScriptMessage(wxWebViewEvent &evt)
auto plugin_folder = (boost::filesystem::path(wxStandardPaths::Get().GetUserDataDir().ToUTF8().data()) / "plugins").make_preferred().string();
desktop_open_any_folder(plugin_folder);
}
} catch (std::exception &e) {
} catch (std::exception &) {
// wxMessageBox(e.what(), "json Exception", MB_OK);
}
}

View file

@ -117,7 +117,31 @@ int TabCtrl::AppendItem(const wxString &item,
bool TabCtrl::DeleteItem(int item)
{
return false;
if (item < 0 || item >= btns.size()) {
return false;
}
const bool selection_changed = sel >= item;
if (selection_changed) {
sendTabCtrlEvent(true);
}
Button* btn = btns[item];
btn->Destroy();
btns.erase(btns.begin() + item);
sizer->Remove(item * 2);
if (btns.size() > 1)
sizer->GetItem(sizer->GetItemCount() - 1)->SetMinSize({0, 0});
if (selection_changed) {
sel--; // `relayout()` uses `sel` so we need to update this before calling `relayout()`
}
relayout();
if (selection_changed) {
sendTabCtrlEvent();
}
return true;
}
void TabCtrl::DeleteAllItems()

View file

@ -373,7 +373,7 @@ bool WebView::RunScript(wxWebView *webView, wxString const &javascript)
}, NULL);
return true;
#endif
} catch (std::exception &e) {
} catch (std::exception &) {
return false;
}
}