diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 23e974a55..a119e0938 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1940,15 +1940,15 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re } } - if (printer_technology == ptSLA) { - // Shift-up all volumes of the object so that it has the right elevation with respect to the print bed - 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()) { - const SLAPrintObject* po = sla_print()->get_print_object_by_model_object_id(volume->object_idx()); - if (po != nullptr) - volume->set_sla_shift_z(po->get_current_elevation() / sla_print()->relative_correction().z()); - } - } +// if (printer_technology == ptSLA) { +// // Shift-up all volumes of the object so that it has the right elevation with respect to the print bed +// 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()) { +// const SLAPrintObject* po = sla_print()->objects()[volume->object_idx()];//sla_print()->get_print_object_by_model_object_id(volume->object_idx()); +//// if (po != nullptr) +//// volume->set_sla_shift_z(po->get_current_elevation() / sla_print()->relative_correction().z()); +// } +// } if (printer_technology == ptFFF && m_config->has("nozzle_diameter")) { // Should the wipe tower be visualized ? diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSlaBase.hpp b/src/slic3r/GUI/Gizmos/GLGizmoSlaBase.hpp index 7bcc01b71..9b5e9f469 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSlaBase.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSlaBase.hpp @@ -42,6 +42,8 @@ protected: bool unproject_on_mesh(const Vec2d& mouse_pos, std::pair& pos_and_normal); + const GLVolumeCollection &volumes() const { return m_volumes; } + private: GLVolumeCollection m_volumes; bool m_input_enabled{ false }; diff --git a/src/slic3r/GUI/Gizmos/GLGizmosCommon.cpp b/src/slic3r/GUI/Gizmos/GLGizmosCommon.cpp index 01d01f1b8..d41120b11 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosCommon.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosCommon.cpp @@ -129,6 +129,13 @@ void SelectionInfo::on_release() m_model_volume = nullptr; } +ModelInstance *SelectionInfo::model_instance() const +{ + int inst_idx = get_active_instance(); + return int(m_model_object->instances.size()) < inst_idx ? + m_model_object->instances[get_active_instance()] : nullptr; +} + int SelectionInfo::get_active_instance() const { return get_pool()->get_canvas()->get_selection().get_instance_idx(); diff --git a/src/slic3r/GUI/Gizmos/GLGizmosCommon.hpp b/src/slic3r/GUI/Gizmos/GLGizmosCommon.hpp index 2ae30a71b..21e1bb73c 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosCommon.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosCommon.hpp @@ -9,6 +9,7 @@ namespace Slic3r { class ModelObject; +class ModelInstance; class SLAPrintObject; class ModelVolume; @@ -160,6 +161,7 @@ public: const SLAPrintObject *print_object() const { return m_print_object; } // Returns a non-null pointer if the selection is a single volume ModelVolume* model_volume() const { return m_model_volume; } + ModelInstance *model_instance() const; int get_active_instance() const; float get_sla_shift() const { return m_z_shift; }