Resync the AMS and device dialogs

This commit is contained in:
SoftFever
2026-07-17 06:48:15 +08:00
parent 50abe02f18
commit 40a875800d
14 changed files with 1595 additions and 1062 deletions

View File

@@ -23,6 +23,7 @@ set(SLIC3R_GUI_SOURCES
GUI/AboutDialog.cpp
GUI/AboutDialog.hpp
GUI/AmsMappingPopup.cpp
GUI/AmsMappingPopupUpdate.cpp
GUI/AmsMappingPopup.hpp
GUI/AMSMaterialsSetting.cpp
GUI/AMSMaterialsSetting.hpp

View File

@@ -296,11 +296,8 @@ void AMSMaterialsSetting::create_panel_kn(wxWindow* parent)
m_ratio_text->SetForegroundColour(wxColour(50, 58, 61));
m_ratio_text->SetFont(Label::Head_14);
std::string language = wxGetApp().app_config->get("language");
wxString region = "en";
if (language.find("zh") == 0)
region = "zh";
wxString link_url = wxString::Format("https://wiki.bambulab.com/%s/software/bambu-studio/calibration_pa", region);
// Orca: link to the Orca Slicer pressure-advance wiki (region-agnostic).
wxString link_url = "https://www.orcaslicer.com/wiki/pressure_advance_calib";
m_wiki_ctrl = new HyperLink(parent, _L("Wiki Guide"), link_url);
cali_title_sizer->Add(m_ratio_text, 0, wxALIGN_CENTER_VERTICAL);
cali_title_sizer->Add(m_wiki_ctrl, 0, wxALIGN_CENTER_VERTICAL);
@@ -449,9 +446,19 @@ void AMSMaterialsSetting::update_filament_editing(bool is_printing)
m_tip_readonly->Wrap(FromDIP(380));
m_tip_readonly->Show(is_printing);
}
if (m_view_only) { // Orca: view-only (2D laser/cut) — lock every edit control and hide apply/reset
m_comboBox_filament->Enable(false);
m_comboBox_cali_result->Enable(false);
m_input_k_val->Enable(false);
m_input_n_val->Enable(false);
m_button_confirm->Hide();
m_button_reset->Hide();
}
}
void AMSMaterialsSetting::on_select_reset(wxCommandEvent& event) {
if (m_view_only) return; // Orca: view-only never commits
MessageDialog msg_dlg(nullptr, _L("Are you sure you want to clear the filament information?"), wxEmptyString, wxICON_WARNING | wxOK | wxCANCEL);
auto result = msg_dlg.ShowModal();
if (result != wxID_OK)
@@ -619,6 +626,8 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event)
if (!obj)
return;
if (m_view_only) return; // Orca: view-only never commits
//get filament id
ams_filament_id = "";
ams_setting_id = "";
@@ -830,6 +839,7 @@ void AMSMaterialsSetting::on_picker_color(wxCommandEvent& event)
void AMSMaterialsSetting::on_clr_picker(wxMouseEvent &event)
{
if (m_view_only) return; // Orca: view-only disables color editing
if(!m_is_third)
return;

View File

@@ -124,6 +124,10 @@ public:
std::string ams_setting_id;
bool m_is_third;
// Orca: view-only mode (dialog half of the laser/cut read-only feature). When set, the dialog is
// inspectable but every editing control is disabled and no command is sent. Set by the caller
// (StatusPanel, cluster 6); dormant (false) until then, so behavior is unchanged.
bool m_view_only = false;
wxString m_brand_filament;
wxString m_brand_sn;
wxString m_brand_tmp;
@@ -183,6 +187,7 @@ protected:
int m_pa_cali_select_id = 0;
// Orca: native wxComboBox on macOS (the custom ComboBox mis-renders the filament dropdown there)
#ifdef __APPLE__
wxComboBox *m_comboBox_filament;
#else

View File

@@ -644,7 +644,7 @@ void AMSSettingTypePanel::Update(const MachineObject* obj)
}
if (ptr->IsSwitching()) {
int display_percent = obj->get_upgrade_percent();
int display_percent = obj->get_upgrade_percent(); // Orca: read upgrade progress via the kept MachineObject accessor
if (display_percent == 100 || display_percent == 0) {
display_percent = 1;// special case, sometimes it's switching but percent is 0 or 100
}
@@ -735,6 +735,7 @@ void AMSSettingTypePanel::OnAmsTypeChanged(wxCommandEvent& event)
event.Skip();
}
// Orca: AMSSettingArrangeAMSOrder impl kept compiled-out (feature intentionally not shipped).
#if 0 /*used option*/
AMSSettingArrangeAMSOrder::AMSSettingArrangeAMSOrder(wxWindow* parent)
: wxPanel(parent)

View File

