Do not render intermediate states while reload from disk action is taking place
This commit is contained in:
parent
a7a01bfc72
commit
fe07bde385
3 changed files with 12 additions and 1 deletions
|
@ -1127,6 +1127,7 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLToolbar
|
||||||
, m_retina_helper(nullptr)
|
, m_retina_helper(nullptr)
|
||||||
#endif
|
#endif
|
||||||
, m_in_render(false)
|
, m_in_render(false)
|
||||||
|
, m_render_enabled(true)
|
||||||
, m_bed(bed)
|
, m_bed(bed)
|
||||||
, m_camera(camera)
|
, m_camera(camera)
|
||||||
, m_view_toolbar(view_toolbar)
|
, m_view_toolbar(view_toolbar)
|
||||||
|
@ -1513,7 +1514,7 @@ void GLCanvas3D::update_volumes_colors_by_extruder()
|
||||||
|
|
||||||
void GLCanvas3D::render()
|
void GLCanvas3D::render()
|
||||||
{
|
{
|
||||||
if (m_in_render)
|
if (!m_render_enabled || m_in_render)
|
||||||
{
|
{
|
||||||
// if called recursively, return
|
// if called recursively, return
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
|
|
|
@ -403,6 +403,7 @@ private:
|
||||||
std::unique_ptr<RetinaHelper> m_retina_helper;
|
std::unique_ptr<RetinaHelper> m_retina_helper;
|
||||||
#endif
|
#endif
|
||||||
bool m_in_render;
|
bool m_in_render;
|
||||||
|
bool m_render_enabled;
|
||||||
LegendTexture m_legend_texture;
|
LegendTexture m_legend_texture;
|
||||||
WarningTexture m_warning_texture;
|
WarningTexture m_warning_texture;
|
||||||
wxTimer m_timer;
|
wxTimer m_timer;
|
||||||
|
@ -533,6 +534,9 @@ public:
|
||||||
void enable_dynamic_background(bool enable);
|
void enable_dynamic_background(bool enable);
|
||||||
void allow_multisample(bool allow);
|
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_bed();
|
||||||
void zoom_to_volumes();
|
void zoom_to_volumes();
|
||||||
void zoom_to_selection();
|
void zoom_to_selection();
|
||||||
|
|
|
@ -3087,6 +3087,9 @@ void Plater::priv::reload_from_disk()
|
||||||
auto *object_orig = model.objects[obj_orig_idx];
|
auto *object_orig = model.objects[obj_orig_idx];
|
||||||
std::vector<fs::path> input_paths(1, object_orig->input_file);
|
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);
|
const auto new_idxs = load_files(input_paths, true, false);
|
||||||
|
|
||||||
for (const auto idx : new_idxs) {
|
for (const auto idx : new_idxs) {
|
||||||
|
@ -3108,6 +3111,9 @@ void Plater::priv::reload_from_disk()
|
||||||
|
|
||||||
remove(obj_orig_idx);
|
remove(obj_orig_idx);
|
||||||
|
|
||||||
|
// re-enable render
|
||||||
|
view3D->get_canvas3d()->enable_render(true);
|
||||||
|
|
||||||
// the previous call to remove() clears the selection
|
// the previous call to remove() clears the selection
|
||||||
// select newly added objects
|
// select newly added objects
|
||||||
selection.clear();
|
selection.clear();
|
||||||
|
|
Loading…
Reference in a new issue