mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-18 14:21:12 -06:00
Feature/merge 1.8.4 (#3827)
* FIX: the logic of buried points that were not buried JIRA: none Signed-off-by: Kunlong Ma <kunlong.ma@bambulab.com> Change-Id: Id95174659c5fce7feba409eb5e14916608745fa4 * ci: update network module based on commit bc7ca98 Change-Id: I923526f0bf9ce5a288144fa1f9b0f2fc640f41b7 * Fix Firefox Co-authored-by: hadess <hadess@hadess.net> * FIX: cali: custom created filament from AMS displayed as incompatible jira: new remove the condition: is_system Change-Id: Ib1366966bbdbe01bc9e2483d9914d270ebefa976 * FIX: duplicated items in comboBox at calibration completed page jira: new Change-Id: I4749a2206df16c438e0d3098e36274b2a20f313e * ENH:update support for P1S plus jira:[for p1s plus] Change-Id: Id577d4e94e2162cb0045d261dfaa5f396ecded2f * ENH: CLI: add mk information support JIRA: no jira Change-Id: Idd89b143d439de50d9f52eb8aec95b262d66875d * ENH:calibration support p1p plus jira:[plus] Change-Id: Ia290d3a8a8b9adaac7a6ee26d9a8b5ea0c1b3aee * FIX: add log for base_id and filament_id github: #3087 Change-Id: Iebfbd0f224fce49f33fc81c71e6108f6e3abb5ff * FIX: sync whole preset vendor directory Change-Id: I191dbe979a87ff35d38cab1149b7975664344838 Jira: STUDIO-5534 (cherry picked from commit 628866608116336453804aa1217dd55db04d47ad) * FIX: use t_utc for debug only Change-Id: Ia05d8969d4de3dd38908980d6e17a3ebb11ca279 Github 3045 Change-Id: I77935df53bbf2772b1146e5c330c537165a3a2e6 * FIX:make sort_volumes right Jira: STUDIO-5645 Change-Id: If324c9115bfaaf0c1b7b4be7c7ee96ba6b8ac890 * ENH:keep an unload logic jira:[for unload] Change-Id: Id30ec71ffa5b2dac89346ea47ca48a62479e3ab1 * FIX: several problems with mesh boolean 1. Cut with multiple volumes are OK now. 2. Close mesh boolean fail error with new object or open object 3. Fix wrong name and config of boolean resulting object github: #3118 jira: none Change-Id: If2c9dbfb36cbdfe4917a2371217923891bb7909c (cherry picked from commit 982c0ecb92cf7c2b5ae5972ab900a6b10e7dda50) * NEW:limit the length of project name jira:[project name] Change-Id: I955620f7073b3b7fda280d1118524f561d047751 * ENH:adjusting the warning level of timelpase jira:[STUDIO-5662] Change-Id: I4902b22d316f5e09a97a62c88b8a98e55c405434 * FIX: 3mf specification: change namespace form slic3rpe to BambuStudio Jira: XXXX Change-Id: Id705affc875ef23fdf2ac6d79f0cb0aafc4f7050 * NEW: Open MakerWorld With BambuStudio GetParam JIRA: none Change-Id: I0d65b364f1cd2d634a88882ab072c3e61ea89167 (cherry picked from commit 8eaf45e5359439a7c796fd79876c86775abcf48e) * FIX: Filament issue generated when creating a printer Jira: XXXX Change-Id: I976770b69b47641bd54aa7a9c56fba7f58d1ab68 (cherry picked from commit ba42188b93c58b3954234d72acdd9769a68e3d3c) * FIX: Blank page appears when editing presets Jira: 5563 Change-Id: I4c49e05515b1beff55991e92f8079c4499c27eab (cherry picked from commit e86517d290f4cd0765a230d811b0ddf2c9f34c17) * FIX: context menu didn't update UI jira: STUDIO-5691 Change-Id: Ia66b8623d832eba805aff5320941233a68ff258b * FIX: crash of "filling bed" "get_arrange_settings() const" gets trapped in infinite recursive calling. Now we delete this function. jira: STUDIO-5688 Change-Id: Ia39974734bb37b2a2f06b5bf78185f01be726872 * FIX: boolean hangs in the middle of color painting Can't do splits in combine_mesh_fff, as do_boolean of mcut will split meshes. jira: STUDIO-5693 Change-Id: Idddb7d20dd7ca386c39ddd3d87d9defc3136aa5d (cherry picked from commit 6c67d015941458e37faaf0015b6509b5a0eadc0e) * Fix: Fix a number of compilation problems issues found when using gcc version 13.2.0 (GCC) in a Flatpak sandbox github : https://github.com/bambulab/BambuStudio/issues/3074 github pull request: https://github.com/bambulab/BambuStudio/pull/3096 Change-Id: I08aeac593eb1ce7675894df72e8489200bae713d (cherry picked from commit 069d133d66bfa682de4a860e379d5dc16b3d907c) * fix: macos icns issue when icon was not attached github pull request:https://github.com/bambulab/BambuStudio/pull/3116 Change-Id: I49072ad49f3af7669a6d307c791594ade210da50 (cherry picked from commit c977e5582e3a30ad16dd267810037423aad9a53c) * FIX: Add flush_length for change_filament_gcode Change-Id: I30f4b97d3d61c2a57f0e92f157cbd31c38aa7265 Jira: XXXX (cherry picked from commit 92eb2bac977a0c4095b316cbbc6580fb5228b710) * FIX: edit preset dialog can't close on mac Jira: 5696 Change-Id: Ib33dfd07cc588ddd3805e3490a4d8c36dcd890ac * ENH: add dev_ota_version in ssdp JIRA: STUDIO-5740 Change-Id: Ic80e6d4b9bf82813fdc4a76604a3d36213d12b03 Signed-off-by: Stone Li <stone.li@bambulab.com> * NEW:Adapt to multicolour and gradient colour JIRA:xxxx Change-Id: I8084cab603d5681cbcaf2d6f5e0d7ad5419cb2af * NEW:Adaptation of semi transparent materials JIRA: XXXX Change-Id: Ie32d8ce67c37b85eb6d7d6594cb514a696307e68 * FIX: disable flush options if prime tower is unchecked jira: STUDIO-5639 Change-Id: I25081584d430bc7d062e14bcc2cdbf7522cf9d99 * ENH: refine GetVersion for HMS query JIRA: STUDIO-5763 Change-Id: Ia3ccc07d79cc0736eb12e9782da50211abb74772 Signed-off-by: Stone Li <stone.li@bambulab.com> * FIX: Prefer old selection when sync AMS not compatible Change-Id: I6b18db51887132a997cf78d70fff9a92e23bc44a Jira: STUDIO-5416 (cherry picked from commit 077fae29823cf4f3071d408b1b40f55ee0cb33c6) * FIX: The flushing was not auto-calc when sync ams list JIRA: STUDIO-5551 1. flushing volume auto-calc when sync ams list 2. flushing volume takes the larger calculation value when filament has multi-colors Signed-off-by: Kunlong Ma <kunlong.ma@bambulab.com> Change-Id: I72e6f9780ea56103a44c2da6068440a4615c254d * FIX:fixed invalid links jira:[fixed link] Change-Id: I036a38b6e8e94da762f93805bd7be706538771fe * FIX: Prompt to delete problematic presets Jira: XXXX Change-Id: Ic43f7bb782794d7ab0b6acbffbb5d73e94f6ed73 * FIX:fixed incorrect HMS content jira:[STUDIO-5818] Change-Id: Ia2896d6f0ab1ffedbc850e54168acece8e47bdbb * FIX:external transparent material display error JIRA: STUDIO-5845 Change-Id: I0a4f05ac5d5c0ac49d85a704ee65a7221c5f1e1d * FIX: [5846] Custom Filament Page show System Filament Simultaneously solve: When downloading Preset from the cloud, the filament_id of the preset in m_preset is null. Jira: 5846 Change-Id: I6ba1b46fe92e345614b6a4af3fffa87d81fa2456 * FIX:A1 and p1 series do not support custom materials JIRA:XXXX Change-Id: Ib0459273d1f9a7152a5563757204634a8d0cd6f5 * FIX: exception when comparing profiles jira:[NEW] Signed-off-by: XunZhangBambu <xun.zhang@bambulab.com> Change-Id: I946b5fcd35f779d271df2b3de731fdcada5aab29 (cherry picked from commit 00e739570812e5c4be3e0f7702ce8c72c0f9e72b) * FIX: hide_id_middle_string Change-Id: I28f32ec526b443d31d7992971b80ab1cb737deb6 Github: STUDIO-5825 * ENH: modify some logs level JIRA: STUDIO-5958 Change-Id: I5a8592dfb8ffa9a81952535cb30944f867aa0e22 Signed-off-by: Stone Li <stone.li@bambulab.com> * NEW:build plate marker detect Change-Id: I70f03efea688bb6ce71c3f5990bb3c50605ab184 * FIX: Studio UI Freeze when saving user preset github: #3335 Change-Id: Idaf53f673a3e46408826c06bdde2c592395d358b * update bbl plugin version * fix build errors * update bbl profiles * update color --------- Signed-off-by: Kunlong Ma <kunlong.ma@bambulab.com> Signed-off-by: Stone Li <stone.li@bambulab.com> Co-authored-by: Kunlong Ma <kunlong.ma@bambulab.com> Co-authored-by: gerrit <gerrit@bambulab.com> Co-authored-by: liz.li <liz.li@bambulab.com> Co-authored-by: tao wang <tao.wang@bambulab.com> Co-authored-by: lane.wei <lane.wei@bambulab.com> Co-authored-by: maosheng.wei <maosheng.wei@bambulab.com> Co-authored-by: chunmao.guo <chunmao.guo@bambulab.com> Co-authored-by: zhou.xu <zhou.xu@bambulab.com> Co-authored-by: Arthur <arthur.tang@bambulab.com> Co-authored-by: Bastien Nocera <hadess@hadess.net> Co-authored-by: zhimin.zeng <zhimin.zeng@bambulab.com> Co-authored-by: hu.wang <hu.wang@bambulab.com> Co-authored-by: Stone Li <stone.li@bambulab.com> Co-authored-by: XunZhangBambu <xun.zhang@bambulab.com>
This commit is contained in:
parent
481fff494b
commit
3cb573dcb9
203 changed files with 1995 additions and 625 deletions
|
@ -671,6 +671,10 @@ void AMSMaterialsSetting::set_colors(std::vector<wxColour> colors)
|
|||
m_clr_picker->set_colors(colors);
|
||||
}
|
||||
|
||||
void AMSMaterialsSetting::set_ctype(int ctype)
|
||||
{
|
||||
m_clr_picker->ctype = ctype;
|
||||
}
|
||||
|
||||
void AMSMaterialsSetting::on_picker_color(wxCommandEvent& event)
|
||||
{
|
||||
|
@ -1107,6 +1111,8 @@ ColorPicker::ColorPicker(wxWindow* parent, wxWindowID id, const wxPoint& pos /*=
|
|||
Bind(wxEVT_PAINT, &ColorPicker::paintEvent, this);
|
||||
|
||||
m_bitmap_border = create_scaled_bitmap("color_picker_border", nullptr, 25);
|
||||
m_bitmap_border_dark = create_scaled_bitmap("color_picker_border_dark", nullptr, 25);
|
||||
m_bitmap_transparent_def = create_scaled_bitmap("transparent_color_picker", nullptr, 25);
|
||||
m_bitmap_transparent = create_scaled_bitmap("transparent_color_picker", nullptr, 25);
|
||||
}
|
||||
|
||||
|
@ -1115,11 +1121,16 @@ ColorPicker::~ColorPicker(){}
|
|||
void ColorPicker::msw_rescale()
|
||||
{
|
||||
m_bitmap_border = create_scaled_bitmap("color_picker_border", nullptr, 25);
|
||||
m_bitmap_border_dark = create_scaled_bitmap("color_picker_border_dark", nullptr, 25);
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void ColorPicker::set_color(wxColour col)
|
||||
{
|
||||
if (m_colour != col && col.Alpha() != 0 && col.Alpha() != 255 && col.Alpha() != 254) {
|
||||
transparent_changed = true;
|
||||
}
|
||||
m_colour = col;
|
||||
Refresh();
|
||||
}
|
||||
|
@ -1161,11 +1172,27 @@ void ColorPicker::doRender(wxDC& dc)
|
|||
{
|
||||
wxSize size = GetSize();
|
||||
auto alpha = m_colour.Alpha();
|
||||
|
||||
auto radius = m_show_full ? size.x / 2 - FromDIP(1) : size.x / 2;
|
||||
if (m_selected) radius -= FromDIP(1);
|
||||
|
||||
if (alpha == 0) {
|
||||
dc.DrawBitmap(m_bitmap_transparent_def, 0, 0);
|
||||
}
|
||||
else if (alpha != 254 && alpha != 255) {
|
||||
if (transparent_changed) {
|
||||
std::string rgb = (m_colour.GetAsString(wxC2S_HTML_SYNTAX)).ToStdString();
|
||||
if (rgb.size() == 9) {
|
||||
//delete alpha value
|
||||
rgb = rgb.substr(0, rgb.size() - 2);
|
||||
}
|
||||
float alpha_f = 0.7 * m_colour.Alpha() / 255.0;
|
||||
std::vector<std::string> replace;
|
||||
replace.push_back(rgb);
|
||||
std::string fill_replace = "fill-opacity=\"" + std::to_string(alpha_f);
|
||||
replace.push_back(fill_replace);
|
||||
m_bitmap_transparent = ScalableBitmap(this, "transparent_color_picker", 25, false, false, true, replace).bmp();
|
||||
transparent_changed = false;
|
||||
}
|
||||
dc.DrawBitmap(m_bitmap_transparent, 0, 0);
|
||||
}
|
||||
else {
|
||||
|
@ -1185,27 +1212,50 @@ void ColorPicker::doRender(wxDC& dc)
|
|||
dc.SetBrush(*wxTRANSPARENT_BRUSH);
|
||||
dc.DrawCircle(size.x / 2, size.y / 2, radius);
|
||||
|
||||
//transparent
|
||||
if (alpha == 0) {
|
||||
dc.DrawBitmap(m_bitmap_transparent, 0, 0);
|
||||
}
|
||||
|
||||
if (m_cols.size() > 1) {
|
||||
int left = FromDIP(0);
|
||||
float total_width = size.x;
|
||||
int gwidth = std::round(total_width / (m_cols.size() - 1));
|
||||
if (ctype == 0) {
|
||||
int left = FromDIP(0);
|
||||
float total_width = size.x;
|
||||
int gwidth = std::round(total_width / (m_cols.size() - 1));
|
||||
|
||||
for (int i = 0; i < m_cols.size() - 1; i++) {
|
||||
for (int i = 0; i < m_cols.size() - 1; i++) {
|
||||
|
||||
if ((left + gwidth) > (size.x)) {
|
||||
gwidth = size.x - left;
|
||||
if ((left + gwidth) > (size.x)) {
|
||||
gwidth = size.x - left;
|
||||
}
|
||||
|
||||
auto rect = wxRect(left, 0, gwidth, size.y);
|
||||
dc.GradientFillLinear(rect, m_cols[i], m_cols[i + 1], wxEAST);
|
||||
left += gwidth;
|
||||
}
|
||||
if (wxGetApp().dark_mode()) {
|
||||
dc.DrawBitmap(m_bitmap_border_dark, wxPoint(0, 0));
|
||||
}
|
||||
else {
|
||||
dc.DrawBitmap(m_bitmap_border, wxPoint(0, 0));
|
||||
}
|
||||
}
|
||||
else {
|
||||
float ev_angle = 360.0 / m_cols.size();
|
||||
float startAngle = 270.0;
|
||||
float endAngle = 270.0;
|
||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||
for (int i = 0; i < m_cols.size(); i++) {
|
||||
dc.SetBrush(m_cols[i]);
|
||||
endAngle += ev_angle;
|
||||
endAngle = endAngle > 360.0 ? endAngle - 360.0 : endAngle;
|
||||
wxPoint center(size.x / 2, size.y / 2);
|
||||
dc.DrawEllipticArc(center.x - radius, center.y - radius, 2 * radius, 2 * radius, startAngle, endAngle);
|
||||
startAngle += ev_angle;
|
||||
startAngle = startAngle > 360.0 ? startAngle - 360.0 : startAngle;
|
||||
}
|
||||
if (wxGetApp().dark_mode()) {
|
||||
dc.DrawBitmap(m_bitmap_border_dark, wxPoint(0, 0));
|
||||
}
|
||||
else {
|
||||
dc.DrawBitmap(m_bitmap_border, wxPoint(0, 0));
|
||||
}
|
||||
|
||||
auto rect = wxRect(left, 0, gwidth, size.y);
|
||||
dc.GradientFillLinear(rect, m_cols[i], m_cols[i + 1], wxEAST);
|
||||
left += gwidth;
|
||||
}
|
||||
dc.DrawBitmap(m_bitmap_border, wxPoint(0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,13 +33,18 @@ class ColorPicker : public wxWindow
|
|||
{
|
||||
public:
|
||||
wxBitmap m_bitmap_border;
|
||||
wxBitmap m_bitmap_border_dark;
|
||||
wxBitmap m_bitmap_transparent;
|
||||
wxBitmap m_bitmap_transparent_def; //default transparent material
|
||||
|
||||
wxColour m_colour;
|
||||
std::vector<wxColour> m_cols;
|
||||
bool m_selected{false};
|
||||
bool m_show_full{false};
|
||||
bool m_is_empty{false};
|
||||
int ctype;
|
||||
|
||||
bool transparent_changed{false};
|
||||
|
||||
ColorPicker(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
|
||||
~ColorPicker();
|
||||
|
@ -108,6 +113,7 @@ public:
|
|||
void set_color(wxColour color);
|
||||
void set_empty_color(wxColour color);
|
||||
void set_colors(std::vector<wxColour> colors);
|
||||
void set_ctype(int ctype);
|
||||
|
||||
void on_picker_color(wxCommandEvent& color);
|
||||
MachineObject* obj{ nullptr };
|
||||
|
|
|
@ -573,7 +573,7 @@ wxString get_fail_reason(int code)
|
|||
agent->track_update_property("dev_ota_version", m_machine_info->get_ota_version());
|
||||
|
||||
m_simplebook->SetSelection(0);
|
||||
auto m_bind_job = std::make_unique<BindJob>(m_machine_info->dev_id, m_machine_info->dev_ip, m_machine_info->bind_sec_link);
|
||||
auto m_bind_job = std::make_unique<BindJob>(m_machine_info->dev_id, m_machine_info->dev_ip, m_machine_info->bind_sec_link, m_machine_info->bind_ssdp_version);
|
||||
|
||||
if (m_machine_info && (m_machine_info->get_printer_series() == PrinterSeries::SERIES_X1)) {
|
||||
m_bind_job->set_improved(false);
|
||||
|
|
|
@ -387,6 +387,78 @@ replaces["\"#009688\""] = "\"#00675b\"";
|
|||
return this->insert_raw_rgba(bitmap_key, width, height, data.data(), grayscale);
|
||||
}
|
||||
|
||||
wxBitmap* BitmapCache::load_svg2(const std::string& bitmap_name, unsigned target_width, unsigned target_height,
|
||||
const bool grayscale/* = false*/, const bool dark_mode/* = false*/, const std::vector<std::string>& array_new_color /*= vector<std::string>()*/, const float scale_in_center/* = 0*/)
|
||||
{
|
||||
|
||||
std::map<std::string, std::string> replaces;
|
||||
if (array_new_color.size() == 2) {
|
||||
replaces["#D9D9D9"] = array_new_color[0];
|
||||
replaces["fill-opacity=\"1.0"] = array_new_color[1];
|
||||
}
|
||||
|
||||
|
||||
NSVGimage* image = nullptr;
|
||||
image = nsvgParseFromFileWithReplace(Slic3r::var(bitmap_name + ".svg").c_str(), "px", 96.0f, replaces);
|
||||
|
||||
if (image == nullptr)
|
||||
return nullptr;
|
||||
|
||||
if (target_height == 0 && target_width == 0)
|
||||
target_height = image->height;
|
||||
|
||||
target_height != 0 ? target_height *= m_scale : target_width *= m_scale;
|
||||
|
||||
float svg_scale = target_height != 0 ?
|
||||
(float)target_height / image->height : target_width != 0 ?
|
||||
(float)target_width / image->width : 1;
|
||||
|
||||
int width = (int)(svg_scale * image->width + 0.5f);
|
||||
int height = (int)(svg_scale * image->height + 0.5f);
|
||||
int n_pixels = width * height;
|
||||
if (n_pixels <= 0) {
|
||||
::nsvgDelete(image);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NSVGrasterizer* rast = ::nsvgCreateRasterizer();
|
||||
if (rast == nullptr) {
|
||||
::nsvgDelete(image);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::vector<unsigned char> data(n_pixels * 4, 0);
|
||||
// BBS: support resize by fill border
|
||||
if (scale_in_center > 0 && scale_in_center < svg_scale) {
|
||||
int w = (int)(image->width * scale_in_center);
|
||||
int h = (int)(image->height * scale_in_center);
|
||||
::nsvgRasterize(rast, image, 0, 0, scale_in_center, data.data() + int(height - h) / 2 * width * 4 + int(width - w) / 2 * 4, w, h, width * 4);
|
||||
}
|
||||
else
|
||||
::nsvgRasterize(rast, image, 0, 0, svg_scale, data.data(), width, height, width * 4);
|
||||
::nsvgDeleteRasterizer(rast);
|
||||
::nsvgDelete(image);
|
||||
|
||||
const unsigned char * raw_data = data.data();
|
||||
wxImage wx_image(width, height);
|
||||
wx_image.InitAlpha();
|
||||
unsigned char* rgb = wx_image.GetData();
|
||||
unsigned char* alpha = wx_image.GetAlpha();
|
||||
unsigned int pixels = width * height;
|
||||
for (unsigned int i = 0; i < pixels; ++i) {
|
||||
*rgb++ = *raw_data++;
|
||||
*rgb++ = *raw_data++;
|
||||
*rgb++ = *raw_data++;
|
||||
*alpha++ = *raw_data++;
|
||||
}
|
||||
|
||||
if (grayscale)
|
||||
wx_image = wx_image.ConvertToGreyscale(m_gs, m_gs, m_gs);
|
||||
auto result = new wxBitmap(wxImage_to_wxBitmap_with_alpha(std::move(wx_image), m_scale));
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
//we make scaled solid bitmaps only for the cases, when its will be used with scaled SVG icon in one output bitmap
|
||||
wxBitmap BitmapCache::mksolid(size_t width, size_t height, unsigned char r, unsigned char g, unsigned char b, unsigned char transparency, bool suppress_scaling/* = false*/, size_t border_width /*= 0*/, bool dark_mode/* = false*/)
|
||||
{
|
||||
|
|
|
@ -43,6 +43,8 @@ public:
|
|||
static NSVGimage* nsvgParseFromFileWithReplace(const char* filename, const char* units, float dpi, const std::map<std::string, std::string>& replaces);
|
||||
// Load svg from resources/icons. bitmap_key is given without the .svg suffix. SVG will be rasterized to provided height/width.
|
||||
wxBitmap* load_svg(const std::string &bitmap_key, unsigned width = 0, unsigned height = 0, const bool grayscale = false, const bool dark_mode = false, const std::string& new_color = "", const float scale_in_center = 0.f);
|
||||
//Load background image of semi transparent material with color,
|
||||
wxBitmap* load_svg2(const std::string &bitmap_key, unsigned width = 0, unsigned height = 0, const bool grayscale = false, const bool dark_mode = false, const std::vector<std::string>& array_new_color = std::vector<std::string>(), const float scale_in_center = 0.0f);
|
||||
|
||||
wxBitmap mksolid(size_t width, size_t height, unsigned char r, unsigned char g, unsigned char b, unsigned char transparency, bool suppress_scaling = false, size_t border_width = 0, bool dark_mode = false);
|
||||
wxBitmap mksolid(size_t width, size_t height, const unsigned char rgb[3], bool suppress_scaling = false, size_t border_width = 0, bool dark_mode = false) { return mksolid(width, height, rgb[0], rgb[1], rgb[2], wxALPHA_OPAQUE, suppress_scaling, border_width, dark_mode); }
|
||||
|
|
|
@ -1790,7 +1790,10 @@ Preset* CalibrationPresetPage::get_printer_preset(MachineObject* obj, float nozz
|
|||
if (printer_nozzle_opt)
|
||||
printer_nozzle_vals = dynamic_cast<ConfigOptionFloats*>(printer_nozzle_opt);
|
||||
std::string model_id = printer_it->get_current_printer_type(preset_bundle);
|
||||
if (model_id.compare(obj->printer_type) == 0
|
||||
|
||||
std::string printer_type = obj->printer_type;
|
||||
if (obj->is_support_p1s_plus) { printer_type = "C12"; }
|
||||
if (model_id.compare(printer_type) == 0
|
||||
&& printer_nozzle_vals
|
||||
&& abs(printer_nozzle_vals->get_at(0) - nozzle_value) < 1e-3) {
|
||||
printer_preset = &(*printer_it);
|
||||
|
|
|
@ -261,11 +261,9 @@ void CaliPASaveAutoPanel::sync_cali_result(const std::vector<PACalibResult>& cal
|
|||
static std::vector<PACalibResult> filtered_results;
|
||||
filtered_results.clear();
|
||||
for (auto history : history_result) {
|
||||
for (auto& info : m_obj->selected_cali_preset) {
|
||||
if (history.filament_id == info.filament_id) {
|
||||
filtered_results.push_back(history);
|
||||
selections.push_back(from_u8(history.name));
|
||||
}
|
||||
if (history.filament_id == item.filament_id) {
|
||||
filtered_results.push_back(history);
|
||||
selections.push_back(from_u8(history.name));
|
||||
}
|
||||
}
|
||||
comboBox_tray_name->Set(selections);
|
||||
|
|
|
@ -420,7 +420,7 @@ static std::string get_filament_id(std::string vendor_typr_serial)
|
|||
continue;
|
||||
}
|
||||
std::string filament_name = preset_name.substr(0, index_at - 1);
|
||||
if (filament_name == vendor_typr_serial)
|
||||
if (filament_name == vendor_typr_serial && preset.filament_id != "null")
|
||||
return preset.filament_id;
|
||||
filament_id_to_filament_name[preset.filament_id].insert(filament_name);
|
||||
}
|
||||
|
@ -437,7 +437,7 @@ static std::string get_filament_id(std::string vendor_typr_serial)
|
|||
continue;
|
||||
}
|
||||
std::string filament_name = preset_name.substr(0, index_at - 1);
|
||||
if (filament_name == vendor_typr_serial)
|
||||
if (filament_name == vendor_typr_serial && preset->filament_id != "null")
|
||||
return preset->filament_id;
|
||||
filament_id_to_filament_name[preset->filament_id].insert(filament_name);
|
||||
}
|
||||
|
@ -460,7 +460,7 @@ static std::string get_filament_id(std::string vendor_typr_serial)
|
|||
user_filament_id = "P" + calculate_md5(vendor_typr_serial + get_curr_time()).substr(0, 7);
|
||||
}
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " filament name is: " << vendor_typr_serial << "and create filament id is: " << user_filament_id;
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " filament name is: " << vendor_typr_serial << "and create filament_id is: " << user_filament_id;
|
||||
return user_filament_id;
|
||||
}
|
||||
|
||||
|
@ -864,7 +864,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_filament_preset_item()
|
|||
}
|
||||
}
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " not find filament id corresponding to the type: and the type is" << filament_type;
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " not find filament_id corresponding to the type: and the type is" << filament_type;
|
||||
}
|
||||
sort_printer_by_nozzle(printer_name_to_filament_preset);
|
||||
for (std::pair<std::string, Preset *> printer_to_preset : printer_name_to_filament_preset)
|
||||
|
@ -1105,7 +1105,8 @@ wxArrayString CreateFilamentPresetDialog::get_filament_preset_choices()
|
|||
Preset *preset = filament_presets.second;
|
||||
auto inherit = preset->config.option<ConfigOptionString>("inherits");
|
||||
if (inherit && !inherit->value.empty()) continue;
|
||||
if (std::string::npos == filament_presets.first.find(type_name)) continue;
|
||||
auto fila_type = preset->config.option<ConfigOptionStrings>("filament_type");
|
||||
if (!fila_type || fila_type->values.empty() || system_filament_types_map[type_name] != fila_type->values[0]) continue;
|
||||
m_filament_choice_map[preset->filament_id].push_back(preset);
|
||||
}
|
||||
|
||||
|
@ -1115,7 +1116,7 @@ wxArrayString CreateFilamentPresetDialog::get_filament_preset_choices()
|
|||
std::set<wxString> preset_name_set;
|
||||
for (Preset* filament_preset : preset.second) {
|
||||
std::string preset_name = filament_preset->name;
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " filament id: " << filament_preset->filament_id << " preset name: " << filament_preset->name;
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " filament_id: " << filament_preset->filament_id << " preset name: " << filament_preset->name;
|
||||
size_t index_at = preset_name.find("@");
|
||||
if (std::string::npos != index_at) {
|
||||
std::string cur_preset_name = preset_name.substr(0, index_at - 1);
|
||||
|
@ -2645,7 +2646,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent)
|
|||
/****************************** clone filament preset ********************************/
|
||||
std::vector<std::string> failures;
|
||||
if (!selected_filament_presets.empty()) {
|
||||
bool create_preset_result = preset_bundle->filaments.create_presets_from_template_for_printer(selected_filament_presets, failures, printer_preset_name, get_filament_id, rewritten);
|
||||
bool create_preset_result = preset_bundle->filaments.clone_presets_for_printer(selected_filament_presets, failures, printer_preset_name, get_filament_id, rewritten);
|
||||
if (!create_preset_result) {
|
||||
std::string message;
|
||||
for (const std::string &failure : failures) { message += "\t" + failure + "\n"; }
|
||||
|
@ -2654,7 +2655,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent)
|
|||
wxYES | wxYES_DEFAULT | wxCENTRE);
|
||||
int res = dlg.ShowModal();
|
||||
if (wxID_YES == res) {
|
||||
create_preset_result = preset_bundle->filaments.create_presets_from_template_for_printer(selected_filament_presets, failures, printer_preset_name,
|
||||
create_preset_result = preset_bundle->filaments.clone_presets_for_printer(selected_filament_presets, failures, printer_preset_name,
|
||||
get_filament_id, true);
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " printer preset no same preset but filament has same preset, user cancel create the printer preset";
|
||||
|
@ -2670,7 +2671,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent)
|
|||
failures.clear();
|
||||
if (!selected_process_presets.empty()) {
|
||||
generate_process_presets_data(selected_process_presets, printer_nozzle_name);
|
||||
bool create_preset_result = preset_bundle->prints.create_presets_from_template_for_printer(selected_process_presets, failures, printer_preset_name,
|
||||
bool create_preset_result = preset_bundle->prints.clone_presets_for_printer(selected_process_presets, failures, printer_preset_name,
|
||||
get_filament_id, rewritten);
|
||||
if (!create_preset_result) {
|
||||
std::string message;
|
||||
|
@ -2680,7 +2681,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent)
|
|||
wxYES | wxYES_DEFAULT | wxCENTRE);
|
||||
int res = dlg.ShowModal();
|
||||
if (wxID_YES == res) {
|
||||
create_preset_result = preset_bundle->prints.create_presets_from_template_for_printer(selected_process_presets, failures, printer_preset_name, get_filament_id, true);
|
||||
create_preset_result = preset_bundle->prints.clone_presets_for_printer(selected_process_presets, failures, printer_preset_name, get_filament_id, true);
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " printer preset no same preset but process has same preset, user cancel create the printer preset";
|
||||
return;
|
||||
|
@ -2692,7 +2693,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent)
|
|||
/****************************** clone filament preset ********************************/
|
||||
std::vector<std::string> failures;
|
||||
if (!selected_filament_presets.empty()) {
|
||||
bool create_preset_result = preset_bundle->filaments.clone_presets_for_printer(selected_filament_presets, failures, printer_preset_name, rewritten);
|
||||
bool create_preset_result = preset_bundle->filaments.clone_presets_for_printer(selected_filament_presets, failures, printer_preset_name, get_filament_id, rewritten);
|
||||
if (!create_preset_result) {
|
||||
std::string message;
|
||||
for (const std::string& failure : failures) {
|
||||
|
@ -2703,7 +2704,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent)
|
|||
wxYES | wxYES_DEFAULT | wxCENTRE);
|
||||
int res = dlg.ShowModal();
|
||||
if (wxID_YES == res) {
|
||||
create_preset_result = preset_bundle->filaments.clone_presets_for_printer(selected_filament_presets, failures, printer_preset_name, true);
|
||||
create_preset_result = preset_bundle->filaments.clone_presets_for_printer(selected_filament_presets, failures, printer_preset_name, get_filament_id, true);
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " printer preset no same preset but filament has same preset, user cancel create the printer preset";
|
||||
return;
|
||||
|
@ -2714,7 +2715,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent)
|
|||
/****************************** clone process preset ********************************/
|
||||
failures.clear();
|
||||
if (!selected_process_presets.empty()) {
|
||||
bool create_preset_result = preset_bundle->prints.clone_presets_for_printer(selected_process_presets, failures, printer_preset_name, rewritten);
|
||||
bool create_preset_result = preset_bundle->prints.clone_presets_for_printer(selected_process_presets, failures, printer_preset_name, get_filament_id, rewritten);
|
||||
if (!create_preset_result) {
|
||||
std::string message;
|
||||
for (const std::string& failure : failures) {
|
||||
|
@ -2723,7 +2724,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent)
|
|||
MessageDialog dlg(this, _L("Create process presets failed. As follows:\n") + from_u8(message) + _L("\nDo you want to rewrite it?"), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE);
|
||||
int res = dlg.ShowModal();
|
||||
if (wxID_YES == res) {
|
||||
create_preset_result = preset_bundle->prints.clone_presets_for_printer(selected_process_presets, failures, printer_preset_name, true);
|
||||
create_preset_result = preset_bundle->prints.clone_presets_for_printer(selected_process_presets, failures, printer_preset_name, get_filament_id, true);
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " printer preset no same preset but filament has same preset, user cancel create the printer preset";
|
||||
return;
|
||||
|
@ -4397,25 +4398,9 @@ void EditFilamentPresetDialog::edit_preset()
|
|||
}
|
||||
|
||||
// edit preset
|
||||
std::shared_ptr<Preset> need_edit_preset = filament_presets[m_need_edit_preset_index];
|
||||
std::string need_edit_preset_name = need_edit_preset->name;
|
||||
Tab * tab = wxGetApp().get_tab(need_edit_preset->type);
|
||||
if (tab == nullptr) {
|
||||
m_selected_printer.clear();
|
||||
m_need_edit_preset_index = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
tab->restore_last_select_item();
|
||||
|
||||
wxGetApp().get_tab(need_edit_preset->type)->select_preset(need_edit_preset_name);
|
||||
// when some preset have modified, if the printer is not need_edit_preset_name compatible printer, the preset will jump to other preset, need select again
|
||||
if (!need_edit_preset->is_compatible) wxGetApp().get_tab(need_edit_preset->type)->select_preset(need_edit_preset_name);
|
||||
|
||||
m_selected_printer.clear();
|
||||
m_need_edit_preset_index = -1;
|
||||
|
||||
m_need_edit_preset = filament_presets[m_need_edit_preset_index];
|
||||
wxGetApp().params_dialog()->set_editing_filament_id(m_filament_id);
|
||||
|
||||
EndModal(wxID_EDIT);
|
||||
}
|
||||
|
||||
|
@ -4882,6 +4867,14 @@ wxPanel *PresetTree::get_child_item(wxPanel *parent, std::shared_ptr<Preset> pre
|
|||
preset_name->SetFont(Label::Body_10);
|
||||
preset_name->SetForegroundColour(*wxBLACK);
|
||||
sizer->Add(preset_name, 0, wxEXPAND | wxALL, 5);
|
||||
bool base_id_error = false;
|
||||
if (preset->inherits() == "" && preset->base_id != "") base_id_error = true;
|
||||
if (base_id_error) {
|
||||
std::string wiki_url = "https://wiki.bambulab.com/en/software/bambu-studio/custom-filament-issue";
|
||||
wxHyperlinkCtrl *m_download_hyperlink = new wxHyperlinkCtrl(panel, wxID_ANY, _L("[Delete Required]"), wiki_url, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
|
||||
m_download_hyperlink->SetFont(Label::Body_10);
|
||||
sizer->Add(m_download_hyperlink, 0, wxEXPAND | wxALL, 5);
|
||||
}
|
||||
sizer->Add(0, 0, 1, wxEXPAND, 0);
|
||||
|
||||
StateColor flush_bg_col(std::pair<wxColour, int>(wxColour(219, 253, 231), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
|
||||
|
@ -4893,6 +4886,9 @@ wxPanel *PresetTree::get_child_item(wxPanel *parent, std::shared_ptr<Preset> pre
|
|||
StateColor flush_bd_col(std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Pressed), std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(172, 172, 172), StateColor::Normal));
|
||||
|
||||
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(0, 137, 123), StateColor::Pressed), std::pair<wxColour, int>(wxColour(38, 166, 154), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Normal));
|
||||
|
||||
Button *edit_preset_btn = new Button(panel, _L("Edit Preset"));
|
||||
edit_preset_btn->SetFont(Label::Body_10);
|
||||
edit_preset_btn->SetPaddingSize(wxSize(8, 3));
|
||||
|
@ -4908,9 +4904,16 @@ wxPanel *PresetTree::get_child_item(wxPanel *parent, std::shared_ptr<Preset> pre
|
|||
del_preset_btn->SetFont(Label::Body_10);
|
||||
del_preset_btn->SetPaddingSize(wxSize(8, 3));
|
||||
del_preset_btn->SetCornerRadius(8);
|
||||
del_preset_btn->SetBackgroundColor(flush_bg_col);
|
||||
del_preset_btn->SetBorderColor(flush_bd_col);
|
||||
del_preset_btn->SetTextColor(flush_fg_col);
|
||||
if (base_id_error) {
|
||||
del_preset_btn->SetBackgroundColor(btn_bg_green);
|
||||
del_preset_btn->SetBorderColor(btn_bg_green);
|
||||
del_preset_btn->SetTextColor(wxColour(0xFFFFFE));
|
||||
} else {
|
||||
del_preset_btn->SetBackgroundColor(flush_bg_col);
|
||||
del_preset_btn->SetBorderColor(flush_bd_col);
|
||||
del_preset_btn->SetTextColor(flush_fg_col);
|
||||
}
|
||||
|
||||
//del_preset_btn->Hide();
|
||||
sizer->Add(del_preset_btn, 0, wxALL | wxALIGN_CENTER_VERTICAL, 0);
|
||||
|
||||
|
|
|
@ -356,6 +356,7 @@ public:
|
|||
~EditFilamentPresetDialog();
|
||||
|
||||
wxPanel *get_preset_tree_panel() { return m_preset_tree_panel; }
|
||||
std::shared_ptr<Preset> get_need_edit_preset() { return m_need_edit_preset; }
|
||||
void set_printer_name(const std::string &printer_name) { m_selected_printer = printer_name; }
|
||||
void set_need_delete_preset_index(int need_delete_preset_index) { m_need_delete_preset_index = need_delete_preset_index; }
|
||||
void set_need_edit_preset_index(int need_edit_preset_index) { m_need_edit_preset_index = need_edit_preset_index; }
|
||||
|
@ -388,6 +389,7 @@ private:
|
|||
wxStaticText * m_note_text = nullptr;
|
||||
int m_need_delete_preset_index = -1;
|
||||
int m_need_edit_preset_index = -1;
|
||||
std::shared_ptr<Preset> m_need_edit_preset;
|
||||
std::string m_selected_printer = "";
|
||||
std::unordered_map<std::string, std::vector<std::shared_ptr<Preset>>> m_printer_compatible_presets;
|
||||
|
||||
|
|
|
@ -1366,7 +1366,7 @@ void MachineObject::parse_status(int flag)
|
|||
}
|
||||
|
||||
is_support_filament_tangle_detect = ((flag >> 19) & 0x1) != 0;
|
||||
|
||||
is_support_user_preset = ((flag >> 22) & 0x1) != 0;
|
||||
if (xcam_filament_tangle_detect_count > 0)
|
||||
xcam_filament_tangle_detect_count--;
|
||||
else {
|
||||
|
@ -1384,6 +1384,9 @@ void MachineObject::parse_status(int flag)
|
|||
if (installed_plus && supported_plus) {
|
||||
is_support_p1s_plus = true;
|
||||
}
|
||||
else {
|
||||
is_support_p1s_plus = false;
|
||||
}
|
||||
}
|
||||
|
||||
sdcard_state = MachineObject::SdcardState((flag >> 8) & 0x11);
|
||||
|
@ -2226,41 +2229,6 @@ int MachineObject::command_get_flow_ratio_calibration_result(float nozzle_diamet
|
|||
return -1;
|
||||
}
|
||||
|
||||
int MachineObject::command_unload_filament()
|
||||
{
|
||||
if (get_printer_series() == PrinterSeries::SERIES_X1 && !ams_support_virtual_tray) {
|
||||
// fixed gcode file
|
||||
json j;
|
||||
j["print"]["command"] = "gcode_file";
|
||||
j["print"]["param"] = "/usr/etc/print/filament_unload.gcode";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
return this->publish_json(j.dump());
|
||||
}
|
||||
else if (get_printer_series() == PrinterSeries::SERIES_P1P || (get_printer_series() == PrinterSeries::SERIES_X1 && ams_support_virtual_tray) ) {
|
||||
std::string gcode = DeviceManager::load_gcode(printer_type, "ams_unload.gcode");
|
||||
if (gcode.empty()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
json j;
|
||||
j["print"]["command"] = "gcode_line";
|
||||
j["print"]["param"] = gcode;
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
|
||||
if (m_agent)
|
||||
j["print"]["user_id"] = m_agent->get_user_id();
|
||||
|
||||
return this->publish_json(j.dump());
|
||||
}
|
||||
else {
|
||||
json j;
|
||||
j["print"]["command"] = "unload_filament";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
return this->publish_json(j.dump());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int MachineObject::command_ipcam_record(bool on_off)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << "command_ipcam_record = " << on_off;
|
||||
|
@ -2721,7 +2689,7 @@ int MachineObject::parse_json(std::string payload)
|
|||
|
||||
uint64_t t_utc = j.value("t_utc", 0ULL);
|
||||
if (t_utc > 0)
|
||||
last_update_time = std::chrono::system_clock::time_point(t_utc * 1ms);
|
||||
last_utc_time = std::chrono::system_clock::time_point(t_utc * 1ms);
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "parse_json: dev_id=" << dev_id << ", playload=" << j.dump(4);
|
||||
|
||||
|
@ -2745,7 +2713,10 @@ int MachineObject::parse_json(std::string payload)
|
|||
module_vers.emplace(ver_info.name, ver_info);
|
||||
if (ver_info.name == "ota") {
|
||||
NetworkAgent* agent = GUI::wxGetApp().getAgent();
|
||||
if (agent) agent->track_update_property("dev_ota_ver", ver_info.sw_ver);
|
||||
if (agent) {
|
||||
std::string dev_ota_str = "dev_ota_ver:" + this->dev_id;
|
||||
agent->track_update_property(dev_ota_str, ver_info.sw_ver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3869,6 +3840,10 @@ int MachineObject::parse_json(std::string payload)
|
|||
curr_tray->color = "";
|
||||
}
|
||||
|
||||
if (tray_it->contains("ctype"))
|
||||
curr_tray->ctype = (*tray_it)["ctype"].get<int>();
|
||||
else
|
||||
curr_tray->ctype = 0;
|
||||
curr_tray->cols.clear();
|
||||
if (tray_it->contains("cols")) {
|
||||
if ((*tray_it)["cols"].is_array()) {
|
||||
|
@ -4943,9 +4918,13 @@ void DeviceManager::on_machine_alive(std::string json_str)
|
|||
std::string connect_type = j["connect_type"].get<std::string>();
|
||||
std::string bind_state = j["bind_state"].get<std::string>();
|
||||
std::string sec_link = "";
|
||||
std::string ssdp_version = "";
|
||||
if (j.contains("sec_link")) {
|
||||
sec_link = j["sec_link"].get<std::string>();
|
||||
}
|
||||
if (j.contains("ssdp_version")) {
|
||||
ssdp_version = j["ssdp_version"].get<std::string>();
|
||||
}
|
||||
std::string connection_name = "";
|
||||
if (j.contains("connection_name")) {
|
||||
connection_name = j["connection_name"].get<std::string>();
|
||||
|
@ -4960,6 +4939,7 @@ void DeviceManager::on_machine_alive(std::string json_str)
|
|||
it->second->bind_state = bind_state;
|
||||
it->second->bind_sec_link = sec_link;
|
||||
it->second->dev_connection_type = connect_type;
|
||||
it->second->bind_ssdp_version = ssdp_version;
|
||||
}
|
||||
|
||||
/* update localMachineList */
|
||||
|
@ -4990,6 +4970,7 @@ void DeviceManager::on_machine_alive(std::string json_str)
|
|||
obj->dev_connection_type= connect_type;
|
||||
obj->bind_state = bind_state;
|
||||
obj->bind_sec_link = sec_link;
|
||||
obj->bind_ssdp_version = ssdp_version;
|
||||
obj->printer_type = MachineObject::parse_printer_type(printer_type_str);
|
||||
|
||||
// U0 firmware
|
||||
|
@ -5014,6 +4995,7 @@ void DeviceManager::on_machine_alive(std::string json_str)
|
|||
obj->bind_state = bind_state;
|
||||
obj->bind_sec_link = sec_link;
|
||||
obj->dev_connection_name = connection_name;
|
||||
obj->bind_ssdp_version = ssdp_version;
|
||||
obj->m_is_online = true;
|
||||
|
||||
//load access code
|
||||
|
|
|
@ -192,6 +192,7 @@ public:
|
|||
std::string nozzle_temp_min;
|
||||
std::string xcam_info;
|
||||
std::string uuid;
|
||||
int ctype = 0;
|
||||
float k = 0.0f; // k range: 0 ~ 0.5
|
||||
float n = 0.0f; // k range: 0.6 ~ 2.0
|
||||
int cali_idx = 0;
|
||||
|
@ -450,6 +451,7 @@ public:
|
|||
std::string bind_user_id;
|
||||
std::string bind_state; /* free | occupied */
|
||||
std::string bind_sec_link;
|
||||
std::string bind_ssdp_version;
|
||||
bool is_avaliable() { return bind_state == "free"; }
|
||||
time_t last_alive;
|
||||
bool m_is_online;
|
||||
|
@ -461,6 +463,7 @@ public:
|
|||
int parse_msg_count = 0;
|
||||
int keep_alive_count = 0;
|
||||
std::chrono::system_clock::time_point last_update_time; /* last received print data from machine */
|
||||
std::chrono::system_clock::time_point last_utc_time; /* last received print data from machine */
|
||||
std::chrono::system_clock::time_point last_keep_alive; /* last received print data from machine */
|
||||
std::chrono::system_clock::time_point last_push_time; /* last received print push from machine */
|
||||
std::chrono::system_clock::time_point last_request_push; /* last received print push from machine */
|
||||
|
@ -877,8 +880,6 @@ public:
|
|||
int command_start_flow_ratio_calibration(const X1CCalibInfos& calib_data);
|
||||
int command_get_flow_ratio_calibration_result(float nozzle_diameter);
|
||||
|
||||
int command_unload_filament();
|
||||
|
||||
// camera control
|
||||
int command_ipcam_record(bool on_off);
|
||||
int command_ipcam_timelapse(bool on_off);
|
||||
|
|
|
@ -1062,17 +1062,6 @@ public:
|
|||
void highlight_toolbar_item(const std::string& item_name);
|
||||
void highlight_gizmo(const std::string& gizmo_name);
|
||||
|
||||
ArrangeSettings get_arrange_settings() const {
|
||||
const ArrangeSettings &settings = get_arrange_settings(this);
|
||||
ArrangeSettings ret = settings;
|
||||
if (&settings == &m_arrange_settings_fff_seq_print) {
|
||||
ret.distance = std::max(ret.distance,
|
||||
float(min_object_distance(*m_config)));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Timestamp for FPS calculation and notification fade-outs.
|
||||
static int64_t timestamp_now() {
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -1028,8 +1028,12 @@ void GUI_App::post_init()
|
|||
// BOOST_LOG_TRIVIAL(info) << "Loading user presets...";
|
||||
// scrn->SetText(_L("Loading user presets..."));
|
||||
if (m_agent) { start_sync_user_preset(); }
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " sync_user_preset: true";
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " sync_user_preset: false";
|
||||
}
|
||||
|
||||
m_open_method = "double_click";
|
||||
bool switch_to_3d = false;
|
||||
if (!this->init_params->input_files.empty()) {
|
||||
|
||||
|
@ -1053,6 +1057,7 @@ void GUI_App::post_init()
|
|||
if (!download_file_url.empty() && ( boost::starts_with(download_file_url, "http://") || boost::starts_with(download_file_url, "https://")) ) {
|
||||
request_model_download(download_origin_url);
|
||||
}
|
||||
m_open_method = "makerworld";
|
||||
}
|
||||
else {
|
||||
switch_to_3d = true;
|
||||
|
@ -1060,23 +1065,28 @@ void GUI_App::post_init()
|
|||
mainframe->select_tab(size_t(MainFrame::tp3DEditor));
|
||||
plater_->select_view_3D("3D");
|
||||
this->plater()->load_gcode(from_u8(this->init_params->input_files.front()));
|
||||
m_open_method = "gcode";
|
||||
}
|
||||
else {
|
||||
mainframe->select_tab(size_t(MainFrame::tp3DEditor));
|
||||
plater_->select_view_3D("3D");
|
||||
Plater::TakeSnapshot snapshot(this->plater(), "Load Project", UndoRedo::SnapshotType::ProjectSeparator);
|
||||
const std::vector<size_t> res = this->plater()->load_files(this->init_params->input_files);
|
||||
if (!res.empty()) {
|
||||
if (this->init_params->input_files.size() == 1) {
|
||||
// Update application titlebar when opening a project file
|
||||
const std::string& filename = this->init_params->input_files.front();
|
||||
this->plater()->up_to_date(true, false);
|
||||
this->plater()->up_to_date(true, true);
|
||||
//BBS: remove amf logic as project
|
||||
if (boost::algorithm::iends_with(filename, ".3mf"))
|
||||
this->plater()->set_project_filename(from_u8(filename));
|
||||
wxArrayString input_files;
|
||||
for (auto & file : this->init_params->input_files) {
|
||||
input_files.push_back(wxString::FromUTF8(file));
|
||||
}
|
||||
this->plater()->set_project_filename(_L("Untitled"));
|
||||
this->plater()->load_files(input_files);
|
||||
try {
|
||||
if (!input_files.empty()) {
|
||||
std::string file_path = input_files.front().ToStdString();
|
||||
std::filesystem::path path(file_path);
|
||||
m_open_method = "file_" + path.extension().string();
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ", file path exception!";
|
||||
m_open_method = "file";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3300,17 +3310,8 @@ void GUI_App::link_to_network_check()
|
|||
else if (country_code == "CN") {
|
||||
url = "https://status.bambulab.cn";
|
||||
}
|
||||
else if (country_code == "ENV_CN_DEV") {
|
||||
url = "https://status.bambu-lab.com";
|
||||
}
|
||||
else if (country_code == "ENV_CN_QA") {
|
||||
url = "https://status.bambu-lab.com";
|
||||
}
|
||||
else if (country_code == "ENV_CN_PRE") {
|
||||
url = "https://status.bambu-lab.com";
|
||||
}
|
||||
else {
|
||||
url = "https://status.bambu-lab.com";
|
||||
url = "https://status.bambulab.com";
|
||||
}
|
||||
wxLaunchDefaultBrowser(url);
|
||||
}
|
||||
|
@ -4162,6 +4163,10 @@ void GUI_App::check_track_enable()
|
|||
/* record studio start event */
|
||||
json j;
|
||||
j["user_mode"] = this->get_mode_str();
|
||||
j["open_method"] = m_open_method;
|
||||
if (m_agent) {
|
||||
m_agent->track_event("studio_launch", j.dump());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5881,7 +5886,7 @@ void GUI_App::OSXStoreOpenFiles(const wxArrayString &fileNames)
|
|||
|
||||
void GUI_App::MacOpenURL(const wxString& url)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "get mac url " << url;
|
||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << "get mac url " << url;
|
||||
|
||||
if (!url.empty() && boost::starts_with(url, "orcasliceropen://")) {
|
||||
auto input_str_arr = split_str(url.ToStdString(), "orcasliceropen://");
|
||||
|
@ -5892,7 +5897,7 @@ void GUI_App::MacOpenURL(const wxString& url)
|
|||
}
|
||||
|
||||
std::string download_file_url = url_decode(download_origin_url);
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << download_file_url;
|
||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << download_file_url;
|
||||
if (!download_file_url.empty() && (boost::starts_with(download_file_url, "http://") || boost::starts_with(download_file_url, "https://"))) {
|
||||
|
||||
if (m_post_initialized) {
|
||||
|
@ -6064,6 +6069,12 @@ void GUI_App::open_mall_page_dialog()
|
|||
link_url = host_url + model_url;
|
||||
}
|
||||
|
||||
if (link_url.find("?") != std::string::npos) {
|
||||
link_url += "&from=orcaslicer";
|
||||
} else {
|
||||
link_url += "?from=orcaslicer";
|
||||
}
|
||||
|
||||
wxLaunchDefaultBrowser(link_url);
|
||||
}
|
||||
|
||||
|
|
|
@ -664,6 +664,7 @@ private:
|
|||
std::string m_older_data_dir_path;
|
||||
boost::optional<Semver> m_last_config_version;
|
||||
bool m_config_corrupted { false };
|
||||
std::string m_open_method;
|
||||
};
|
||||
|
||||
DECLARE_APP(GUI_App)
|
||||
|
|
|
@ -915,6 +915,10 @@ void MenuFactory::append_menu_items_flush_options(wxMenu* menu)
|
|||
ModelConfig& select_object_config = object_list->object(selection.get_object_idx())->config;
|
||||
|
||||
wxMenu* flush_options_menu = new wxMenu();
|
||||
auto can_flush = [&global_config]() {
|
||||
auto option = global_config.option("enable_prime_tower");
|
||||
return option ? option->getBool() : false;
|
||||
};
|
||||
append_menu_check_item(flush_options_menu, wxID_ANY, _L("Flush into objects' infill"), "",
|
||||
[&select_object_config, &global_config](wxCommandEvent&) {
|
||||
const ConfigOption* option = select_object_config.option(FREQ_SETTINGS_BUNDLE_FFF["Flush options"][0]);
|
||||
|
@ -923,8 +927,8 @@ void MenuFactory::append_menu_items_flush_options(wxMenu* menu)
|
|||
}
|
||||
select_object_config.set_key_value(FREQ_SETTINGS_BUNDLE_FFF["Flush options"][0], new ConfigOptionBool(!option->getBool()));
|
||||
wxGetApp().obj_settings()->UpdateAndShow(true);
|
||||
}, menu, []() {return true; },
|
||||
[&select_object_config, &global_config]() {
|
||||
}, menu, can_flush,
|
||||
[&select_object_config, &global_config]() {
|
||||
const ConfigOption* option = select_object_config.option(FREQ_SETTINGS_BUNDLE_FFF["Flush options"][0]);
|
||||
if (!option) {
|
||||
option = global_config.option(FREQ_SETTINGS_BUNDLE_FFF["Flush options"][0]);
|
||||
|
@ -940,8 +944,8 @@ void MenuFactory::append_menu_items_flush_options(wxMenu* menu)
|
|||
}
|
||||
select_object_config.set_key_value(FREQ_SETTINGS_BUNDLE_FFF["Flush options"][1], new ConfigOptionBool(!option->getBool()));
|
||||
wxGetApp().obj_settings()->UpdateAndShow(true);
|
||||
}, menu, []() {return true; },
|
||||
[&select_object_config, &global_config]() {
|
||||
}, menu, can_flush,
|
||||
[&select_object_config, &global_config]() {
|
||||
const ConfigOption* option = select_object_config.option(FREQ_SETTINGS_BUNDLE_FFF["Flush options"][1]);
|
||||
if (!option) {
|
||||
option = global_config.option(FREQ_SETTINGS_BUNDLE_FFF["Flush options"][1]);
|
||||
|
@ -957,8 +961,8 @@ void MenuFactory::append_menu_items_flush_options(wxMenu* menu)
|
|||
}
|
||||
select_object_config.set_key_value(FREQ_SETTINGS_BUNDLE_FFF["Flush options"][2], new ConfigOptionBool(!option->getBool()));
|
||||
wxGetApp().obj_settings()->UpdateAndShow(true);
|
||||
}, menu, []() {return true; },
|
||||
[&select_object_config, &global_config]() {
|
||||
}, menu, can_flush,
|
||||
[&select_object_config, &global_config]() {
|
||||
const ConfigOption* option = select_object_config.option(FREQ_SETTINGS_BUNDLE_FFF["Flush options"][2]);
|
||||
if (!option) {
|
||||
option = global_config.option(FREQ_SETTINGS_BUNDLE_FFF["Flush options"][2]);
|
||||
|
|
|
@ -2892,15 +2892,16 @@ void ObjectList::boolean()
|
|||
|
||||
Plater::TakeSnapshot snapshot(wxGetApp().plater(), "boolean");
|
||||
|
||||
Model* model = (*m_objects)[0]->get_model();
|
||||
ModelObject* new_object = model->add_object();
|
||||
new_object->name = (*m_objects)[0]->name;
|
||||
new_object->config.assign_config((*m_objects)[0]->config);
|
||||
if (new_object->instances.empty())
|
||||
new_object->add_instance();
|
||||
|
||||
ModelObject* object = (*m_objects)[obj_idxs.front()];
|
||||
TriangleMesh mesh = Plater::combine_mesh_fff(*object, -1, [this](const std::string& msg) {return wxGetApp().notification_manager()->push_plater_error_notification(msg); });
|
||||
|
||||
// add mesh to model as a new object, keep the original object's name and config
|
||||
Model* model = object->get_model();
|
||||
ModelObject* new_object = model->add_object();
|
||||
new_object->name = object->name;
|
||||
new_object->config.assign_config(object->config);
|
||||
if (new_object->instances.empty())
|
||||
new_object->add_instance();
|
||||
ModelVolume* new_volume = new_object->add_volume(mesh);
|
||||
|
||||
// BBS: ensure on bed but no need to ensure locate in the center around origin
|
||||
|
@ -3712,6 +3713,9 @@ wxDataViewItemArray ObjectList::add_volumes_to_object_in_list(size_t obj_idx, st
|
|||
}
|
||||
|
||||
int volume_idx{-1};
|
||||
auto& ui_and_3d_volume_map = m_objects_model->get_ui_and_3d_volume_map();
|
||||
ui_and_3d_volume_map.clear();
|
||||
int ui_volume_idx = 0;
|
||||
for (const ModelVolume *volume : object->volumes) {
|
||||
++volume_idx;
|
||||
if (object->is_cut() && volume->is_cut_connector())
|
||||
|
@ -3726,6 +3730,8 @@ wxDataViewItemArray ObjectList::add_volumes_to_object_in_list(size_t obj_idx, st
|
|||
get_warning_icon_name(volume->mesh().stats()),
|
||||
volume->config.has("extruder") ? volume->config.extruder() : 0,
|
||||
false);
|
||||
ui_and_3d_volume_map[ui_volume_idx] = volume_idx;
|
||||
ui_volume_idx++;
|
||||
add_settings_item(vol_item, &volume->config.get());
|
||||
|
||||
if (add_to_selection && add_to_selection(volume))
|
||||
|
@ -4442,8 +4448,10 @@ void ObjectList::update_selections()
|
|||
assert(obj_idx >= 0 && vol_idx >= 0);
|
||||
if (object(obj_idx)->volumes[vol_idx]->is_cut_connector())
|
||||
sels.Add(m_objects_model->GetInfoItemByType(m_objects_model->GetItemById(obj_idx), InfoItemType::CutConnectors));
|
||||
else
|
||||
else {
|
||||
vol_idx = m_objects_model->get_real_volume_index_in_ui(vol_idx);
|
||||
sels.Add(m_objects_model->GetItemByVolumeId(obj_idx, vol_idx));
|
||||
}
|
||||
}
|
||||
}
|
||||
m_selection_mode = smVolume; }
|
||||
|
@ -4547,7 +4555,8 @@ void ObjectList::update_selections_on_canvas()
|
|||
const int obj_idx = m_objects_model->GetObjectIdByItem(item);
|
||||
|
||||
if (type == itVolume) {
|
||||
const int vol_idx = m_objects_model->GetVolumeIdByItem(item);
|
||||
int vol_idx = m_objects_model->GetVolumeIdByItem(item);
|
||||
vol_idx = m_objects_model->get_real_volume_index_in_3d(vol_idx);
|
||||
std::vector<unsigned int> idxs = selection.get_volume_idxs_from_volume(obj_idx, std::max(instance_idx, 0), vol_idx);
|
||||
volume_idxs.insert(volume_idxs.end(), idxs.begin(), idxs.end());
|
||||
}
|
||||
|
@ -5761,24 +5770,8 @@ wxDataViewItemArray ObjectList::reorder_volumes_and_get_selection(int obj_idx, s
|
|||
return items;
|
||||
|
||||
object->sort_volumes(true);
|
||||
|
||||
wxDataViewItem object_item = m_objects_model->GetItemById(obj_idx);
|
||||
m_objects_model->DeleteVolumeChildren(object_item);
|
||||
|
||||
for (const ModelVolume* volume : object->volumes) {
|
||||
wxDataViewItem vol_item = m_objects_model->AddVolumeChild(object_item, from_u8(volume->name),
|
||||
volume->type(),
|
||||
volume->is_text(),
|
||||
volume->is_svg(),
|
||||
get_warning_icon_name(volume->mesh().stats()),
|
||||
volume->config.has("extruder") ? volume->config.extruder() : 0,
|
||||
false);
|
||||
// add settings to the part, if it has those
|
||||
add_settings_item(vol_item, &volume->config.get());
|
||||
|
||||
if (add_to_selection && add_to_selection(volume))
|
||||
items.Add(vol_item);
|
||||
}
|
||||
update_info_items(obj_idx, nullptr, true);
|
||||
items = add_volumes_to_object_in_list(obj_idx, std::move(add_to_selection));
|
||||
|
||||
changed_object(obj_idx);
|
||||
return items;
|
||||
|
|
|
@ -17,7 +17,9 @@ int get_hms_info_version(std::string& version)
|
|||
}
|
||||
int result = -1;
|
||||
version = "";
|
||||
std::string url = (boost::format("https://%1%/GetVersion.php") % hms_host).str();
|
||||
std::string lang;
|
||||
std::string query_params = HMSQuery::build_query_params(lang);
|
||||
std::string url = (boost::format("https://%1%/GetVersion.php?%2%") % hms_host % query_params).str();
|
||||
Slic3r::Http http = Slic3r::Http::get(url);
|
||||
http.timeout_max(10)
|
||||
.on_complete([&result, &version](std::string body, unsigned status){
|
||||
|
@ -44,13 +46,14 @@ int HMSQuery::download_hms_info()
|
|||
if (!config) return -1;
|
||||
|
||||
std::string hms_host = wxGetApp().app_config->get_hms_host();
|
||||
std::string lang_code = HMSQuery::hms_language_code();
|
||||
std::string url = (boost::format("https://%1%/query.php?lang=%2%") % hms_host % lang_code).str();
|
||||
std::string lang;
|
||||
std::string query_params = HMSQuery::build_query_params(lang);
|
||||
std::string url = (boost::format("https://%1%/query.php?%2%") % hms_host % query_params).str();
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "hms: download url = " << url;
|
||||
|
||||
Slic3r::Http http = Slic3r::Http::get(url);
|
||||
|
||||
m_hms_json.clear();
|
||||
http.on_complete([this](std::string body, unsigned status) {
|
||||
try {
|
||||
json j = json::parse(body);
|
||||
|
@ -73,7 +76,8 @@ int HMSQuery::download_hms_info()
|
|||
BOOST_LOG_TRIVIAL(error) << "HMSQuery: update hms info error = " << error << ", body = " << body << ", status = " << status;
|
||||
}).perform_sync();
|
||||
|
||||
save_to_local();
|
||||
if (!m_hms_json.empty())
|
||||
save_to_local(lang);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -84,7 +88,7 @@ int HMSQuery::load_from_local(std::string &version_info)
|
|||
BOOST_LOG_TRIVIAL(error) << "HMS: load_from_local, data_dir() is empty";
|
||||
return -1;
|
||||
}
|
||||
std::string filename = get_hms_file();
|
||||
std::string filename = get_hms_file(HMSQuery::hms_language_code());
|
||||
auto hms_folder = (boost::filesystem::path(data_dir()) / "hms");
|
||||
if (!fs::exists(hms_folder))
|
||||
fs::create_directory(hms_folder);
|
||||
|
@ -111,13 +115,13 @@ int HMSQuery::load_from_local(std::string &version_info)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int HMSQuery::save_to_local()
|
||||
int HMSQuery::save_to_local(std::string lang)
|
||||
{
|
||||
if (data_dir().empty()) {
|
||||
BOOST_LOG_TRIVIAL(error) << "HMS: save_to_local, data_dir() is empty";
|
||||
return -1;
|
||||
}
|
||||
std::string filename = get_hms_file();
|
||||
std::string filename = get_hms_file(lang);
|
||||
auto hms_folder = (boost::filesystem::path(data_dir()) / "hms");
|
||||
if (!fs::exists(hms_folder))
|
||||
fs::create_directory(hms_folder);
|
||||
|
@ -152,10 +156,18 @@ std::string HMSQuery::hms_language_code()
|
|||
return lang_code;
|
||||
}
|
||||
|
||||
std::string HMSQuery::get_hms_file()
|
||||
std::string HMSQuery::build_query_params(std::string& lang)
|
||||
{
|
||||
std::string lang_code = HMSQuery::hms_language_code();
|
||||
return (boost::format("hms_%1%.json") % lang_code).str();
|
||||
lang = lang_code;
|
||||
std::string query_params = (boost::format("lang=%1%") % lang_code).str();
|
||||
return query_params;
|
||||
}
|
||||
|
||||
std::string HMSQuery::get_hms_file(std::string lang)
|
||||
{
|
||||
//std::string lang_code = HMSQuery::hms_language_code();
|
||||
return (boost::format("hms_%1%.json") % lang).str();
|
||||
}
|
||||
|
||||
wxString HMSQuery::query_hms_msg(std::string long_error_code)
|
||||
|
@ -263,6 +275,9 @@ int HMSQuery::check_hms_info()
|
|||
std::string new_version;
|
||||
get_hms_info_version(new_version);
|
||||
BOOST_LOG_TRIVIAL(info) << "HMS: check_hms_info latest version = " << new_version;
|
||||
|
||||
if (new_version.empty()) {return 0;}
|
||||
|
||||
if (!version.empty() && version == new_version) {
|
||||
download_new_hms_info = false;
|
||||
}
|
||||
|
@ -272,7 +287,7 @@ int HMSQuery::check_hms_info()
|
|||
if (download_new_hms_info) {
|
||||
download_hms_info();
|
||||
}
|
||||
return;
|
||||
return 0;
|
||||
});
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@ protected:
|
|||
json m_hms_json;
|
||||
int download_hms_info();
|
||||
int load_from_local(std::string& version_info);
|
||||
int save_to_local();
|
||||
std::string get_hms_file();
|
||||
int save_to_local(std::string lang);
|
||||
std::string get_hms_file(std::string lang);
|
||||
wxString _query_hms_msg(std::string long_error_code, std::string lang_code = "en");
|
||||
wxString _query_error_msg(std::string long_error_code, std::string lang_code = "en");
|
||||
public:
|
||||
|
@ -32,6 +32,7 @@ public:
|
|||
wxString query_hms_msg(std::string long_error_code);
|
||||
wxString query_print_error_msg(int print_error);
|
||||
static std::string hms_language_code();
|
||||
static std::string build_query_params(std::string& lang);
|
||||
};
|
||||
|
||||
int get_hms_info_version(std::string &version);
|
||||
|
|
|
@ -752,9 +752,9 @@ double bed_stride_y(const Plater* plater) {
|
|||
arrangement::ArrangeParams init_arrange_params(Plater *p)
|
||||
{
|
||||
arrangement::ArrangeParams params;
|
||||
const GLCanvas3D::ArrangeSettings &settings = static_cast<const GLCanvas3D *>(p->canvas3D())->get_arrange_settings();
|
||||
auto & print = wxGetApp().plater()->get_partplate_list().get_current_fff_print();
|
||||
const PrintConfig& print_config = print.config();
|
||||
GLCanvas3D::ArrangeSettings &settings = p->canvas3D()->get_arrange_settings();
|
||||
auto &print = wxGetApp().plater()->get_partplate_list().get_current_fff_print();
|
||||
const PrintConfig &print_config = print.config();
|
||||
|
||||
params.clearance_height_to_rod = print_config.extruder_clearance_height_to_rod.value;
|
||||
params.clearance_height_to_lid = print_config.extruder_clearance_height_to_lid.value;
|
||||
|
|
|
@ -16,11 +16,12 @@ static auto waiting_auth_str = _u8L("Logging in");
|
|||
static auto login_failed_str = _u8L("Login failed");
|
||||
|
||||
|
||||
BindJob::BindJob(std::string dev_id, std::string dev_ip, std::string sec_link)
|
||||
BindJob::BindJob(std::string dev_id, std::string dev_ip, std::string sec_link, std::string ssdp_version)
|
||||
:
|
||||
m_dev_id(dev_id),
|
||||
m_dev_ip(dev_ip),
|
||||
m_sec_link(sec_link)
|
||||
m_sec_link(sec_link),
|
||||
m_ssdp_version(ssdp_version)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
@ -55,7 +56,8 @@ void BindJob::process(Ctl &ctl)
|
|||
wxDateTime::TimeZone tz(wxDateTime::Local);
|
||||
long offset = tz.GetOffset();
|
||||
std::string timezone = get_timezone_utc_hm(offset);
|
||||
|
||||
|
||||
m_agent->track_update_property("ssdp_version", m_ssdp_version, "string");
|
||||
int result = m_agent->bind(m_dev_ip, m_dev_id, m_sec_link, timezone, m_improved,
|
||||
[this, &ctl, &curr_percent, &msg, &result_code, &result_info](int stage, int code, std::string info) {
|
||||
|
||||
|
|
|
@ -17,12 +17,13 @@ class BindJob : public Job
|
|||
std::string m_dev_id;
|
||||
std::string m_dev_ip;
|
||||
std::string m_sec_link;
|
||||
std::string m_ssdp_version;
|
||||
bool m_job_finished{ false };
|
||||
int m_print_job_completed_id = 0;
|
||||
bool m_improved{false};
|
||||
|
||||
public:
|
||||
BindJob(std::string dev_id, std::string dev_ip, std::string sec_link);
|
||||
BindJob(std::string dev_id, std::string dev_ip, std::string sec_link, std::string ssdp_version);
|
||||
|
||||
int status_range() const
|
||||
{
|
||||
|
|
|
@ -150,8 +150,7 @@ void FillBedJob::prepare()
|
|||
|
||||
double sc = scaled<double>(1.) * scaled(1.);
|
||||
|
||||
const GLCanvas3D::ArrangeSettings& settings = static_cast<const GLCanvas3D*>(m_plater->canvas3D())->get_arrange_settings();
|
||||
auto polys = offset_ex(m_selected.front().poly, scaled(settings.distance) / 2);
|
||||
auto polys = offset_ex(m_selected.front().poly, params.min_obj_distance / 2);
|
||||
ExPolygon poly = polys.empty() ? m_selected.front().poly : polys.front();
|
||||
double poly_area = poly.area() / sc;
|
||||
double unsel_area = std::accumulate(m_unselected.begin(),
|
||||
|
|
|
@ -68,9 +68,15 @@ std::string PrintJob::truncate_string(const std::string& str, size_t maxLength)
|
|||
}
|
||||
|
||||
wxString local_str = wxString::FromUTF8(str);
|
||||
wxString truncatedStr = local_str.Mid(0, maxLength - 3);
|
||||
truncatedStr.append("...");
|
||||
wxString truncatedStr;
|
||||
|
||||
for (auto i = 1; i < local_str.Length(); i++) {
|
||||
wxString tagStr = local_str.Mid(0, i);
|
||||
if (tagStr.ToUTF8().length() >= maxLength) {
|
||||
truncatedStr = local_str.Mid(0, i - 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return truncatedStr.utf8_string();
|
||||
}
|
||||
|
||||
|
|
|
@ -3688,11 +3688,13 @@ void MainFrame::on_select_default_preset(SimpleEvent& evt)
|
|||
case wxID_YES: {
|
||||
wxGetApp().app_config->set_bool("sync_user_preset", true);
|
||||
wxGetApp().start_sync_user_preset(true);
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " sync_user_preset: true";
|
||||
break;
|
||||
}
|
||||
case wxID_NO:
|
||||
wxGetApp().app_config->set_bool("sync_user_preset", false);
|
||||
wxGetApp().stop_sync_user_preset();
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " sync_user_preset: false";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -198,7 +198,9 @@ MediaFilePanel::~MediaFilePanel()
|
|||
SetMachineObject(nullptr);
|
||||
}
|
||||
|
||||
void MediaFilePanel::SetMachineObject(MachineObject* obj)
|
||||
wxString hide_id_middle_string(wxString const &str, size_t offset = 0, size_t length = -1);
|
||||
|
||||
void MediaFilePanel::SetMachineObject(MachineObject* obj)
|
||||
{
|
||||
std::string machine = obj ? obj->dev_id : "";
|
||||
if (obj) {
|
||||
|
@ -442,7 +444,7 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
|
|||
if (agent) {
|
||||
agent->get_camera_url(m_machine,
|
||||
[this, wfs, m = m_machine, v = m_dev_ver](std::string url) {
|
||||
BOOST_LOG_TRIVIAL(info) << "MediaFilePanel::fetchUrl: camera_url: " << hide_passwd(url, {"authkey=", "passwd="});
|
||||
BOOST_LOG_TRIVIAL(info) << "MediaFilePanel::fetchUrl: camera_url: " << hide_id_middle_string(hide_passwd(url, {"authkey=", "passwd="}), 9, 20);
|
||||
CallAfter([=] {
|
||||
boost::shared_ptr fs(wfs.lock());
|
||||
if (!fs || fs != m_image_grid->GetFileSystem()) return;
|
||||
|
|
|
@ -90,6 +90,15 @@ MediaPlayCtrl::~MediaPlayCtrl()
|
|||
m_thread.join();
|
||||
}
|
||||
|
||||
wxString hide_id_middle_string(wxString const &str, size_t offset = 0, size_t length = -1)
|
||||
{
|
||||
if (length == size_t(-1))
|
||||
length = str.Length() - offset;
|
||||
if (length <= 8)
|
||||
return str;
|
||||
return str.Left(offset + 4) + wxString(length - 8, '*') + str.Mid(offset + length - 4);
|
||||
}
|
||||
|
||||
void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
|
||||
{
|
||||
std::string machine = obj ? obj->dev_id : "";
|
||||
|
@ -120,7 +129,7 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
|
|||
return;
|
||||
}
|
||||
m_machine = machine;
|
||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl switch machine: " << m_machine;
|
||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl switch machine: " << hide_id_middle_string(m_machine);
|
||||
m_disable_lan = false;
|
||||
m_failed_retry = 0;
|
||||
m_last_failed_codes.clear();
|
||||
|
@ -149,8 +158,7 @@ wxString hide_passwd(wxString url, std::vector<wxString> const &passwords)
|
|||
if (p[p.length() - 1] == '=') {
|
||||
i = j;
|
||||
j = url.find('&', i);
|
||||
if (j == wxString::npos)
|
||||
j = url.length();
|
||||
if (j == wxString::npos) j = url.length();
|
||||
}
|
||||
auto l = size_t(j - i);
|
||||
if (j == url.length() || url[j] == '@' || url[j] == '&')
|
||||
|
@ -199,7 +207,7 @@ void MediaPlayCtrl::Play()
|
|||
m_url = "bambu:///rtsps___" + m_lan_user + ":" + m_lan_passwd + "@" + m_lan_ip + "/streaming/live/1?proto=rtsps";
|
||||
else if (m_lan_proto == MachineObject::LVL_Rtsp)
|
||||
m_url = "bambu:///rtsp___" + m_lan_user + ":" + m_lan_passwd + "@" + m_lan_ip + "/streaming/live/1?proto=rtsp";
|
||||
m_url += "&device=" + m_machine;
|
||||
m_url += "&device=" + hide_id_middle_string(m_machine);
|
||||
m_url += "&version=" + agent_version;
|
||||
m_url += "&dev_ver=" + m_dev_ver;
|
||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl: " << hide_passwd(m_url, {m_lan_passwd} );
|
||||
|
@ -231,11 +239,11 @@ void MediaPlayCtrl::Play()
|
|||
if (agent) {
|
||||
agent->get_camera_url(m_machine, [this, m = m_machine, v = agent_version, dv = m_dev_ver](std::string url) {
|
||||
if (boost::algorithm::starts_with(url, "bambu:///")) {
|
||||
url += "&device=" + m;
|
||||
url += "&device=" + into_u8(hide_id_middle_string(m));
|
||||
url += "&version=" + v;
|
||||
url += "&dev_ver=" + dv;
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl: " << hide_passwd(url, {"authkey=", "passwd="}) << ", machine: " << m_machine;
|
||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl: " << hide_id_middle_string(hide_passwd(url, {"authkey=", "passwd="}), 9, 20);
|
||||
CallAfter([this, m, url] {
|
||||
if (m != m_machine) {
|
||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl drop late ttcode for machine: " << m;
|
||||
|
@ -392,7 +400,7 @@ void MediaPlayCtrl::ToggleStream()
|
|||
url = "bambu:///rtsps___" + m_lan_user + ":" + m_lan_passwd + "@" + m_lan_ip + "/streaming/live/1?proto=rtsps";
|
||||
else if (m_lan_proto == MachineObject::LVL_Rtsp)
|
||||
url = "bambu:///rtsp___" + m_lan_user + ":" + m_lan_passwd + "@" + m_lan_ip + "/streaming/live/1?proto=rtsp";
|
||||
url += "&device=" + m_machine;
|
||||
url += "&device=" + into_u8(hide_id_middle_string(m_machine));
|
||||
url += "&dev_ver=" + m_dev_ver;
|
||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::ToggleStream: " << hide_passwd(url, {m_lan_passwd});
|
||||
std::string file_url = data_dir() + "/cameratools/url.txt";
|
||||
|
@ -411,7 +419,7 @@ void MediaPlayCtrl::ToggleStream()
|
|||
url += "&version=" + v;
|
||||
url += "&dev_ver=" + dv;
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::ToggleStream: " << hide_passwd(url, {"authkey=", "passwd="});
|
||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::ToggleStream: " << hide_id_middle_string(hide_passwd(url, {"authkey=", "passwd="}), 9, 20);
|
||||
CallAfter([this, m, url] {
|
||||
if (m != m_machine) return;
|
||||
if (url.empty() || !boost::algorithm::starts_with(url, "bambu:///")) {
|
||||
|
@ -537,7 +545,7 @@ void MediaPlayCtrl::media_proc()
|
|||
}
|
||||
wxString url = m_tasks.front();
|
||||
if (m_tasks.size() >= 2 && !url.IsEmpty() && url[0] != '<' && m_tasks[1] == "<stop>") {
|
||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl: busy skip url: " << hide_passwd(url, {"authkey=", "passwd=", m_lan_passwd});
|
||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl: busy skip url: " << hide_id_middle_string(hide_passwd(url, {"authkey=", "passwd=", m_lan_passwd}), 9, 20);
|
||||
m_tasks.pop_front();
|
||||
m_tasks.pop_front();
|
||||
continue;
|
||||
|
|
|
@ -342,13 +342,30 @@ class ObjectDataViewModel :public wxDataViewModel
|
|||
wxDataViewCtrl* m_ctrl { nullptr };
|
||||
std::vector<std::pair<ObjectDataViewModelNode*, wxString>> assembly_name_list;
|
||||
std::vector<std::pair<ObjectDataViewModelNode*, wxString>> search_found_list;
|
||||
std::map<int, int> m_ui_and_3d_volume_map;
|
||||
|
||||
public:
|
||||
ObjectDataViewModel();
|
||||
~ObjectDataViewModel();
|
||||
|
||||
void Init();
|
||||
|
||||
std::map<int, int> &get_ui_and_3d_volume_map() { return m_ui_and_3d_volume_map; }
|
||||
int get_real_volume_index_in_3d(int ui_value)
|
||||
{
|
||||
if (m_ui_and_3d_volume_map.find(ui_value) != m_ui_and_3d_volume_map.end()) {
|
||||
return m_ui_and_3d_volume_map[ui_value];
|
||||
}
|
||||
return ui_value;
|
||||
}
|
||||
int get_real_volume_index_in_ui(int _3d_value)
|
||||
{
|
||||
for (auto item: m_ui_and_3d_volume_map) {
|
||||
if (item.second == _3d_value) {
|
||||
return item.first;
|
||||
}
|
||||
}
|
||||
return _3d_value;
|
||||
}
|
||||
wxDataViewItem AddPlate(PartPlate* part_plate, wxString name = wxEmptyString, bool refresh = true);
|
||||
wxDataViewItem AddObject(ModelObject* model_object, std::string warning_bitmap, bool has_lock = false, bool refresh = true);
|
||||
wxDataViewItem AddVolumeChild( const wxDataViewItem &parent_item,
|
||||
|
|
|
@ -1541,6 +1541,10 @@ std::map<int, DynamicPrintConfig> Sidebar::build_filament_ams_list(MachineObject
|
|||
vt_tray_config.set_key_value("filament_colour", new ConfigOptionStrings{ into_u8(wxColour("#" + vt_tray.color).GetAsString(wxC2S_HTML_SYNTAX)) });
|
||||
vt_tray_config.set_key_value("filament_exist", new ConfigOptionBools{ true });
|
||||
|
||||
vt_tray_config.set_key_value("filament_multi_colors", new ConfigOptionStrings{});
|
||||
for (int i = 0; i < vt_tray.cols.size(); ++i) {
|
||||
vt_tray_config.opt<ConfigOptionStrings>("filament_multi_colors")->values.push_back(into_u8(wxColour("#" + vt_tray.cols[i]).GetAsString(wxC2S_HTML_SYNTAX)));
|
||||
}
|
||||
filament_ams_list.emplace(VIRTUAL_TRAY_ID, std::move(vt_tray_config));
|
||||
}
|
||||
|
||||
|
@ -1559,6 +1563,10 @@ std::map<int, DynamicPrintConfig> Sidebar::build_filament_ams_list(MachineObject
|
|||
tray_config.set_key_value("filament_colour", new ConfigOptionStrings{ into_u8(wxColour("#" + tray.second->color).GetAsString(wxC2S_HTML_SYNTAX)) });
|
||||
tray_config.set_key_value("filament_exist", new ConfigOptionBools{ tray.second->is_exists });
|
||||
|
||||
tray_config.set_key_value("filament_multi_colors", new ConfigOptionStrings{});
|
||||
for (int i = 0; i < tray.second->cols.size(); ++i) {
|
||||
tray_config.opt<ConfigOptionStrings>("filament_multi_colors")->values.push_back(into_u8(wxColour("#" + tray.second->cols[i]).GetAsString(wxC2S_HTML_SYNTAX)));
|
||||
}
|
||||
filament_ams_list.emplace(((n - 'A') * 4 + t - '1'), std::move(tray_config));
|
||||
}
|
||||
}
|
||||
|
@ -1619,6 +1627,17 @@ void Sidebar::sync_ams_list()
|
|||
ams.set_key_value("filament_changed", new ConfigOptionBool{res == wxID_YES || list2[i] != filament_id});
|
||||
list2[i] = filament_id;
|
||||
}
|
||||
|
||||
// BBS:Record consumables information before synchronization
|
||||
std::vector<string> color_before_sync;
|
||||
std::vector<int> is_support_before;
|
||||
DynamicPrintConfig& project_config = wxGetApp().preset_bundle->project_config;
|
||||
ConfigOptionStrings* color_opt = project_config.option<ConfigOptionStrings>("filament_colour");
|
||||
for (int i = 0; i < p->combos_filament.size(); ++i) {
|
||||
is_support_before.push_back(is_support_filament(i));
|
||||
color_before_sync.push_back(color_opt->values[i]);
|
||||
}
|
||||
|
||||
unsigned int unknowns = 0;
|
||||
auto n = wxGetApp().preset_bundle->sync_ams_list(unknowns);
|
||||
if (n == 0) {
|
||||
|
@ -1637,13 +1656,32 @@ void Sidebar::sync_ams_list()
|
|||
dlg.ShowModal();
|
||||
}
|
||||
wxGetApp().plater()->on_filaments_change(n);
|
||||
for (auto &c : p->combos_filament)
|
||||
for (auto& c : p->combos_filament)
|
||||
c->update();
|
||||
wxGetApp().get_tab(Preset::TYPE_FILAMENT)->select_preset(wxGetApp().preset_bundle->filament_presets[0]);
|
||||
wxGetApp().preset_bundle->export_selections(*wxGetApp().app_config);
|
||||
dynamic_filament_list.update();
|
||||
// Expand filament list
|
||||
p->m_panel_filament_content->SetMaxSize({-1, -1});
|
||||
// BBS:Synchronized consumables information
|
||||
// auto calculation of flushing volumes
|
||||
for (int i = 0; i < p->combos_filament.size(); ++i) {
|
||||
if (i >= color_before_sync.size()) {
|
||||
auto_calc_flushing_volumes(i);
|
||||
}
|
||||
else {
|
||||
// if color changed
|
||||
if (color_before_sync[i] != color_opt->values[i]) {
|
||||
auto_calc_flushing_volumes(i);
|
||||
}
|
||||
// color don't change, but changes between supporting filament and non supporting filament
|
||||
else {
|
||||
bool flag = is_support_filament(i);
|
||||
if (flag != is_support_before[i])
|
||||
auto_calc_flushing_volumes(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
Layout();
|
||||
}
|
||||
|
||||
|
@ -1810,71 +1848,103 @@ std::string& Sidebar::get_search_line()
|
|||
return p->searcher.search_string();
|
||||
}
|
||||
|
||||
void Sidebar::auto_calc_flushing_volumes(const int modify_id) {
|
||||
auto& project_config = wxGetApp().preset_bundle->project_config;
|
||||
auto& printer_config = wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
void Sidebar::auto_calc_flushing_volumes(const int modify_id)
|
||||
{
|
||||
auto& preset_bundle = wxGetApp().preset_bundle;
|
||||
auto& project_config = preset_bundle->project_config;
|
||||
auto& printer_config = preset_bundle->printers.get_edited_preset().config;
|
||||
auto& ams_multi_color_filament = preset_bundle->ams_multi_color_filment;
|
||||
auto& ams_filament_list = preset_bundle->filament_ams_list;
|
||||
|
||||
const std::vector<double>& init_matrix = (project_config.option<ConfigOptionFloats>("flush_volumes_matrix"))->values;
|
||||
const std::vector<double>& init_extruders = (project_config.option<ConfigOptionFloats>("flush_volumes_vector"))->values;
|
||||
ConfigOption* extra_flush_volume_opt = printer_config.option("nozzle_volume");
|
||||
int extra_flush_volume = extra_flush_volume_opt ? (int)extra_flush_volume_opt->getFloat() : 0;
|
||||
ConfigOptionFloat* flush_multi_opt = project_config.option<ConfigOptionFloat>("flush_multiplier");
|
||||
float flush_multiplier = flush_multi_opt ? flush_multi_opt->getFloat() : 1.f;
|
||||
vector<double> matrix = init_matrix;
|
||||
std::vector<double> matrix = init_matrix;
|
||||
int m_min_flush_volume = extra_flush_volume;
|
||||
int m_max_flush_volume = Slic3r::g_max_flush_volume;
|
||||
unsigned int m_number_of_extruders = (int)(sqrt(init_matrix.size()) + 0.001);
|
||||
|
||||
const std::vector<std::string> extruder_colours = wxGetApp().plater()->get_extruder_colors_from_plater_config();
|
||||
vector<wxColour> m_colours;
|
||||
for (const std::string& color : extruder_colours) {
|
||||
m_colours.push_back(wxColor(color));
|
||||
std::vector<std::vector<wxColour>> multi_colours;
|
||||
|
||||
// Support for multi-color filament
|
||||
for (int i = 0; i < extruder_colours.size(); ++i) {
|
||||
std::vector<wxColour> single_filament;
|
||||
if (i < ams_multi_color_filament.size()) {
|
||||
if (!ams_multi_color_filament[i].empty()) {
|
||||
std::vector<std::string> colors = ams_multi_color_filament[i];
|
||||
for (int j = 0; j < colors.size(); ++j) {
|
||||
single_filament.push_back(wxColour(colors[j]));
|
||||
}
|
||||
multi_colours.push_back(single_filament);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
single_filament.push_back(wxColour(extruder_colours[i]));
|
||||
multi_colours.push_back(single_filament);
|
||||
}
|
||||
if (modify_id >= 0 && modify_id < m_colours.size()) {
|
||||
for (int i = 0; i < m_colours.size(); ++i) {
|
||||
|
||||
if (modify_id >= 0 && modify_id < multi_colours.size()) {
|
||||
for (int i = 0; i < multi_colours.size(); ++i) {
|
||||
|
||||
Slic3r::FlushVolCalculator calculator(m_min_flush_volume, m_max_flush_volume);
|
||||
|
||||
// from to modify
|
||||
int from_idx = i;
|
||||
if (from_idx != modify_id) {
|
||||
const wxColour& from = m_colours[from_idx];
|
||||
bool is_from_support = is_support_filament(from_idx);
|
||||
const wxColour& to = m_colours[modify_id];
|
||||
bool is_to_support = is_support_filament(modify_id);
|
||||
int flushing_volume = 0;
|
||||
bool is_from_support = is_support_filament(from_idx);
|
||||
bool is_to_support = is_support_filament(modify_id);
|
||||
if (is_to_support) {
|
||||
flushing_volume = Slic3r::g_flush_volume_to_support;
|
||||
}
|
||||
else {
|
||||
const wxColour& to = m_colours[modify_id];
|
||||
Slic3r::FlushVolCalculator calculator(m_min_flush_volume, m_max_flush_volume);
|
||||
flushing_volume = calculator.calc_flush_vol(from.Alpha(), from.Red(), from.Green(), from.Blue(), to.Alpha(), to.Red(), to.Green(), to.Blue());
|
||||
if (is_from_support) {
|
||||
flushing_volume = std::max(Slic3r::g_min_flush_volume_from_support, flushing_volume);
|
||||
for (int j = 0; j < multi_colours[from_idx].size(); ++j) {
|
||||
const wxColour& from = multi_colours[from_idx][j];
|
||||
for (int k = 0; k < multi_colours[modify_id].size(); ++k) {
|
||||
const wxColour& to = multi_colours[modify_id][k];
|
||||
int volume = calculator.calc_flush_vol(from.Alpha(), from.Red(), from.Green(), from.Blue(), to.Alpha(), to.Red(), to.Green(), to.Blue());
|
||||
flushing_volume = std::max(flushing_volume, volume);
|
||||
}
|
||||
}
|
||||
if (is_from_support)
|
||||
flushing_volume = std::max(flushing_volume, Slic3r::g_min_flush_volume_from_support);
|
||||
}
|
||||
matrix[m_number_of_extruders * from_idx + modify_id] = flushing_volume;
|
||||
}
|
||||
|
||||
// modify to to
|
||||
int to_idx = i;
|
||||
if (to_idx != modify_id) {
|
||||
const wxColour& from = m_colours[modify_id];
|
||||
bool is_from_support = is_support_filament(modify_id);
|
||||
const wxColour& to = m_colours[to_idx];
|
||||
bool is_to_support = is_support_filament(to_idx);
|
||||
int flushing_volume = 0;
|
||||
if (is_to_support) {
|
||||
flushing_volume = Slic3r::g_flush_volume_to_support;
|
||||
}
|
||||
else {
|
||||
const wxColour& to = m_colours[to_idx];
|
||||
Slic3r::FlushVolCalculator calculator(m_min_flush_volume, m_max_flush_volume);
|
||||
flushing_volume = calculator.calc_flush_vol(from.Alpha(), from.Red(), from.Green(), from.Blue(), to.Alpha(), to.Red(), to.Green(), to.Blue());
|
||||
if (is_from_support) {
|
||||
flushing_volume = std::max(Slic3r::g_min_flush_volume_from_support, flushing_volume);
|
||||
for (int j = 0; j < multi_colours[modify_id].size(); ++j) {
|
||||
const wxColour& from = multi_colours[modify_id][j];
|
||||
for (int k = 0; k < multi_colours[to_idx].size(); ++k) {
|
||||
const wxColour& to = multi_colours[to_idx][k];
|
||||
int volume = calculator.calc_flush_vol(from.Alpha(), from.Red(), from.Green(), from.Blue(), to.Alpha(), to.Red(), to.Green(), to.Blue());
|
||||
flushing_volume = std::max(flushing_volume, volume);
|
||||
}
|
||||
}
|
||||
if (is_from_support)
|
||||
flushing_volume = std::max(flushing_volume, Slic3r::g_min_flush_volume_from_support);
|
||||
|
||||
matrix[m_number_of_extruders * modify_id + to_idx] = flushing_volume;
|
||||
}
|
||||
matrix[m_number_of_extruders * modify_id + to_idx] = flushing_volume;
|
||||
}
|
||||
}
|
||||
}
|
||||
(project_config.option<ConfigOptionFloats>("flush_volumes_matrix"))->values = std::vector<double>(matrix.begin(), matrix.end());
|
||||
|
||||
|
||||
wxGetApp().preset_bundle->export_selections(*wxGetApp().app_config);
|
||||
|
||||
wxGetApp().plater()->update_project_dirty_from_presets();
|
||||
|
@ -2660,7 +2730,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||
m_aui_mgr.Update();
|
||||
}
|
||||
|
||||
menus.init(q);
|
||||
menus.init(main_frame);
|
||||
|
||||
|
||||
// Events:
|
||||
|
@ -3412,7 +3482,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
|||
int progress_percent = static_cast<int>(100.0f * static_cast<float>(i) / static_cast<float>(input_files.size()));
|
||||
const auto real_filename = (strategy & LoadStrategy::Restore) ? input_files[++i].filename() : filename;
|
||||
const auto dlg_info = _L("Loading file") + ": " + from_path(real_filename);
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": load file %1%") % filename;
|
||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << boost::format(": load file %1%") % filename;
|
||||
dlg_cont = dlg.Update(progress_percent, dlg_info);
|
||||
if (!dlg_cont) return empty_result;
|
||||
|
||||
|
@ -5074,7 +5144,7 @@ void Plater::priv::export_gcode(fs::path output_path, bool output_path_on_remova
|
|||
{
|
||||
wxCHECK_RET(!(output_path.empty()), "export_gcode: output_path and upload_job empty");
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("export_gcode: output_path %1%")%output_path.string();
|
||||
BOOST_LOG_TRIVIAL(trace) << boost::format("export_gcode: output_path %1%")%output_path.string();
|
||||
if (model.objects.empty())
|
||||
return;
|
||||
|
||||
|
@ -6909,10 +6979,14 @@ void Plater::priv::on_filament_color_changed(wxCommandEvent &event)
|
|||
{
|
||||
//q->update_all_plate_thumbnails(true);
|
||||
//q->get_preview_canvas3D()->update_plate_thumbnails();
|
||||
int modify_id = event.GetInt();
|
||||
if (wxGetApp().app_config->get("auto_calculate") == "true") {
|
||||
int modify_id = event.GetInt();
|
||||
sidebar->auto_calc_flushing_volumes(modify_id);
|
||||
}
|
||||
|
||||
auto& ams_multi_color_filment = wxGetApp().preset_bundle->ams_multi_color_filment;
|
||||
if (modify_id >= 0 && modify_id < ams_multi_color_filment.size())
|
||||
ams_multi_color_filment[modify_id].clear();
|
||||
}
|
||||
|
||||
void Plater::priv::install_network_plugin(wxCommandEvent &event)
|
||||
|
@ -7257,7 +7331,7 @@ wxString Plater::priv::get_project_name()
|
|||
//BBS
|
||||
void Plater::priv::set_project_name(const wxString& project_name)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " project is:" << project_name;
|
||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << __LINE__ << " project is:" << project_name;
|
||||
m_project_name = project_name;
|
||||
//update topbar title
|
||||
wxGetApp().mainframe->SetTitle(m_project_name);
|
||||
|
@ -7287,7 +7361,7 @@ void Plater::priv::set_project_filename(const wxString& filename)
|
|||
full_path.replace_extension("");
|
||||
|
||||
m_project_folder = full_path.parent_path();
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " project folder is:" << m_project_folder.string();
|
||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << __LINE__ << " project folder is:" << m_project_folder.string();
|
||||
|
||||
//BBS
|
||||
wxString project_name = from_u8(full_path.filename().string());
|
||||
|
@ -7803,16 +7877,29 @@ void Plater::priv::on_modify_filament(SimpleEvent &evt)
|
|||
{
|
||||
FilamentInfomation *filament_info = static_cast<FilamentInfomation *>(evt.GetEventObject());
|
||||
int res;
|
||||
std::shared_ptr<Preset> need_edit_preset;
|
||||
{
|
||||
EditFilamentPresetDialog dlg(wxGetApp().mainframe, filament_info);
|
||||
res = dlg.ShowModal();
|
||||
need_edit_preset = dlg.get_need_edit_preset();
|
||||
}
|
||||
wxGetApp().mainframe->update_side_preset_ui();
|
||||
update_ui_from_settings();
|
||||
sidebar->update_all_preset_comboboxes();
|
||||
if (wxID_EDIT == res) {
|
||||
Tab *tab = wxGetApp().get_tab(Preset::Type::TYPE_FILAMENT);
|
||||
//tab->restore_last_select_item();
|
||||
if (tab == nullptr) { return; }
|
||||
// Popup needs to be called before "restore_last_select_item", otherwise the page may not be updated
|
||||
wxGetApp().params_dialog()->Popup();
|
||||
tab->restore_last_select_item();
|
||||
// Opening Studio and directly accessing the Filament settings interface through the edit preset button will not take effect and requires manual settings.
|
||||
tab->set_just_edit(true);
|
||||
tab->select_preset(need_edit_preset->name);
|
||||
// when some preset have modified, if the printer is not need_edit_preset_name compatible printer, the preset will jump to other preset, need select again
|
||||
if (!need_edit_preset->is_compatible) tab->select_preset(need_edit_preset->name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Plater::priv::enter_gizmos_stack()
|
||||
|
@ -8206,6 +8293,7 @@ void Plater::priv::record_start_print_preset(std::string action) {
|
|||
// record start print preset
|
||||
try {
|
||||
json j;
|
||||
j["user_mode"] = wxGetApp().get_mode_str();
|
||||
int plate_count = partplate_list.get_plate_count();
|
||||
j["plate_count"] = plate_count;
|
||||
unsigned int obj_count = model.objects.size();
|
||||
|
@ -8314,6 +8402,11 @@ int Plater::new_project(bool skip_confirm, bool silent, const wxString& project_
|
|||
get_notification_manager()->bbl_close_plateinfo_notification();
|
||||
get_notification_manager()->bbl_close_preview_only_notification();
|
||||
get_notification_manager()->bbl_close_3mf_warn_notification();
|
||||
get_notification_manager()->close_notification_of_type(NotificationType::PlaterError);
|
||||
get_notification_manager()->close_notification_of_type(NotificationType::PlaterWarning);
|
||||
get_notification_manager()->close_notification_of_type(NotificationType::SlicingError);
|
||||
get_notification_manager()->close_notification_of_type(NotificationType::SlicingSeriousWarning);
|
||||
get_notification_manager()->close_notification_of_type(NotificationType::SlicingWarning);
|
||||
|
||||
if (!silent)
|
||||
wxGetApp().mainframe->select_tab(MainFrame::tp3DEditor);
|
||||
|
@ -8366,6 +8459,7 @@ void Plater::load_project(wxString const& filename2,
|
|||
wxString const& originfile)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "filename is: " << filename2 << "and originfile is: " << originfile;
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__;
|
||||
auto filename = filename2;
|
||||
auto check = [&filename, this] (bool yes_or_no) {
|
||||
if (!yes_or_no && !wxGetApp().check_and_save_current_preset_changes(_L("Load project"),
|
||||
|
@ -8399,6 +8493,11 @@ void Plater::load_project(wxString const& filename2,
|
|||
get_notification_manager()->bbl_close_plateinfo_notification();
|
||||
get_notification_manager()->bbl_close_preview_only_notification();
|
||||
get_notification_manager()->bbl_close_3mf_warn_notification();
|
||||
get_notification_manager()->close_notification_of_type(NotificationType::PlaterError);
|
||||
get_notification_manager()->close_notification_of_type(NotificationType::PlaterWarning);
|
||||
get_notification_manager()->close_notification_of_type(NotificationType::SlicingError);
|
||||
get_notification_manager()->close_notification_of_type(NotificationType::SlicingSeriousWarning);
|
||||
get_notification_manager()->close_notification_of_type(NotificationType::SlicingWarning);
|
||||
|
||||
auto path = into_path(filename);
|
||||
|
||||
|
@ -8498,7 +8597,7 @@ int Plater::save_project(bool saveAs)
|
|||
Slic3r::remove_backup(model(), false);
|
||||
|
||||
p->set_project_filename(filename);
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " call set_project_filename: " << filename;
|
||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << __LINE__ << " call set_project_filename: " << filename;
|
||||
|
||||
up_to_date(true, false);
|
||||
up_to_date(true, true);
|
||||
|
@ -8521,7 +8620,7 @@ int Plater::save_project(bool saveAs)
|
|||
//BBS import model by model id
|
||||
void Plater::import_model_id(wxString download_info)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " download info: " << download_info;
|
||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << __LINE__ << " download info: " << download_info;
|
||||
|
||||
wxString download_origin_url = download_info;
|
||||
wxString download_url;
|
||||
|
@ -9359,7 +9458,8 @@ void Plater::load_gcode()
|
|||
//BBS: remove GCodeViewer as seperate APP logic
|
||||
void Plater::load_gcode(const wxString& filename)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " entry and filename: " << filename;
|
||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << __LINE__ << " entry and filename: " << filename;
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__;
|
||||
if (! is_gcode_file(into_u8(filename))
|
||||
|| (m_last_loaded_gcode == filename && m_only_gcode)
|
||||
)
|
||||
|
@ -10578,7 +10678,7 @@ void Plater::export_gcode(bool prefer_removable)
|
|||
|
||||
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
|
||||
if (preset_bundle) {
|
||||
j["Gcode_printer_model"] = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle);
|
||||
j["gcode_printer_model"] = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle);
|
||||
}
|
||||
NetworkAgent *agent = wxGetApp().getAgent();
|
||||
} catch (...) {}
|
||||
|
@ -10691,7 +10791,7 @@ TriangleMesh Plater::combine_mesh_fff(const ModelObject& mo, int instance_id, st
|
|||
std::vector<csg::CSGPart> csgmesh;
|
||||
csgmesh.reserve(2 * mo.volumes.size());
|
||||
bool has_splitable_volume = csg::model_to_csgmesh(mo, Transform3d::Identity(), std::back_inserter(csgmesh),
|
||||
csg::mpartsPositive | csg::mpartsNegative | csg::mpartsDoSplits);
|
||||
csg::mpartsPositive | csg::mpartsNegative);
|
||||
|
||||
if (csg::check_csgmesh_booleans(Range{ std::begin(csgmesh), std::end(csgmesh) }) == csgmesh.end()) {
|
||||
try {
|
||||
|
@ -11085,9 +11185,12 @@ int Plater::export_3mf(const boost::filesystem::path& output_path, SaveStrategy
|
|||
const std::string path_u8 = into_u8(path);
|
||||
wxBusyCursor wait;
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": path=%1%, backup=%2%, export_plate_idx=%3%, SaveStrategy=%4%")
|
||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << boost::format(": path=%1%, backup=%2%, export_plate_idx=%3%, SaveStrategy=%4%")
|
||||
%output_path.string()%(strategy & SaveStrategy::Backup)%export_plate_idx %(unsigned int)strategy;
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": path=%1%, backup=%2%, export_plate_idx=%3%, SaveStrategy=%4%")
|
||||
% std::string("") % (strategy & SaveStrategy::Backup) % export_plate_idx % (unsigned int)strategy;
|
||||
|
||||
//BBS: add plate logic for thumbnail generate
|
||||
std::vector<ThumbnailData*> thumbnails;
|
||||
std::vector<ThumbnailData*> calibration_thumbnails;
|
||||
|
@ -11241,7 +11344,7 @@ int Plater::export_3mf(const boost::filesystem::path& output_path, SaveStrategy
|
|||
if (!(store_params.strategy & SaveStrategy::Silence)) {
|
||||
// Success
|
||||
p->set_project_filename(path);
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " call set_project_filename: " << path;
|
||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << __LINE__ << " call set_project_filename: " << path;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -664,6 +664,7 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxWindow *pa
|
|||
} else {
|
||||
wxGetApp().stop_sync_user_preset();
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " sync_user_preset: " << (sync ? "true" : "false");
|
||||
}
|
||||
|
||||
#ifdef __WXMSW__
|
||||
|
|
|
@ -1424,7 +1424,7 @@ void GUI::CalibrateFilamentComboBox::load_tray(DynamicPrintConfig &config)
|
|||
auto &filaments = m_collection->get_presets();
|
||||
auto iter = std::find_if(filaments.begin(), filaments.end(), [this](auto &f) {
|
||||
bool is_compatible = m_preset_bundle->calibrate_filaments.find(&f) != m_preset_bundle->calibrate_filaments.end();
|
||||
return is_compatible && f.is_system && f.filament_id == m_filament_id;
|
||||
return is_compatible && f.filament_id == m_filament_id;
|
||||
});
|
||||
//if (iter == filaments.end() && !m_filament_type.empty()) {
|
||||
// auto filament_type = "Generic " + m_filament_type;
|
||||
|
|
|
@ -469,29 +469,6 @@ PrinterFileSystem::File const &PrinterFileSystem::GetFile(size_t index, bool &se
|
|||
return m_file_list[m_group_month[index]];
|
||||
}
|
||||
|
||||
int PrinterFileSystem::RecvData(std::function<int(Bambu_Sample& sample)> const & callback)
|
||||
{
|
||||
int result = 0;
|
||||
while (true) {
|
||||
Bambu_Sample sample;
|
||||
result = Bambu_ReadSample(m_session.tunnel, &sample);
|
||||
if (result == Bambu_success) {
|
||||
result = callback(sample);
|
||||
if (result == 1)
|
||||
continue;
|
||||
} else if (result == Bambu_would_block) {
|
||||
boost::this_thread::sleep(boost::posix_time::seconds(1));
|
||||
continue;
|
||||
} else if (result == Bambu_stream_end) {
|
||||
result = 0;
|
||||
} else {
|
||||
result = ERROR_PIPE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void PrinterFileSystem::Attached()
|
||||
{
|
||||
boost::unique_lock lock(m_mutex);
|
||||
|
|
|
@ -280,8 +280,6 @@ private:
|
|||
|
||||
void Reconnect(boost::unique_lock<boost::mutex> & l, int result);
|
||||
|
||||
int RecvData(std::function<int(Bambu_Sample & sample)> const & callback);
|
||||
|
||||
template <typename T>
|
||||
void PostCallback(Callback<T> const& callback, int result, T const& resp)
|
||||
{
|
||||
|
|
|
@ -2822,8 +2822,10 @@ void SelectMachineDialog::on_send_print()
|
|||
|
||||
// update ota version
|
||||
NetworkAgent* agent = wxGetApp().getAgent();
|
||||
if (agent)
|
||||
agent->track_update_property("dev_ota_version", obj_->get_ota_version());
|
||||
if (agent) {
|
||||
std::string dev_ota_str = "dev_ota_ver:" + obj_->dev_id;
|
||||
agent->track_update_property(dev_ota_str, obj_->get_ota_version());
|
||||
}
|
||||
|
||||
replace_job(*m_worker, std::move(m_print_job));
|
||||
BOOST_LOG_TRIVIAL(info) << "print_job: start print job";
|
||||
|
@ -3442,15 +3444,16 @@ void SelectMachineDialog::update_show_status()
|
|||
}
|
||||
}
|
||||
|
||||
if (has_timelapse_warning()) {
|
||||
show_status(PrintDialogStatus::PrintStatusTimelapseWarning);
|
||||
return;
|
||||
}
|
||||
|
||||
// no ams
|
||||
if (!obj_->has_ams() || !m_checkbox_list["use_ams"]->GetValue()) {
|
||||
if (!has_tips(obj_))
|
||||
show_status(PrintDialogStatus::PrintStatusReadingFinished);
|
||||
if (!has_tips(obj_)) {
|
||||
if (has_timelapse_warning()) {
|
||||
show_status(PrintDialogStatus::PrintStatusTimelapseWarning);
|
||||
}
|
||||
else {
|
||||
show_status(PrintDialogStatus::PrintStatusReadingFinished);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3458,7 +3461,14 @@ void SelectMachineDialog::update_show_status()
|
|||
if (!m_checkbox_list["use_ams"]->GetValue()) {
|
||||
m_ams_mapping_result.clear();
|
||||
sync_ams_mapping_result(m_ams_mapping_result);
|
||||
show_status(PrintDialogStatus::PrintStatusDisableAms);
|
||||
|
||||
if (has_timelapse_warning()) {
|
||||
show_status(PrintDialogStatus::PrintStatusTimelapseWarning);
|
||||
}
|
||||
else {
|
||||
show_status(PrintDialogStatus::PrintStatusDisableAms);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -3477,7 +3487,14 @@ void SelectMachineDialog::update_show_status()
|
|||
show_status(PrintDialogStatus::PrintStatusNeedUpgradingAms, params);
|
||||
} else {
|
||||
if (obj_->is_valid_mapping_result(m_ams_mapping_result)) {
|
||||
show_status(PrintDialogStatus::PrintStatusAmsMappingByOrder);
|
||||
|
||||
if (has_timelapse_warning()) {
|
||||
show_status(PrintDialogStatus::PrintStatusTimelapseWarning);
|
||||
}
|
||||
else {
|
||||
show_status(PrintDialogStatus::PrintStatusAmsMappingByOrder);
|
||||
}
|
||||
|
||||
} else {
|
||||
int mismatch_index = -1;
|
||||
for (int i = 0; i < m_ams_mapping_result.size(); i++) {
|
||||
|
@ -3498,20 +3515,31 @@ void SelectMachineDialog::update_show_status()
|
|||
}
|
||||
|
||||
if (m_ams_mapping_res) {
|
||||
show_status(PrintDialogStatus::PrintStatusAmsMappingSuccess);
|
||||
if (has_timelapse_warning()) {
|
||||
show_status(PrintDialogStatus::PrintStatusTimelapseWarning);
|
||||
}
|
||||
else {
|
||||
show_status(PrintDialogStatus::PrintStatusAmsMappingSuccess);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if (obj_->is_valid_mapping_result(m_ams_mapping_result)) {
|
||||
if (!has_tips(obj_))
|
||||
show_status(PrintDialogStatus::PrintStatusAmsMappingValid);
|
||||
return;
|
||||
if (!has_tips(obj_)){
|
||||
if (has_timelapse_warning()) {
|
||||
show_status(PrintDialogStatus::PrintStatusTimelapseWarning);
|
||||
}
|
||||
else {
|
||||
show_status(PrintDialogStatus::PrintStatusAmsMappingValid);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
show_status(PrintDialogStatus::PrintStatusAmsMappingInvalid);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool SelectMachineDialog::has_timelapse_warning()
|
||||
|
|
|
@ -2026,7 +2026,7 @@ void StatusPanel::update(MachineObject *obj)
|
|||
m_project_task_panel->Thaw();
|
||||
|
||||
#if !BBL_RELEASE_TO_PUBLIC
|
||||
auto delay1 = std::chrono::duration_cast<std::chrono::milliseconds>(obj->last_update_time - std::chrono::system_clock::now()).count();
|
||||
auto delay1 = std::chrono::duration_cast<std::chrono::milliseconds>(obj->last_utc_time - std::chrono::system_clock::now()).count();
|
||||
auto delay2 = std::chrono::duration_cast<std::chrono::milliseconds>(obj->last_push_time - std::chrono::system_clock::now()).count();
|
||||
auto delay = wxString::Format(" %ld/%ld", delay1, delay2);
|
||||
m_staticText_timelapse
|
||||
|
@ -3228,7 +3228,7 @@ void StatusPanel::on_axis_ctrl_e_down_10(wxCommandEvent &event)
|
|||
|
||||
void StatusPanel::on_start_unload(wxCommandEvent &event)
|
||||
{
|
||||
if (obj) obj->command_unload_filament();
|
||||
if (obj) obj->command_ams_switch(255);
|
||||
}
|
||||
|
||||
void StatusPanel::on_set_bed_temp()
|
||||
|
@ -3504,7 +3504,7 @@ void StatusPanel::on_filament_edit(wxCommandEvent &event)
|
|||
for (auto col : tray_it->second->cols) {
|
||||
cols.push_back( AmsTray::decode_color(col));
|
||||
}
|
||||
|
||||
m_filament_setting_dlg->set_ctype(tray_it->second->ctype);
|
||||
m_filament_setting_dlg->ams_filament_id = tray_it->second->setting_id;
|
||||
|
||||
if (m_filament_setting_dlg->ams_filament_id.empty()) {
|
||||
|
@ -3512,6 +3512,7 @@ void StatusPanel::on_filament_edit(wxCommandEvent &event)
|
|||
}
|
||||
else {
|
||||
m_filament_setting_dlg->set_color(color);
|
||||
m_filament_setting_dlg->set_colors(cols);
|
||||
}
|
||||
|
||||
m_filament_setting_dlg->m_is_third = !MachineObject::is_bbl_filament(tray_it->second->tag_uid);
|
||||
|
@ -3559,12 +3560,19 @@ void StatusPanel::on_ext_spool_edit(wxCommandEvent &event)
|
|||
wxColor color = AmsTray::decode_color(obj->vt_tray.color);
|
||||
m_filament_setting_dlg->ams_filament_id = obj->vt_tray.setting_id;
|
||||
|
||||
std::vector<wxColour> cols;
|
||||
for (auto col : obj->vt_tray.cols) {
|
||||
cols.push_back(AmsTray::decode_color(col));
|
||||
}
|
||||
m_filament_setting_dlg->set_ctype(obj->vt_tray.ctype);
|
||||
|
||||
if (m_filament_setting_dlg->ams_filament_id.empty()) {
|
||||
m_filament_setting_dlg->set_empty_color(color);
|
||||
}
|
||||
else {
|
||||
m_filament_setting_dlg->set_color(color);
|
||||
m_filament_setting_dlg->set_colors(cols);
|
||||
|
||||
}
|
||||
|
||||
m_filament_setting_dlg->m_is_third = !MachineObject::is_bbl_filament(obj->vt_tray.tag_uid);
|
||||
|
|
|
@ -1370,6 +1370,9 @@ static wxString get_string_value(std::string opt_key, const DynamicPrintConfig&
|
|||
else if (opt_key == "thumbnails") {
|
||||
return get_thumbnails_string(config.option<ConfigOptionPoints>(opt_key)->values);
|
||||
}
|
||||
else if (opt_key == "head_wrap_detect_zone") {
|
||||
return get_thumbnails_string(config.option<ConfigOptionPoints>(opt_key)->values);
|
||||
}
|
||||
Vec2d val = config.opt<ConfigOptionPoints>(opt_key)->get_at(opt_idx);
|
||||
return from_u8((boost::format("[%1%]") % ConfigOptionPoint(val).serialize()).str());
|
||||
}
|
||||
|
|
|
@ -45,21 +45,50 @@ static wxString update_custom_filaments()
|
|||
std::map<std::string, std::vector<Preset const *>> temp_filament_id_to_presets = preset_bundle->filaments.get_filament_presets();
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> need_sort;
|
||||
bool need_delete_some_filament = false;
|
||||
for (std::pair<std::string, std::vector<Preset const *>> filament_id_to_presets : temp_filament_id_to_presets) {
|
||||
std::string filament_id = filament_id_to_presets.first;
|
||||
if (filament_id.empty()) continue;
|
||||
if (filament_id == "null") {
|
||||
need_delete_some_filament = true;
|
||||
}
|
||||
bool filament_with_base_id = false;
|
||||
bool not_need_show = false;
|
||||
std::string filament_name;
|
||||
for (const Preset *preset : filament_id_to_presets.second) {
|
||||
if (preset->is_system || filament_id.empty() || "null" == filament_id || filament_id.size() != 8 || filament_id[0] != 'P') break;
|
||||
auto filament_vendor = dynamic_cast<ConfigOptionStrings *> (const_cast<Preset*>(preset)->config.option("filament_vendor",false));
|
||||
if(filament_vendor&&filament_vendor->values.size()&&filament_vendor->values[0] == "Generic") break;
|
||||
std::string preset_name = preset->name;
|
||||
size_t index_at = preset_name.find(" @");
|
||||
if (std::string::npos != index_at) { preset_name = preset_name.substr(0, index_at); }
|
||||
need_sort.push_back(std::make_pair(preset_name, preset->filament_id));
|
||||
break;
|
||||
if (preset->is_system) {
|
||||
not_need_show = true;
|
||||
break;
|
||||
}
|
||||
if (preset->inherits() != "") continue;
|
||||
if (!preset->base_id.empty()) filament_with_base_id = true;
|
||||
|
||||
if (!not_need_show) {
|
||||
auto filament_vendor = dynamic_cast<ConfigOptionStrings *>(const_cast<Preset *>(preset)->config.option("filament_vendor", false));
|
||||
if (filament_vendor && filament_vendor->values.size() && filament_vendor->values[0] == "Generic") not_need_show = true;
|
||||
}
|
||||
|
||||
if (filament_name.empty()) {
|
||||
std::string preset_name = preset->name;
|
||||
size_t index_at = preset_name.find(" @");
|
||||
if (std::string::npos != index_at) { preset_name = preset_name.substr(0, index_at); }
|
||||
filament_name = preset_name;
|
||||
}
|
||||
}
|
||||
if (not_need_show) continue;
|
||||
if (!filament_name.empty()) {
|
||||
if (filament_with_base_id) {
|
||||
need_sort.push_back(std::make_pair("[Action Required] " + filament_name, filament_id));
|
||||
} else {
|
||||
|
||||
need_sort.push_back(std::make_pair(filament_name, filament_id));
|
||||
}
|
||||
}
|
||||
}
|
||||
std::sort(need_sort.begin(), need_sort.end(), [](const std::pair<std::string, std::string> &a, const std::pair<std::string, std::string> &b) { return a.first < b.first; });
|
||||
if (need_delete_some_filament) {
|
||||
need_sort.push_back(std::make_pair("[Action Required]", "null"));
|
||||
}
|
||||
json temp_j;
|
||||
for (std::pair<std::string, std::string> &filament_name_to_id : need_sort) {
|
||||
temp_j["name"] = filament_name_to_id.first;
|
||||
|
@ -162,7 +191,7 @@ GuideFrame::~GuideFrame()
|
|||
|
||||
void GuideFrame::load_url(wxString &url)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< " enter, url=" << url.ToStdString();
|
||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__<< " enter, url=" << url.ToStdString();
|
||||
WebView::LoadUrl(m_browser, url);
|
||||
m_browser->SetFocus();
|
||||
UpdateState();
|
||||
|
@ -523,7 +552,7 @@ void GuideFrame::OnError(wxWebViewEvent &evt)
|
|||
// Show the info bar with an error
|
||||
// m_info->ShowMessage(_L("An error occurred loading ") + evt.GetURL() +
|
||||
// "\n" + "'" + category + "'", wxICON_ERROR);
|
||||
BOOST_LOG_TRIVIAL(info) << "GuideFrame::OnError: An error occurred loading " << evt.GetURL() << category;
|
||||
BOOST_LOG_TRIVIAL(trace) << "GuideFrame::OnError: An error occurred loading " << evt.GetURL() << category;
|
||||
|
||||
UpdateState();
|
||||
}
|
||||
|
@ -1581,7 +1610,7 @@ bool GuideFrame::LoadFile(std::string jPath, std::string &sContent)
|
|||
std::stringstream buffer;
|
||||
buffer << t.rdbuf();
|
||||
sContent=buffer.str();
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", load %1% into buffer")% jPath;
|
||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << boost::format(", load %1% into buffer")% jPath;
|
||||
}
|
||||
catch (std::exception &e)
|
||||
{
|
||||
|
|
|
@ -220,7 +220,7 @@ WebViewPanel::WebViewPanel(wxWindow *parent)
|
|||
|
||||
WebViewPanel::~WebViewPanel()
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " Start";
|
||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << " Start";
|
||||
SetEvtHandlerEnabled(false);
|
||||
|
||||
delete m_tools_menu;
|
||||
|
@ -230,7 +230,7 @@ WebViewPanel::~WebViewPanel()
|
|||
delete m_LoginUpdateTimer;
|
||||
m_LoginUpdateTimer = NULL;
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " End";
|
||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << " End";
|
||||
}
|
||||
|
||||
|
||||
|
@ -459,9 +459,9 @@ void WebViewPanel::OpenModelDetail(std::string id, NetworkAgent *agent)
|
|||
{
|
||||
if (url.find("?") != std::string::npos)
|
||||
{
|
||||
url += "&from=bambustudio";
|
||||
url += "&from=orcaslicer";
|
||||
} else {
|
||||
url += "?from=bambustudio";
|
||||
url += "?from=orcaslicer";
|
||||
}
|
||||
|
||||
wxLaunchDefaultBrowser(url);
|
||||
|
@ -536,7 +536,7 @@ void WebViewPanel::update_mode()
|
|||
*/
|
||||
void WebViewPanel::OnNavigationRequest(wxWebViewEvent& evt)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": " << evt.GetTarget().ToUTF8().data();
|
||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << ": " << evt.GetTarget().ToUTF8().data();
|
||||
const wxString &url = evt.GetURL();
|
||||
if (url.StartsWith("File://") || url.StartsWith("file://")) {
|
||||
if (!url.Contains("/web/homepage/index.html")) {
|
||||
|
@ -580,7 +580,7 @@ void WebViewPanel::OnNavigationComplete(wxWebViewEvent& evt)
|
|||
{
|
||||
m_browser->Show();
|
||||
Layout();
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": " << evt.GetTarget().ToUTF8().data();
|
||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << ": " << evt.GetTarget().ToUTF8().data();
|
||||
if (wxGetApp().get_mode() == comDevelop)
|
||||
wxLogMessage("%s", "Navigation complete; url='" + evt.GetURL() + "'");
|
||||
UpdateState();
|
||||
|
@ -591,7 +591,7 @@ void WebViewPanel::OnNavigationComplete(wxWebViewEvent& evt)
|
|||
*/
|
||||
void WebViewPanel::OnDocumentLoaded(wxWebViewEvent& evt)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": " << evt.GetTarget().ToUTF8().data();
|
||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << ": " << evt.GetTarget().ToUTF8().data();
|
||||
// Only notify if the document is the main frame, not a subframe
|
||||
if (evt.GetURL() == m_browser->GetCurrentURL())
|
||||
{
|
||||
|
@ -604,7 +604,7 @@ void WebViewPanel::OnDocumentLoaded(wxWebViewEvent& evt)
|
|||
|
||||
void WebViewPanel::OnTitleChanged(wxWebViewEvent &evt)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": " << evt.GetString().ToUTF8().data();
|
||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << ": " << evt.GetString().ToUTF8().data();
|
||||
// wxGetApp().CallAfter([this] { SendRecentList(); });
|
||||
}
|
||||
|
||||
|
@ -613,7 +613,7 @@ void WebViewPanel::OnTitleChanged(wxWebViewEvent &evt)
|
|||
*/
|
||||
void WebViewPanel::OnNewWindow(wxWebViewEvent& evt)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": " << evt.GetURL().ToUTF8().data();
|
||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << ": " << evt.GetURL().ToUTF8().data();
|
||||
wxString flag = " (other)";
|
||||
|
||||
if (evt.GetNavigationAction() == wxWEBVIEW_NAV_ACTION_USER)
|
||||
|
@ -634,7 +634,7 @@ void WebViewPanel::OnNewWindow(wxWebViewEvent& evt)
|
|||
|
||||
void WebViewPanel::OnScriptMessage(wxWebViewEvent& evt)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": " << evt.GetString().ToUTF8().data();
|
||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << ": " << evt.GetString().ToUTF8().data();
|
||||
// update login status
|
||||
if (m_LoginUpdateTimer == nullptr) {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " Create Timer";
|
||||
|
@ -880,7 +880,7 @@ void WebViewPanel::OnError(wxWebViewEvent& evt)
|
|||
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_OTHER);
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": [" << category << "] " << evt.GetString().ToUTF8().data();
|
||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << ": [" << category << "] " << evt.GetString().ToUTF8().data();
|
||||
|
||||
if (wxGetApp().get_mode() == comDevelop)
|
||||
wxLogMessage("%s", "Error; url='" + evt.GetURL() + "', error='" + category + " (" + evt.GetString() + ")'");
|
||||
|
|
|
@ -49,6 +49,7 @@ bool AMSinfo::parse_ams_info(MachineObject *obj, Ams *ams, bool remain_flag, boo
|
|||
if (it != ams->trayList.end() && it->second->is_exists) {
|
||||
if (it->second->is_tray_info_ready()) {
|
||||
info.can_id = it->second->id;
|
||||
info.ctype = it->second->ctype;
|
||||
info.material_name = it->second->get_display_filament_type();
|
||||
if (!it->second->color.empty()) {
|
||||
info.material_colour = AmsTray::decode_color(it->second->color);
|
||||
|
@ -78,6 +79,7 @@ bool AMSinfo::parse_ams_info(MachineObject *obj, Ams *ams, bool remain_flag, boo
|
|||
} else {
|
||||
info.can_id = it->second->id;
|
||||
info.material_name = "";
|
||||
info.ctype = 0;
|
||||
info.material_colour = AMS_TRAY_DEFAULT_COL;
|
||||
info.material_state = AMSCanType::AMS_CAN_TYPE_THIRDBRAND;
|
||||
wxColour(255, 255, 255);
|
||||
|
@ -644,6 +646,7 @@ void AMSLib::create(wxWindow *parent, wxWindowID id, const wxPoint &pos, const w
|
|||
m_bitmap_readonly = ScalableBitmap(this, "ams_readonly", 14);
|
||||
m_bitmap_readonly_light = ScalableBitmap(this, "ams_readonly_light", 14);
|
||||
m_bitmap_transparent = ScalableBitmap(this, "transparent_ams_lib", 68);
|
||||
m_bitmap_transparent_def = ScalableBitmap(this, "transparent_ams_lib", 68);
|
||||
|
||||
m_bitmap_extra_tray_left = ScalableBitmap(this, "extra_ams_tray_left", 80);
|
||||
m_bitmap_extra_tray_right = ScalableBitmap(this, "extra_ams_tray_right", 80);
|
||||
|
@ -857,6 +860,10 @@ void AMSLib::render_generic_text(wxDC &dc)
|
|||
|
||||
dc.SetFont(::Label::Body_13);
|
||||
dc.SetTextForeground(temp_text_colour);
|
||||
auto alpha = m_info.material_colour.Alpha();
|
||||
if (alpha != 0 && alpha != 255) {
|
||||
dc.SetTextForeground(*wxBLACK);
|
||||
}
|
||||
|
||||
auto libsize = GetSize();
|
||||
if (m_info.material_state == AMSCanType::AMS_CAN_TYPE_THIRDBRAND
|
||||
|
@ -903,6 +910,7 @@ void AMSLib::render_generic_text(wxDC &dc)
|
|||
auto pot_top = wxPoint((libsize.x - line_top_tsize.x) / 2, (libsize.y - line_top_tsize.y) / 2 - line_top_tsize.y + FromDIP(6));
|
||||
dc.DrawText(line_top, pot_top);
|
||||
|
||||
|
||||
auto pot_bottom = wxPoint((libsize.x - line_bottom_tsize.x) / 2, (libsize.y - line_bottom_tsize.y) / 2 + FromDIP(4));
|
||||
dc.DrawText(line_bottom, pot_bottom);
|
||||
}
|
||||
|
@ -966,7 +974,7 @@ void AMSLib::render_extra_lib(wxDC& dc)
|
|||
ScalableBitmap tray_bitmap_selected = m_can_index <= 1 ? m_bitmap_extra_tray_left_selected : m_bitmap_extra_tray_right_selected;
|
||||
|
||||
|
||||
auto tmp_lib_colour = m_info.material_colour;
|
||||
auto tmp_lib_colour = m_info.material_colour;
|
||||
auto temp_bitmap_third = m_bitmap_editable_light;
|
||||
auto temp_bitmap_brand = m_bitmap_readonly_light;
|
||||
|
||||
|
@ -1012,11 +1020,34 @@ void AMSLib::render_extra_lib(wxDC& dc)
|
|||
temp_bitmap_brand = m_bitmap_readonly;
|
||||
}
|
||||
|
||||
dc.SetPen(wxPen(*wxTRANSPARENT_PEN));
|
||||
if (m_info.material_cols.size() > 1) {
|
||||
int left = FromDIP(10);
|
||||
int gwidth = std::round(size.x / (m_info.material_cols.size() - 1));
|
||||
//gradient
|
||||
if (m_info.ctype == 0) {
|
||||
for (int i = 0; i < m_info.material_cols.size() - 1; i++) {
|
||||
auto rect = wxRect(left, FromDIP(10), size.x - FromDIP(20), size.y - FromDIP(20));
|
||||
dc.GradientFillLinear(rect, m_info.material_cols[i], m_info.material_cols[i + 1], wxEAST);
|
||||
left += gwidth;
|
||||
}
|
||||
}
|
||||
else {
|
||||
int cols_size = m_info.material_cols.size();
|
||||
for (int i = 0; i < cols_size; i++) {
|
||||
dc.SetBrush(wxBrush(m_info.material_cols[i]));
|
||||
float x = FromDIP(10) + ((float)size.x - FromDIP(20)) * i / cols_size;
|
||||
dc.DrawRoundedRectangle(x, FromDIP(10), ((float)size.x - FromDIP(20)) / cols_size, size.y - FromDIP(20), 0);
|
||||
}
|
||||
dc.SetBrush(wxBrush(tmp_lib_colour));
|
||||
}
|
||||
}
|
||||
else {
|
||||
dc.SetBrush(wxBrush(tmp_lib_colour));
|
||||
dc.DrawRoundedRectangle(FromDIP(10), FromDIP(10), size.x - FromDIP(20), size.y - FromDIP(20), 0);
|
||||
}
|
||||
dc.SetPen(wxPen(*wxTRANSPARENT_PEN));
|
||||
dc.SetBrush(wxBrush(tmp_lib_colour));
|
||||
dc.DrawRoundedRectangle(FromDIP(10), FromDIP(10), size.x - FromDIP(20), size.y - FromDIP(20), 0);
|
||||
|
||||
|
||||
if (!m_disable_mode) {
|
||||
// edit icon
|
||||
if (m_info.material_state != AMSCanType::AMS_CAN_TYPE_EMPTY && m_info.material_state != AMSCanType::AMS_CAN_TYPE_NONE)
|
||||
|
@ -1107,7 +1138,7 @@ void AMSLib::render_generic_lib(wxDC &dc)
|
|||
|
||||
//draw remain
|
||||
int height = size.y - FromDIP(8);
|
||||
int curr_height = height * float(m_info.material_remain * 1.0 / 100.0);
|
||||
int curr_height = height * float(m_info.material_remain * 1.0 / 100.0); dc.SetFont(::Label::Body_13);
|
||||
|
||||
int top = height - curr_height;
|
||||
|
||||
|
@ -1116,24 +1147,60 @@ void AMSLib::render_generic_lib(wxDC &dc)
|
|||
//transparent
|
||||
auto alpha = m_info.material_colour.Alpha();
|
||||
if (alpha == 0) {
|
||||
dc.DrawBitmap(m_bitmap_transparent.bmp(), FromDIP(4), FromDIP(4));
|
||||
dc.DrawBitmap(m_bitmap_transparent_def.bmp(), FromDIP(4), FromDIP(4));
|
||||
}
|
||||
|
||||
//gradient
|
||||
if (m_info.material_cols.size() > 1) {
|
||||
int left = FromDIP(4);
|
||||
float total_width = size.x - FromDIP(8);
|
||||
int gwidth = std::round(total_width / (m_info.material_cols.size() - 1));
|
||||
//gradient
|
||||
if (m_info.ctype == 0) {
|
||||
for (int i = 0; i < m_info.material_cols.size() - 1; i++) {
|
||||
|
||||
for (int i = 0; i < m_info.material_cols.size() - 1; i++) {
|
||||
if ((left + gwidth) > (size.x - FromDIP(8))) {
|
||||
gwidth = (size.x - FromDIP(4)) - left;
|
||||
}
|
||||
|
||||
if ((left + gwidth) > (size.x - FromDIP(8))) {
|
||||
gwidth = (size.x - FromDIP(4)) - left;
|
||||
auto rect = wxRect(left, height - curr_height + FromDIP(4), gwidth, curr_height);
|
||||
dc.GradientFillLinear(rect, m_info.material_cols[i], m_info.material_cols[i + 1], wxEAST);
|
||||
left += gwidth;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//multicolour
|
||||
gwidth = std::round(total_width / m_info.material_cols.size());
|
||||
for (int i = 0; i < m_info.material_cols.size(); i++) {
|
||||
dc.SetPen(wxPen(*wxTRANSPARENT_PEN));
|
||||
dc.SetBrush(wxBrush(m_info.material_cols[i]));
|
||||
if (i == 0 || i == m_info.material_cols.size() - 1) {
|
||||
#ifdef __APPLE__
|
||||
dc.DrawRoundedRectangle(left + gwidth * i, height - curr_height + FromDIP(4), gwidth, curr_height, m_radius);
|
||||
#else
|
||||
dc.DrawRoundedRectangle(left + gwidth * i, height - curr_height + FromDIP(4), gwidth, curr_height, m_radius - 1);
|
||||
#endif
|
||||
//add rectangle
|
||||
int dr_gwidth = std::round(gwidth * 0.6);
|
||||
if (i == 0) {
|
||||
dc.DrawRectangle(left + gwidth - dr_gwidth, height - curr_height + FromDIP(4), dr_gwidth, curr_height);
|
||||
}
|
||||
else {
|
||||
dc.DrawRectangle(left + gwidth*i, height - curr_height + FromDIP(4), dr_gwidth, curr_height);
|
||||
}
|
||||
}
|
||||
else {
|
||||
dc.DrawRectangle(left + gwidth * i, height - curr_height + FromDIP(4), gwidth, curr_height);
|
||||
}
|
||||
}
|
||||
//reset pen and brush
|
||||
if (m_selected || m_hover) {
|
||||
dc.SetPen(wxPen(*wxTRANSPARENT_PEN));
|
||||
dc.SetBrush(wxBrush(tmp_lib_colour));
|
||||
}
|
||||
else {
|
||||
dc.SetPen(wxPen(tmp_lib_colour, 1, wxSOLID));
|
||||
dc.SetBrush(wxBrush(tmp_lib_colour));
|
||||
}
|
||||
|
||||
auto rect = wxRect(left, height - curr_height + FromDIP(4), gwidth, curr_height);
|
||||
dc.GradientFillLinear(rect, m_info.material_cols[i], m_info.material_cols[i + 1], wxEAST);
|
||||
left += gwidth;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -1141,6 +1208,23 @@ void AMSLib::render_generic_lib(wxDC &dc)
|
|||
dc.DrawRoundedRectangle(FromDIP(4), FromDIP(4) + top, size.x - FromDIP(8), curr_height, m_radius);
|
||||
#else
|
||||
dc.DrawRoundedRectangle(FromDIP(4), FromDIP(4) + top, size.x - FromDIP(8), curr_height, m_radius - 1);
|
||||
if (alpha != 0 && alpha != 255) {
|
||||
if (transparent_changed) {
|
||||
std::string rgb = (tmp_lib_colour.GetAsString(wxC2S_HTML_SYNTAX)).ToStdString();
|
||||
if (rgb.size() == 8) {
|
||||
//delete alpha value
|
||||
rgb= rgb.substr(0, rgb.size() - 2);
|
||||
}
|
||||
float alpha_f = 0.3 * tmp_lib_colour.Alpha() / 255.0;
|
||||
std::vector<std::string> replace;
|
||||
replace.push_back(rgb);
|
||||
std::string fill_replace = "fill-opacity=\"" + std::to_string(alpha_f);
|
||||
replace.push_back(fill_replace);
|
||||
m_bitmap_transparent = ScalableBitmap(this, "transparent_ams_lib", 68, false, false, true, replace);
|
||||
transparent_changed = false;
|
||||
}
|
||||
dc.DrawBitmap(m_bitmap_transparent.bmp(), FromDIP(4), FromDIP(4));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -1209,7 +1293,9 @@ void AMSLib::Update(Caninfo info, bool refresh)
|
|||
if (dev->get_selected_machine() && dev->get_selected_machine() != m_obj) {
|
||||
m_obj = dev->get_selected_machine();
|
||||
}
|
||||
|
||||
if (info.material_colour.Alpha() != 0 && info.material_colour.Alpha() != 255 && m_info.material_colour != info.material_colour) {
|
||||
transparent_changed = true;
|
||||
}
|
||||
m_info = info;
|
||||
Layout();
|
||||
if (refresh) Refresh();
|
||||
|
@ -1245,7 +1331,9 @@ bool AMSLib::Enable(bool enable) { return wxWindow::Enable(enable); }
|
|||
|
||||
void AMSLib::msw_rescale()
|
||||
{
|
||||
m_bitmap_transparent.msw_rescale();
|
||||
//m_bitmap_transparent.msw_rescale();
|
||||
m_bitmap_transparent_def.msw_rescale();
|
||||
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
|
@ -3182,6 +3270,10 @@ void AMSControl::update_vams_kn_value(AmsTray tray, MachineObject* obj)
|
|||
m_vams_info.material_name = tray.get_display_filament_type();
|
||||
m_vams_info.material_colour = tray.get_color();
|
||||
m_vams_lib->m_info.material_name = tray.get_display_filament_type();
|
||||
auto col= tray.get_color();
|
||||
if (col.Alpha() != 0 && col.Alpha() != 255 && col.Alpha() != 254 && m_vams_lib->m_info.material_colour != col) {
|
||||
m_vams_lib->transparent_changed = true;
|
||||
}
|
||||
m_vams_lib->m_info.material_colour = tray.get_color();
|
||||
m_vams_lib->Refresh();
|
||||
}
|
||||
|
|
|
@ -140,6 +140,7 @@ struct Caninfo
|
|||
wxString material_name;
|
||||
wxColour material_colour = {*wxWHITE};
|
||||
AMSCanType material_state;
|
||||
int ctype=0;
|
||||
int material_remain = 100;
|
||||
float k = 0.0f;
|
||||
float n = 0.0f;
|
||||
|
@ -298,6 +299,7 @@ public:
|
|||
Caninfo m_info;
|
||||
MachineObject* m_obj = {nullptr};
|
||||
int m_can_index = 0;
|
||||
bool transparent_changed = { false };
|
||||
AMSModel m_ams_model;
|
||||
|
||||
void Update(Caninfo info, bool refresh = true);
|
||||
|
@ -322,6 +324,7 @@ protected:
|
|||
ScalableBitmap m_bitmap_readonly;
|
||||
ScalableBitmap m_bitmap_readonly_light;
|
||||
ScalableBitmap m_bitmap_transparent;
|
||||
ScalableBitmap m_bitmap_transparent_def;
|
||||
|
||||
ScalableBitmap m_bitmap_extra_tray_left;
|
||||
ScalableBitmap m_bitmap_extra_tray_right;
|
||||
|
@ -338,6 +341,7 @@ protected:
|
|||
bool m_hover = {false};
|
||||
bool m_show_kn = {false};
|
||||
bool m_support_cali = {false};
|
||||
|
||||
|
||||
double m_radius = {4};
|
||||
wxColour m_border_color;
|
||||
|
|
|
@ -251,7 +251,7 @@ wxWebView* WebView::CreateWebView(wxWindow * parent, wxString const & url)
|
|||
url2.Replace("\\", "/");
|
||||
#endif
|
||||
if (!url2.empty()) { url2 = wxURI(url2).BuildURI(); }
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": " << url2.ToUTF8();
|
||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << ": " << url2.ToUTF8();
|
||||
|
||||
#ifdef __WIN32__
|
||||
wxWebView* webView = new WebViewEdge;
|
||||
|
@ -337,7 +337,7 @@ void WebView::LoadUrl(wxWebView * webView, wxString const &url)
|
|||
url2.Replace("\\", "/");
|
||||
#endif
|
||||
if (!url2.empty()) { url2 = wxURI(url2).BuildURI(); }
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << url2.ToUTF8();
|
||||
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << url2.ToUTF8();
|
||||
webView->LoadURL(url2);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,10 +11,11 @@
|
|||
#include "Widgets/Button.hpp"
|
||||
#include "slic3r/Utils/ColorSpaceConvert.hpp"
|
||||
#include "MainFrame.hpp"
|
||||
#include "libslic3r/Config.hpp"
|
||||
|
||||
#include <wx/sizer.h>
|
||||
|
||||
|
||||
using namespace Slic3r;
|
||||
using namespace Slic3r::GUI;
|
||||
|
||||
int scale(const int val) { return val * Slic3r::GUI::wxGetApp().em_unit() / 10; }
|
||||
|
@ -766,10 +767,29 @@ void WipingPanel::update_warning_texts()
|
|||
|
||||
void WipingPanel::calc_flushing_volumes()
|
||||
{
|
||||
for (int from_idx = 0; from_idx < m_colours.size(); from_idx++) {
|
||||
const wxColour& from = m_colours[from_idx];
|
||||
auto& ams_multi_color_filament = wxGetApp().preset_bundle->ams_multi_color_filment;
|
||||
std::vector<std::vector<wxColour>> multi_colors;
|
||||
|
||||
// Support for multi-color filament
|
||||
for (int i = 0; i < m_colours.size(); ++i) {
|
||||
std::vector<wxColour> single_filament;
|
||||
if (i < ams_multi_color_filament.size()) {
|
||||
if (!ams_multi_color_filament[i].empty()) {
|
||||
std::vector<std::string> colors = ams_multi_color_filament[i];
|
||||
for (int j = 0; j < colors.size(); ++j) {
|
||||
single_filament.push_back(wxColour(colors[j]));
|
||||
}
|
||||
multi_colors.push_back(single_filament);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
single_filament.push_back(wxColour(m_colours[i]));
|
||||
multi_colors.push_back(single_filament);
|
||||
}
|
||||
|
||||
for (int from_idx = 0; from_idx < multi_colors.size(); ++from_idx) {
|
||||
bool is_from_support = is_support_filament(from_idx);
|
||||
for (int to_idx = 0; to_idx < m_colours.size(); to_idx++) {
|
||||
for (int to_idx = 0; to_idx < multi_colors.size(); ++to_idx) {
|
||||
bool is_to_support = is_support_filament(to_idx);
|
||||
if (from_idx == to_idx) {
|
||||
edit_boxes[to_idx][from_idx]->SetValue(std::to_string(0));
|
||||
|
@ -780,8 +800,15 @@ void WipingPanel::calc_flushing_volumes()
|
|||
flushing_volume = Slic3r::g_flush_volume_to_support;
|
||||
}
|
||||
else {
|
||||
const wxColour& to = m_colours[to_idx];
|
||||
flushing_volume = calc_flushing_volume(from, to);
|
||||
for (int i = 0; i < multi_colors[from_idx].size(); ++i) {
|
||||
const wxColour& from = multi_colors[from_idx][i];
|
||||
for (int j = 0; j < multi_colors[to_idx].size(); ++j) {
|
||||
const wxColour& to = multi_colors[to_idx][j];
|
||||
int volume = calc_flushing_volume(from, to);
|
||||
flushing_volume = std::max(flushing_volume, volume);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_from_support) {
|
||||
flushing_volume = std::max(Slic3r::g_min_flush_volume_from_support, flushing_volume);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
|
||||
#include "BitmapCache.hpp"
|
||||
#include "GUI.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
#include "GUI_ObjectList.hpp"
|
||||
|
@ -432,10 +431,14 @@ wxBitmap create_scaled_bitmap( const std::string& bmp_name_in,
|
|||
const bool grayscale/* = false*/,
|
||||
const std::string& new_color/* = std::string()*/, // color witch will used instead of orange
|
||||
const bool menu_bitmap/* = false*/,
|
||||
const bool resize/* = false*/)
|
||||
const bool resize/* = false*/,
|
||||
const bool bitmap2/* = false*/,
|
||||
const vector<std::string>& array_new_color/* = vector<std::string>*/)//used for semi transparent material)
|
||||
{
|
||||
static Slic3r::GUI::BitmapCache cache;
|
||||
|
||||
if (bitmap2) {
|
||||
return create_scaled_bitmap2(bmp_name_in, cache, win, px_cnt, grayscale, resize, array_new_color);
|
||||
}
|
||||
unsigned int width = 0;
|
||||
unsigned int height = (unsigned int) (win->FromDIP(px_cnt) + 0.5f);
|
||||
|
||||
|
@ -462,6 +465,25 @@ wxBitmap create_scaled_bitmap( const std::string& bmp_name_in,
|
|||
return *bmp;
|
||||
}
|
||||
|
||||
wxBitmap create_scaled_bitmap2(const std::string& bmp_name_in, Slic3r::GUI::BitmapCache& cache, wxWindow* win/* = nullptr*/ ,
|
||||
const int px_cnt/* = 16*/, const bool grayscale/* = false*/ , const bool resize/* = false*/ ,
|
||||
const vector<std::string>& array_new_color/* = vector<std::string>()*/) // color witch will used instead of orange
|
||||
{
|
||||
unsigned int width = 0;
|
||||
unsigned int height = (unsigned int)(win->FromDIP(px_cnt) + 0.5f);
|
||||
|
||||
std::string bmp_name = bmp_name_in;
|
||||
boost::replace_last(bmp_name, ".png", "");
|
||||
|
||||
wxBitmap* bmp = cache.load_svg2(bmp_name, width, height, grayscale, false, array_new_color, resize ? em_unit(win) * 0.1f : 0.f);
|
||||
if (bmp == nullptr) {
|
||||
// No SVG found
|
||||
throw Slic3r::RuntimeError("Could not load bitmap: " + bmp_name);
|
||||
}
|
||||
return *bmp;
|
||||
}
|
||||
|
||||
|
||||
wxBitmap* get_default_extruder_color_icon(bool thin_icon/* = false*/)
|
||||
{
|
||||
static Slic3r::GUI::BitmapCache bmp_cache;
|
||||
|
@ -858,11 +880,13 @@ ScalableBitmap::ScalableBitmap( wxWindow *parent,
|
|||
const std::string& icon_name/* = ""*/,
|
||||
const int px_cnt/* = 16*/,
|
||||
const bool grayscale/* = false*/,
|
||||
const bool resize/* = false*/):
|
||||
const bool resize/* = false*/,
|
||||
const bool bitmap2/* = false*/,
|
||||
const std::vector<std::string>& new_color/* = vector<std::string>*/) :
|
||||
m_parent(parent), m_icon_name(icon_name),
|
||||
m_px_cnt(px_cnt), m_grayscale(grayscale), m_resize(resize) // BBS: support resize by fill border
|
||||
{
|
||||
m_bmp = create_scaled_bitmap(icon_name, parent, px_cnt, m_grayscale, std::string(), false, resize);
|
||||
m_bmp = create_scaled_bitmap(icon_name, parent, px_cnt, m_grayscale, std::string(), false, resize, bitmap2, new_color);
|
||||
if (px_cnt == 0) {
|
||||
m_px_cnt = m_bmp.GetHeight(); // scale
|
||||
unsigned int height = (unsigned int) (parent->FromDIP(m_px_cnt) + 0.5f);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
#include "BitmapCache.hpp"
|
||||
#include "Widgets/PopupWindow.hpp"
|
||||
|
||||
#ifdef __WXMSW__
|
||||
|
@ -59,7 +59,13 @@ wxBitmap create_menu_bitmap(const std::string& bmp_name);
|
|||
wxBitmap create_scaled_bitmap(const std::string& bmp_name, wxWindow *win = nullptr,
|
||||
const int px_cnt = 16, const bool grayscale = false,
|
||||
const std::string& new_color = std::string(), // color witch will used instead of orange
|
||||
const bool menu_bitmap = false, const bool resize = false);
|
||||
const bool menu_bitmap = false, const bool resize = false,
|
||||
const bool bitmap2 = false,// for create_scaled_bitmap2
|
||||
const std::vector<std::string>& array_new_color = std::vector<std::string>());
|
||||
//used for semi transparent material
|
||||
wxBitmap create_scaled_bitmap2(const std::string& bmp_name_in, Slic3r::GUI::BitmapCache& cache, wxWindow* win = nullptr,
|
||||
const int px_cnt = 16, const bool grayscale = false, const bool resize = false,
|
||||
const std::vector<std::string>& array_new_color = std::vector<std::string>()); // color witch will used instead of orange
|
||||
#else
|
||||
wxBitmap create_scaled_bitmap(const std::string& bmp_name, wxWindow *win = nullptr,
|
||||
const int px_cnt = 16, const bool grayscale = false, const bool resize = false);
|
||||
|
@ -153,7 +159,9 @@ public:
|
|||
const std::string& icon_name = "",
|
||||
const int px_cnt = 16,
|
||||
const bool grayscale = false,
|
||||
const bool resize = false); // BBS: support resize by fill border
|
||||
const bool resize = false,
|
||||
const bool bitmap2 = false,
|
||||
const std::vector<std::string>& new_color = std::vector<std::string>());// BBS: support resize by fill border
|
||||
|
||||
~ScalableBitmap() {}
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ WXLRESULT wxMediaCtrl2::MSWWindowProc(WXUINT nMsg,
|
|||
}
|
||||
}
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(info) << msg.ToUTF8().data();
|
||||
BOOST_LOG_TRIVIAL(trace) << msg.ToUTF8().data();
|
||||
return 0;
|
||||
}
|
||||
return wxMediaCtrl::MSWWindowProc(nMsg, wParam, lParam);
|
||||
|
|
|
@ -1060,29 +1060,13 @@ bool PresetUpdater::priv::install_bundles_rsrc(std::vector<std::string> bundles,
|
|||
updates.updates.emplace_back(std::move(path_in_rsrc), std::move(path_in_vendors), Version(), bundle, "", "");
|
||||
|
||||
//BBS: add directory support
|
||||
auto print_in_rsrc = (this->rsrc_path / bundle / PRESET_PRINT_NAME);
|
||||
auto print_in_vendors = (this->vendor_path / bundle / PRESET_PRINT_NAME);
|
||||
auto print_in_rsrc = this->rsrc_path / bundle;
|
||||
auto print_in_vendors = this->vendor_path / bundle;
|
||||
fs::path print_folder(print_in_vendors);
|
||||
if (fs::exists(print_folder))
|
||||
fs::remove_all(print_folder);
|
||||
fs::create_directories(print_folder);
|
||||
updates.updates.emplace_back(std::move(print_in_rsrc), std::move(print_in_vendors), Version(), bundle, "", "", false, true);
|
||||
|
||||
auto filament_in_rsrc = (this->rsrc_path / bundle / PRESET_FILAMENT_NAME);
|
||||
auto filament_in_vendors = (this->vendor_path / bundle / PRESET_FILAMENT_NAME);
|
||||
fs::path filament_folder(filament_in_vendors);
|
||||
if (fs::exists(filament_folder))
|
||||
fs::remove_all(filament_folder);
|
||||
fs::create_directories(filament_folder);
|
||||
updates.updates.emplace_back(std::move(filament_in_rsrc), std::move(filament_in_vendors), Version(), bundle, "", "", false, true);
|
||||
|
||||
auto machine_in_rsrc = (this->rsrc_path / bundle / PRESET_PRINTER_NAME);
|
||||
auto machine_in_vendors = (this->vendor_path / bundle / PRESET_PRINTER_NAME);
|
||||
fs::path machine_folder(machine_in_vendors);
|
||||
if (fs::exists(machine_folder))
|
||||
fs::remove_all(machine_folder);
|
||||
fs::create_directories(machine_folder);
|
||||
updates.updates.emplace_back(std::move(machine_in_rsrc), std::move(machine_in_vendors), Version(), bundle, "", "", false, true);
|
||||
}
|
||||
|
||||
return perform_updates(std::move(updates), snapshot);
|
||||
|
@ -1256,14 +1240,7 @@ Updates PresetUpdater::priv::get_config_updates(const Semver &old_slic3r_version
|
|||
updates.updates.emplace_back(std::move(file_path), std::move(path_in_vendor.string()), std::move(version), vendor_name, changelog, "", force_update, false);
|
||||
|
||||
//BBS: add directory support
|
||||
auto print_in_vendors = (vendor_path / vendor_name / PRESET_PRINT_NAME);
|
||||
updates.updates.emplace_back(std::move(print_in_cache), std::move(print_in_vendors.string()), Version(), vendor_name, "", "", force_update, true);
|
||||
|
||||
auto filament_in_vendors = (vendor_path / vendor_name / PRESET_FILAMENT_NAME);
|
||||
updates.updates.emplace_back(std::move(filament_in_cache), std::move(filament_in_vendors.string()), Version(), vendor_name, "", "", force_update, true);
|
||||
|
||||
auto machine_in_vendors = (vendor_path / vendor_name / PRESET_PRINTER_NAME);
|
||||
updates.updates.emplace_back(std::move(machine_in_cache), std::move(machine_in_vendors.string()), Version(), vendor_name, "", "", force_update, true);
|
||||
updates.updates.emplace_back(cache_path / vendor_name, vendor_path / vendor_name, Version(), vendor_name, "", "", force_update, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,7 +94,8 @@ namespace BBL {
|
|||
|
||||
#define BAMBU_NETWORK_LIBRARY "bambu_networking"
|
||||
#define BAMBU_NETWORK_AGENT_NAME "bambu_network_agent"
|
||||
#define BAMBU_NETWORK_AGENT_VERSION "01.07.09.02"
|
||||
|
||||
#define BAMBU_NETWORK_AGENT_VERSION "01.08.04.01"
|
||||
|
||||
//iot preset type strings
|
||||
#define IOT_PRINTER_TYPE_STRING "printer"
|
||||
|
@ -104,27 +105,13 @@ namespace BBL {
|
|||
#define IOT_JSON_KEY_VERSION "version"
|
||||
#define IOT_JSON_KEY_NAME "name"
|
||||
#define IOT_JSON_KEY_TYPE "type"
|
||||
#define IOT_JSON_KEY_UPDATE_TIME "updated_time"
|
||||
#define IOT_JSON_KEY_UPDATE_TIME "update_time"
|
||||
#define IOT_JSON_KEY_UPDATED_TIME "updated_time"
|
||||
#define IOT_JSON_KEY_BASE_ID "base_id"
|
||||
#define IOT_JSON_KEY_SETTING_ID "setting_id"
|
||||
#define IOT_JSON_KEY_FILAMENT_ID "filament_id"
|
||||
#define IOT_JSON_KEY_USER_ID "user_id"
|
||||
|
||||
#define IOT_JSON_KEY_SIGN_DATE "sign_date"
|
||||
#define IOT_JSON_KEY_CERT_START_DATE "cert_start_date"
|
||||
#define IOT_JSON_KEY_CERT_END_DATE "cert_end_date"
|
||||
#define IOT_JSON_KEY_CERT_ISSUE_NAME "issue_name"
|
||||
#define IOT_JSON_KEY_CERT_SUBJECT_NAME "subject_name"
|
||||
#define IOT_JSON_KEY_CERT_SERIAL_NUMBER "serial_number"
|
||||
#define IOT_JSON_KEY_CERT_HASH_VALUE "hash_value"
|
||||
#define IOT_JSON_KEY_CERT_VERIFY_RESULT "verify_result"
|
||||
|
||||
#define EMBEDDED_ISSUER_NAME "GlobalSign GCC R45 EV CodeSigning CA 2020"
|
||||
#define EMBEDDED_SUBJECT_NAME "Shenzhen Tuozhu Technology Co., Ltd."
|
||||
#define EMBEDDED_SERIAL_NAME "0b209295a54b188466ad7478"
|
||||
#define EMBEDDED_HASH_NAME "9690647085f910ffe2098129bc1229956a51e250"
|
||||
|
||||
|
||||
// user callbacks
|
||||
typedef std::function<void(int online_login, bool login)> OnUserLoginFn;
|
||||
// printer callbacks
|
||||
|
@ -234,6 +221,14 @@ struct PublishParams {
|
|||
std::string config_filename;
|
||||
};
|
||||
|
||||
struct CertificateInformation {
|
||||
std::string issuer;
|
||||
std::string sub_name;
|
||||
std::string start_date;
|
||||
std::string end_date;
|
||||
std::string serial_number;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue