mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-21 07:41:09 -06:00
Merge remote-tracking branch 'remote/master' into feature/merge_upstream
# Conflicts: # bbl/i18n/OrcaSlicer.pot # bbl/i18n/de/OrcaSlicer_de.po # bbl/i18n/en/OrcaSlicer_en.po # bbl/i18n/es/OrcaSlicer_es.po # bbl/i18n/fr/OrcaSlicer_fr.po # bbl/i18n/hu/OrcaSlicer_hu.po # bbl/i18n/it/OrcaSlicer_it.po # bbl/i18n/ja/OrcaSlicer_ja.po # bbl/i18n/nl/OrcaSlicer_nl.po # bbl/i18n/sv/OrcaSlicer_sv.po # bbl/i18n/zh_cn/OrcaSlicer_zh_CN.po # 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/ja/OrcaSlicer.mo # resources/i18n/nl/BambuStudio.mo # resources/i18n/sv/BambuStudio.mo # resources/i18n/zh_cn/BambuStudio.mo # resources/images/ams_humidity_2.svg # resources/images/ams_humidity_3.svg # resources/images/ams_humidity_4.svg # resources/images/ams_humidity_tips.svg # resources/images/monitor_state_on.svg # resources/images/sdcard_state_normal.svg # resources/profiles/BBL.json # resources/profiles/BBL/filament/Bambu PETG-CF @base.json # resources/profiles/BBL/filament/Generic PETG-CF @base.json # resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json # resources/web/data/text.js # resources/web/guide/3/index.html # resources/web/guide/31/index.html # src/BambuStudio.cpp # src/libslic3r/AABBTreeLines.hpp # src/libslic3r/Brim.cpp # src/libslic3r/CMakeLists.txt # src/libslic3r/ExPolygon.hpp # src/libslic3r/Fill/FillBase.hpp # src/libslic3r/Format/bbs_3mf.cpp # src/libslic3r/GCodeWriter.cpp # src/libslic3r/Line.hpp # src/libslic3r/PerimeterGenerator.cpp # src/libslic3r/Preset.cpp # src/libslic3r/Print.cpp # src/libslic3r/Print.hpp # src/libslic3r/PrintConfig.cpp # src/libslic3r/PrintConfig.hpp # src/libslic3r/TreeSupport.cpp # src/slic3r/GUI/AmsMappingPopup.cpp # src/slic3r/GUI/BackgroundSlicingProcess.cpp # src/slic3r/GUI/ConfigManipulation.cpp # src/slic3r/GUI/GCodeViewer.cpp # src/slic3r/GUI/GCodeViewer.hpp # src/slic3r/GUI/GLCanvas3D.cpp # src/slic3r/GUI/GUI_App.cpp # src/slic3r/GUI/MainFrame.cpp # src/slic3r/GUI/PartPlate.cpp # src/slic3r/GUI/Plater.cpp # src/slic3r/GUI/Preferences.cpp # src/slic3r/GUI/SelectMachine.cpp # src/slic3r/GUI/Widgets/AMSControl.cpp # src/slic3r/GUI/wxMediaCtrl2.cpp # src/slic3r/Utils/Process.cpp # version.inc
This commit is contained in:
commit
9f598046d1
658 changed files with 70312 additions and 4877 deletions
|
@ -171,17 +171,21 @@ void PartPlate::init()
|
|||
m_plate_name_vbo_id = 0;
|
||||
}
|
||||
|
||||
BedType PartPlate::get_bed_type() const
|
||||
BedType PartPlate::get_bed_type(bool load_from_project) const
|
||||
{
|
||||
std::string bed_type_key = "curr_bed_type";
|
||||
|
||||
// should be called in GUI context
|
||||
assert(m_plater != nullptr);
|
||||
if (m_config.has(bed_type_key)) {
|
||||
BedType bed_type = m_config.opt_enum<BedType>(bed_type_key);
|
||||
return bed_type;
|
||||
}
|
||||
|
||||
if (!load_from_project || !m_plater || !wxGetApp().preset_bundle)
|
||||
return btDefault;
|
||||
|
||||
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 btDefault;
|
||||
}
|
||||
|
||||
|
@ -258,9 +262,6 @@ 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;
|
||||
|
@ -1344,10 +1345,14 @@ std::vector<int> PartPlate::get_extruders(bool conside_custom_gcode) const
|
|||
|
||||
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);
|
||||
int nums_extruders = 0;
|
||||
if (const ConfigOptionStrings *color_option = dynamic_cast<const ConfigOptionStrings *>(wxGetApp().preset_bundle->project_config.option("filament_colour"))) {
|
||||
nums_extruders = color_option->values.size();
|
||||
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 && item.extruder <= nums_extruders)
|
||||
plate_extruders.push_back(item.extruder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1731,6 +1736,8 @@ bool PartPlate::check_outside(int obj_id, int instance_id, BoundingBoxf3* boundi
|
|||
m_origin.z() + m_height + Slic3r::BuildVolume::SceneEpsilon);
|
||||
Vec3d low_point = m_bounding_box.min + Vec3d(-Slic3r::BuildVolume::SceneEpsilon, -Slic3r::BuildVolume::SceneEpsilon,
|
||||
m_origin.z() - Slic3r::BuildVolume::SceneEpsilon);
|
||||
Polygon hull = instance->convex_hull_2d();
|
||||
if (instance_box.max.z() > low_point.z()) low_point.z() += instance_box.min.z(); // not considering outsize if sinking
|
||||
BoundingBoxf3 plate_box(low_point, up_point);
|
||||
|
||||
if (plate_box.contains(instance_box))
|
||||
|
@ -2449,21 +2456,26 @@ int PartPlate::load_gcode_from_file(const std::string& filename)
|
|||
// BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("Failed to rename the output G-code file from %1% to %2%, error code %3%") % filename.c_str() % path.c_str() %
|
||||
//error.message(); return -1;
|
||||
//}
|
||||
if (boost::filesystem::exists(filename)) {
|
||||
assert(m_tmp_gcode_path.empty());
|
||||
m_tmp_gcode_path = filename;
|
||||
m_gcode_result->filename = filename;
|
||||
m_print->set_gcode_file_ready();
|
||||
if (boost::filesystem::exists(filename)) {
|
||||
assert(m_tmp_gcode_path.empty());
|
||||
m_tmp_gcode_path = filename;
|
||||
m_gcode_result->filename = filename;
|
||||
m_print->set_gcode_file_ready();
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": from %1% to %2%, finished") % filename.c_str() % filename.c_str();
|
||||
}
|
||||
update_slice_result_valid_state(true);
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": found valid gcode file %1%") % filename.c_str();
|
||||
}
|
||||
else {
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(": can not find gcode file %1%") % filename.c_str();
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
update_slice_result_valid_state(true);
|
||||
m_ready_for_slice = true;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int PartPlate::load_thumbnail_data(std::string filename)
|
||||
int PartPlate::load_thumbnail_data(std::string filename, ThumbnailData& thumb_data)
|
||||
{
|
||||
bool result = true;
|
||||
wxImage img;
|
||||
|
@ -2472,11 +2484,11 @@ int PartPlate::load_thumbnail_data(std::string filename)
|
|||
img = img.Mirror(false);
|
||||
}
|
||||
if (result) {
|
||||
thumbnail_data.set(img.GetWidth(), img.GetHeight());
|
||||
thumb_data.set(img.GetWidth(), img.GetHeight());
|
||||
for (int i = 0; i < img.GetWidth() * img.GetHeight(); i++) {
|
||||
memcpy(&thumbnail_data.pixels[4 * i], (unsigned char*)(img.GetData() + 3 * i), 3);
|
||||
memcpy(&thumb_data.pixels[4 * i], (unsigned char*)(img.GetData() + 3 * i), 3);
|
||||
if (img.HasAlpha()) {
|
||||
thumbnail_data.pixels[4 * i + 3] = *(unsigned char*)(img.GetAlpha() + i);
|
||||
thumb_data.pixels[4 * i + 3] = *(unsigned char*)(img.GetAlpha() + i);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -2487,7 +2499,7 @@ int PartPlate::load_thumbnail_data(std::string filename)
|
|||
|
||||
int PartPlate::load_pattern_thumbnail_data(std::string filename)
|
||||
{
|
||||
bool result = true;
|
||||
/*bool result = true;
|
||||
wxImage img;
|
||||
result = load_image(filename, img);
|
||||
if (result) {
|
||||
|
@ -2501,7 +2513,7 @@ int PartPlate::load_pattern_thumbnail_data(std::string filename)
|
|||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
}*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -3520,6 +3532,8 @@ int PartPlateList::notify_instance_update(int obj_id, int instance_id)
|
|||
PartPlate* plate = m_plate_list[obj_id - 1000];
|
||||
plate->update_slice_result_valid_state( false );
|
||||
plate->thumbnail_data.reset();
|
||||
plate->top_thumbnail_data.reset();
|
||||
plate->pick_thumbnail_data.reset();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -3548,10 +3562,14 @@ int PartPlateList::notify_instance_update(int obj_id, int instance_id)
|
|||
plate->update_states();
|
||||
plate->update_slice_result_valid_state();
|
||||
plate->thumbnail_data.reset();
|
||||
plate->top_thumbnail_data.reset();
|
||||
plate->pick_thumbnail_data.reset();
|
||||
return 0;
|
||||
}
|
||||
plate->update_slice_result_valid_state();
|
||||
plate->thumbnail_data.reset();
|
||||
plate->top_thumbnail_data.reset();
|
||||
plate->pick_thumbnail_data.reset();
|
||||
}
|
||||
else if (unprintable_plate.contain_instance(obj_id, instance_id))
|
||||
{
|
||||
|
@ -3582,6 +3600,8 @@ int PartPlateList::notify_instance_update(int obj_id, int instance_id)
|
|||
plate->add_instance(obj_id, instance_id, false, &boundingbox);
|
||||
plate->update_slice_result_valid_state();
|
||||
plate->thumbnail_data.reset();
|
||||
plate->top_thumbnail_data.reset();
|
||||
plate->pick_thumbnail_data.reset();
|
||||
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": add it to new plate %1%") % i;
|
||||
return 0;
|
||||
}
|
||||
|
@ -3617,6 +3637,8 @@ int PartPlateList::notify_instance_removed(int obj_id, int instance_id)
|
|||
plate->remove_instance(obj_id, instance_to_delete);
|
||||
plate->update_slice_result_valid_state();
|
||||
plate->thumbnail_data.reset();
|
||||
plate->top_thumbnail_data.reset();
|
||||
plate->pick_thumbnail_data.reset();
|
||||
}
|
||||
|
||||
if (unprintable_plate.contain_instance(obj_id, instance_to_delete))
|
||||
|
@ -4058,7 +4080,7 @@ void PartPlateList::postprocess_arrange_polygon(arrangement::ArrangePolygon& arr
|
|||
{
|
||||
// outarea for large object
|
||||
arrange_polygon.bed_idx = m_plate_list.size();
|
||||
BoundingBox apbox(arrange_polygon.poly);
|
||||
BoundingBox apbox = get_extents(arrange_polygon.poly);
|
||||
auto apbox_size = apbox.size();
|
||||
|
||||
//arrange_polygon.translation(X) = scaled<double>(0.5 * plate_stride_x());
|
||||
|
@ -4512,6 +4534,11 @@ int PartPlateList::store_to_3mf_structure(PlateDataPtrs& plate_data_list, bool w
|
|||
%(i+1) %plate_data_item->plate_thumbnail.width %plate_data_item->plate_thumbnail.height %plate_data_item->plate_thumbnail.pixels.size();
|
||||
plate_data_item->config.apply(*m_plate_list[i]->config());
|
||||
|
||||
if (m_plate_list[i]->top_thumbnail_data.is_valid())
|
||||
plate_data_item->top_file = "valid_top";
|
||||
if (m_plate_list[i]->pick_thumbnail_data.is_valid())
|
||||
plate_data_item->pick_file = "valid_pick";
|
||||
|
||||
if (m_plate_list[i]->obj_to_instance_set.size() > 0)
|
||||
{
|
||||
for (std::set<std::pair<int, int>>::iterator it = m_plate_list[i]->obj_to_instance_set.begin(); it != m_plate_list[i]->obj_to_instance_set.end(); ++it)
|
||||
|
@ -4526,8 +4553,8 @@ int PartPlateList::store_to_3mf_structure(PlateDataPtrs& plate_data_list, bool w
|
|||
// BBS only include current palte_idx
|
||||
if (plate_idx == i || plate_idx == PLATE_CURRENT_IDX || plate_idx == PLATE_ALL_IDX) {
|
||||
//load calibration thumbnail
|
||||
if (m_plate_list[i]->cali_thumbnail_data.is_valid())
|
||||
plate_data_item->pattern_file = "valid_pattern";
|
||||
//if (m_plate_list[i]->cali_thumbnail_data.is_valid())
|
||||
// plate_data_item->pattern_file = "valid_pattern";
|
||||
if (m_plate_list[i]->cali_bboxes_data.is_valid())
|
||||
plate_data_item->pattern_bbox_file = "valid_pattern_bbox";
|
||||
plate_data_item->gcode_file = m_plate_list[i]->m_gcode_result->filename;
|
||||
|
@ -4610,17 +4637,29 @@ int PartPlateList::load_from_3mf_structure(PlateDataPtrs& plate_data_list)
|
|||
if (m_plater && !plate_data_list[i]->thumbnail_file.empty()) {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": plate %1%, load thumbnail from %2%.")%(i+1) %plate_data_list[i]->thumbnail_file;
|
||||
if (boost::filesystem::exists(plate_data_list[i]->thumbnail_file)) {
|
||||
m_plate_list[index]->load_thumbnail_data(plate_data_list[i]->thumbnail_file);
|
||||
m_plate_list[index]->load_thumbnail_data(plate_data_list[i]->thumbnail_file, m_plate_list[index]->thumbnail_data);
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ <<boost::format(": plate %1% after load, width %2%, height %3%, size %4%!")
|
||||
%(i+1) %m_plate_list[index]->thumbnail_data.width %m_plate_list[index]->thumbnail_data.height %m_plate_list[index]->thumbnail_data.pixels.size();
|
||||
}
|
||||
}
|
||||
|
||||
if (m_plater && !plate_data_list[i]->pattern_file.empty()) {
|
||||
/*if (m_plater && !plate_data_list[i]->pattern_file.empty()) {
|
||||
if (boost::filesystem::exists(plate_data_list[i]->pattern_file)) {
|
||||
//no need to load pattern data currently
|
||||
//m_plate_list[index]->load_pattern_thumbnail_data(plate_data_list[i]->pattern_file);
|
||||
}
|
||||
}*/
|
||||
if (m_plater && !plate_data_list[i]->top_file.empty()) {
|
||||
if (boost::filesystem::exists(plate_data_list[i]->top_file)) {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": plate %1%, load top_thumbnail from %2%.")%(i+1) %plate_data_list[i]->top_file;
|
||||
m_plate_list[index]->load_thumbnail_data(plate_data_list[i]->top_file, m_plate_list[index]->top_thumbnail_data);
|
||||
}
|
||||
}
|
||||
if (m_plater && !plate_data_list[i]->pick_file.empty()) {
|
||||
if (boost::filesystem::exists(plate_data_list[i]->pick_file)) {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": plate %1%, load pick_thumbnail from %2%.")%(i+1) %plate_data_list[i]->pick_file;
|
||||
m_plate_list[index]->load_thumbnail_data(plate_data_list[i]->pick_file, m_plate_list[index]->pick_thumbnail_data);
|
||||
}
|
||||
}
|
||||
if (m_plater && !plate_data_list[i]->pattern_bbox_file.empty()) {
|
||||
if (boost::filesystem::exists(plate_data_list[i]->pattern_bbox_file)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue