More SLA support points improvements

- unselected objects are hidden when SLA gizmo is active
- support volumes are hidden when editing mode is active
- 3mf support points format versioning
This commit is contained in:
Lukas Matena 2019-02-01 16:12:00 +01:00
parent 21026ec9a8
commit f568f93f08
11 changed files with 248 additions and 97 deletions

View file

@ -4031,6 +4031,7 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas)
, m_moving(false)
, m_color_by("volume")
, m_reload_delayed(false)
, m_render_sla_auxiliaries(true)
#if !ENABLE_IMGUI
, m_external_gizmo_widgets_parent(nullptr)
#endif // not ENABLE_IMGUI
@ -4186,6 +4187,27 @@ int GLCanvas3D::check_volumes_outside_state() const
return (int)state;
}
void GLCanvas3D::toggle_sla_auxiliaries_visibility(bool visible)
{
for (GLVolume* vol : m_volumes.volumes) {
if (vol->composite_id.volume_id < 0)
vol->is_active = visible;
}
m_render_sla_auxiliaries = visible;
}
void GLCanvas3D::toggle_model_objects_visibility(bool visible, const ModelObject* mo)
{
for (GLVolume* vol : m_volumes.volumes) {
if (mo == nullptr || m_model->objects[vol->composite_id.object_id] == mo)
vol->is_active = visible;
}
if (visible && !mo)
toggle_sla_auxiliaries_visibility(true);
}
void GLCanvas3D::set_config(const DynamicPrintConfig* config)
{
m_config = config;
@ -4732,7 +4754,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
if (it != model_volume_state.end() && it->geometry_id == key.geometry_id)
mvs = &(*it);
}
if (mvs == nullptr || force_full_scene_refresh) {
if (mvs == nullptr || force_full_scene_refresh || (volume->composite_id.volume_id < 0 && !m_render_sla_auxiliaries)) {
// This GLVolume will be released.
if (volume->is_wipe_tower) {
// There is only one wipe tower.
@ -4841,7 +4863,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
size_t volumes_count = m_volumes.volumes.size();
for (size_t istep = 0; istep < sla_steps.size(); ++istep)
if (!instances[istep].empty())
if (!instances[istep].empty() && m_render_sla_auxiliaries)
m_volumes.load_object_auxiliary(print_object, object_idx, instances[istep], sla_steps[istep], state.step[istep].timestamp, m_use_VBOs && m_initialized);
}
@ -6622,6 +6644,9 @@ void GLCanvas3D::_render_volumes(bool fake_colors) const
unsigned int volume_id = 0;
for (GLVolume* vol : m_volumes.volumes)
{
if (vol->composite_id.volume_id < 0 && !m_render_sla_auxiliaries)
continue;
if (fake_colors)
{
// Object picking mode. Render the object with a color encoding the object index.