mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-30 16:52:04 +08:00
Multiple beds - updates, partially outside = on the bed
This commit is contained in:
parent
08eb318780
commit
ec87263ce4
@ -364,20 +364,22 @@ BuildVolume::ObjectState BuildVolume::volume_state_bbox(const BoundingBoxf3 volu
|
||||
build_volume.min.z() = -std::numeric_limits<double>::max();
|
||||
|
||||
ObjectState state = ObjectState::Outside;
|
||||
int bed_id = 0;
|
||||
for (bed_id = 0; bed_id <= std::min(s_multiple_beds.get_number_of_beds(), s_multiple_beds.get_max_beds() - 1); ++bed_id) {
|
||||
int obj_bed_id = -1;
|
||||
for (int bed_id = 0; bed_id <= std::min(s_multiple_beds.get_number_of_beds(), s_multiple_beds.get_max_beds() - 1); ++bed_id) {
|
||||
BoundingBoxf3 volume_bbox = volume_bbox_orig;
|
||||
volume_bbox.translate(-s_multiple_beds.get_bed_translation(bed_id));
|
||||
|
||||
state = build_volume.max.z() <= -SceneEpsilon ? ObjectState::Below :
|
||||
build_volume.contains(volume_bbox) ? ObjectState::Inside :
|
||||
build_volume.intersects(volume_bbox) ? ObjectState::Colliding : ObjectState::Outside;
|
||||
if (state != ObjectState::Outside)
|
||||
if (state != ObjectState::Outside) {
|
||||
obj_bed_id = bed_id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bed_idx)
|
||||
*bed_idx = bed_id;
|
||||
*bed_idx = obj_bed_id;
|
||||
return state;
|
||||
}
|
||||
|
||||
|
@ -1660,7 +1660,7 @@ unsigned int ModelObject::update_instances_print_volume_state(const BuildVolume
|
||||
inside_outside == INSIDE ? ModelInstancePVS_Inside : ModelInstancePVS_Fully_Outside;
|
||||
if (inside_outside == INSIDE)
|
||||
++num_printable;
|
||||
if (bed_idx != -1 && model_instance->is_printable())
|
||||
if (bed_idx != -1)
|
||||
s_multiple_beds.set_instance_bed(model_instance->id(), bed_idx);
|
||||
}
|
||||
return num_printable;
|
||||
|
@ -197,10 +197,11 @@ bool MultipleBeds::is_glvolume_on_thumbnail_bed(const Model& model, int obj_idx,
|
||||
return (m_bed_for_thumbnails_generation < 0 || it->second == m_bed_for_thumbnails_generation);
|
||||
}
|
||||
|
||||
void MultipleBeds::update_shown_beds(Model& model, const BuildVolume& build_volume) {
|
||||
void MultipleBeds::update_shown_beds(Model& model, const BuildVolume& build_volume, bool only_remove /*=false*/) {
|
||||
const int original_number_of_beds = m_number_of_beds;
|
||||
const int stash_active = get_active_bed();
|
||||
m_number_of_beds = get_max_beds();
|
||||
if (! only_remove)
|
||||
m_number_of_beds = get_max_beds();
|
||||
model.update_print_volume_state(build_volume);
|
||||
const int max_bed{std::accumulate(
|
||||
this->m_inst_to_bed.begin(), this->m_inst_to_bed.end(), 0,
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
void set_last_hovered_bed(int i) { m_last_hovered_bed = i; }
|
||||
int get_last_hovered_bed() const { return m_last_hovered_bed; }
|
||||
|
||||
void update_shown_beds(Model& model, const BuildVolume& build_volume);
|
||||
void update_shown_beds(Model& model, const BuildVolume& build_volume, bool only_remove = false);
|
||||
bool rearrange_after_load(Model& model, const BuildVolume& build_volume, std::function<void()> update_fn);
|
||||
void set_loading_project_flag(bool project) { m_loading_project = project; }
|
||||
bool get_loading_project_flag() const { return m_loading_project; }
|
||||
|
@ -1563,8 +1563,8 @@ bool GLCanvas3D::check_volumes_outside_state(GLVolumeCollection& volumes, ModelI
|
||||
overall_state = ModelInstancePVS_Partly_Outside;
|
||||
contained_min_one |= !volume->is_outside;
|
||||
|
||||
if (! volume->is_outside && bed_idx != -1 && bed_idx == s_multiple_beds.get_number_of_beds())
|
||||
s_multiple_beds.request_next_bed(true);
|
||||
if (bed_idx != -1 && bed_idx == s_multiple_beds.get_number_of_beds())
|
||||
s_multiple_beds.request_next_bed(true);
|
||||
}
|
||||
}
|
||||
else if (volume->is_modifier)
|
||||
|
@ -1093,7 +1093,7 @@ void Plater::priv::update(unsigned int flags)
|
||||
// Update the SLAPrint from the current Model, so that the reload_scene()
|
||||
// pulls the correct data.
|
||||
update_status = this->update_background_process(false, flags & (unsigned int)UpdateParams::POSTPONE_VALIDATION_ERROR_MESSAGE);
|
||||
s_multiple_beds.update_shown_beds(model, q->build_volume());
|
||||
s_multiple_beds.update_shown_beds(model, q->build_volume(), true);
|
||||
this->view3D->reload_scene(false, flags & (unsigned int)UpdateParams::FORCE_FULL_SCREEN_REFRESH);
|
||||
this->preview->reload_print();
|
||||
if (force_background_processing_restart)
|
||||
@ -1600,11 +1600,12 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
||||
GLGizmoSimplify::add_simplify_suggestion_notification(
|
||||
obj_idxs, model.objects, *notification_manager);
|
||||
|
||||
if (s_multiple_beds.rearrange_after_load(model, q->build_volume(), [this]() {
|
||||
s_multiple_beds.rearrange_after_load(model, q->build_volume(), [this]() {
|
||||
q->canvas3D()->check_volumes_outside_state();
|
||||
s_multiple_beds.ensure_wipe_towers_on_beds(model, fff_prints);
|
||||
}))
|
||||
update();
|
||||
s_multiple_beds.update_shown_beds(model, q->build_volume());
|
||||
});
|
||||
update();
|
||||
|
||||
return obj_idxs;
|
||||
}
|
||||
@ -4089,6 +4090,7 @@ void Plater::priv::update_after_undo_redo(const UndoRedo::Snapshot& snapshot, bo
|
||||
this->view3D->get_canvas3d()->get_selection().set_deserialized(GUI::Selection::EMode(this->undo_redo_stack().selection_deserialized().mode), this->undo_redo_stack().selection_deserialized().volumes_and_instances);
|
||||
this->view3D->get_canvas3d()->get_gizmos_manager().update_after_undo_redo(snapshot);
|
||||
|
||||
s_multiple_beds.update_shown_beds(model, q->build_volume(), false);
|
||||
wxGetApp().obj_list()->update_after_undo_redo();
|
||||
|
||||
if (wxGetApp().get_mode() == comSimple && model_has_advanced_features(this->model)) {
|
||||
@ -6811,6 +6813,7 @@ void Plater::arrange(Worker &w, const ArrangeSelectionMode &mode)
|
||||
concat_strings(names, "\n")));
|
||||
}
|
||||
|
||||
s_multiple_beds.update_shown_beds(model(), build_volume());
|
||||
canvas3D()->check_volumes_outside_state();
|
||||
|
||||
update(static_cast<unsigned int>(UpdateParams::FORCE_FULL_SCREEN_REFRESH));
|
||||
|
Loading…
x
Reference in New Issue
Block a user