Merge branch 'main' into skirt-object-fix-pr

This commit is contained in:
SoftFever 2024-09-07 10:57:59 +08:00 committed by GitHub
commit 5b5cd478c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
160 changed files with 13381 additions and 10798 deletions

View file

@ -423,7 +423,7 @@ void GLVolume::render()
}
//BBS: add outline related logic
void GLVolume::render_with_outline(const Transform3d &view_model_matrix)
void GLVolume::render_with_outline(const GUI::Size& cnv_size)
{
if (!is_active)
return;
@ -435,37 +435,79 @@ void GLVolume::render_with_outline(const Transform3d &view_model_matrix)
ModelObjectPtrs &model_objects = GUI::wxGetApp().model().objects;
std::vector<ColorRGBA> colors = get_extruders_colors();
glEnable(GL_STENCIL_TEST);
glStencilMask(0xFF);
glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
glClear(GL_STENCIL_BUFFER_BIT);
glStencilFunc(GL_ALWAYS, 0xff, 0xFF);
const GUI::OpenGLManager::EFramebufferType framebuffers_type = GUI::OpenGLManager::get_framebuffers_type();
if (framebuffers_type == GUI::OpenGLManager::EFramebufferType::Unknown) {
// No supported, degrade to normal rendering
simple_render(shader, model_objects, colors);
return;
}
simple_render(shader, model_objects, colors);
// 1st. render pass, render the model into a separate render target that has only depth buffer
GLuint depth_fbo = 0;
GLuint depth_tex = 0;
if (framebuffers_type == GUI::OpenGLManager::EFramebufferType::Arb) {
glsafe(::glGenFramebuffers(1, &depth_fbo));
glsafe(::glBindFramebuffer(GL_FRAMEBUFFER, depth_fbo));
// 2nd. render pass: now draw slightly scaled versions of the objects, this time disabling stencil writing.
// Because the stencil buffer is now filled with several 1s. The parts of the buffer that are 1 are not drawn, thus only drawing
// the objects' size differences, making it look like borders.
glStencilFunc(GL_NOTEQUAL, 0xff, 0xFF);
glStencilMask(0x00);
float scale = 1.02f;
ColorRGBA body_color = { 1.0f, 1.0f, 1.0f, 1.0f }; //red
glActiveTexture(GL_TEXTURE0);
glsafe(::glGenTextures(1, &depth_tex));
glsafe(::glBindTexture(GL_TEXTURE_2D, depth_tex));
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32F, cnv_size.get_width(), cnv_size.get_height(), 0, GL_DEPTH_COMPONENT, GL_FLOAT, nullptr));
model.set_color(body_color);
shader->set_uniform("is_outline", true);
glsafe(::glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depth_tex, 0));
} else {
glsafe(::glGenFramebuffersEXT(1, &depth_fbo));
glsafe(::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, depth_fbo));
Transform3d matrix = view_model_matrix;
matrix.scale(scale);
shader->set_uniform("view_model_matrix", matrix);
glActiveTexture(GL_TEXTURE0);
glsafe(::glGenTextures(1, &depth_tex));
glsafe(::glBindTexture(GL_TEXTURE_2D, depth_tex));
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32F, cnv_size.get_width(), cnv_size.get_height(), 0, GL_DEPTH_COMPONENT, GL_FLOAT, nullptr));
glsafe(::glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, depth_tex, 0));
}
glsafe(::glClear(GL_DEPTH_BUFFER_BIT));
if (tverts_range == std::make_pair<size_t, size_t>(0, -1))
model.render();
else
model.render(this->tverts_range);
glsafe(::glBindTexture(GL_TEXTURE_2D, 0));
shader->set_uniform("view_model_matrix", view_model_matrix);
// 2nd. render pass, just a normal render with the depth buffer passed as a texture
if (framebuffers_type == GUI::OpenGLManager::EFramebufferType::Arb) {
glsafe(::glBindFramebuffer(GL_FRAMEBUFFER, 0));
} else if (framebuffers_type == GUI::OpenGLManager::EFramebufferType::Ext) {
glsafe(::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0));
}
shader->set_uniform("is_outline", true);
shader->set_uniform("screen_size", Vec2f{cnv_size.get_width(), cnv_size.get_height()});
glActiveTexture(GL_TEXTURE0);
glsafe(::glBindTexture(GL_TEXTURE_2D, depth_tex));
shader->set_uniform("depth_tex", 0);
simple_render(shader, model_objects, colors);
// Some clean up to do
glsafe(::glBindTexture(GL_TEXTURE_2D, 0));
shader->set_uniform("is_outline", false);
glDisable(GL_STENCIL_TEST);
if (framebuffers_type == GUI::OpenGLManager::EFramebufferType::Arb) {
glsafe(::glBindFramebuffer(GL_FRAMEBUFFER, 0));
if (depth_fbo != 0)
glsafe(::glDeleteFramebuffers(1, &depth_fbo));
} else if (framebuffers_type == GUI::OpenGLManager::EFramebufferType::Ext) {
glsafe(::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0));
if (depth_fbo != 0)
glsafe(::glDeleteFramebuffersEXT(1, &depth_fbo));
}
if (depth_tex != 0)
glsafe(::glDeleteTextures(1, &depth_tex));
}
//BBS add render for simple case
@ -847,8 +889,8 @@ int GLVolumeCollection::get_selection_support_threshold_angle(bool &enable_suppo
}
//BBS: add outline drawing logic
void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disable_cullface, const Transform3d& view_matrix, const Transform3d& projection_matrix,
std::function<bool(const GLVolume&)> filter_func, bool with_outline) const
void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disable_cullface, const Transform3d& view_matrix, const Transform3d& projection_matrix, const GUI::Size& cnv_size,
std::function<bool(const GLVolume&)> filter_func) const
{
GLVolumeWithIdAndZList to_render = volumes_to_render(volumes, type, view_matrix, filter_func);
if (to_render.empty())
@ -953,9 +995,9 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab
const Matrix3d view_normal_matrix = view_matrix.matrix().block(0, 0, 3, 3) * model_matrix.matrix().block(0, 0, 3, 3).inverse().transpose();
shader->set_uniform("view_normal_matrix", view_normal_matrix);
//BBS: add outline related logic
//if (with_outline && volume.first->selected)
// volume.first->render_with_outline(view_matrix * model_matrix);
//else
if (volume.first->selected && GUI::wxGetApp().show_outline())
volume.first->render_with_outline(cnv_size);
else
volume.first->render();
#if ENABLE_ENVIRONMENT_MAP

View file

@ -39,6 +39,10 @@ extern Slic3r::ColorRGBA adjust_color_for_rendering(const Slic3r::C
namespace Slic3r {
namespace GUI {
class Size;
}
class SLAPrintObject;
enum SLAPrintObjectStep : unsigned int;
class BuildVolume;
@ -322,7 +326,7 @@ public:
virtual void render();
//BBS: add outline related logic and add virtual specifier
virtual void render_with_outline(const Transform3d &view_model_matrix);
virtual void render_with_outline(const GUI::Size& cnv_size);
//BBS: add simple render function for thumbnail
void simple_render(GLShaderProgram* shader, ModelObjectPtrs& model_objects, std::vector<ColorRGBA>& extruder_colors, bool ban_light =false);
@ -355,7 +359,7 @@ class GLWipeTowerVolume : public GLVolume {
public:
GLWipeTowerVolume(const std::vector<ColorRGBA>& colors);
void render() override;
void render_with_outline(const Transform3d &view_model_matrix) override { render(); }
void render_with_outline(const GUI::Size& cnv_size) override { render(); }
std::vector<GUI::GLModel> model_per_colors;
bool IsTransparent();
@ -465,8 +469,8 @@ public:
int get_selection_support_threshold_angle(bool&) const;
// Render the volumes by OpenGL.
//BBS: add outline drawing logic
void render(ERenderType type, bool disable_cullface, const Transform3d& view_matrix, const Transform3d& projection_matrix,
std::function<bool(const GLVolume &)> filter_func = std::function<bool(const GLVolume &)>(), bool with_outline = true) const;
void render(ERenderType type, bool disable_cullface, const Transform3d& view_matrix, const Transform3d& projection_matrix, const GUI::Size& cnv_size,
std::function<bool(const GLVolume &)> filter_func = std::function<bool(const GLVolume &)>()) const;
// Clear the geometry
void clear() { for (auto *v : volumes) delete v; volumes.clear(); }

View file

@ -143,6 +143,15 @@ static bool str_is_all_digit(const std::string &str) {
return true;
}
// Custom comparator for case-insensitive sorting
static bool caseInsensitiveCompare(const std::string& a, const std::string& b) {
std::string lowerA = a;
std::string lowerB = b;
std::transform(lowerA.begin(), lowerA.end(), lowerA.begin(), ::tolower);
std::transform(lowerB.begin(), lowerB.end(), lowerB.begin(), ::tolower);
return lowerA < lowerB;
}
static bool delete_filament_preset_by_name(std::string delete_preset_name, std::string &selected_preset_name)
{
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("select preset, name %1%") % delete_preset_name;
@ -692,11 +701,19 @@ wxBoxSizer *CreateFilamentPresetDialog::create_vendor_item()
optionSizer->SetMinSize(OPTION_SIZE);
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
wxArrayString choices;
for (const wxString vendor : filament_vendors) {
choices.push_back(vendor);
// Convert all std::any to std::string
std::vector<std::string> string_vendors;
for (const auto& vendor_any : filament_vendors) {
string_vendors.push_back(std::any_cast<std::string>(vendor_any));
}
// Sort the vendors alphabetically
std::sort(string_vendors.begin(), string_vendors.end(), caseInsensitiveCompare);
wxArrayString choices;
for (const std::string &vendor : string_vendors) {
choices.push_back(wxString(vendor)); // Convert std::string to wxString before adding
}
choices.Sort();
wxBoxSizer *vendor_sizer = new wxBoxSizer(wxHORIZONTAL);
m_filament_vendor_combobox = new ComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, NAME_OPTION_COMBOBOX_SIZE, 0, nullptr, wxCB_READONLY);
@ -4122,13 +4139,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

@ -1244,7 +1244,7 @@ void GCodeViewer::render(int canvas_width, int canvas_height, int right_margin)
#endif // ENABLE_GCODE_VIEWER_STATISTICS
glsafe(::glEnable(GL_DEPTH_TEST));
render_shells();
render_shells(canvas_width, canvas_height);
if (m_roles.empty())
return;
@ -4023,7 +4023,7 @@ void GCodeViewer::render_toolpaths()
}
}
void GCodeViewer::render_shells()
void GCodeViewer::render_shells(int canvas_width, int canvas_height)
{
//BBS: add shell previewing logic
if ((!m_shells.previewing && !m_shells.visible) || m_shells.volumes.empty())
@ -4039,7 +4039,9 @@ void GCodeViewer::render_shells()
shader->start_using();
shader->set_uniform("emission_factor", 0.1f);
const Camera& camera = wxGetApp().plater()->get_camera();
m_shells.volumes.render(GLVolumeCollection::ERenderType::Transparent, false, camera.get_view_matrix(), camera.get_projection_matrix());
shader->set_uniform("z_far", camera.get_far_z());
shader->set_uniform("z_near", camera.get_near_z());
m_shells.volumes.render(GLVolumeCollection::ERenderType::Transparent, false, camera.get_view_matrix(), camera.get_projection_matrix(), {canvas_width, canvas_height});
shader->set_uniform("emission_factor", 0.0f);
shader->stop_using();

View file

@ -893,7 +893,7 @@ private:
//void load_shells(const Print& print);
void refresh_render_paths(bool keep_sequential_current_first, bool keep_sequential_current_last) const;
void render_toolpaths();
void render_shells();
void render_shells(int canvas_width, int canvas_height);
//BBS: GUI refactor: add canvas size
void render_legend(float &legend_height, int canvas_width, int canvas_height, int right_margin);

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)
@ -7227,6 +7233,12 @@ void GLCanvas3D::_render_objects(GLVolumeCollection::ERenderType type, bool with
if (shader != nullptr) {
shader->start_using();
const Size& cvn_size = get_canvas_size();
{
const Camera& camera = wxGetApp().plater()->get_camera();
shader->set_uniform("z_far", camera.get_far_z());
shader->set_uniform("z_near", camera.get_near_z());
}
switch (type)
{
default:
@ -7238,7 +7250,7 @@ void GLCanvas3D::_render_objects(GLVolumeCollection::ERenderType type, bool with
if (m_picking_enabled && m_layers_editing.is_enabled() && (m_layers_editing.last_object_id != -1) && (m_layers_editing.object_max_z() > 0.0f)) {
int object_id = m_layers_editing.last_object_id;
const Camera& camera = wxGetApp().plater()->get_camera();
m_volumes.render(type, false, camera.get_view_matrix(), camera.get_projection_matrix(), [object_id](const GLVolume& volume) {
m_volumes.render(type, false, camera.get_view_matrix(), camera.get_projection_matrix(), cvn_size, [object_id](const GLVolume& volume) {
// Which volume to paint without the layer height profile shader?
return volume.is_active && (volume.is_modifier || volume.composite_id.object_id != object_id);
});
@ -7254,14 +7266,14 @@ void GLCanvas3D::_render_objects(GLVolumeCollection::ERenderType type, bool with
//BBS:add assemble view related logic
// do not cull backfaces to show broken geometry, if any
const Camera& camera = wxGetApp().plater()->get_camera();
m_volumes.render(type, m_picking_enabled, camera.get_view_matrix(), camera.get_projection_matrix(), [this, canvas_type](const GLVolume& volume) {
m_volumes.render(type, m_picking_enabled, camera.get_view_matrix(), camera.get_projection_matrix(), cvn_size, [this, canvas_type](const GLVolume& volume) {
if (canvas_type == ECanvasType::CanvasAssembleView) {
return !volume.is_modifier && !volume.is_wipe_tower;
}
else {
return (m_render_sla_auxiliaries || volume.composite_id.volume_id >= 0);
}
}, with_outline);
});
}
}
else {
@ -7288,14 +7300,14 @@ void GLCanvas3D::_render_objects(GLVolumeCollection::ERenderType type, bool with
}*/
const Camera& camera = wxGetApp().plater()->get_camera();
//BBS:add assemble view related logic
m_volumes.render(type, false, camera.get_view_matrix(), camera.get_projection_matrix(), [this, canvas_type](const GLVolume& volume) {
m_volumes.render(type, false, camera.get_view_matrix(), camera.get_projection_matrix(), cvn_size, [this, canvas_type](const GLVolume& volume) {
if (canvas_type == ECanvasType::CanvasAssembleView) {
return !volume.is_modifier;
}
else {
return true;
}
}, with_outline);
});
if (m_canvas_type == CanvasAssembleView && m_gizmos.m_assemble_view_data->model_objects_clipper()->get_position() > 0) {
const GLGizmosManager& gm = get_gizmos_manager();
shader->stop_using();
@ -8433,7 +8445,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

@ -344,6 +344,9 @@ private:
bool show_3d_navigator() const { return app_config->get_bool("show_3d_navigator"); }
void toggle_show_3d_navigator() const { app_config->set_bool("show_3d_navigator", !show_3d_navigator()); }
bool show_outline() const { return app_config->get_bool("show_outline"); }
void toggle_show_outline() const { app_config->set_bool("show_outline", !show_outline()); }
wxString get_inf_dialog_contect () {return m_info_dialog_content;};
std::vector<std::string> split_str(std::string src, std::string separator);

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

@ -2642,6 +2642,16 @@ void MainFrame::init_menubar_as_editor()
m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT));
},
this, [this]() { return m_plater->is_view3D_shown(); }, [this]() { return m_plater->is_view3D_overhang_shown(); }, this);
append_menu_check_item(
viewMenu, wxID_ANY, _L("Show Selected Outline (Experimental)"), _L("Show outline around selected object in 3D scene"),
[this](wxCommandEvent&) {
wxGetApp().toggle_show_outline();
m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT));
},
this, [this]() { return m_tabpanel->GetSelection() == TabPosition::tp3DEditor; },
[this]() { return wxGetApp().show_outline(); }, this);
/*viewMenu->AppendSeparator();
append_menu_check_item(viewMenu, wxID_ANY, _L("Show &Wireframe") + "\tCtrl+Shift+Enter", _L("Show wireframes in 3D scene"),
[this](wxCommandEvent&) { m_plater->toggle_show_wireframe(); m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT)); }, this,
@ -2822,10 +2832,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 +2926,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");
@ -3261,6 +3254,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");
@ -4472,7 +4466,7 @@ void TabPrinter::toggle_options()
toggle_line(el, is_BBL_printer);
// SoftFever: hide non-BBL settings
for (auto el : {"use_firmware_retraction", "use_relative_e_distances", "support_multi_bed_types", "pellet_modded_printer"})
for (auto el : {"use_firmware_retraction", "use_relative_e_distances", "support_multi_bed_types", "pellet_modded_printer", "bed_mesh_max", "bed_mesh_min", "bed_mesh_probe_distance", "adaptive_bed_mesh_margin", "thumbnails"})
toggle_line(el, !is_BBL_printer);
}
@ -4755,19 +4749,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
@ -5282,10 +5285,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;
}
}

View file

@ -184,7 +184,7 @@ Http::priv::priv(const std::string &url)
set_timeout_max(DEFAULT_TIMEOUT_MAX);
::curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, log_trace);
::curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); // curl makes a copy internally
::curl_easy_setopt(curl, CURLOPT_USERAGENT, SLIC3R_APP_NAME "/" SLIC3R_VERSION);
::curl_easy_setopt(curl, CURLOPT_USERAGENT, SLIC3R_APP_NAME "/" SoftFever_VERSION);
::curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error_buffer.front());
#ifdef __WINDOWS__
::curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_MAX_TLSv1_2);