Files
OrcaSlicer/src/slic3r/GUI/FilamentMapDialog.hpp
SoftFever 75c8d0775a feat(gui): per-filament nozzle volume selection and persistence
- FilamentMapDialog's manual page understands volume types: a mixed
  (Hybrid) extruder shows separate Standard / High Flow drop zones
  with live sub-nozzle counts, a validation timer with an inline
  error + "set nozzle count" suggestion, and composes a per-filament
  volume map on OK (persisted to the plate or globally)
- switching an extruder's Flow type rewrites the affected plate map
  entries; plate maps stay sized across filament add/delete/count
  changes (values keep their filament, no index shift)
- CLI: manual mapping on multi-nozzle printers synthesizes the volume
  map from extruder flow types when absent; nozzle-manual mode
  requires explicit maps; computed maps land on the plate so exported
  projects carry filament_volume_maps
- filament_nozzle_map joins the project options (selection seeding +
  filament-count resizing)
- pot entries for the new dialog strings

All 19 reference fixtures byte-identical; slicing an exported Hybrid
project reproduces its g-code byte-for-byte with the volume map
round-tripped through model_settings.config.
2026-07-11 16:37:50 +08:00

105 lines
2.8 KiB
C++

#ifndef slic3r_FilamentMapDialog_hpp_
#define slic3r_FilamentMapDialog_hpp_
#include "FilamentMapPanel.hpp"
#include <vector>
#include "CapsuleButton.hpp"
#include "Widgets/CheckBox.hpp"
class Button;
namespace Slic3r {
class DynamicPrintConfig;
namespace GUI {
class DragDropPanel;
class Plater;
class PartPlate;
class SmartFilamentPanel;
/**
* @brief Try to pop up the filament map dialog before slicing.
*
* Only pop up in multi extruder machines. If user don't want the pop up, we
* pop up if the applied filament map mode in manual
*
* @param is_slice_all In slice all
* @param plater_ref Plater to get/set global filament map
* @param partplate_ref Partplate to get/set plate filament map mode
* @return whether continue slicing
*/
bool try_pop_up_before_slice(bool is_slice_all, Plater* plater_ref, PartPlate* partplate_ref, bool force_pop_up = false);
class FilamentMapDialog : public wxDialog
{
enum PageType {
ptAuto,
ptManual,
ptDefault
};
public:
FilamentMapDialog(wxWindow *parent,
const std::vector<std::string>& filament_color,
const std::vector<std::string>& filament_type,
const std::vector<int> &filament_map,
const std::vector<int> &filament_volume_map,
const std::vector<int> &filaments,
const FilamentMapMode mode,
bool machine_synced,
bool show_default=true,
bool with_checkbox = false
);
FilamentMapMode get_mode();
std::vector<int> get_filament_maps() const {
if (m_page_type == PageType::ptManual)
return m_filament_map;
return {};
}
std::vector<int> get_filament_volume_maps() const {
if (m_page_type == PageType::ptManual)
return m_filament_volume_map;
return {};
}
int ShowModal();
void set_modal_btn_labels(const wxString& left_label, const wxString& right_label);
private:
void on_ok(wxCommandEvent &event);
void on_cancel(wxCommandEvent &event);
void on_switch_mode(wxCommandEvent &event);
void on_checkbox(wxCommandEvent &event);
void update_panel_status(PageType page);
private:
FilamentMapManualPanel* m_manual_map_panel;
FilamentMapAutoPanel* m_auto_map_panel;
FilamentMapDefaultPanel* m_default_map_panel;
CapsuleButton* m_auto_btn;
CapsuleButton* m_manual_btn;
CapsuleButton* m_default_btn;
Button* m_ok_btn;
Button* m_cancel_btn;
CheckBox* m_checkbox;
SmartFilamentPanel* m_smart_filament{nullptr};
bool m_fila_switch_ready{false};
PageType m_page_type;
private:
std::vector<int> m_filament_map;
std::vector<int> m_filament_volume_map;
std::vector<std::string> m_filament_color;
std::vector<std::string> m_filament_type;
};
}} // namespace Slic3r::GUI
#endif /* slic3r_FilamentMapDialog_hpp_ */