diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 556faaa763..676d310f7b 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -5059,7 +5059,21 @@ void GLCanvas3D::do_move(const std::string& snapshot_type) } //BBS: notify instance updates to part plater list - m_selection.notify_instance_update(-1, 0); + // Only what moved: the selected instances, or every instance of an object one of whose + // parts moved. Notifying a plate about an instance that stayed put invalidates its slice + // result, and notifying instance 0 alone left a moved copy unregistered on its new plate. + { + std::set> notified; + for (unsigned int i : m_selection.get_volume_idxs()) { + const GLVolume* v = m_volumes.volumes[i]; + const int object_idx = v->object_idx(); + if (object_idx < 0 || object_idx >= static_cast(m_model->objects.size())) + continue; + const std::pair key(object_idx, selection_mode == Selection::Volume ? -1 : v->instance_idx()); + if (notified.insert(key).second) + m_selection.notify_instance_update(key.first, key.second); + } + } // Fixes sinking/flying instances (snaps object to buildplate) for (const std::pair& i : done) { diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index 9826498fbd..d38ab5e0ac 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -1917,7 +1917,7 @@ std::vector PartPlate::get_extruders_without_support(bool conside_custom_gc const DynamicPrintConfig& glb_config = wxGetApp().preset_bundle->prints.get_edited_preset().config; for (int obj_idx = 0; obj_idx < m_model->objects.size(); obj_idx++) { - if (!contain_instance_totally(obj_idx, 0)) + if (!contain_any_instance_totally(obj_idx)) continue; ModelObject* mo = m_model->objects[obj_idx]; @@ -2088,7 +2088,7 @@ bool PartPlate::check_single_extruder_mixed_filament_risk(const DynamicPrintConf "which may significantly increase waste and the risk of nozzle / waste-chute clogging."); for (int obj_idx = 0; obj_idx < (int)m_model->objects.size(); ++obj_idx) { - if (!contain_instance_totally(obj_idx, 0)) + if (!contain_any_instance_totally(obj_idx)) continue; ModelObject *mo = m_model->objects[obj_idx]; int obj_ext = mo->config.has("extruder") ? mo->config.extruder() : 1; @@ -2307,7 +2307,7 @@ bool PartPlate::check_compatible_of_nozzle_and_filament(const DynamicPrintConfig return wipe_tower_size; for (int obj_idx = 0; obj_idx < m_model->objects.size(); obj_idx++) { - if (!use_global_objects && !contain_instance_totally(obj_idx, 0)) + if (!use_global_objects && !contain_any_instance_totally(obj_idx)) continue; BoundingBoxf3 bbox = m_model->objects[obj_idx]->bounding_box(); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index a28add0e4d..0fdb9dcd94 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -17839,6 +17839,10 @@ void Plater::increase_instances(size_t num) model_object->add_instance(offset_vec, model_instance->get_scaling_factor(), model_instance->get_rotation(), model_instance->get_mirror()); // p->print.get_object(obj_idx)->add_copy(Slic3r::to_2d(offset_vec)); } + // Register the copies with the plate they land on before the scene reloads: the plate's + // filament list and wipe tower preview are read from that registry. + for (size_t i = model_object->instances.size() - num; i < model_object->instances.size(); ++i) + p->partplate_list.notify_instance_update(obj_idx, static_cast(i)); #ifdef SUPPORT_AUTO_CENTER if (p->get_config("autocenter") == "true") @@ -17869,8 +17873,10 @@ void Plater::decrease_instances(size_t num) ModelObject* model_object = p->model.objects[obj_idx]; if (model_object->instances.size() > num) { - for (size_t i = 0; i < num; ++ i) + for (size_t i = 0; i < num; ++ i) { + p->partplate_list.notify_instance_removed(obj_idx, static_cast(model_object->instances.size()) - 1); model_object->delete_last_instance(); + } p->update(); // Delete object from Sidebar list. Do it after update, so that the GLScene selection is updated with the modified model. sidebar().obj_list()->decrease_object_instances(obj_idx, num);