mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 00:56:00 +08:00
Fix missing update of preview:
The problem was that when one print preview was loaded, second print was in progress and someone switched to the first bed in 3D view and then switched to preview, the preview was not updated. GCodeViewer remembers last preview it loaded, so it thought that no action is needed. For now, let's just place this ugly patch to make sure that no other functionality is broken.
This commit is contained in:
parent
77bb4945f2
commit
817df53480
@ -12,6 +12,7 @@ namespace Slic3r {
|
||||
MultipleBeds s_multiple_beds;
|
||||
bool s_reload_preview_after_switching_beds = false;
|
||||
bool s_beds_just_switched = false;
|
||||
bool s_beds_switched_since_last_gcode_load = false;
|
||||
|
||||
bool is_sliceable(const PrintStatus status) {
|
||||
if (status == PrintStatus::empty) {
|
||||
|
@ -17,6 +17,7 @@ class Print;
|
||||
|
||||
extern bool s_reload_preview_after_switching_beds;
|
||||
extern bool s_beds_just_switched;
|
||||
extern bool s_beds_switched_since_last_gcode_load;
|
||||
|
||||
namespace BedsGrid {
|
||||
using GridCoords = Vec2crd;
|
||||
|
@ -870,7 +870,7 @@ void GCodeViewer::load_as_gcode(const GCodeProcessorResult& gcode_result, const
|
||||
m_viewer.toggle_top_layer_only_view_range();
|
||||
|
||||
// avoid processing if called with the same gcode_result
|
||||
if (m_last_result_id == gcode_result.id && wxGetApp().is_editor() && ! s_reload_preview_after_switching_beds) {
|
||||
if (m_last_result_id == gcode_result.id && ! s_beds_switched_since_last_gcode_load && wxGetApp().is_editor() && ! s_reload_preview_after_switching_beds) {
|
||||
// collect tool colors
|
||||
libvgcode::Palette tools_colors;
|
||||
tools_colors.reserve(str_tool_colors.size());
|
||||
@ -890,6 +890,7 @@ void GCodeViewer::load_as_gcode(const GCodeProcessorResult& gcode_result, const
|
||||
}
|
||||
|
||||
m_last_result_id = gcode_result.id;
|
||||
s_beds_switched_since_last_gcode_load = false;
|
||||
|
||||
// release gpu memory, if used
|
||||
reset();
|
||||
|
@ -135,6 +135,7 @@ void GLCanvas3D::select_bed(int i, bool triggered_by_user)
|
||||
wxYield();
|
||||
s_multiple_beds.set_active_bed(i);
|
||||
s_beds_just_switched = true;
|
||||
s_beds_switched_since_last_gcode_load = true;
|
||||
if (wxGetApp().plater()->is_preview_shown()) {
|
||||
s_reload_preview_after_switching_beds = true;
|
||||
wxPostEvent(wxGetApp().plater(), SimpleEvent(EVT_GLVIEWTOOLBAR_PREVIEW));
|
||||
|
Loading…
x
Reference in New Issue
Block a user