Added force_full_scene_refresh parameter to the 3DScene::refresh()

function to force a refresh of all GLVolumes. Currently this hack
is used by the Platter::arrange() function only, and ideally
we should replace this parameter with a smarter 3DScene::refresh()
function, which would check for the transformation matrices as well.
This commit is contained in:
bubnikv 2018-11-21 13:52:46 +01:00
parent bc9de8956a
commit a21f1783a9
7 changed files with 16 additions and 16 deletions

View File

@ -2107,9 +2107,9 @@ void _3DScene::mirror_selection(wxGLCanvas* canvas, Axis axis)
s_canvas_mgr.mirror_selection(canvas, axis);
}
void _3DScene::reload_scene(wxGLCanvas* canvas, bool force)
void _3DScene::reload_scene(wxGLCanvas* canvas, bool refresh_immediately, bool force_full_scene_refresh)
{
s_canvas_mgr.reload_scene(canvas, force);
s_canvas_mgr.reload_scene(canvas, refresh_immediately, force_full_scene_refresh);
}
void _3DScene::load_gcode_preview(wxGLCanvas* canvas, const GCodePreviewData* preview_data, const std::vector<std::string>& str_tool_colors)

View File

@ -644,7 +644,7 @@ public:
static void mirror_selection(wxGLCanvas* canvas, Axis axis);
static void reload_scene(wxGLCanvas* canvas, bool force);
static void reload_scene(wxGLCanvas* canvas, bool refresh_immediately, bool force_full_scene_refresh = false);
static void load_gcode_preview(wxGLCanvas* canvas, const GCodePreviewData* preview_data, const std::vector<std::string>& str_tool_colors);
static void load_preview(wxGLCanvas* canvas, const std::vector<std::string>& str_tool_colors);

View File

@ -3767,7 +3767,7 @@ void GLCanvas3D::mirror_selection(Axis axis)
// 3) SLA support meshes for their respective ModelObjects / ModelInstances
// 4) Wipe tower preview
// 5) Out of bed collision status & message overlay (texture)
void GLCanvas3D::reload_scene(bool force)
void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_refresh)
{
if ((m_canvas == nullptr) || (m_config == nullptr) || (m_model == nullptr))
return;
@ -3809,7 +3809,7 @@ void GLCanvas3D::reload_scene(bool force)
glvolumes_new.reserve(m_volumes.volumes.size());
auto model_volume_state_lower = [](const ModelVolumeState &m1, const ModelVolumeState &m2) { return m1.geometry_id < m2.geometry_id; };
m_reload_delayed = ! m_canvas->IsShown() && ! force;
m_reload_delayed = ! m_canvas->IsShown() && ! refresh_immediately && ! force_full_scene_refresh;
PrinterTechnology printer_technology = wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology();
@ -3866,7 +3866,7 @@ void GLCanvas3D::reload_scene(bool force)
if (it != model_volume_state.end() && it->geometry_id == key.geometry_id)
mvs = &(*it);
}
if (mvs == nullptr) {
if (mvs == nullptr || force_full_scene_refresh) {
// This GLVolume will be released.
volume->release_geometry();
if (! m_reload_delayed)

View File

@ -824,7 +824,7 @@ public:
void mirror_selection(Axis axis);
void reload_scene(bool force);
void reload_scene(bool refresh_immediately, bool force_full_scene_refresh);
void load_gcode_preview(const GCodePreviewData& preview_data, const std::vector<std::string>& str_tool_colors);
void load_preview(const std::vector<std::string>& str_tool_colors);

View File

@ -506,11 +506,11 @@ void GLCanvas3DManager::mirror_selection(wxGLCanvas* canvas, Axis axis)
it->second->mirror_selection(axis);
}
void GLCanvas3DManager::reload_scene(wxGLCanvas* canvas, bool force)
void GLCanvas3DManager::reload_scene(wxGLCanvas* canvas, bool refresh_immediately, bool force_full_scene_refresh)
{
CanvasesMap::iterator it = _get_canvas(canvas);
if (it != m_canvases.end())
it->second->reload_scene(force);
it->second->reload_scene(refresh_immediately, force_full_scene_refresh);
}
void GLCanvas3DManager::load_gcode_preview(wxGLCanvas* canvas, const GCodePreviewData* preview_data, const std::vector<std::string>& str_tool_colors)

View File

@ -141,7 +141,7 @@ public:
void mirror_selection(wxGLCanvas* canvas, Axis axis);
void reload_scene(wxGLCanvas* canvas, bool force);
void reload_scene(wxGLCanvas* canvas, bool refresh_immediately, bool force_full_scene_refresh = false);
void load_gcode_preview(wxGLCanvas* canvas, const GCodePreviewData* preview_data, const std::vector<std::string>& str_tool_colors);
void load_preview(wxGLCanvas* canvas, const std::vector<std::string>& str_tool_colors);

View File

@ -930,7 +930,7 @@ struct Plater::priv
priv(Plater *q, MainFrame *main_frame);
void update();
void update(bool force_full_scene_refresh = false);
void select_view(const std::string& direction);
void update_ui_from_settings();
ProgressStatusBar* statusbar();
@ -1144,7 +1144,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
q->Layout();
}
void Plater::priv::update()
void Plater::priv::update(bool force_full_scene_refresh)
{
wxWindowUpdateLocker freeze_guard(q);
if (get_config("autocenter") == "1") {
@ -1160,7 +1160,7 @@ void Plater::priv::update()
// pulls the correct data.
this->update_background_process();
}
_3DScene::reload_scene(canvas3D, false);
_3DScene::reload_scene(canvas3D, false, force_full_scene_refresh);
preview->reset_gcode_preview_data();
preview->reload_print();
@ -1662,9 +1662,9 @@ void Plater::priv::arrange()
// We enable back the arrange button
_3DScene::enable_toolbar_item(canvas3D, "arrange", can_arrange());
// FIXME: none of the following seem to work now. (update did the job previously)
// _3DScene::reload_scene(canvas3D, false);
update();
// Do a full refresh of scene tree, including regenerating all the GLVolumes.
//FIXME The update function shall just reload the modified matrices.
update(true);
}
void Plater::priv::split_object()