@@ -129,6 +129,7 @@ private:
AnimaIcon* m_switching_icon;
};
// Orca: the firmware AMS-reorder ("Arrange AMS Order") panel is intentionally not shipped.
#if 0
class AMSSettingArrangeAMSOrder : public wxPanel
{

File diff suppressed because it is too large Load Diff

View File

@@ -34,23 +34,28 @@
#include "Widgets/CheckBox.hpp"
#include "Widgets/ComboBox.hpp"
#include "Widgets/ScrolledWindow.hpp"
#include "Widgets/SwitchButton.hpp"
#include "Widgets/SwitchButton.hpp" // Orca: SwitchBoard (m_nozzle_btn_panel); not transitively available here
#include "Widgets/PopupWindow.hpp"
#include <wx/simplebook.h>
#include <wx/hashmap.h>
#include "slic3r/GUI/DeviceCore/DevUtil.h"
#include <optional>
#define MAPPING_ITEM_INVALID_REMAIN -1
namespace Slic3r {
// Previous definitions
namespace Slic3r
{
class DevNozzleRack;
namespace GUI { class wgtDeviceNozzleRackSelect; }
}
namespace GUI
{
class wgtDeviceNozzleRackSelect;
class wgtMsgPanel;
};
};
namespace Slic3r { namespace GUI {
namespace Slic3r {
namespace GUI {
#define AMS_TOTAL_COUNT 4
@@ -86,26 +91,59 @@ struct TrayData
class MaterialItem: public wxPanel
{
protected:
int m_text_pos_x = 0;
int m_text_pos_y = -1;
bool m_dropdown_allow_painted = true;
wxString m_mapping_text;
public:
MaterialItem(wxWindow *parent, wxColour mcolour, wxString mname);
// Orca: filament_id defaults to empty so the pre-resync 3-arg callers (SelectMachine [cluster 7],
// SendMultiMachinePage, the calibration wizard) keep compiling; m_filament_id is otherwise unused here.
MaterialItem(wxWindow *parent, wxColour mcolour, wxString mname, std::string filament_id = std::string());
~MaterialItem();
wxPanel* m_main_panel;
void allow_paint_dropdown(bool flag);
void set_ams_text(const wxString& txt);
void set_ams_info(wxColour col, wxString txt,
int ctype = 0, std::vector<wxColour> cols = std::vector<wxColour>(),
bool record_back_info = false);
void set_material_cols(int ctype, const std::vector<wxColour>& cols);
void reset_ams_info();
virtual void reset_valid_info();
void set_nozzle_info(const wxString& mapped_nozzle_str);
void disable();
void enable();
void on_normal();
void on_selected();
void on_warning();
bool is_selected() const { return m_selected;}
bool is_warning() const { return m_warning;}
void msw_rescale();
protected:
void messure_size();
public:
std::string m_filament_id;
wxColour m_material_coloul;
int m_material_ctype = 0;
std::vector<wxColour> m_material_cols;
wxString m_material_name;
wxString m_mapped_nozzle_str;
//info
wxColour m_ams_coloul;
wxString m_ams_name;
// Physical nozzle(s) the print-dispatch mapping assigned to this filament (e.g. "R1", "L R").
// Empty on printers without a nozzle rack or filament switcher; when set, the card grows a row.
wxString m_mapped_nozzle_str;
int m_ams_ctype = 0;
std::vector<wxColour> m_ams_cols = std::vector<wxColour>();
//reset
wxColour m_back_ams_coloul;
wxString m_back_ams_name;
@@ -125,32 +163,17 @@ public:
bool m_match {true};
bool m_enable {true};
void msw_rescale();
void allow_paint_dropdown(bool flag);
void set_ams_info(wxColour col, wxString txt, int ctype=0, std::vector<wxColour> cols= std::vector<wxColour>(),bool record_back_info = false);
void reset_ams_info();
// Set the mapped-nozzle label ("R1", "L R", ...); grows/shrinks the card as the row appears/clears.
void set_nozzle_info(const wxString& mapped_nozzle_str);
// Size the card: base swatch height, plus one row when a nozzle label is present.
void messure_size();
void disable();
void enable();
void on_normal();
void on_selected();
void on_warning();
void paintEvent(wxPaintEvent &evt);
virtual void render(wxDC &dc);
void match(bool mat);
virtual void doRender(wxDC &dc);
virtual void reset_valid_info();
};
class MaterialSyncItem : public MaterialItem
{
public:
MaterialSyncItem(wxWindow *parent, wxColour mcolour, wxString mname);
// Orca: filament_id defaults to empty for pre-resync 3-arg callers (see MaterialItem).
MaterialSyncItem(wxWindow *parent, wxColour mcolour, wxString mname, std::string filament_id = std::string());
~MaterialSyncItem();
int get_real_offset();
void render(wxDC &dc) override;
@@ -182,7 +205,7 @@ public:
public:
void update_data(TrayData data);
void send_event(int fliament_id);
void set_data(const wxString& tag_name, wxColour colour, wxString name, bool remain_detect, TrayData data, bool unmatch = false);
void set_data(const wxString& tag_name, wxColour colour, wxString name, bool remain_detect, TrayData data, bool unmatch = false, std::optional<wxString> tooltip_opt = std::nullopt);
void set_checked(bool checked);
void set_tray_index(wxString t_index) { m_tray_index = t_index; };
@@ -223,13 +246,38 @@ protected:
void doRender(wxDC& dc);
};
class DevIconLabel : public wxPanel
{
public:
DevIconLabel(wxWindow* parent, const wxString& icon, const wxString& label);
public:
void SetAllBackgroundColor(const wxColour& color);
Label* GetLabelItem() const { return m_label; }
void SetLabel(const wxString& label);
void SetIcon(const wxString& icon);
void Rescale();
private:
void CreateGui();
private:
Label* m_label{ nullptr };
wxString m_icon_str;
wxStaticBitmap* m_icon{ nullptr };
};
class AmsMapingPopup : public PopupWindow
{
bool m_use_in_sync_dialog = false;
bool m_ams_remain_detect_flag = false;
bool m_ext_mapping_filatype_check = true;
wxStaticText* m_title_text{ nullptr };
wgtDeviceNozzleRackSelect *m_rack_nozzle_select{nullptr};
DevIconLabel* m_flush_warning_panel;
public:
AmsMapingPopup(wxWindow *parent,bool use_in_sync_dialog = false);
~AmsMapingPopup() {};
@@ -245,11 +293,11 @@ public:
bool m_has_unmatch_filament {false};
int m_current_filament_id;
ShowType m_show_type{ShowType::RIGHT};
// Orca: set from update() — true when a Filament Track Switch is installed, which makes the
// external-spool slots un-pickable (false on any printer without a switch, so behavior is unchanged).
bool m_fila_switch_installed{false};
std::string m_tag_material;
wxScrolledWindow *m_scrolled_window{nullptr};
wxBoxSizer *m_sizer_main{nullptr};
wxBoxSizer *m_sizer_main_h{nullptr};
wxBoxSizer *m_sizer_ams_v{nullptr};
wxBoxSizer *m_sizer_ams{nullptr};
wxBoxSizer *m_sizer_ams_left{nullptr};
wxBoxSizer *m_sizer_ams_right{nullptr};
@@ -263,26 +311,27 @@ public:
MappingItem* m_right_extra_slot{nullptr};
wxPanel * m_left_marea_panel{nullptr};
wxPanel * m_right_marea_panel{nullptr};
wxPanel* m_right_marea_panel{ nullptr }; // used as right if both left and right sides shown. used as single panel if only one side shown.
wxPanel * m_left_first_text_panel{nullptr};
wxPanel * m_right_first_text_panel{nullptr};
wgtMsgPanel* m_ams_tips_msg_panel{nullptr};
wxPanel * m_split_line_panel{nullptr};
wxBoxSizer * m_left_split_ams_sizer{nullptr};
wxBoxSizer * m_right_split_ams_sizer{nullptr};
wxBoxSizer * m_right_split_ext_sizer{ nullptr };
Label * m_left_tips{nullptr};
Label * m_right_tips{nullptr};
ScalableButton* m_reset_btn{nullptr};
wxString m_single_tip_text;
wxString m_left_tip_text;
wxString m_right_tip_text;
wxString m_ams_tips_panel_text;
wxBoxSizer* m_sizer_split_ams_left;
wxBoxSizer* m_sizer_split_ams_right;
bool m_mapping_from_multi_machines {false};
// Rack nozzle manual-pick (rack printers only; hidden by default via Show(false)).
wgtDeviceNozzleRackSelect* m_rack_nozzle_select{nullptr};
Label* m_flush_warning_panel{nullptr}; // Orca: uses a plain Label for the flush warning
std::weak_ptr<DevNozzleRack> m_rack;
bool get_use_in_sync_dialog() { return m_use_in_sync_dialog; }
void set_sizer_title(wxBoxSizer *sizer, wxString text);
wxBoxSizer* create_split_sizer(wxWindow* parent, wxString text);
void set_send_win(wxWindow* win) {send_win = win;};
@@ -290,8 +339,6 @@ public:
void set_tag_texture(std::string texture);
void update(MachineObject* obj, const std::vector<FilamentInfo>& ams_mapping_result, bool use_dynamic_switch = false, std::optional<PrintFromType> print_type = std::nullopt);
void update_rack_select(MachineObject* obj, bool use_dynamic_switch, std::optional<PrintFromType> print_type);
void update_flush_waste(MachineObject* obj);
void update_title(MachineObject* obj);
void update_items_check_state(const std::vector<FilamentInfo>& ams_mapping_result);
void update_ams_data_multi_machines();
void add_ams_mapping(std::vector<TrayData> tray_data, bool remain_detect_flag, wxWindow *container, wxBoxSizer *sizer);
@@ -305,15 +352,26 @@ public:
void paintEvent(wxPaintEvent &evt);
void set_parent_item(MaterialItem* item) {m_parent_item = item;};
void set_show_type(ShowType type) { m_show_type = type; };
// Orca: transitional shim (removed in resync cluster 8) — keeps SelectMachine (cluster 7, not yet
// resynced) compiling. Its only caller passes false, which equals the copied update path's default
// (all slots shown), so a no-op preserves behavior.
void set_only_show_ext_spool(bool /*flag*/) {}
// Orca: transitional shim (removed in resync cluster 8) — SelectMachine (cluster 7) still calls this
// dropped-from-REF helper; restored verbatim from the pre-resync Orca implementation.
std::vector<TrayData> parse_ams_mapping(const std::map<std::string, DevAms*, NumericStrCompare>& amsList);
#ifdef __APPLE__
void on_mouse_move(wxMouseEvent &evt);
wxPopupWindow * m_tip_popup{nullptr};
Label* m_tip_label{nullptr};
#endif
using ResetCallback = std::function<void(const std::string&)>;
void reset_ams_info();
void set_reset_callback(ResetCallback callback);
void show_reset_button();
void set_material_index_str(std::string str) { m_material_index = str; }
const std::string &get_material_index_str() { return m_material_index; }
void set_only_show_ext_spool(bool flag);
public:
void msw_rescale();
@@ -321,11 +379,20 @@ public:
void EnableExtMappingFilaTypeCheck(bool to_check = true) { m_ext_mapping_filatype_check = to_check;} ;
private:
// update
void update_title(MachineObject* obj);
void update_ams_tips(MachineObject* obj);
void update_mapping_items(MachineObject* obj, const std::vector<FilamentInfo>& ams_mapping_result, bool use_dynamic_switch);
// events
void OnNozzleMappingSelected(wxCommandEvent& evt);
void update_flush_waste(MachineObject* obj);
private:
std::weak_ptr<DevNozzleRack> m_rack;
ResetCallback m_reset_callback{nullptr};
std::string m_material_index;
bool m_only_show_ext_spool{false};
};
class AmsMapingTipPopup : public PopupWindow

View File

@@ -0,0 +1,704 @@
/*****************************************************************//**
* \file AmsMappingPopupUpdate.cpp
* \brief do update for AmsMappingPopup
* \note moved from AmsMappingPopup.cpp to here to reduce the code size of AmsMappingPopup.cpp
*
* \author xin.zhang
* \date February 2026
*********************************************************************/
#include "AmsMappingPopup.hpp"
#include "I18N.hpp"
#include "DeviceCore/DevConfigUtil.h"
#include "libslic3r/Utils.hpp"
#include "slic3r/Utils/WxFontUtils.hpp"
#include "GUI.hpp"
#include "GUI_App.hpp"
#include "GUI_Preview.hpp"
#include "MainFrame.hpp"
#include "format.hpp"
#include "Widgets/ProgressDialog.hpp"
#include "Widgets/RoundedRectangle.hpp"
#include "Widgets/StaticBox.hpp"
#include <wx/progdlg.h>
#include <wx/clipbrd.h>
#include <wx/dcgraph.h>
#include <wx/graphics.h>
#include <miniz.h>
#include <algorithm>
#include <optional>
#include "Plater.hpp"
#include "BitmapCache.hpp"
#include "DeviceCore/DevFilaSystem.h"
#include "DeviceCore/DevFilaSwitch.h"
#include "DeviceCore/DevMappingNozzle.h"
#include "DeviceCore/DevNozzleRack.h" // Orca: full type for GetNozzleSystem()->GetNozzleRack()->IsSupported()
#include "DeviceTab/wgtDeviceNozzleSelect.h"
#include "DeviceTab/wgtMsgPanel.h"
namespace Slic3r::GUI {
static void _add_containers(const AmsMapingPopup* win,
std::list<MappingContainer*>& one_slot_containers,
const std::vector<MappingContainer*>& four_slots_containers,
wxBoxSizer* target_sizer)
{
for (auto container : four_slots_containers) { target_sizer->Add(container, 0, wxTOP, win->FromDIP(5)); }
while (!one_slot_containers.empty()) {
wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
for (int i = 0; i < 3; i++) {
if (one_slot_containers.empty()) { break; }
sizer->Add(one_slot_containers.front(), 0, wxLEFT, (i == 0) ? 0 : win->FromDIP(5));
one_slot_containers.pop_front();
}
target_sizer->Add(sizer, 0, wxTOP, win->FromDIP(5));
}
}
void AmsMapingPopup::update(MachineObject* obj,
const std::vector<FilamentInfo>& ams_mapping_result,
bool use_dynamic_switch,
std::optional<PrintFromType> print_type)
{
BOOST_LOG_TRIVIAL(info) << "ams_mapping total count " << obj->GetFilaSystem()->GetAmsCount();
if (!obj) { return; }
for (auto& ams_container : m_amsmapping_container_list) {
ams_container->Destroy();
}
m_amsmapping_container_list.clear();
m_amsmapping_container_sizer_list.clear();
m_mapping_item_list.clear();
/*title*/
update_title(obj);
/*ams mapping*/
update_ams_tips(obj);
update_mapping_items(obj, ams_mapping_result, use_dynamic_switch);
/*rack*/
update_rack_select(obj, use_dynamic_switch, print_type);
update_flush_waste(obj);
if (wxGetApp().dark_mode() && m_reset_btn->GetName() != "erase_dark") {
m_reset_btn->SetName("erase_dark");
m_reset_btn->SetBitmap(ScalableBitmap(m_right_first_text_panel, "erase_dark", 14).bmp());
} else if (!wxGetApp().dark_mode() && m_reset_btn->GetName() != "erase") {
m_reset_btn->SetName("erase");
m_reset_btn->SetBitmap(ScalableBitmap(m_right_first_text_panel, "erase", 14).bmp());
}
size_t extruder_num = obj->GetExtderSystem()->GetTotalExtderCount();
if (extruder_num == 1) {
m_left_marea_panel->Hide();
m_left_extra_slot->Hide();
m_split_line_panel->Hide();
m_right_marea_panel->Show();
m_right_marea_panel->Enable(true);
m_right_extra_slot->Show();
m_right_extra_slot->Enable(true);
m_right_split_ext_sizer->Show(true);
set_sizer_title(m_right_split_ams_sizer, _L("AMS"));
} else if (extruder_num > 1) {
if (m_show_type == ShowType::LEFT_AND_RIGHT_DYNAMIC) {
m_left_marea_panel->Show(false);
m_left_extra_slot->Show(false);
m_right_extra_slot->Show(false);
m_left_split_ams_sizer->Show(false);
m_right_split_ams_sizer->Show(false);
m_right_split_ext_sizer->Show(false);
m_split_line_panel->Hide();
m_right_marea_panel->Show();
m_right_marea_panel->Enable(true);
} else {
m_left_marea_panel->Show();
m_left_extra_slot->Show();
m_split_line_panel->Show();
m_right_marea_panel->Show();
m_right_extra_slot->Show();
m_right_split_ext_sizer->Show(true);
m_left_tips->SetLabel(m_left_tip_text);
m_right_tips->SetLabel(m_right_tip_text);
set_sizer_title(m_left_split_ams_sizer, _L("Left AMS"));
set_sizer_title(m_right_split_ams_sizer, _L("Right AMS"));
if (m_show_type == ShowType::LEFT) {
m_left_marea_panel->Enable(true);
m_left_extra_slot->Enable(true);
m_right_marea_panel->Enable(false);
m_right_extra_slot->Enable(false);
if (m_use_in_sync_dialog) {
m_left_tips->SetLabel(m_single_tip_text);
m_right_tips->SetLabel("");
}
} else if (m_show_type == ShowType::RIGHT) {
m_left_marea_panel->Enable(false);
m_left_extra_slot->Enable(false);
m_right_marea_panel->Enable(true);
m_right_extra_slot->Enable(true);
if (m_use_in_sync_dialog) {
// m_right_tips->SetLabel(m_single_tip_text);
m_left_tips->SetLabel("");
}
} else if (m_show_type == ShowType::LEFT_AND_RIGHT) {
m_left_marea_panel->Enable(true);
m_left_extra_slot->Enable(true);
m_right_marea_panel->Enable(true);
m_right_extra_slot->Enable(true);
if (m_use_in_sync_dialog) {
m_left_tips->SetLabel(m_single_tip_text);
m_right_tips->SetLabel("");
}
} else if (m_show_type == ShowType::LEFT_AND_RIGHT_DYNAMIC) {
m_left_marea_panel->Show(false);
m_left_extra_slot->Show(false);
m_right_extra_slot->Show(false);
m_left_split_ams_sizer->Show(false);
m_right_split_ams_sizer->Show(false);
m_right_split_ext_sizer->Show(false);
m_split_line_panel->Hide();
m_right_marea_panel->Show();
m_right_marea_panel->Enable(true);
}
}
}
Layout();
Fit();
Refresh();
}
// Orca: the kept fila model has no tray-level ams_type; the owning AMS type is passed in
// (DevAms::GetAmsType() for AMS trays, DevAmsType::EXT_SPOOL for the virtual/ext slots).
static std::optional<TrayData> sGetTrayData(DevAmsTray* tray,
const std::string& ams_id_str,
DevAmsType ams_type)
{
int ams_id = 0;
int tray_id = 0;
try {
ams_id = std::stoi(ams_id_str);
tray_id = atoi(tray->id.c_str());
} catch (const std::exception& e) {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ":[error] invalid ams_id or tray_id: " << e.what();
return std::nullopt;
}
TrayData td;
td.ams_id = ams_id;
if (ams_type != DevAmsType::EXT_SPOOL) {
td.slot_id = tray_id;
} else {
td.slot_id = 0;
}
if (ams_type == DevAmsType::AMS ||
ams_type == DevAmsType::AMS_LITE ||
ams_type == DevAmsType::N3F) {
td.id = ams_id * 4 + tray_id;
} else if (ams_type == DevAmsType::N3S) {
td.id = ams_id + tray_id;
} else if(ams_type == DevAmsType::EXT_SPOOL){
td.id = tray_id;
}
if (ams_type != EXT_SPOOL && !tray->is_exists) {
td.type = EMPTY;
} else {
if (!tray->is_tray_info_ready()) {
td.type = THIRD;
} else {
td.type = NORMAL;
td.remain = tray->remain;
td.colour = DevAmsTray::decode_color(tray->color);
td.name = tray->get_display_filament_type();
td.filament_type = tray->get_filament_type();
td.ctype = tray->ctype;
for (const auto& col : tray->cols) {
td.material_cols.push_back(DevAmsTray::decode_color(col));
}
}
}
return td;
}
void AmsMapingPopup::update_mapping_items(MachineObject* obj, const std::vector<FilamentInfo>& ams_mapping_result, bool use_dynamic_switch)
{
std::list<MappingContainer*> left_one_slot_containers;
std::list<MappingContainer*> right_one_slot_containers;
std::vector<MappingContainer*> left_four_slots_containers;
std::vector<MappingContainer*> right_four_slot_containers;
const auto& ams_list = obj->GetFilaSystem()->GetAmsList();
for (auto ams_iter = ams_list.begin(); ams_iter != ams_list.end(); ams_iter++) {
const auto& extruder_set = ams_iter->second->GetBindedExtruderSet();
if (extruder_set.size() <= 0) {
continue;
}
wxPanel* target_panel = nullptr;
if (m_show_type == ShowType::LEFT_AND_RIGHT_DYNAMIC) {
target_panel = m_right_marea_panel;
} else {
int extruder_id = *extruder_set.begin();
if (extruder_id == MAIN_EXTRUDER_ID) {
target_panel = m_right_marea_panel;
} else if (extruder_id == DEPUTY_EXTRUDER_ID) {
target_panel = m_left_marea_panel;
}
}
if (!target_panel) {
continue;
}
auto sizer_mapping_list = new wxBoxSizer(wxHORIZONTAL);
auto ams_mapping_item_container = new MappingContainer(target_panel, ams_iter->second->GetDisplayName(), ams_iter->second->GetSlotCount());
ams_mapping_item_container->SetName(target_panel->GetName());
ams_mapping_item_container->SetSizer(sizer_mapping_list);
ams_mapping_item_container->Layout();
BOOST_LOG_TRIVIAL(trace) << "ams_mapping ams id " << ams_iter->first.c_str();
DevAms* ams_group = ams_iter->second;
auto ams_type = ams_group->GetAmsType();
std::vector<TrayData> tray_datas;
std::map<std::string, DevAmsTray*>::const_iterator tray_iter;
for (tray_iter = ams_group->GetTrays().cbegin(); tray_iter != ams_group->GetTrays().cend(); tray_iter++) {
const auto& td_opt = sGetTrayData(tray_iter->second, ams_group->GetAmsId(), ams_type);
if (td_opt.has_value()) {
tray_datas.push_back(td_opt.value());
}
}
ams_mapping_item_container->Show();
add_ams_mapping(tray_datas, obj->GetFilaSystem()->IsDetectRemainEnabled(), ams_mapping_item_container, sizer_mapping_list);
m_amsmapping_container_sizer_list.push_back(sizer_mapping_list);
m_amsmapping_container_list.push_back(ams_mapping_item_container);
if (target_panel == m_right_marea_panel) {
if (ams_mapping_item_container->get_slots_num() == 1) {
right_one_slot_containers.push_back(ams_mapping_item_container);
} else {
right_four_slot_containers.push_back(ams_mapping_item_container);
}
} else if (target_panel == m_left_marea_panel) {
if (ams_mapping_item_container->get_slots_num() == 1) {
left_one_slot_containers.push_back(ams_mapping_item_container);
} else {
left_four_slots_containers.push_back(ams_mapping_item_container);
}
}
}
for (int i = obj->vt_slot.size() - 1; i >= 0; i--) {
DevAmsTray* tray_data = &obj->vt_slot[i];
const auto& td_opt = sGetTrayData(tray_data, tray_data->id, DevAmsType::EXT_SPOOL);
if (!td_opt.has_value()) {
continue;
}
if (m_show_type == ShowType::LEFT_AND_RIGHT_DYNAMIC) {
auto sizer_mapping_list = new wxBoxSizer(wxHORIZONTAL);
const auto& shown_name = td_opt->ams_id == VIRTUAL_TRAY_MAIN_ID ? "Ext-R" : "Ext-L";
auto ams_mapping_item_container = new MappingContainer(m_right_marea_panel, shown_name, 1);
ams_mapping_item_container->SetName(m_right_marea_panel->GetName());
ams_mapping_item_container->SetSizer(sizer_mapping_list);
ams_mapping_item_container->Layout();
std::vector<TrayData> tray_datas;
tray_datas.push_back(td_opt.value());
add_ams_mapping(tray_datas, false, ams_mapping_item_container, sizer_mapping_list);
m_amsmapping_container_sizer_list.push_back(sizer_mapping_list);
m_amsmapping_container_list.push_back(ams_mapping_item_container);
right_one_slot_containers.push_back(ams_mapping_item_container);
} else {
if (td_opt->ams_id == VIRTUAL_TRAY_MAIN_ID) {
m_right_extra_slot->send_win = send_win;
add_ext_ams_mapping(td_opt.value(), m_right_extra_slot);
} else if (td_opt->ams_id == VIRTUAL_TRAY_DEPUTY_ID) {
m_left_extra_slot->send_win = send_win;
add_ext_ams_mapping(td_opt.value(), m_left_extra_slot);
}
}
}
_add_containers(this, left_one_slot_containers, left_four_slots_containers, m_sizer_ams_basket_left);
_add_containers(this, right_one_slot_containers, right_four_slot_containers, m_sizer_ams_basket_right);
if (m_show_type != ShowType::LEFT_AND_RIGHT_DYNAMIC){
m_left_split_ams_sizer->Show(!left_one_slot_containers.empty() || !left_four_slots_containers.empty());
m_right_split_ams_sizer->Show(!right_one_slot_containers.empty() || !right_four_slot_containers.empty());
} else {
m_left_split_ams_sizer->Show(false);
m_right_split_ams_sizer->Show(false);
}
update_items_check_state(ams_mapping_result);
}
void AmsMapingPopup::update_ams_data_multi_machines()
{
m_mapping_from_multi_machines = true;
std::vector<TrayData> tray_datas;
for (int i = 0; i < 4; ++i) {
TrayData td;
td.id = i;
td.type = EMPTY;
td.colour = wxColour(166, 169, 170);
td.name = "";
td.filament_type = "";
td.ctype = 0;
tray_datas.push_back(td);
}
for (auto& ams_container : m_amsmapping_container_list) {
ams_container->Destroy();
}
m_amsmapping_container_list.clear();
m_amsmapping_container_sizer_list.clear();
m_mapping_item_list.clear();
if (wxGetApp().dark_mode() && m_reset_btn->GetName() != "erase_dark") {
m_reset_btn->SetName("erase_dark");
m_reset_btn->SetBitmap(ScalableBitmap(m_right_first_text_panel, "erase_dark", 14).bmp());
} else if (!wxGetApp().dark_mode() && m_reset_btn->GetName() != "erase") {
m_reset_btn->SetName("erase");
m_reset_btn->SetBitmap(ScalableBitmap(m_right_first_text_panel, "erase", 14).bmp());
}
size_t nozzle_nums = 1;
m_show_type = ShowType::RIGHT;
m_left_marea_panel->Hide();
m_left_extra_slot->Hide();
// m_left_marea_panel->Show();
m_right_marea_panel->Show();
set_sizer_title(m_right_split_ams_sizer, _L("AMS"));
// m_right_tips->SetLabel(m_single_tip_text);
m_right_extra_slot->Hide();
m_left_extra_slot->Hide();
/*ams*/
bool has_left_ams = false, has_right_ams = false;
std::list<MappingContainer*> left_one_slot_containers;
std::list<MappingContainer*> right_one_slot_containers;
std::vector<MappingContainer*> left_four_slots_containers;
std::vector<MappingContainer*> right_four_slot_containers;
for (int i = 0; i < 1; i++) {
int ams_indx = 0;
int ams_type = 1;
int nozzle_id = 0;
if (ams_type >= 1 || ams_type <= 3) { // 1:ams 2:ams-lite 3:n3f
auto sizer_mapping_list = new wxBoxSizer(wxHORIZONTAL);
auto ams_mapping_item_container = new MappingContainer(nozzle_id == 0 ? m_right_marea_panel : m_left_marea_panel, "AMS-1", 4);
ams_mapping_item_container->SetName(nozzle_id == 0 ? m_right_marea_panel->GetName() : m_left_marea_panel->GetName());
ams_mapping_item_container->SetSizer(sizer_mapping_list);
ams_mapping_item_container->Layout();
m_has_unmatch_filament = false;
ams_mapping_item_container->Show();
add_ams_mapping(tray_datas, false, ams_mapping_item_container, sizer_mapping_list);
m_amsmapping_container_sizer_list.push_back(sizer_mapping_list);
m_amsmapping_container_list.push_back(ams_mapping_item_container);
if (nozzle_id == 0) {
has_right_ams = true;
if (ams_mapping_item_container->get_slots_num() == 1) {
right_one_slot_containers.push_back(ams_mapping_item_container);
} else {
right_four_slot_containers.push_back(ams_mapping_item_container);
}
} else if (nozzle_id == 1) {
has_left_ams = true;
if (ams_mapping_item_container->get_slots_num() == 1) {
left_one_slot_containers.push_back(ams_mapping_item_container);
} else {
left_four_slots_containers.push_back(ams_mapping_item_container);
}
}
} else if (ams_type == 4) { // 4:n3s
}
}
_add_containers(this, left_one_slot_containers, left_four_slots_containers, m_sizer_ams_basket_left);
_add_containers(this, right_one_slot_containers, right_four_slot_containers, m_sizer_ams_basket_right);
m_left_split_ams_sizer->Show(has_left_ams);
m_right_split_ams_sizer->Show(has_right_ams);
//update_items_check_state(ams_mapping_result);
Layout();
Fit();
}
void AmsMapingPopup::update_title(MachineObject* obj)
{
const auto& full_config = wxGetApp().preset_bundle->full_config();
size_t nozzle_nums = full_config.option<ConfigOptionFloatsNullable>("nozzle_diameter")->values.size();
if (nozzle_nums > 1) {
m_split_line_panel->Show();
if (m_show_type == ShowType::LEFT) {
wxString nozzle_name = obj ? _L(DevPrinterConfigUtil::get_toolhead_display_name(
obj->printer_type, DEPUTY_EXTRUDER_ID, ToolHeadComponent::Nozzle, ToolHeadNameCase::LowerCase)) : _L("left nozzle");
m_title_text->SetLabelText(wxString::Format(_L("Please select the filament installed on the %s."), nozzle_name));
return;
} else if (m_show_type == ShowType::RIGHT) {
wxString nozzle_name = obj ? _L(DevPrinterConfigUtil::get_toolhead_display_name(
obj->printer_type, MAIN_EXTRUDER_ID, ToolHeadComponent::Nozzle, ToolHeadNameCase::LowerCase)) : _L("right nozzle");
m_title_text->SetLabelText(wxString::Format(_L("Please select the filament installed on the %s."), nozzle_name));
return;
} else if (m_show_type == ShowType::LEFT_AND_RIGHT_DYNAMIC) {
m_title_text->SetLabelText(_L("Please select the filament."));
return;
}
} else if (nozzle_nums == 1) {
m_split_line_panel->Hide();
}
m_title_text->SetLabelText(_L("Nozzle"));
}
void AmsMapingPopup::update_ams_tips(MachineObject* obj)
{
const auto& full_config = wxGetApp().preset_bundle->full_config();
size_t nozzle_nums = full_config.option<ConfigOptionFloatsNullable>("nozzle_diameter")->values.size();
if (m_ams_tips_msg_panel) {
m_ams_tips_msg_panel->Clear();
if (nozzle_nums == 2 && m_show_type != ShowType::LEFT_AND_RIGHT) {
m_ams_tips_msg_panel->AddMessage(_L("To learn about the filaments matching rules."),
"#FF6F00", ""); // Orca: dropped vendor help link
}
if (obj && obj->GetFilaSwitch()->IsInstalled()) {
const auto& msg = _L("External spools is not supported since Filament Track Switch has been installed. If you want to use external spool, please uninstall it.");
m_ams_tips_msg_panel->AddMessage(msg, "#FF6F00", "");
}
m_ams_tips_msg_panel->Layout();
m_ams_tips_msg_panel->Fit();
m_ams_tips_msg_panel->Show(m_ams_tips_msg_panel->GetMessageCount() > 0);
}
}
void AmsMapingPopup::update_rack_select(MachineObject* obj, bool use_dynamic_switch, std::optional<PrintFromType> print_from_type)
{
// Orca: MachineObject has no GetNozzleRack() convenience; route through the nozzle system instead.
m_rack = obj ? obj->GetNozzleSystem()->GetNozzleRack() : nullptr;
bool show_rack_select_area = false;
if (!m_mapping_from_multi_machines && !m_use_in_sync_dialog &&
obj && obj->GetNozzleSystem()->GetNozzleRack()->IsSupported() &&
print_from_type.has_value() && print_from_type.value() == PrintFromType::FROM_NORMAL) {
const auto& nozzle_pos_vec = obj->get_nozzle_mapping_result()->GetMappedNozzlePosVecByFilaId(m_current_filament_id);
m_rack_nozzle_select->UpdatSelectedNozzles(obj->GetNozzleSystem()->GetNozzleRack(), nozzle_pos_vec, use_dynamic_switch, print_from_type);
show_rack_select_area = true;
}
if (show_rack_select_area != m_rack_nozzle_select->IsShown()) {
m_right_tip_text = show_rack_select_area ? _L("Select Filament && Hotends") : _L("Select Filament");
m_right_tips->SetLabel(m_right_tip_text);
m_rack_nozzle_select->Show(show_rack_select_area);
Layout();
Fit();
}
}
void AmsMapingPopup::update_items_check_state(const std::vector<FilamentInfo>& ams_mapping_result)
{
/*update check states*/
if (m_parent_item) {
auto update_item_check_state = [&ams_mapping_result, this](MappingItem* item) {
if (item) {
for (const auto& mapping_res : ams_mapping_result) {
if (mapping_res.id == this->m_current_filament_id) {
if (mapping_res.ams_id == std::to_string(item->m_ams_id) &&
mapping_res.slot_id == std::to_string(item->m_slot_id)) {
item->set_checked(true);
} else {
item->set_checked(false);
}
return;
}
}
item->set_checked(false);
}
};
update_item_check_state(m_left_extra_slot);
update_item_check_state(m_right_extra_slot);
for (auto mapping_item : m_mapping_item_list) {
update_item_check_state(mapping_item);
}
}
}
void AmsMapingPopup::add_ams_mapping(std::vector<TrayData> tray_data,
bool remain_detect_flag,
wxWindow* container,
wxBoxSizer* sizer)
{
sizer->Add(0, 0, 0, wxLEFT, FromDIP(6));
for (auto i = 0; i < tray_data.size(); i++) {
// set button
MappingItem* m_mapping_item = new MappingItem(container);
m_mapping_item->send_win = send_win;
m_mapping_item->m_ams_id = tray_data[i].ams_id;
m_mapping_item->m_slot_id = tray_data[i].slot_id;
// Orca: transition_tridid here has no total-extruder-count overload; label the virtual (ext)
// slots Ext-R / Ext-L inline in the two-nozzle left+right views (matches that overload's result).
if ((m_show_type == ShowType::LEFT_AND_RIGHT || m_show_type == ShowType::LEFT_AND_RIGHT_DYNAMIC)
&& (tray_data[i].id == VIRTUAL_TRAY_MAIN_ID || tray_data[i].id == VIRTUAL_TRAY_DEPUTY_ID)) {
m_mapping_item->set_tray_index(tray_data[i].id == VIRTUAL_TRAY_MAIN_ID ? wxString("Ext-R") : wxString("Ext-L"));
} else {
m_mapping_item->set_tray_index(wxGetApp().transition_tridid(tray_data[i].id));
}
m_mapping_item->SetSize(wxSize(FromDIP(48), FromDIP(60)));
m_mapping_item->SetMinSize(wxSize(FromDIP(48), FromDIP(60)));
m_mapping_item->SetMaxSize(wxSize(FromDIP(48), FromDIP(60)));
// traversal if can pick the item or not
bool can_pick_the_item = true;
std::optional<wxString> item_tooltip_msg;
// check filament area
if (m_use_in_sync_dialog) {
if (can_pick_the_item) {
if (m_show_type == ShowType::LEFT_AND_RIGHT_DYNAMIC) {
can_pick_the_item = !devPrinterUtil::IsVirtualSlot(m_mapping_item->m_ams_id);
if (!can_pick_the_item) {
item_tooltip_msg = _L(
"External spools is not supported since Filament Track Switch has been installed. If you want to use external spool, please uninstall it.");
}
}
}
}
else {
if (can_pick_the_item) {
auto parent = container->GetParent();
if (parent == m_left_marea_panel) {
can_pick_the_item = (m_show_type == ShowType::LEFT);
} else if (parent == m_right_marea_panel) {
if (m_show_type == ShowType::LEFT_AND_RIGHT_DYNAMIC) {
can_pick_the_item = !devPrinterUtil::IsVirtualSlot(m_mapping_item->m_ams_id);
if (!can_pick_the_item) {
item_tooltip_msg = _L(
"External spools is not supported since Filament Track Switch has been installed. If you want to use external spool, please uninstall it.");
}
} else if (m_show_type != ShowType::RIGHT) {
can_pick_the_item = false;
}
}
}
}
// check filament type
if (can_pick_the_item) {
if (tray_data[i].type == NORMAL && !is_match_material(tray_data[i].filament_type)){
can_pick_the_item = false;
} else if(tray_data[i].type == EMPTY){
can_pick_the_item = false;
}
}
wxColour display_color;
if (can_pick_the_item) {
display_color = tray_data[i].type == NORMAL ? tray_data[i].colour : wxColour(0xCE, 0xCE, 0xCE);
} else {
display_color = wxColour(0xEE, 0xEE, 0xEE);
}
wxString display_name;
if (tray_data[i].type == THIRD) {
display_name = "?";
} else if (tray_data[i].type == EMPTY) {
display_name = "-";
} else {
display_name = tray_data[i].name;
}
m_mapping_item->set_data(m_tag_material, display_color, display_name, remain_detect_flag, tray_data[i], !can_pick_the_item, item_tooltip_msg);
m_mapping_item->Bind(wxEVT_LEFT_DOWN, [this, can_pick_the_item, m_mapping_item](wxMouseEvent& e) {
if (can_pick_the_item) {
m_mapping_item->send_event(m_current_filament_id);
Dismiss();
}
});
sizer->Add(0, 0, 0, wxRIGHT, FromDIP(6));
sizer->Add(m_mapping_item, 0, wxTOP, FromDIP(1));
m_mapping_item_list.push_back(m_mapping_item);
}
}
void AmsMapingPopup::add_ext_ams_mapping(TrayData tray_data, MappingItem* item)
{
#ifdef __APPLE__
m_mapping_item_list.push_back(item);
#endif
// set button
if (tray_data.type == NORMAL) {
if (is_match_material(tray_data.filament_type)) {
item->set_data(m_tag_material, tray_data.colour, tray_data.name, false, tray_data);
} else {
item->set_data(m_tag_material, m_ext_mapping_filatype_check ? wxColour(0xEE, 0xEE, 0xEE) : tray_data.colour, tray_data.name, false, tray_data, true);
m_has_unmatch_filament = true;
}
item->Bind(wxEVT_LEFT_DOWN, [this, tray_data, item](wxMouseEvent& e) {
if (!item->GetParent() || !item->GetParent()->IsEnabled()) return;
if (m_ext_mapping_filatype_check && !is_match_material(tray_data.filament_type)) return;
item->send_event(m_current_filament_id);
Dismiss();
});
}
// temp
if (tray_data.type == EMPTY) {
item->set_data(m_tag_material, wxColour(0xCE, 0xCE, 0xCE), "-", false, tray_data);
item->Bind(wxEVT_LEFT_DOWN, [this, tray_data, item](wxMouseEvent& e) {
if (!item->GetParent() || !item->GetParent()->IsEnabled()) return;
item->send_event(m_current_filament_id);
Dismiss();
});
}
// third party
if (tray_data.type == THIRD) {
item->set_data(m_tag_material, tray_data.colour, "?", false, tray_data);
//item->set_data(wxColour(0xCE, 0xCE, 0xCE), "?", tray_data);
item->Bind(wxEVT_LEFT_DOWN, [this, tray_data, item](wxMouseEvent& e) {
if (!item->GetParent() || !item->GetParent()->IsEnabled()) return;
item->send_event(m_current_filament_id);
Dismiss();
});
}
item->set_tray_index("Ext");
}
} // namespace Slic3r::GUI

View File

@@ -102,7 +102,7 @@ CameraPopup::CameraPopup(wxWindow *parent)
top_sizer->Add(0, 0, wxALL, 0);
}
// custom IP camera
// Orca: custom IP camera source — lets the user point Live Video at any camera URL (Orca feature; not in the reference)
m_custom_camera_input_confirm = new Button(m_panel, _L("Enable"));
m_custom_camera_input_confirm->SetBackgroundColor(wxColour(38, 166, 154));
m_custom_camera_input_confirm->SetBorderColor(wxColour(38, 166, 154));
@@ -132,7 +132,7 @@ CameraPopup::CameraPopup(wxWindow *parent)
top_sizer->Add(m_custom_camera_input_confirm, 1, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, FromDIP(5));
main_sizer->Add(top_sizer, 0, wxALL, FromDIP(10));
auto url = wxString::Format(L"https://wiki.bambulab.com/%s/software/bambu-studio/virtual-camera", L"en");
auto url = wxString(L"https://www.orcaslicer.com/wiki/"); // Orca: neutral wiki link (vendor URL removed)
auto text = _L("Show \"Live Video\" guide page.");
wxBoxSizer* link_sizer = new wxBoxSizer(wxVERTICAL);
@@ -479,7 +479,7 @@ void CameraPopup::OnLeftUp(wxMouseEvent &event)
//hyper link
auto h_rect = vcamera_guide_link->ClientToScreen(wxPoint(0, 0));
if (mouse_pos.x > h_rect.x && mouse_pos.y > h_rect.y && mouse_pos.x < (h_rect.x + vcamera_guide_link->GetSize().x) && mouse_pos.y < (h_rect.y + vcamera_guide_link->GetSize().y)) {
auto url = wxString::Format(L"https://wiki.bambulab.com/%s/software/bambu-studio/virtual-camera", L"en");
auto url = wxString(L"https://www.orcaslicer.com/wiki/"); // Orca: neutral wiki link (vendor URL removed)
wxLaunchDefaultBrowser(url);
}
}

View File

@@ -304,6 +304,7 @@ void DeviceErrorDialog::init_button_list()
init_button(FILAMENT_LOAD_RESUME, _L("Filament Loaded, Resume"));
init_button(JUMP_TO_LIVEVIEW, _L("View Liveview"));
init_button(NO_REMINDER_NEXT_TIME, _L("No Reminder Next Time"));
init_button(REFRESH_NOZZLE, _L("Recheck")); // Orca: ported REF error action
init_button(IGNORE_NO_REMINDER_NEXT_TIME, _L("Ignore. Don't Remind Next Time"));
init_button(IGNORE_RESUME, _L("Ignore this and Resume"));
init_button(PROBLEM_SOLVED_RESUME, _L("Problem Solved and Resume"));
@@ -312,6 +313,8 @@ void DeviceErrorDialog::init_button_list()
init_button(CANCEL, _L("Cancel"));
init_button(STOP_DRYING, _L("Stop Drying"));
init_button(PROCEED, _L("Proceed"));
init_button(OK_JUMP_RACK, _L("OK")); // Orca: ported REF error action
init_button(ABORT, _L("Abort")); // Orca: ported REF error action
init_button(DISABLE_PURIFICATION, _L("Disable Purification for This Print"));
init_button(DONT_REMIND_NEXT_TIME, _L("Don't Remind Me"));
init_button(DBL_CHECK_CANCEL, _L("Cancel"));
@@ -377,6 +380,7 @@ wxString DeviceErrorDialog::show_error_code(int error_code)
Raise();
#ifndef __linux__
// Orca: skip RequestUserAttention on Linux/Wayland (urgency-hint deadlock).
// On Linux (especially Wayland) RequestUserAttention(wxUSER_ATTENTION_ERROR) maps to
// gtk_window_set_urgency_hint(TRUE) which can leave the window in an urgent-but-unfocused
// state — clicks no longer reach any widget in the app and the user has to kill the
@@ -600,6 +604,21 @@ void DeviceErrorDialog::on_button_click(ActionButton btn_id)
}
break;
}
case DeviceErrorDialog::REFRESH_NOZZLE: { // Orca: ported REF error action
m_obj->command_refresh_nozzle();
break;
}
case DeviceErrorDialog::OK_JUMP_RACK: { // Orca: ported REF error action
Slic3r::GUI::wxGetApp().mainframe->jump_to_monitor();
// Orca: transitional shim (removed in resync cluster 8)
if (auto* mon = Slic3r::GUI::wxGetApp().mainframe->m_monitor)
mon->get_status_panel()->jump_to_Rack();
break;
}
case DeviceErrorDialog::ABORT: { // Orca: ported REF error action
m_obj->command_ams_control("abort");
break;
}
case DeviceErrorDialog::DISABLE_PURIFICATION: {
m_obj->command_purification_disable();
break;

View File

@@ -37,6 +37,7 @@ public:
JUMP_TO_LIVEVIEW,
NO_REMINDER_NEXT_TIME = 23,
REFRESH_NOZZLE = 24, // Orca: ported REF error action (recheck nozzle)
IGNORE_NO_REMINDER_NEXT_TIME = 25,
//LOAD_FILAMENT = 26*/
IGNORE_RESUME = 27,
@@ -48,6 +49,8 @@ public:
CANCEL = 37,
REMOVE_CLOSE_BTN = 39, // special case, do not show close button
PROCEED = 41,
OK_JUMP_RACK = 49, // Orca: ported REF error action (jump to the nozzle rack)
ABORT = 51, // Orca: ported REF error action (abort)
DISABLE_PURIFICATION = 54,
DONT_REMIND_NEXT_TIME = 57,

View File

@@ -220,10 +220,34 @@ PrintOptionsDialog::PrintOptionsDialog(wxWindow* parent)
if (!obj || !obj->GetPrintOptions()) { evt.Skip(); return; }
int sel = m_smart_nozzle_blob_mode_switch->GetSelection();
// UI: 0=Auto, 1=On, 2=Off -> protocol: 0=off, 1=on, 2=auto
// Orca: the reference's Auto->On in-print confirmation is omitted here, as its
// stringing-prone helper is not available in this codebase.
int mode_map[] = {2, 1, 0};
if (sel < 0 || sel > 2) { evt.Skip(); return; }
// Orca: Auto->On in-print confirmation (backing helper landed in cluster 2). If currently in
// Auto (current_detect_value == 2), a print is running, and a loaded filament is stringing-prone,
// confirm before enabling — turning blob detection on mid-print with such filament can degrade quality.
const auto* blob_opt = obj->GetPrintOptions()->GetDetectionOption(PrintOptionEnum::Smart_Nozzle_Blob_Detection);
const bool was_auto = blob_opt && blob_opt->current_detect_value == 2;
if (sel == 1 /*On*/ && was_auto && obj->is_in_printing()
&& obj->any_loaded_filament_is_stringing_prone()) {
wxString message = _L("There is stringing-prone filament in the current print job. "
"Enabling nozzle clumping detection now may degrade print quality. "
"Are you sure you want to enable it?");
wxString caption = _L("Enable Nozzle Clumping Detection");
// Themed warning dialog with Cancel as the highlighted default, so the safe choice (leave
// detection off) is the default and Confirm must be actively picked.
MessageDialog dialog(this, message, caption, wxICON_WARNING);
dialog.AddButton(wxID_CANCEL, _L("Cancel"), true);
dialog.AddButton(wxID_OK, _L("Confirm"), false);
if (dialog.ShowModal() != wxID_OK) {
// User cancelled: roll the switch back to Auto without sending the command.
m_smart_nozzle_blob_mode_switch->SetSelection(0);
update_smart_nozzle_blob_mode_desc(0);
evt.Skip();
return;
}
}
obj->GetPrintOptions()->command_smart_nozzle_blob_detect_mode(mode_map[sel]);
update_smart_nozzle_blob_mode_desc(sel);
evt.Skip();
@@ -1078,7 +1102,7 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
line_sizer->Add(FromDIP(5), 0, 0, 0);
line_sizer->Add(m_cb_save_remote_print_file_to_storage, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
line_sizer->Add(text_save_remote_print_file_to_storage, 1, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
text_save_remote_print_file_to_storage_explain = new Label(parent, _L("Save the printing files initiated from Bambu Studio, Bambu Handy and MakerWorld on External Storage"));
text_save_remote_print_file_to_storage_explain = new Label(parent, _L("Save the printing files sent from the slicer and other apps on External Storage")); // Orca: neutral wording (vendor app names removed)
text_save_remote_print_file_to_storage_explain->SetForegroundColour(STATIC_TEXT_EXPLAIN_COL);
text_save_remote_print_file_to_storage_explain->SetFont(Label::Body_12);
text_save_remote_print_file_to_storage_explain->Wrap(FromDIP(400));

View File

@@ -25,6 +25,7 @@
#include "DeviceCore/DevConfig.h"
#include "DeviceCore/DevConfigUtil.h"
#include "DeviceCore/DevFilaSwitch.h" // Orca: has_selector() reads GetFilaSwitch()->IsInstalled()/IsReady()
#include "DeviceCore/DevFilaSystem.h"
#include "DeviceCore/DevManager.h"
#include "DeviceCore/DevMapping.h"
@@ -371,6 +372,9 @@ void SyncAmsInfoDialog::update_map_when_change_map_mode()
m_cur_colors_in_thumbnail = m_back_cur_colors_in_thumbnail;
} else if (m_map_mode == MapModeEnum::Override) {
if (m_ams_combo_info.empty()) {
// Orca: the reference passes has_selector() here to skip ext-spool colors in Override mode;
// that overload lives in libslic3r/PresetBundle (out of this cluster's scope), so we keep the
// 1-arg form. Minor: with an FTS installed, ext-spool colors still appear in the Override combo.
wxGetApp().preset_bundle->get_ams_cobox_infos(m_ams_combo_info);
}
for (size_t i = 0; i < m_ams_combo_info.ams_filament_colors.size(); i++) {
@@ -1221,6 +1225,19 @@ void SyncAmsInfoDialog::sync_ams_mapping_result(std::vector<FilamentInfo> &resul
}
}
// Orca: ported FTS "selector" check — a Filament Track Switch, once installed and ready, feeds both
// nozzles from one AMS set, so the mapping collapses to a single dynamic panel and skips ext spools.
bool SyncAmsInfoDialog::has_selector(MachineObject *obj_) const
{
if (!obj_) {
DeviceManager *dev_manager = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev_manager)
return false;
obj_ = dev_manager->get_selected_machine();
}
return obj_ && obj_->GetFilaSwitch()->IsInstalled() && obj_->GetFilaSwitch()->IsReady();
}
bool SyncAmsInfoDialog::do_ams_mapping(MachineObject *obj_)
{
if (!obj_) return false;
@@ -1237,6 +1254,10 @@ bool SyncAmsInfoDialog::do_ams_mapping(MachineObject *obj_)
std::vector<bool> map_opt; // four values: use_left_ams, use_right_ams, use_left_ext, use_right_ext
if (nozzle_nums > 1) {
map_opt = {true, true, true, true}; // four values: use_left_ams, use_right_ams, use_left_ext, use_right_ext
if (has_selector(obj_)) { // Orca: with a Filament Track Switch the ext spools route through the switch — don't map them
map_opt[2] = false;
map_opt[3] = false;
}
filament_result = DevMappingUtil::ams_filament_mapping(obj_, m_filaments, m_ams_mapping_result, map_opt, std::vector<int>(),
wxGetApp().app_config->get_bool("ams_sync_match_full_use_color_dist") ? false : true);
}
@@ -2638,8 +2659,14 @@ void SyncAmsInfoDialog::reset_and_sync_ams_list()
DeviceManager *dev_manager = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev_manager) return;
MachineObject *obj_ = dev_manager->get_selected_machine();
bool is_selector = false;
if (get_is_double_extruder()) {
m_mapping_popup.set_show_type(ShowType::LEFT_AND_RIGHT);//special
if (has_selector(obj_)) { // Orca: ported FTS combined view — one dynamic panel when a switch is installed+ready
m_mapping_popup.set_show_type(ShowType::LEFT_AND_RIGHT_DYNAMIC);
is_selector = true;
} else {
m_mapping_popup.set_show_type(ShowType::LEFT_AND_RIGHT);//special
}
}
// m_mapping_popup.set_show_type(ShowType::RIGHT);
if (obj_) {
@@ -2666,7 +2693,7 @@ void SyncAmsInfoDialog::reset_and_sync_ams_list()
m_mapping_popup.set_reset_callback(reset_call_back);
m_mapping_popup.set_tag_texture(materials[extruder]);
m_mapping_popup.set_send_win(this);
m_mapping_popup.update(obj_, m_ams_mapping_result);
m_mapping_popup.update(obj_, m_ams_mapping_result, is_selector); // Orca: dynamic combined view when FTS installed
m_mapping_popup.Popup();
}
}

View File

@@ -208,6 +208,8 @@ public:
int update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name, std::string file_path);
void set_print_type(PrintFromType type) { m_print_type = type; };
bool do_ams_mapping(MachineObject *obj_);
// Orca: true when a Filament Track Switch is installed and ready (drives the combined dynamic mapping view).
bool has_selector(MachineObject *obj_) const;
void deal_only_exist_ext_spool(MachineObject *obj_);
void show_thumbnail_page();
bool get_ams_mapping_result(std::string &mapping_array_str, std::string &mapping_array_str2, std::string &ams_mapping_info);