Do not render intermediate states while reload from disk action is taking place

This commit is contained in:
Enrico Turri 2019-09-06 13:49:15 +02:00
parent a7a01bfc72
commit fe07bde385
3 changed files with 12 additions and 1 deletions

View file

@ -1127,6 +1127,7 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLToolbar
, m_retina_helper(nullptr)
#endif
, m_in_render(false)
, m_render_enabled(true)
, m_bed(bed)
, m_camera(camera)
, m_view_toolbar(view_toolbar)
@ -1513,7 +1514,7 @@ void GLCanvas3D::update_volumes_colors_by_extruder()
void GLCanvas3D::render()
{
if (m_in_render)
if (!m_render_enabled || m_in_render)
{
// if called recursively, return
m_dirty = true;

View file

@ -403,6 +403,7 @@ private:
std::unique_ptr<RetinaHelper> m_retina_helper;
#endif
bool m_in_render;
bool m_render_enabled;
LegendTexture m_legend_texture;
WarningTexture m_warning_texture;
wxTimer m_timer;
@ -533,6 +534,9 @@ public:
void enable_dynamic_background(bool enable);
void allow_multisample(bool allow);
void enable_render(bool enable) { m_render_enabled = enable; }
bool is_render_enabled() const { return m_render_enabled; }
void zoom_to_bed();
void zoom_to_volumes();
void zoom_to_selection();

View file

@ -3087,6 +3087,9 @@ void Plater::priv::reload_from_disk()
auto *object_orig = model.objects[obj_orig_idx];
std::vector<fs::path> input_paths(1, object_orig->input_file);
// disable render to avoid to show intermediate states
view3D->get_canvas3d()->enable_render(false);
const auto new_idxs = load_files(input_paths, true, false);
for (const auto idx : new_idxs) {
@ -3108,6 +3111,9 @@ void Plater::priv::reload_from_disk()
remove(obj_orig_idx);
// re-enable render
view3D->get_canvas3d()->enable_render(true);
// the previous call to remove() clears the selection
// select newly added objects
selection.clear();