mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-21 09:52:11 +00:00
Merge branch 'main' into pr/grant0013/13752
This commit is contained in:
@@ -877,54 +877,6 @@ struct DynamicFilamentList : DynamicList
|
||||
}
|
||||
};
|
||||
|
||||
struct DynamicFilamentList1Based : DynamicFilamentList
|
||||
{
|
||||
void apply_on(Choice *c) override
|
||||
{
|
||||
if (items.empty())
|
||||
update(true);
|
||||
auto cb = dynamic_cast<ComboBox *>(c->window);
|
||||
auto n = cb->GetSelection();
|
||||
cb->Clear();
|
||||
for (auto i : items) {
|
||||
cb->Append(i.first, *i.second);
|
||||
}
|
||||
if (n < cb->GetCount())
|
||||
cb->SetSelection(n);
|
||||
}
|
||||
wxString get_value(int index) override
|
||||
{
|
||||
wxString str;
|
||||
str << index+1;
|
||||
return str;
|
||||
}
|
||||
int index_of(wxString value) override
|
||||
{
|
||||
long n = 0;
|
||||
if(!value.ToLong(&n))
|
||||
return -1;
|
||||
--n;
|
||||
return (n >= 0 && n <= items.size()) ? int(n) : -1;
|
||||
}
|
||||
void update(bool force = false)
|
||||
{
|
||||
items.clear();
|
||||
if (!force && m_choices.empty())
|
||||
return;
|
||||
auto icons = get_extruder_color_icons(true);
|
||||
auto presets = wxGetApp().preset_bundle->filament_presets;
|
||||
for (int i = 0; i < presets.size(); ++i) {
|
||||
wxString str;
|
||||
std::string type;
|
||||
wxGetApp().preset_bundle->filaments.find_preset(presets[i])->get_filament_type(type);
|
||||
str << type;
|
||||
items.push_back({str, i < icons.size() ? icons[i] : nullptr});
|
||||
}
|
||||
DynamicList::update();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Check if the machine supports Junction Deviation (Marlin firmware with machine_max_junction_deviation > 0)
|
||||
static bool has_junction_deviation(const DynamicPrintConfig* printer_config)
|
||||
{
|
||||
@@ -941,7 +893,6 @@ static bool has_junction_deviation(const DynamicPrintConfig* printer_config)
|
||||
}
|
||||
|
||||
static DynamicFilamentList dynamic_filament_list;
|
||||
static DynamicFilamentList1Based dynamic_filament_list_1_based;
|
||||
|
||||
class AMSCountPopupWindow : public PopupWindow
|
||||
{
|
||||
@@ -1648,9 +1599,12 @@ Sidebar::Sidebar(Plater *parent)
|
||||
{
|
||||
Choice::register_dynamic_list("support_filament", &dynamic_filament_list);
|
||||
Choice::register_dynamic_list("support_interface_filament", &dynamic_filament_list);
|
||||
Choice::register_dynamic_list("wall_filament", &dynamic_filament_list_1_based);
|
||||
Choice::register_dynamic_list("sparse_infill_filament", &dynamic_filament_list_1_based);
|
||||
Choice::register_dynamic_list("solid_infill_filament", &dynamic_filament_list_1_based);
|
||||
Choice::register_dynamic_list("outer_wall_filament_id", &dynamic_filament_list);
|
||||
Choice::register_dynamic_list("inner_wall_filament_id", &dynamic_filament_list);
|
||||
Choice::register_dynamic_list("sparse_infill_filament_id", &dynamic_filament_list);
|
||||
Choice::register_dynamic_list("internal_solid_filament_id", &dynamic_filament_list);
|
||||
Choice::register_dynamic_list("top_surface_filament_id", &dynamic_filament_list);
|
||||
Choice::register_dynamic_list("bottom_surface_filament_id", &dynamic_filament_list);
|
||||
Choice::register_dynamic_list("wipe_tower_filament", &dynamic_filament_list);
|
||||
|
||||
p->scrolled = new wxPanel(this);
|
||||
@@ -3769,7 +3723,6 @@ void Sidebar::show_SEMM_buttons()
|
||||
void Sidebar::update_dynamic_filament_list()
|
||||
{
|
||||
dynamic_filament_list.update();
|
||||
dynamic_filament_list_1_based.update();
|
||||
}
|
||||
|
||||
PlaterPresetComboBox* Sidebar::printer_combox()
|
||||
@@ -4923,7 +4876,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
||||
"extruder_colour", "filament_colour", "filament_type", "material_colour", "printable_height", "extruder_printable_height", "printer_model", "printer_technology",
|
||||
// These values are necessary to construct SlicingParameters by the Canvas3D variable layer height editor.
|
||||
"layer_height", "initial_layer_print_height", "min_layer_height", "max_layer_height",
|
||||
"wall_loops", "wall_filament", "sparse_infill_density", "sparse_infill_filament", "top_shell_layers",
|
||||
"wall_loops", "outer_wall_filament_id", "inner_wall_filament_id", "sparse_infill_density", "sparse_infill_filament_id", "top_shell_layers",
|
||||
"enable_support", "support_filament", "support_interface_filament",
|
||||
"support_top_z_distance", "support_bottom_z_distance", "raft_layers",
|
||||
"wipe_tower_rotation_angle", "wipe_tower_cone_angle", "wipe_tower_extra_spacing", "wipe_tower_extra_flow", "wipe_tower_max_purge_speed",
|
||||
@@ -6205,6 +6158,10 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
||||
}
|
||||
}
|
||||
|
||||
// ORCA: legacy feature-filament default migration (1 -> 0) is now handled
|
||||
// uniformly in PrintConfigDef::handle_legacy() via the old->new key rename
|
||||
// (wall_filament -> wall_filament_id, etc.), which also covers saved presets.
|
||||
|
||||
// plate data
|
||||
if (plate_data.size() > 0) {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":" << __LINE__ << boost::format(", import 3mf UPDATE_GCODE_RESULT \n");
|
||||
@@ -9594,6 +9551,12 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
|
||||
wxGetApp().get_tab(preset_type)->select_preset(preset_name);
|
||||
}
|
||||
|
||||
// ORCA: Always refresh the selected filament combo so its color swatch (clr_picker)
|
||||
// matches the chosen preset. update_ams_color() (in OnSelect) updates the project
|
||||
// filament color when the preset defines one; this repaints the swatch to match.
|
||||
if (preset_type == Preset::TYPE_FILAMENT)
|
||||
combo->update();
|
||||
|
||||
// update plater with new config
|
||||
q->on_config_change(wxGetApp().preset_bundle->full_config());
|
||||
if (preset_type == Preset::TYPE_PRINTER) {
|
||||
@@ -16709,8 +16672,10 @@ void Plater::on_config_change(const DynamicPrintConfig &config)
|
||||
update_scheduled = true;
|
||||
}
|
||||
// Orca: update when *_filament changed
|
||||
else if (opt_key == "support_interface_filament" || opt_key == "support_filament" || opt_key == "wall_filament" ||
|
||||
opt_key == "sparse_infill_filament" || opt_key == "solid_infill_filament") {
|
||||
else if (opt_key == "support_interface_filament" || opt_key == "support_filament" ||
|
||||
opt_key == "outer_wall_filament_id" || opt_key == "inner_wall_filament_id" ||
|
||||
opt_key == "sparse_infill_filament_id" || opt_key == "internal_solid_filament_id" ||
|
||||
opt_key == "top_surface_filament_id" || opt_key == "bottom_surface_filament_id") {
|
||||
update_scheduled = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user