Suppress to switch to SLA-technology printer, if an object has a modifier(s)
+ WIP: ptSLA : Hide modifiers on 3DScene. Waiting for @enricoturri1966 review/reworking
This commit is contained in:
parent
999c49c8e8
commit
473c8a26a4
6 changed files with 59 additions and 4 deletions
|
@ -2586,6 +2586,15 @@ bool model_mmu_segmentation_data_changed(const ModelObject& mo, const ModelObjec
|
|||
[](const ModelVolume &mv_old, const ModelVolume &mv_new){ return mv_old.mmu_segmentation_facets.timestamp_matches(mv_new.mmu_segmentation_facets); });
|
||||
}
|
||||
|
||||
bool model_has_parameter_modifiers_in_objects(const Model &model)
|
||||
{
|
||||
for (const auto& model_object : model.objects)
|
||||
for (const auto& volume : model_object->volumes)
|
||||
if (volume->is_modifier())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool model_has_multi_part_objects(const Model &model)
|
||||
{
|
||||
for (const ModelObject *model_object : model.objects)
|
||||
|
|
|
@ -1388,6 +1388,9 @@ bool model_custom_seam_data_changed(const ModelObject& mo, const ModelObject& mo
|
|||
// The function assumes that volumes list is synchronized.
|
||||
extern bool model_mmu_segmentation_data_changed(const ModelObject& mo, const ModelObject& mo_new);
|
||||
|
||||
// If the model has object(s) which contains a modofoer, then it is currently not supported by the SLA mode.
|
||||
// Either the model cannot be loaded, or a SLA printer has to be activated.
|
||||
bool model_has_parameter_modifiers_in_objects(const Model& model);
|
||||
// If the model has multi-part objects, then it is currently not supported by the SLA mode.
|
||||
// Either the model cannot be loaded, or a SLA printer has to be activated.
|
||||
bool model_has_multi_part_objects(const Model &model);
|
||||
|
|
|
@ -2049,6 +2049,12 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
|||
raycaster->set_active(v->is_active);
|
||||
}
|
||||
|
||||
for (GLVolume* volume : m_volumes.volumes)
|
||||
if (volume->object_idx() < (int)m_model->objects.size() && m_model->objects[volume->object_idx()]->instances[volume->instance_idx()]->is_printable()) {
|
||||
if (volume->is_modifier && m_model->objects[volume->object_idx()]->volumes[volume->volume_idx()]->is_modifier())
|
||||
volume->is_active = printer_technology != ptSLA;
|
||||
}
|
||||
|
||||
// refresh gizmo elements raycasters for picking
|
||||
GLGizmoBase* curr_gizmo = m_gizmos.get_current();
|
||||
if (curr_gizmo != nullptr)
|
||||
|
|
|
@ -2884,6 +2884,14 @@ void GUI_App::open_web_page_localized(const std::string &http_address)
|
|||
// Because of we can't to print the multi-part objects with SLA technology.
|
||||
bool GUI_App::may_switch_to_SLA_preset(const wxString& caption)
|
||||
{
|
||||
if (model_has_parameter_modifiers_in_objects(model())) {
|
||||
show_info(nullptr,
|
||||
_L("It's impossible to print object(s) which contains parameter modifiers with SLA technology.") + "\n\n" +
|
||||
_L("Please check your object list before preset changing."),
|
||||
caption);
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
if (model_has_multi_part_objects(model())) {
|
||||
show_info(nullptr,
|
||||
_L("It's impossible to print multi-part object(s) with SLA technology.") + "\n\n" +
|
||||
|
@ -2898,6 +2906,7 @@ bool GUI_App::may_switch_to_SLA_preset(const wxString& caption)
|
|||
caption);
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -157,6 +157,11 @@ void Selection::add(unsigned int volume_idx, bool as_single_selection, bool chec
|
|||
return;
|
||||
|
||||
const GLVolume* volume = (*m_volumes)[volume_idx];
|
||||
|
||||
if (wxGetApp().plater()->printer_technology() == ptSLA && volume->is_modifier &&
|
||||
m_model->objects[volume->object_idx()]->volumes[volume->volume_idx()]->is_modifier())
|
||||
return;
|
||||
|
||||
// wipe tower is already selected
|
||||
if (is_wipe_tower() && volume->is_wipe_tower)
|
||||
return;
|
||||
|
@ -482,8 +487,14 @@ void Selection::instances_changed(const std::vector<size_t> &instance_ids_select
|
|||
assert(m_valid);
|
||||
assert(m_mode == Instance);
|
||||
m_list.clear();
|
||||
|
||||
const PrinterTechnology pt = wxGetApp().plater()->printer_technology();
|
||||
|
||||
for (unsigned int volume_idx = 0; volume_idx < (unsigned int)m_volumes->size(); ++ volume_idx) {
|
||||
const GLVolume *volume = (*m_volumes)[volume_idx];
|
||||
if (pt == ptSLA && volume->is_modifier &&
|
||||
m_model->objects[volume->object_idx()]->volumes[volume->volume_idx()]->is_modifier())
|
||||
continue;
|
||||
auto it = std::lower_bound(instance_ids_selected.begin(), instance_ids_selected.end(), volume->geometry_id.second);
|
||||
if (it != instance_ids_selected.end() && *it == volume->geometry_id.second)
|
||||
this->do_add_volume(volume_idx);
|
||||
|
@ -1940,9 +1951,16 @@ std::vector<unsigned int> Selection::get_volume_idxs_from_object(unsigned int ob
|
|||
{
|
||||
std::vector<unsigned int> idxs;
|
||||
|
||||
const PrinterTechnology pt = wxGetApp().plater()->printer_technology();
|
||||
|
||||
for (unsigned int i = 0; i < (unsigned int)m_volumes->size(); ++i) {
|
||||
if ((*m_volumes)[i]->object_idx() == (int)object_idx)
|
||||
const GLVolume* v = (*m_volumes)[i];
|
||||
if (v->object_idx() == (int)object_idx) {
|
||||
if (pt == ptSLA && v->is_modifier &&
|
||||
m_model->objects[object_idx]->volumes[v->volume_idx()]->is_modifier())
|
||||
continue;
|
||||
idxs.push_back(i);
|
||||
}
|
||||
}
|
||||
|
||||
return idxs;
|
||||
|
@ -1952,8 +1970,13 @@ std::vector<unsigned int> Selection::get_volume_idxs_from_instance(unsigned int
|
|||
{
|
||||
std::vector<unsigned int> idxs;
|
||||
|
||||
const PrinterTechnology pt = wxGetApp().plater()->printer_technology();
|
||||
|
||||
for (unsigned int i = 0; i < (unsigned int)m_volumes->size(); ++i) {
|
||||
const GLVolume* v = (*m_volumes)[i];
|
||||
if (pt == ptSLA && v->is_modifier &&
|
||||
m_model->objects[object_idx]->volumes[i]->is_modifier())
|
||||
continue;
|
||||
if (v->object_idx() == (int)object_idx && v->instance_idx() == (int)instance_idx)
|
||||
idxs.push_back(i);
|
||||
}
|
||||
|
@ -2911,7 +2934,12 @@ bool Selection::is_from_fully_selected_instance(unsigned int volume_idx) const
|
|||
return false;
|
||||
|
||||
unsigned int count = (unsigned int)std::count_if(m_list.begin(), m_list.end(), SameInstance(object_idx, volume->instance_idx(), *m_volumes));
|
||||
return count == (unsigned int)m_model->objects[object_idx]->volumes.size();
|
||||
|
||||
PrinterTechnology pt = wxGetApp().plater()->printer_technology();
|
||||
const ModelVolumePtrs& volumes = m_model->objects[object_idx]->volumes;
|
||||
const unsigned int vol_cnt = (unsigned int)std::count_if(volumes.begin(), volumes.end(), [pt](const ModelVolume* volume) { return pt == ptFFF || !volume->is_modifier(); });
|
||||
|
||||
return count == vol_cnt;
|
||||
}
|
||||
|
||||
void Selection::paste_volumes_from_clipboard()
|
||||
|
|
|
@ -3279,9 +3279,9 @@ void Tab::select_preset(std::string preset_name, bool delete_current /*=false*/,
|
|||
const PresetWithVendorProfile new_printer_preset_with_vendor_profile = m_presets->get_preset_with_vendor_profile(new_printer_preset);
|
||||
PrinterTechnology old_printer_technology = m_presets->get_edited_preset().printer_technology();
|
||||
PrinterTechnology new_printer_technology = new_printer_preset.printer_technology();
|
||||
/*if (new_printer_technology == ptSLA && old_printer_technology == ptFFF && !wxGetApp().may_switch_to_SLA_preset(_L("New printer preset selected")))
|
||||
if (new_printer_technology == ptSLA && old_printer_technology == ptFFF && !wxGetApp().may_switch_to_SLA_preset(_L("New printer preset selected")))
|
||||
canceled = true;
|
||||
else */{
|
||||
else {
|
||||
struct PresetUpdate {
|
||||
Preset::Type tab_type;
|
||||
PresetCollection *presets;
|
||||
|
|
Loading…
Reference in a new issue