Fix some build error

This commit is contained in:
Noisyfox
2025-08-20 15:34:40 +08:00
parent 9142654795
commit 1a03d33795
5 changed files with 22 additions and 100 deletions

View File

@@ -1061,7 +1061,7 @@ bool SelectMachineDialog::do_ams_mapping(MachineObject *obj_)
std::vector<bool> map_opt; //four values: use_left_ams, use_right_ams, use_left_ext, use_right_ext
if (nozzle_nums > 1){
//get nozzle property, the nozzles are same?
if (!can_hybrid_mapping(obj_->m_nozzle_data)){
if (!can_hybrid_mapping(obj_->m_extder_data)){
std::vector<FilamentInfo> m_ams_mapping_result_left, m_ams_mapping_result_right;
std::vector<FilamentInfo> m_filament_left, m_filament_right;
for (auto it = m_filaments.begin(); it != m_filaments.end(); it++){
@@ -1283,17 +1283,17 @@ bool SelectMachineDialog::build_nozzles_info(std::string& nozzles_info)
return true;
}
bool SelectMachineDialog::can_hybrid_mapping(NozzleData data) {
if (data.total_nozzle_count <= 1 || data.nozzles.size() <= 1 || !wxGetApp().preset_bundle)
bool SelectMachineDialog::can_hybrid_mapping(ExtderData data) {
if (data.total_extder_count <= 1 || data.extders.size() <= 1 || !wxGetApp().preset_bundle)
return false;
//The default two extruders are left, right, but the order of the extruders on the machine is right, left.
//Therefore, some adjustments need to be made.
std::vector<std::string>flow_type_of_machine;
for (auto it = data.nozzles.rbegin(); it != data.nozzles.rend(); it++){
for (auto it = data.extders.rbegin(); it != data.extders.rend(); it++){
//exist field is not updated, wait add
//if (it->exist < 3) return false;
std::string type_str = it->flow_type ? "Big Traffic" : "Normal";
std::string type_str = /*it->flow_type ? "Big Traffic" :*/ "Normal";
flow_type_of_machine.push_back(type_str);
}
//get the nozzle type of preset --> flow_types
@@ -1335,14 +1335,14 @@ void SelectMachineDialog::auto_supply_with_ext(std::vector<AmsTray> slots) {
}
}
bool SelectMachineDialog::is_nozzle_type_match(NozzleData data) {
if (data.total_nozzle_count <= 1 || data.nozzles.size() <= 1 || !wxGetApp().preset_bundle)
bool SelectMachineDialog::is_nozzle_type_match(ExtderData data) {
if (data.total_extder_count <= 1 || data.extders.size() <= 1 || !wxGetApp().preset_bundle)
return false;
//The default two extruders are left, right, but the order of the extruders on the machine is right, left.
std::vector<std::string>flow_type_of_machine;
for (auto it = data.nozzles.rbegin(); it != data.nozzles.rend(); it++) {
std::string str_flow = it->flow_type ? "Big Traffic" : "Normal";
for (auto it = data.extders.begin(); it != data.extders.end(); it++) {
std::string str_flow = /*it->flow_type ? "Big Traffic" :*/ "Normal";
flow_type_of_machine.push_back(str_flow);
}
//get the nozzle type of preset --> flow_types
@@ -2983,7 +2983,7 @@ void SelectMachineDialog::update_show_status()
size_t nozzle_nums = full_config.option<ConfigOptionFloats>("nozzle_diameter")->values.size();
//the nozzle type of preset and machine are different
if (nozzle_nums > 1 && !is_nozzle_type_match(obj_->m_nozzle_data)) {
if (nozzle_nums > 1 && !is_nozzle_type_match(obj_->m_extder_data)) {
show_status(PrintDialogStatus::PrintStatusNozzleMatchInvalid);
return;
}
@@ -3507,7 +3507,7 @@ void SelectMachineDialog::reset_and_sync_ams_list()
size_t nozzle_nums = full_config.option<ConfigOptionFloats>("nozzle_diameter")->values.size();
if (nozzle_nums > 1)
{
if (obj_ && can_hybrid_mapping(obj_->m_nozzle_data))
if (obj_ && can_hybrid_mapping(obj_->m_extder_data))
{
m_mapping_popup.set_show_type(ShowType::LEFT_AND_RIGHT);
}

View File

@@ -374,9 +374,9 @@ public:
bool do_ams_mapping(MachineObject* obj_);
bool get_ams_mapping_result(std::string& mapping_array_str, std::string& mapping_array_str2, std::string& ams_mapping_info);
bool build_nozzles_info(std::string& nozzles_info);
bool can_hybrid_mapping(NozzleData data);
bool can_hybrid_mapping(ExtderData data);
void auto_supply_with_ext(std::vector<AmsTray> slots);
bool is_nozzle_type_match(NozzleData data);
bool is_nozzle_type_match(ExtderData data);
std::string get_print_status_info(PrintDialogStatus status);

View File

@@ -1172,87 +1172,6 @@ void Selection::move_to_center(const Vec3d& displacement, bool local)
this->set_bounding_boxes_dirty();
}
void Selection::translate(const Vec3d &displacement, bool local)
{
if (!m_valid)
return;
EMode translation_type = m_mode;
//BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": %1%, displacement {%2%, %3%, %4%}") % __LINE__ % displacement(X) % displacement(Y) % displacement(Z);
for (unsigned int i : m_list) {
GLVolume& v = *(*m_volumes)[i];
if (v.is_wipe_tower) {
int plate_idx = v.object_idx() - 1000;
PartPlate* part_plate = wxGetApp().plater()->get_partplate_list().get_plate(plate_idx);
BoundingBoxf3 plate_bbox = part_plate->get_bounding_box();
BoundingBoxf plate_bbox_2d(Vec2d(plate_bbox.min(0), plate_bbox.min(1)), Vec2d(plate_bbox.max(0), plate_bbox.max(1)));
const std::vector<Pointfs>& extruder_areas = part_plate->get_extruder_areas();
for (Pointfs points : extruder_areas) {
BoundingBoxf bboxf(points);
plate_bbox_2d.min = plate_bbox_2d.min(0) >= bboxf.min(0) ? plate_bbox_2d.min : bboxf.min;
plate_bbox_2d.max = plate_bbox_2d.max(0) <= bboxf.max(0) ? plate_bbox_2d.max : bboxf.max;
}
Vec3d tower_size = v.bounding_box().size();
Vec3d tower_origin = m_cache.volumes_data[i].get_volume_position();
Vec3d actual_displacement = displacement;
const double margin = WIPE_TOWER_MARGIN;
if (!local)
actual_displacement = (m_cache.volumes_data[i].get_instance_rotation_matrix() * m_cache.volumes_data[i].get_instance_scale_matrix() * m_cache.volumes_data[i].get_instance_mirror_matrix()).inverse() * displacement;
if (tower_origin(0) + actual_displacement(0) - margin < plate_bbox_2d.min(0)) {
actual_displacement(0) = plate_bbox_2d.min(0) - tower_origin(0) + margin;
}
else if (tower_origin(0) + actual_displacement(0) + tower_size(0) + margin > plate_bbox_2d.max(0)) {
actual_displacement(0) = plate_bbox_2d.max(0) - tower_origin(0) - tower_size(0) - margin;
}
if (tower_origin(1) + actual_displacement(1) - margin < plate_bbox_2d.min(1)) {
actual_displacement(1) = plate_bbox_2d.min(1) - tower_origin(1) + margin;
}
else if (tower_origin(1) + actual_displacement(1) + tower_size(1) + margin > plate_bbox_2d.max(1)) {
actual_displacement(1) = plate_bbox_2d.max(1) - tower_origin(1) - tower_size(1) - margin;
}
v.set_volume_offset(m_cache.volumes_data[i].get_volume_position() + actual_displacement);
}
else if (m_mode == Volume || v.is_wipe_tower) {
if (local)
v.set_volume_offset(m_cache.volumes_data[i].get_volume_position() + displacement);
else {
const Vec3d local_displacement = (m_cache.volumes_data[i].get_instance_rotation_matrix() * m_cache.volumes_data[i].get_instance_scale_matrix() * m_cache.volumes_data[i].get_instance_mirror_matrix()).inverse() * displacement;
v.set_volume_offset(m_cache.volumes_data[i].get_volume_position() + local_displacement);
}
}
else if (m_mode == Instance) {
if (is_from_fully_selected_instance(i))
v.set_instance_offset(m_cache.volumes_data[i].get_instance_position() + displacement);
else {
const Vec3d local_displacement = (m_cache.volumes_data[i].get_instance_rotation_matrix() * m_cache.volumes_data[i].get_instance_scale_matrix() * m_cache.volumes_data[i].get_instance_mirror_matrix()).inverse() * displacement;
v.set_volume_offset(m_cache.volumes_data[i].get_volume_position() + local_displacement);
translation_type = Volume;
}
}
}
#if !DISABLE_INSTANCES_SYNCH
if (translation_type == Instance)
synchronize_unselected_instances(SYNC_ROTATION_NONE);
else if (translation_type == Volume)
synchronize_unselected_volumes();
#endif // !DISABLE_INSTANCES_SYNCH
if (wxGetApp().plater()->canvas3D()->get_canvas_type() != GLCanvas3D::ECanvasType::CanvasAssembleView) {
ensure_not_below_bed();
}
set_bounding_boxes_dirty();
if (wxGetApp().plater()->canvas3D()->get_canvas_type() != GLCanvas3D::ECanvasType::CanvasAssembleView) {
wxGetApp().plater()->canvas3D()->requires_check_outside_state();
}
}
void Selection::translate(const Vec3d &displacement, TransformationType transformation_type)
{
if (!m_valid) return;

View File

@@ -1674,11 +1674,13 @@ Description:AMSPreview
**************************************************/
AMSPreview::AMSPreview() {}
AMSPreview::AMSPreview(wxWindow *parent, wxWindowID id, AMSinfo amsinfo, const wxSize cube_size, const wxPoint &pos, const wxSize &size) : AMSPreview()
AMSPreview::AMSPreview(wxWindow* parent, wxWindowID id, AMSinfo amsinfo, AMSModel itemType, const wxPoint& pos, const wxSize& size) : AMSPreview()
{
wxWindow::Create(parent, id, pos);
create(parent, id, pos, AMS_ITEM_SIZE);
m_amsinfo = amsinfo;
m_cube_size = cube_size;
m_ams_item_type = itemType;
//create(parent, id, pos, AMS_PREVIEW_SIZE);
Bind(wxEVT_PAINT, &AMSPreview::paintEvent, this);
Bind(wxEVT_ENTER_WINDOW, &AMSPreview::OnEnterWindow, this);
Bind(wxEVT_LEAVE_WINDOW, &AMSPreview::OnLeaveWindow, this);
@@ -1704,9 +1706,8 @@ void AMSPreview::Update(AMSinfo amsinfo)
void AMSPreview::create(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size)
{
m_ts_bitmap_cube = new ScalableBitmap(this, "ts_bitmap_cube", 14);
wxWindow::Create(parent, id, pos, size);
SetMinSize(AMS_ITEM_SIZE);
SetMaxSize(AMS_ITEM_SIZE);
SetMinSize(size);
SetMaxSize(size);
SetBackgroundColour(StateColor::darkModeColorFor(AMS_CONTROL_WHITE_COLOUR));
Refresh();
}

View File

@@ -478,7 +478,7 @@ class AMSPreview : public wxWindow
{
public:
AMSPreview();
AMSPreview(wxWindow *parent, wxWindowID id, AMSinfo amsinfo, const wxSize cube_size = wxSize(14, 14), const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize);
AMSPreview(wxWindow *parent, wxWindowID id, AMSinfo amsinfo, AMSModel itemType = AMSModel::GENERIC_AMS, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
bool m_open = {false};
void Open();
@@ -504,6 +504,8 @@ protected:
int m_space = {5};
bool m_hover = {false};
bool m_selected = {false};
AMSModel m_ams_item_type = AMSModel::GENERIC_AMS;
ScalableBitmap* m_ts_bitmap_cube;
void paintEvent(wxPaintEvent &evt);