mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-21 07:41:09 -06:00
Merge branch 'master-remote' into feature/1.5
Signed-off-by: SoftFever <softfeverever@gmail.com> # Conflicts: # bbl/i18n/BambuStudio.pot # bbl/i18n/de/BambuStudio_de.po # bbl/i18n/en/BambuStudio_en.po # bbl/i18n/es/BambuStudio_es.po # bbl/i18n/fr/BambuStudio_fr.po # bbl/i18n/hu/BambuStudio_hu.po # bbl/i18n/it/BambuStudio_it.po # bbl/i18n/nl/BambuStudio_nl.po # bbl/i18n/sv/BambuStudio_sv.po # bbl/i18n/zh_cn/BambuStudio_zh_CN.po # deps/Boost/Boost.cmake # deps/wxWidgets/wxWidgets.cmake # resources/config.json # resources/i18n/de/BambuStudio.mo # resources/i18n/en/BambuStudio.mo # resources/i18n/es/BambuStudio.mo # resources/i18n/fr/BambuStudio.mo # resources/i18n/hu/BambuStudio.mo # resources/i18n/it/BambuStudio.mo # resources/i18n/nl/BambuStudio.mo # resources/i18n/sv/BambuStudio.mo # resources/i18n/zh_cn/BambuStudio.mo # resources/images/tips_arrow.svg # resources/profiles/Anycubic.json # resources/profiles/Anycubic/filament/Anycubic Generic ABS.json # resources/profiles/Anycubic/filament/Anycubic Generic ASA.json # resources/profiles/Anycubic/filament/Anycubic Generic PA-CF.json # resources/profiles/Anycubic/filament/Anycubic Generic PA.json # resources/profiles/Anycubic/filament/Anycubic Generic PC.json # resources/profiles/Anycubic/filament/Anycubic Generic PETG.json # resources/profiles/Anycubic/filament/Anycubic Generic PLA-CF.json # resources/profiles/Anycubic/filament/Anycubic Generic PLA.json # resources/profiles/Anycubic/filament/Anycubic Generic PVA.json # resources/profiles/Anycubic/filament/Anycubic Generic TPU.json # resources/profiles/Anycubic/filament/fdm_filament_common.json # resources/profiles/Anycubic/machine/Anycubic 4Max Pro 0.4 nozzle.json # resources/profiles/Anycubic/machine/Anycubic 4Max Pro.json # resources/profiles/Anycubic/process/0.20mm Standard @4MaxPro.json # resources/profiles/Anycubic/process/fdm_process_common.json # resources/profiles/BBL.json # resources/profiles/BBL/machine/Bambu Lab P1P 0.2 nozzle.json # resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json # resources/profiles/BBL/machine/Bambu Lab P1P 0.6 nozzle.json # resources/profiles/BBL/machine/Bambu Lab P1P 0.8 nozzle.json # resources/profiles/BBL/machine/Bambu Lab X1 0.2 nozzle.json # resources/profiles/BBL/machine/Bambu Lab X1 0.4 nozzle.json # resources/profiles/BBL/machine/Bambu Lab X1 0.6 nozzle.json # resources/profiles/BBL/machine/Bambu Lab X1 0.8 nozzle.json # resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.2 nozzle.json # resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.4 nozzle.json # resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.6 nozzle.json # resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.8 nozzle.json # resources/profiles/BBL/machine/fdm_bbl_3dp_001_common.json # resources/profiles/Voron.json # resources/web/data/text.js # resources/web/image/printer/Anycubic 4Max Pro_cover.png # src/BambuStudio.cpp # src/libslic3r/GCode.cpp # src/libslic3r/GCode.hpp # src/libslic3r/GCode/GCodeProcessor.cpp # src/libslic3r/GCodeWriter.hpp # src/libslic3r/PerimeterGenerator.cpp # src/libslic3r/PresetBundle.cpp # src/libslic3r/Print.cpp # src/libslic3r/Print.hpp # src/libslic3r/PrintConfig.cpp # src/libslic3r/PrintConfig.hpp # src/libslic3r/PrintObject.cpp # src/slic3r/GUI/AMSMaterialsSetting.cpp # src/slic3r/GUI/AMSMaterialsSetting.hpp # src/slic3r/GUI/AmsMappingPopup.cpp # src/slic3r/GUI/AmsMappingPopup.hpp # src/slic3r/GUI/Auxiliary.cpp # src/slic3r/GUI/BackgroundSlicingProcess.cpp # src/slic3r/GUI/ConfigManipulation.cpp # src/slic3r/GUI/DeviceManager.cpp # src/slic3r/GUI/DeviceManager.hpp # src/slic3r/GUI/ExtrusionCalibration.cpp # src/slic3r/GUI/GCodeViewer.cpp # src/slic3r/GUI/GCodeViewer.hpp # src/slic3r/GUI/GUI_App.cpp # src/slic3r/GUI/IMSlider.cpp # src/slic3r/GUI/Jobs/PrintJob.cpp # src/slic3r/GUI/Jobs/PrintJob.hpp # src/slic3r/GUI/Jobs/SendJob.cpp # src/slic3r/GUI/Jobs/SendJob.hpp # src/slic3r/GUI/MainFrame.cpp # src/slic3r/GUI/MainFrame.hpp # src/slic3r/GUI/MediaPlayCtrl.cpp # src/slic3r/GUI/OptionsGroup.cpp # src/slic3r/GUI/PhysicalPrinterDialog.cpp # src/slic3r/GUI/Plater.cpp # src/slic3r/GUI/PrintHostDialogs.cpp # src/slic3r/GUI/Printer/BambuTunnel.h # src/slic3r/GUI/Printer/PrinterFileSystem.cpp # src/slic3r/GUI/Printer/gstbambusrc.c # src/slic3r/GUI/Printer/gstbambusrc.h # src/slic3r/GUI/ReleaseNote.cpp # src/slic3r/GUI/ReleaseNote.hpp # src/slic3r/GUI/SelectMachine.cpp # src/slic3r/GUI/SendToPrinter.cpp # src/slic3r/GUI/SetBedTypeDialog.cpp # src/slic3r/GUI/StatusPanel.cpp # src/slic3r/GUI/StatusPanel.hpp # src/slic3r/GUI/Tab.cpp # src/slic3r/GUI/Widgets/AMSControl.cpp # src/slic3r/GUI/Widgets/AMSControl.hpp # src/slic3r/GUI/Widgets/ImageSwitchButton.cpp # src/slic3r/GUI/Widgets/Label.cpp # src/slic3r/GUI/WipeTowerDialog.cpp # src/slic3r/Utils/Process.cpp # src/slic3r/Utils/bambu_networking.hpp # version.inc
This commit is contained in:
commit
5ef51f6c8a
339 changed files with 37169 additions and 5445 deletions
|
@ -133,7 +133,7 @@ void PartPlate::init()
|
|||
m_print = nullptr;
|
||||
}
|
||||
|
||||
BedType PartPlate::get_bed_type(bool check_global/*= true*/) const
|
||||
BedType PartPlate::get_bed_type() const
|
||||
{
|
||||
std::string bed_type_key = "curr_bed_type";
|
||||
|
||||
|
@ -141,32 +141,26 @@ BedType PartPlate::get_bed_type(bool check_global/*= true*/) const
|
|||
assert(m_plater != nullptr);
|
||||
if (m_config.has(bed_type_key)) {
|
||||
BedType bed_type = m_config.opt_enum<BedType>(bed_type_key);
|
||||
if (bed_type != btDefault)
|
||||
return bed_type;
|
||||
return bed_type;
|
||||
}
|
||||
|
||||
if (!check_global)
|
||||
return btDefault;
|
||||
|
||||
if (m_plater) {
|
||||
// In GUI mode
|
||||
DynamicConfig& proj_cfg = wxGetApp().preset_bundle->project_config;
|
||||
if (proj_cfg.has(bed_type_key))
|
||||
return proj_cfg.opt_enum<BedType>(bed_type_key);
|
||||
}
|
||||
|
||||
return BedType::btPC;
|
||||
return btDefault;
|
||||
}
|
||||
|
||||
void PartPlate::set_bed_type(BedType bed_type)
|
||||
{
|
||||
std::string bed_type_key = "curr_bed_type";
|
||||
std::string bed_type_key = "curr_bed_type";
|
||||
|
||||
// should be called in GUI context
|
||||
assert(m_plater != nullptr);
|
||||
// should be called in GUI context
|
||||
assert(m_plater != nullptr);
|
||||
|
||||
// update slice state
|
||||
BedType old_real_bed_type = get_bed_type();
|
||||
if (old_real_bed_type == btDefault) {
|
||||
DynamicConfig& proj_cfg = wxGetApp().preset_bundle->project_config;
|
||||
if (proj_cfg.has(bed_type_key))
|
||||
old_real_bed_type = proj_cfg.opt_enum<BedType>(bed_type_key);
|
||||
}
|
||||
BedType new_real_bed_type = bed_type;
|
||||
if (bed_type == BedType::btDefault) {
|
||||
DynamicConfig& proj_cfg = wxGetApp().preset_bundle->project_config;
|
||||
|
@ -177,18 +171,74 @@ void PartPlate::set_bed_type(BedType bed_type)
|
|||
update_slice_result_valid_state(false);
|
||||
}
|
||||
|
||||
if (bed_type == BedType::btDefault)
|
||||
m_config.erase(bed_type_key);
|
||||
else
|
||||
m_config.set_key_value("curr_bed_type", new ConfigOptionEnum<BedType>(bed_type));
|
||||
|
||||
if (m_plater)
|
||||
m_plater->update_project_dirty_from_presets();
|
||||
if (bed_type == BedType::btDefault)
|
||||
m_config.erase(bed_type_key);
|
||||
else
|
||||
m_config.set_key_value("curr_bed_type", new ConfigOptionEnum<BedType>(bed_type));
|
||||
}
|
||||
|
||||
void PartPlate::reset_bed_type()
|
||||
{
|
||||
m_config.erase("curr_bed_type");
|
||||
m_config.erase("curr_bed_type");
|
||||
}
|
||||
|
||||
void PartPlate::set_print_seq(PrintSequence print_seq)
|
||||
{
|
||||
std::string print_seq_key = "print_sequence";
|
||||
|
||||
// should be called in GUI context
|
||||
assert(m_plater != nullptr);
|
||||
|
||||
// update slice state
|
||||
PrintSequence old_real_print_seq = get_print_seq();
|
||||
if (old_real_print_seq == PrintSequence::ByDefault) {
|
||||
auto curr_preset_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
if (curr_preset_config.has(print_seq_key))
|
||||
old_real_print_seq = curr_preset_config.option<ConfigOptionEnum<PrintSequence>>(print_seq_key)->value;
|
||||
}
|
||||
|
||||
PrintSequence new_real_print_seq = print_seq;
|
||||
|
||||
if (print_seq == PrintSequence::ByDefault) {
|
||||
auto curr_preset_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
if (curr_preset_config.has(print_seq_key))
|
||||
new_real_print_seq = curr_preset_config.option<ConfigOptionEnum<PrintSequence>>(print_seq_key)->value;
|
||||
}
|
||||
|
||||
if (old_real_print_seq != new_real_print_seq) {
|
||||
update_slice_result_valid_state(false);
|
||||
}
|
||||
|
||||
//print_seq_same_global = same_global;
|
||||
if (print_seq == PrintSequence::ByDefault)
|
||||
m_config.erase(print_seq_key);
|
||||
else
|
||||
m_config.set_key_value(print_seq_key, new ConfigOptionEnum<PrintSequence>(print_seq));
|
||||
}
|
||||
|
||||
PrintSequence PartPlate::get_print_seq() const
|
||||
{
|
||||
std::string print_seq_key = "print_sequence";
|
||||
|
||||
// should be called in GUI context
|
||||
assert(m_plater != nullptr);
|
||||
|
||||
if (m_config.has(print_seq_key)) {
|
||||
PrintSequence print_seq = m_config.opt_enum<PrintSequence>(print_seq_key);
|
||||
return print_seq;
|
||||
}
|
||||
|
||||
return PrintSequence::ByDefault;
|
||||
}
|
||||
|
||||
PrintSequence PartPlate::get_real_print_seq() const
|
||||
{
|
||||
PrintSequence curr_plate_seq = get_print_seq();
|
||||
if (curr_plate_seq == PrintSequence::ByDefault) {
|
||||
auto curr_preset_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
if (curr_preset_config.has("print_sequence")) curr_plate_seq = curr_preset_config.option<ConfigOptionEnum<PrintSequence>>("print_sequence")->value;
|
||||
}
|
||||
return curr_plate_seq;
|
||||
}
|
||||
|
||||
bool PartPlate::valid_instance(int obj_id, int instance_id)
|
||||
|
@ -545,7 +595,7 @@ void PartPlate::render_logo(bool bottom) const
|
|||
|
||||
//canvas.request_extra_frame();
|
||||
}
|
||||
|
||||
|
||||
if (m_vbo_id == 0) {
|
||||
unsigned int* vbo_id_ptr = const_cast<unsigned int*>(&m_vbo_id);
|
||||
glsafe(::glGenBuffers(1, vbo_id_ptr));
|
||||
|
@ -561,13 +611,19 @@ void PartPlate::render_logo(bool bottom) const
|
|||
m_partplate_list->load_bedtype_textures();
|
||||
|
||||
// btDefault should be skipped
|
||||
int bed_type_idx = (int)get_bed_type();
|
||||
auto curr_bed_type = get_bed_type();
|
||||
if (curr_bed_type == btDefault) {
|
||||
DynamicConfig& proj_cfg = wxGetApp().preset_bundle->project_config;
|
||||
if (proj_cfg.has(std::string("curr_bed_type")))
|
||||
curr_bed_type = proj_cfg.opt_enum<BedType>(std::string("curr_bed_type"));
|
||||
}
|
||||
int bed_type_idx = (int)curr_bed_type;
|
||||
for (auto &part : m_partplate_list->bed_texture_info[bed_type_idx].parts) {
|
||||
if (part.texture) {
|
||||
if (part.buffer && part.buffer->get_vertices_count() > 0
|
||||
//&& part.vbo_id != 0
|
||||
) {
|
||||
if (part.offset.x() != m_origin.x() || part.offset.y() != m_origin.y()) {
|
||||
if (part.offset.x() != m_origin.x() || part.offset.y() != m_origin.y()) {
|
||||
part.offset = Vec2d(m_origin.x(), m_origin.y());
|
||||
part.update_buffer();
|
||||
}
|
||||
|
@ -739,18 +795,18 @@ void PartPlate::render_icons(bool bottom, int hover_id) const
|
|||
render_icon_texture(position_id, tex_coords_id, m_lock_icon, m_partplate_list->m_lockopen_texture, m_lock_vbo_id);
|
||||
}
|
||||
|
||||
if (m_partplate_list->render_bedtype_setting) {
|
||||
if (m_partplate_list->render_plate_settings) {
|
||||
if (hover_id == 5) {
|
||||
if (get_bed_type(false) == BedType::btDefault)
|
||||
render_icon_texture(position_id, tex_coords_id, m_bedtype_icon, m_partplate_list->m_bedtype_hovered_texture, m_bedtype_vbo_id);
|
||||
if (get_bed_type() == BedType::btDefault && get_print_seq() == PrintSequence::ByDefault)
|
||||
render_icon_texture(position_id, tex_coords_id, m_plate_settings_icon, m_partplate_list->m_plate_settings_hovered_texture, m_plate_settings_vbo_id);
|
||||
else
|
||||
render_icon_texture(position_id, tex_coords_id, m_bedtype_icon, m_partplate_list->m_bedtype_changed_hovered_texture, m_bedtype_vbo_id);
|
||||
render_icon_texture(position_id, tex_coords_id, m_plate_settings_icon, m_partplate_list->m_plate_settings_changed_hovered_texture, m_plate_settings_vbo_id);
|
||||
}
|
||||
else {
|
||||
if (get_bed_type(false) == BedType::btDefault)
|
||||
render_icon_texture(position_id, tex_coords_id, m_bedtype_icon, m_partplate_list->m_bedtype_texture, m_bedtype_vbo_id);
|
||||
if (get_bed_type() == BedType::btDefault && get_print_seq() == PrintSequence::ByDefault)
|
||||
render_icon_texture(position_id, tex_coords_id, m_plate_settings_icon, m_partplate_list->m_plate_settings_texture, m_plate_settings_vbo_id);
|
||||
else
|
||||
render_icon_texture(position_id, tex_coords_id, m_bedtype_icon, m_partplate_list->m_bedtype_changed_texture, m_bedtype_vbo_id);
|
||||
render_icon_texture(position_id, tex_coords_id, m_plate_settings_icon, m_partplate_list->m_plate_settings_changed_texture, m_plate_settings_vbo_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1088,8 +1144,8 @@ void PartPlate::on_render_for_picking() const {
|
|||
m_grabber_color[1] = color[1];
|
||||
m_grabber_color[2] = color[2];
|
||||
m_grabber_color[3] = color[3];
|
||||
if (m_partplate_list->render_bedtype_setting)
|
||||
render_rectangle_for_picking(m_bedtype_icon, m_grabber_color);
|
||||
if (m_partplate_list->render_plate_settings)
|
||||
render_rectangle_for_picking(m_plate_settings_icon, m_grabber_color);
|
||||
}
|
||||
|
||||
std::array<float, 4> PartPlate::picking_color_component(int idx) const
|
||||
|
@ -1126,9 +1182,9 @@ void PartPlate::release_opengl_resource()
|
|||
glsafe(::glDeleteBuffers(1, &m_lock_vbo_id));
|
||||
m_lock_vbo_id = 0;
|
||||
}
|
||||
if (m_bedtype_vbo_id > 0) {
|
||||
glsafe(::glDeleteBuffers(1, &m_bedtype_vbo_id));
|
||||
m_bedtype_vbo_id = 0;
|
||||
if (m_plate_settings_vbo_id > 0) {
|
||||
glsafe(::glDeleteBuffers(1, &m_plate_settings_vbo_id));
|
||||
m_plate_settings_vbo_id = 0;
|
||||
}
|
||||
if (m_plate_idx_vbo_id > 0) {
|
||||
glsafe(::glDeleteBuffers(1, &m_plate_idx_vbo_id));
|
||||
|
@ -1136,7 +1192,7 @@ void PartPlate::release_opengl_resource()
|
|||
}
|
||||
}
|
||||
|
||||
std::vector<int> PartPlate::get_extruders() const
|
||||
std::vector<int> PartPlate::get_extruders(bool conside_custom_gcode) const
|
||||
{
|
||||
std::vector<int> plate_extruders;
|
||||
// if gcode.3mf file
|
||||
|
@ -1152,6 +1208,7 @@ std::vector<int> PartPlate::get_extruders() const
|
|||
int glb_support_intf_extr = glb_config.opt_int("support_interface_filament");
|
||||
int glb_support_extr = glb_config.opt_int("support_filament");
|
||||
bool glb_support = glb_config.opt_bool("enable_support");
|
||||
glb_support |= glb_config.opt_int("raft_layers") > 0;
|
||||
|
||||
for (int obj_idx = 0; obj_idx < m_model->objects.size(); obj_idx++) {
|
||||
if (!contain_instance_totally(obj_idx, 0))
|
||||
|
@ -1165,8 +1222,13 @@ std::vector<int> PartPlate::get_extruders() const
|
|||
|
||||
bool obj_support = false;
|
||||
const ConfigOption* obj_support_opt = mo->config.option("enable_support");
|
||||
if (obj_support_opt != nullptr)
|
||||
obj_support = obj_support_opt->getBool();
|
||||
const ConfigOption *obj_raft_opt = mo->config.option("raft_layers");
|
||||
if (obj_support_opt != nullptr || obj_raft_opt != nullptr) {
|
||||
if (obj_support_opt != nullptr)
|
||||
obj_support = obj_support_opt->getBool();
|
||||
if (obj_raft_opt != nullptr)
|
||||
obj_support |= obj_raft_opt->getInt() > 0;
|
||||
}
|
||||
else
|
||||
obj_support = glb_support;
|
||||
|
||||
|
@ -1192,6 +1254,16 @@ std::vector<int> PartPlate::get_extruders() const
|
|||
plate_extruders.push_back(glb_support_extr);
|
||||
}
|
||||
|
||||
if (conside_custom_gcode) {
|
||||
//BBS
|
||||
if (m_model->plates_custom_gcodes.find(m_plate_index) != m_model->plates_custom_gcodes.end()) {
|
||||
for (auto item : m_model->plates_custom_gcodes.at(m_plate_index).gcodes) {
|
||||
if (item.type == CustomGCode::Type::ToolChange)
|
||||
plate_extruders.push_back(item.extruder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(plate_extruders.begin(), plate_extruders.end());
|
||||
auto it_end = std::unique(plate_extruders.begin(), plate_extruders.end());
|
||||
plate_extruders.resize(std::distance(plate_extruders.begin(), it_end));
|
||||
|
@ -1223,7 +1295,7 @@ std::vector<int> PartPlate::get_used_extruders()
|
|||
Vec3d PartPlate::estimate_wipe_tower_size(const double w, const double wipe_volume) const
|
||||
{
|
||||
Vec3d wipe_tower_size;
|
||||
std::vector<int> plate_extruders = get_extruders();
|
||||
std::vector<int> plate_extruders = get_extruders(true);
|
||||
double layer_height = 0.08f; // hard code layer height
|
||||
double max_height = 0.f;
|
||||
wipe_tower_size.setZero();
|
||||
|
@ -1673,6 +1745,29 @@ int PartPlate::remove_instance(int obj_id, int instance_id)
|
|||
return result;
|
||||
}
|
||||
|
||||
//translate instance on the plate
|
||||
void PartPlate::translate_all_instance(Vec3d position)
|
||||
{
|
||||
for (std::set<std::pair<int, int>>::iterator it = obj_to_instance_set.begin(); it != obj_to_instance_set.end(); ++it)
|
||||
{
|
||||
int obj_id = it->first;
|
||||
int instance_id = it->second;
|
||||
|
||||
if ((obj_id >= 0) && (obj_id < m_model->objects.size()))
|
||||
{
|
||||
ModelObject* object = m_model->objects[obj_id];
|
||||
if ((instance_id >= 0) && (instance_id < object->instances.size()))
|
||||
{
|
||||
ModelInstance* instance = object->instances[instance_id];
|
||||
const Vec3d& offset = instance->get_offset();
|
||||
instance->set_offset(offset + position);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//update instance exclude state
|
||||
void PartPlate::update_instance_exclude_status(int obj_id, int instance_id, BoundingBoxf3* bounding_box)
|
||||
{
|
||||
|
@ -1722,6 +1817,26 @@ void PartPlate::update_object_index(int obj_idx_removed, int obj_idx_max)
|
|||
|
||||
}
|
||||
|
||||
int PartPlate::printable_instance_size()
|
||||
{
|
||||
int size = 0;
|
||||
for (std::set<std::pair<int, int>>::iterator it = obj_to_instance_set.begin(); it != obj_to_instance_set.end(); ++it) {
|
||||
int obj_id = it->first;
|
||||
int instance_id = it->second;
|
||||
|
||||
if (obj_id >= m_model->objects.size())
|
||||
continue;
|
||||
|
||||
ModelObject * object = m_model->objects[obj_id];
|
||||
ModelInstance *instance = object->instances[instance_id];
|
||||
|
||||
if ((instance->printable) && (instance_outside_set.find(std::pair(obj_id, instance_id)) == instance_outside_set.end())) {
|
||||
size++;
|
||||
}
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
//whether it is has printable instances
|
||||
bool PartPlate::has_printable_instances()
|
||||
{
|
||||
|
@ -1917,17 +2032,27 @@ void PartPlate::generate_exclude_polygon(ExPolygon &exclude_polygon)
|
|||
|
||||
bool PartPlate::set_shape(const Pointfs& shape, const Pointfs& exclude_areas, Vec2d position, float height_to_lid, float height_to_rod)
|
||||
{
|
||||
if ((m_shape == shape)&&(m_exclude_area == exclude_areas)
|
||||
Pointfs new_shape, new_exclude_areas;
|
||||
|
||||
for (const Vec2d& p : shape) {
|
||||
new_shape.push_back(Vec2d(p.x() + position.x(), p.y() + position.y()));
|
||||
}
|
||||
|
||||
for (const Vec2d& p : exclude_areas) {
|
||||
new_exclude_areas.push_back(Vec2d(p.x() + position.x(), p.y() + position.y()));
|
||||
}
|
||||
if ((m_shape == new_shape)&&(m_exclude_area == new_exclude_areas)
|
||||
&&(m_height_to_lid == height_to_lid)&&(m_height_to_rod == height_to_rod)) {
|
||||
BOOST_LOG_TRIVIAL(trace) << "PartPlate same shape";
|
||||
BOOST_LOG_TRIVIAL(info) << "PartPlate same shape, skip directly";
|
||||
return false;
|
||||
}
|
||||
|
||||
m_height_to_lid = height_to_lid;
|
||||
m_height_to_rod = height_to_rod;
|
||||
|
||||
if ((m_shape != shape) || (m_exclude_area != exclude_areas))
|
||||
if ((m_shape != new_shape) || (m_exclude_area != new_exclude_areas))
|
||||
{
|
||||
m_shape.clear();
|
||||
/*m_shape.clear();
|
||||
for (const Vec2d& p : shape) {
|
||||
m_shape.push_back(Vec2d(p.x() + position.x(), p.y() + position.y()));
|
||||
}
|
||||
|
@ -1935,7 +2060,9 @@ bool PartPlate::set_shape(const Pointfs& shape, const Pointfs& exclude_areas, Ve
|
|||
m_exclude_area.clear();
|
||||
for (const Vec2d& p : exclude_areas) {
|
||||
m_exclude_area.push_back(Vec2d(p.x() + position.x(), p.y() + position.y()));
|
||||
}
|
||||
}*/
|
||||
m_shape = std::move(new_shape);
|
||||
m_exclude_area = std::move(new_exclude_areas);
|
||||
|
||||
calc_bounding_boxes();
|
||||
|
||||
|
@ -1970,7 +2097,7 @@ bool PartPlate::set_shape(const Pointfs& shape, const Pointfs& exclude_areas, Ve
|
|||
calc_vertex_for_icons(1, m_orient_icon);
|
||||
calc_vertex_for_icons(2, m_arrange_icon);
|
||||
calc_vertex_for_icons(3, m_lock_icon);
|
||||
calc_vertex_for_icons(4, m_bedtype_icon);
|
||||
calc_vertex_for_icons(4, m_plate_settings_icon);
|
||||
//calc_vertex_for_number(0, (m_plate_index < 9), m_plate_idx_icon);
|
||||
calc_vertex_for_number(0, false, m_plate_idx_icon);
|
||||
}
|
||||
|
@ -2188,10 +2315,13 @@ int PartPlate::load_gcode_from_file(const std::string& filename)
|
|||
int ret = 0;
|
||||
|
||||
// process gcode
|
||||
m_print->apply(*m_model, wxGetApp().preset_bundle->full_config());
|
||||
DynamicPrintConfig full_config = wxGetApp().preset_bundle->full_config();
|
||||
full_config.apply(m_config, true);
|
||||
m_print->apply(*m_model, full_config);
|
||||
//BBS: need to apply two times, for after the first apply, the m_print got its object,
|
||||
//which will affect the config when new_full_config.normalize_fdm(used_filaments);
|
||||
m_print->apply(*m_model, wxGetApp().preset_bundle->full_config());
|
||||
m_print->apply(*m_model, full_config);
|
||||
|
||||
// BBS: use backup path to save temp gcode
|
||||
// auto path = get_tmp_gcode_path();
|
||||
// if (boost::filesystem::exists(boost::filesystem::path(path))) {
|
||||
|
@ -2372,6 +2502,23 @@ Vec3d PartPlateList::compute_origin(int i, int cols)
|
|||
return origin;
|
||||
}
|
||||
|
||||
//compute the origin for printable plate with index i using new width
|
||||
Vec3d PartPlateList::compute_origin_using_new_size(int i, int new_width, int new_depth)
|
||||
{
|
||||
Vec3d origin;
|
||||
int row, col;
|
||||
|
||||
row = i / m_plate_cols;
|
||||
col = i % m_plate_cols;
|
||||
|
||||
origin(0) = col * (new_width * (1. + LOGICAL_PART_PLATE_GAP));
|
||||
origin(1) = -row * (new_depth * (1. + LOGICAL_PART_PLATE_GAP));
|
||||
origin(2) = 0;
|
||||
|
||||
return origin;
|
||||
}
|
||||
|
||||
|
||||
//compute the origin for printable plate with index i
|
||||
Vec3d PartPlateList::compute_origin_for_unprintable()
|
||||
{
|
||||
|
@ -2489,32 +2636,32 @@ void PartPlateList::generate_icon_textures()
|
|||
|
||||
//if (m_bedtype_texture.get_id() == 0)
|
||||
{
|
||||
file_name = path + (m_is_dark ? "plate_set_bedtype_dark.svg" : "plate_set_bedtype.svg");
|
||||
if (!m_bedtype_texture.load_from_svg_file(file_name, true, false, false, icon_size)) {
|
||||
file_name = path + (m_is_dark ? "plate_settings_dark.svg" : "plate_settings.svg");
|
||||
if (!m_plate_settings_texture.load_from_svg_file(file_name, true, false, false, icon_size)) {
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":load file %1% failed") % file_name;
|
||||
}
|
||||
}
|
||||
|
||||
//if (m_bedtype_changed_texture.get_id() == 0)
|
||||
{
|
||||
file_name = path + (m_is_dark ? "plate_set_bedtype_changed_dark.svg" : "plate_set_bedtype_changed.svg");
|
||||
if (!m_bedtype_changed_texture.load_from_svg_file(file_name, true, false, false, icon_size)) {
|
||||
file_name = path + (m_is_dark ? "plate_settings_changed_dark.svg" : "plate_settings_changed.svg");
|
||||
if (!m_plate_settings_changed_texture.load_from_svg_file(file_name, true, false, false, icon_size)) {
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":load file %1% failed") % file_name;
|
||||
}
|
||||
}
|
||||
|
||||
//if (m_bedtype_hovered_texture.get_id() == 0)
|
||||
{
|
||||
file_name = path + (m_is_dark ? "plate_set_bedtype_hover_dark.svg" : "plate_set_bedtype_hover.svg");
|
||||
if (!m_bedtype_hovered_texture.load_from_svg_file(file_name, true, false, false, icon_size)) {
|
||||
file_name = path + (m_is_dark ? "plate_settings_hover_dark.svg" : "plate_settings_hover.svg");
|
||||
if (!m_plate_settings_hovered_texture.load_from_svg_file(file_name, true, false, false, icon_size)) {
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":load file %1% failed") % file_name;
|
||||
}
|
||||
}
|
||||
|
||||
//if (m_bedtype_changed_hovered_texture.get_id() == 0)
|
||||
{
|
||||
file_name = path + (m_is_dark ? "plate_set_bedtype_changed_hover_dark.svg" : "plate_set_bedtype_changed_hover.svg");
|
||||
if (!m_bedtype_changed_hovered_texture.load_from_svg_file(file_name, true, false, false, icon_size)) {
|
||||
file_name = path + (m_is_dark ? "plate_settings_changed_hover_dark.svg" : "plate_settings_changed_hover.svg");
|
||||
if (!m_plate_settings_changed_hovered_texture.load_from_svg_file(file_name, true, false, false, icon_size)) {
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":load file %1% failed") % file_name;
|
||||
}
|
||||
}
|
||||
|
@ -2575,10 +2722,10 @@ void PartPlateList::release_icon_textures()
|
|||
m_locked_hovered_texture.reset();
|
||||
m_lockopen_texture.reset();
|
||||
m_lockopen_hovered_texture.reset();
|
||||
m_bedtype_texture.reset();
|
||||
m_bedtype_changed_texture.reset();
|
||||
m_bedtype_hovered_texture.reset();
|
||||
m_bedtype_changed_hovered_texture.reset();
|
||||
m_plate_settings_texture.reset();
|
||||
m_plate_settings_texture.reset();
|
||||
m_plate_settings_texture.reset();
|
||||
m_plate_settings_hovered_texture.reset();
|
||||
|
||||
for (int i = 0;i < MAX_PLATE_COUNT; i++) {
|
||||
m_idx_textures[i].reset();
|
||||
|
@ -2603,7 +2750,7 @@ void PartPlateList::release_icon_textures()
|
|||
}
|
||||
|
||||
//this may be happened after machine changed
|
||||
void PartPlateList::reset_size(int width, int depth, int height)
|
||||
void PartPlateList::reset_size(int width, int depth, int height, bool reload_objects, bool update_shapes)
|
||||
{
|
||||
Vec3d origin1, origin2;
|
||||
|
||||
|
@ -2615,7 +2762,13 @@ void PartPlateList::reset_size(int width, int depth, int height)
|
|||
m_plate_depth = depth;
|
||||
m_plate_height = height;
|
||||
update_all_plates_pos_and_size(false, false);
|
||||
reload_all_objects();
|
||||
if (update_shapes) {
|
||||
set_shapes(m_shape, m_exclude_areas, m_logo_texture_filename, m_height_to_lid, m_height_to_rod);
|
||||
}
|
||||
if (reload_objects)
|
||||
reload_all_objects();
|
||||
else
|
||||
clear(false, false, false, -1);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -2967,6 +3120,25 @@ PartPlate* PartPlateList::get_selected_plate()
|
|||
return m_plate_list[m_current_plate];
|
||||
}
|
||||
|
||||
std::vector<PartPlate*> PartPlateList::get_nonempty_plate_list()
|
||||
{
|
||||
std::vector<PartPlate*> nonempty_plate_list;
|
||||
for (auto plate : m_plate_list){
|
||||
if (plate->get_extruders().size() != 0) {
|
||||
nonempty_plate_list.push_back(plate);
|
||||
}
|
||||
}
|
||||
return nonempty_plate_list;
|
||||
}
|
||||
|
||||
std::vector<const GCodeProcessorResult*> PartPlateList::get_nonempty_plates_slice_results() {
|
||||
std::vector<const GCodeProcessorResult*> nonempty_plates_slice_result;
|
||||
for (auto plate : get_nonempty_plate_list()) {
|
||||
nonempty_plates_slice_result.push_back(plate->get_slice_result());
|
||||
}
|
||||
return nonempty_plates_slice_result;
|
||||
}
|
||||
|
||||
//select plate
|
||||
int PartPlateList::select_plate(int index)
|
||||
{
|
||||
|
@ -2989,11 +3161,15 @@ int PartPlateList::select_plate(int index)
|
|||
m_current_plate = index;
|
||||
m_plate_list[m_current_plate]->set_selected();
|
||||
|
||||
//BBS
|
||||
if(m_model)
|
||||
m_model->curr_plate_index = index;
|
||||
|
||||
//BBS update bed origin
|
||||
if (m_intialized && m_plater) {
|
||||
Vec2d pos = compute_shape_position(index, m_plate_cols);
|
||||
m_plater->set_bed_position(pos);
|
||||
wxQueueEvent(m_plater, new SimpleEvent(EVT_GLCANVAS_PLATE_SELECT));
|
||||
//wxQueueEvent(m_plater, new SimpleEvent(EVT_GLCANVAS_PLATE_SELECT));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -3886,10 +4062,10 @@ void PartPlateList::render_for_picking_pass()
|
|||
return 0;
|
||||
}*/
|
||||
|
||||
void PartPlateList::set_render_option(bool bedtype_texture, bool bedtype_setting)
|
||||
void PartPlateList::set_render_option(bool bedtype_texture, bool plate_settings)
|
||||
{
|
||||
render_bedtype_logo = bedtype_texture;
|
||||
render_bedtype_setting = bedtype_setting;
|
||||
render_bedtype_logo = bedtype_texture;
|
||||
render_plate_settings = plate_settings;
|
||||
}
|
||||
|
||||
int PartPlateList::select_plate_by_obj(int obj_index, int instance_index)
|
||||
|
@ -4246,8 +4422,8 @@ int PartPlateList::store_to_3mf_structure(PlateDataPtrs& plate_data_list, bool w
|
|||
plate_data_item->objects_and_instances.emplace_back(it->first, it->second);
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ <<boost::format(": plate %1%, gcode_filename=%2%, with_slice_info=%3%, slice_valid %4%")
|
||||
%i %m_plate_list[i]->m_gcode_result->filename % with_slice_info %m_plate_list[i]->is_slice_result_valid();
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ <<boost::format(": plate %1%, gcode_filename=%2%, with_slice_info=%3%, slice_valid %4%, object item count %5%.")
|
||||
%i %m_plate_list[i]->m_gcode_result->filename % with_slice_info %m_plate_list[i]->is_slice_result_valid()%plate_data_item->objects_and_instances.size();
|
||||
|
||||
if (with_slice_info) {
|
||||
if (m_plate_list[i]->get_slice_result() && m_plate_list[i]->is_slice_result_valid()) {
|
||||
|
@ -4421,7 +4597,7 @@ void PartPlateList::BedTextureInfo::TexturePart::update_buffer()
|
|||
rectangle.push_back(Vec2d(x+w, y+h));
|
||||
rectangle.push_back(Vec2d(x, y+h));
|
||||
ExPolygon poly;
|
||||
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
const Vec2d & p = rectangle[i];
|
||||
for (auto& p : rectangle) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue