Fixed call to reset_legend_texture() made on hidden canvas

This commit is contained in:
Enrico Turri 2018-10-02 14:12:23 +02:00
parent 01ba59158d
commit 7977bce98d
5 changed files with 14 additions and 14 deletions

View File

@ -2293,9 +2293,9 @@ void _3DScene::load_preview(wxGLCanvas* canvas, const std::vector<std::string>&
s_canvas_mgr.load_preview(canvas, str_tool_colors);
}
void _3DScene::reset_legend_texture()
void _3DScene::reset_legend_texture(wxGLCanvas* canvas)
{
s_canvas_mgr.reset_legend_texture();
s_canvas_mgr.reset_legend_texture(canvas);
}
} // namespace Slic3r

View File

@ -602,7 +602,7 @@ public:
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);
static void reset_legend_texture();
static void reset_legend_texture(wxGLCanvas* canvas);
static void thick_lines_to_verts(const Lines& lines, const std::vector<double>& widths, const std::vector<double>& heights, bool closed, double top_z, GLVolume& volume);
static void thick_lines_to_verts(const Lines3& lines, const std::vector<double>& widths, const std::vector<double>& heights, bool closed, GLVolume& volume);

View File

@ -580,13 +580,11 @@ void GLCanvas3DManager::load_preview(wxGLCanvas* canvas, const std::vector<std::
it->second->load_preview(str_tool_colors);
}
void GLCanvas3DManager::reset_legend_texture()
void GLCanvas3DManager::reset_legend_texture(wxGLCanvas* canvas)
{
for (CanvasesMap::value_type& canvas : m_canvases)
{
if (canvas.second != nullptr)
canvas.second->reset_legend_texture();
}
CanvasesMap::iterator it = _get_canvas(canvas);
if (it != m_canvases.end())
it->second->reset_legend_texture();
}
void GLCanvas3DManager::register_on_viewport_changed_callback(wxGLCanvas* canvas, void* callback)

View File

@ -154,7 +154,7 @@ public:
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);
void reset_legend_texture();
void reset_legend_texture(wxGLCanvas* canvas);
void register_on_viewport_changed_callback(wxGLCanvas* canvas, void* callback);
void register_on_double_click_callback(wxGLCanvas* canvas, void* callback);

View File

@ -214,7 +214,8 @@ void Preview::set_number_extruders(unsigned int number_extruders)
void Preview::reset_gcode_preview_data()
{
m_gcode_preview_data->reset();
_3DScene::reset_legend_texture();
if (m_canvas != nullptr)
_3DScene::reset_legend_texture(m_canvas);
}
void Preview::set_canvas_as_dirty()
@ -290,10 +291,11 @@ void Preview::load_print()
if (n_layers == 0)
{
reset_sliders();
_3DScene::reset_legend_texture();
if (m_canvas)
if (m_canvas != nullptr)
{
_3DScene::reset_legend_texture(m_canvas);
m_canvas->Refresh();
}
return;
}