NEW:add bed texture for double extruder

jira: none
Change-Id: I7608ba5beec6e598f53ceca9e23301f258466593
(cherry picked from commit 886705237446380191c11b9347fd1c732775e51f)
This commit is contained in:
zhou.xu
2025-01-07 11:30:25 +08:00
committed by Noisyfox
parent 94ac262624
commit 32e0d8a5c9
4 changed files with 84 additions and 14 deletions

View File

@@ -829,8 +829,10 @@ void PartPlate::render_logo(bool bottom, bool render_cali)
int bed_type_idx = (int)curr_bed_type;
auto is_single_extruder = wxGetApp().preset_bundle->get_printer_extruder_count() == 1;
if (!is_single_extruder) {
bed_type_idx = 0;
}
if (m_partplate_list->m_allow_bed_type_in_double_nozzle.find(bed_type_idx) == m_partplate_list->m_allow_bed_type_in_double_nozzle.end()) {
bed_type_idx = 0;
}
}
// render bed textures
for (auto &part : m_partplate_list->bed_texture_info[bed_type_idx].parts) {
if (part.texture) {
@@ -5792,8 +5794,8 @@ void PartPlateList::BedTextureInfo::reset()
void PartPlateList::init_bed_type_info()
{
BedTextureInfo::TexturePart pct_part_left(10, 130, 10, 110, "orca_bed_pct_left.svg");
BedTextureInfo::TexturePart st_part1(9, 70, 12.5, 170, "bbl_bed_st_left.svg");
BedTextureInfo::TexturePart st_part2(74, -10, 148, 12, "bbl_bed_st_bottom.svg");
BedTextureInfo::TexturePart st_part1(9, 70, 12.5, 170, "bbl_bed_st_left.svg");
BedTextureInfo::TexturePart st_part2(74, -10, 148, 12, "bbl_bed_st_bottom.svg");
BedTextureInfo::TexturePart pc_part1(10, 130, 10, 110, "bbl_bed_pc_left.svg");
BedTextureInfo::TexturePart pc_part2(74, -10, 148, 12, "bbl_bed_pc_bottom.svg");
BedTextureInfo::TexturePart ep_part1(7.5, 90, 12.5, 150, "bbl_bed_ep_left.svg");
@@ -5802,6 +5804,18 @@ void PartPlateList::init_bed_type_info()
BedTextureInfo::TexturePart pei_part2(74, -10, 148, 12, "bbl_bed_pei_bottom.svg");
BedTextureInfo::TexturePart pte_part1(10, 80, 10, 160, "bbl_bed_pte_left.svg");
BedTextureInfo::TexturePart pte_part2(74, -10, 148, 12, "bbl_bed_pte_bottom.svg");
auto is_single_extruder = wxGetApp().preset_bundle->get_printer_extruder_count() == 1;
if (!is_single_extruder) {
m_allow_bed_type_in_double_nozzle.clear();
pte_part1 = BedTextureInfo::TexturePart(57, 300, 236.12f, 10.f, "bbl_bed_pte_middle.svg");
pte_part2 = BedTextureInfo::TexturePart(150, -10, 148, 12, "bbl_bed_pte_bottom.svg");
pei_part1 = BedTextureInfo::TexturePart(57, 300, 236.12f, 10.f, "bbl_bed_pei_middle.svg");
pei_part2 = BedTextureInfo::TexturePart(150, -10, 148, 12, "bbl_bed_pei_bottom.svg");
m_allow_bed_type_in_double_nozzle[(int) btPEI] = true;
m_allow_bed_type_in_double_nozzle[(int) btPTE] = true;
}
for (size_t i = 0; i < btCount; i++) {
bed_texture_info[i].reset();
bed_texture_info[i].parts.clear();
@@ -5822,19 +5836,23 @@ void PartPlateList::init_bed_type_info()
auto bed_ext = get_extents(m_shape);
int bed_width = bed_ext.size()(0);
int bed_height = bed_ext.size()(1);
float base_width = 256;
float base_height = 256;
float x_rate = bed_width / base_width;
float y_rate = bed_height / base_height;
for (int i = 0; i < btCount; i++) {
float base_width = 256;//standard 256*256 for single_extruder
float base_height = 256;
if (!is_single_extruder) {//standard 350*325 for double_extruder
base_width = 350;
base_height = 320;
}
float x_rate = bed_width / base_width;
float y_rate = bed_height / base_height;
for (int i = 0; i < btCount; i++) {
for (int j = 0; j < bed_texture_info[i].parts.size(); j++) {
bed_texture_info[i].parts[j].x *= x_rate;
bed_texture_info[i].parts[j].y *= y_rate;
bed_texture_info[i].parts[j].w *= x_rate;
bed_texture_info[i].parts[j].h *= y_rate;
bed_texture_info[i].parts[j].update_buffer();
}
}
bed_texture_info[i].parts[j].w *= x_rate;
bed_texture_info[i].parts[j].h *= y_rate;
bed_texture_info[i].parts[j].update_buffer();
}
}
}
bool PartPlateList::calc_extruder_only_area(Rect &left_only_rect, Rect &right_only_rect)

View File

@@ -913,6 +913,7 @@ public:
void on_filament_deleted(int filament_count, int filament_id);
void on_filament_added(int filament_count);
std::map<int, bool> m_allow_bed_type_in_double_nozzle;
BedTextureInfo bed_texture_info[btCount];
BedTextureInfo cali_texture_info;
BedTextureInfo extruder_only_area_info[(unsigned char) Slic3r::ExtruderOnlyAreaType::btAreaCount];