mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-31 22:06:59 +00:00
Crash fix assembly mode flatpak (#13413)
* Update GLCanvas3D.cpp * Update GLCanvas3D.cpp * update * Update GLCanvas3D.cpp Co-Authored-By: Rodrigo Faselli <162915171+RF47@users.noreply.github.com> --------- Co-authored-by: Rodrigo Faselli <162915171+RF47@users.noreply.github.com>
This commit is contained in:
@@ -1920,6 +1920,14 @@ void GLCanvas3D::render(bool only_init)
|
|||||||
|
|
||||||
if (!is_initialized() && !init())
|
if (!is_initialized() && !init())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// If a scene reload was postponed while the canvas was hidden, consume it on first visible render.
|
||||||
|
if (m_reload_delayed) {
|
||||||
|
reload_scene(true);
|
||||||
|
if (m_reload_delayed)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_canvas_type == ECanvasType::CanvasView3D && m_gizmos.get_current_type() == GLGizmosManager::Undefined) {
|
if (m_canvas_type == ECanvasType::CanvasView3D && m_gizmos.get_current_type() == GLGizmosManager::Undefined) {
|
||||||
enable_return_toolbar(false);
|
enable_return_toolbar(false);
|
||||||
}
|
}
|
||||||
@@ -2398,10 +2406,11 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
|||||||
if (m_canvas == nullptr || m_config == nullptr || m_model == nullptr)
|
if (m_canvas == nullptr || m_config == nullptr || m_model == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!m_initialized)
|
if (!m_initialized || !_set_current()) {
|
||||||
|
m_reload_delayed = true;
|
||||||
|
set_as_dirty();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
_set_current();
|
|
||||||
|
|
||||||
m_hover_volume_idxs.clear();
|
m_hover_volume_idxs.clear();
|
||||||
|
|
||||||
@@ -2456,6 +2465,10 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
|||||||
auto model_volume_state_lower = [](const ModelVolumeState& m1, const ModelVolumeState& m2) { return m1.geometry_id < m2.geometry_id; };
|
auto model_volume_state_lower = [](const ModelVolumeState& m1, const ModelVolumeState& m2) { return m1.geometry_id < m2.geometry_id; };
|
||||||
|
|
||||||
m_reload_delayed = !m_canvas->IsShown() && !refresh_immediately && !force_full_scene_refresh;
|
m_reload_delayed = !m_canvas->IsShown() && !refresh_immediately && !force_full_scene_refresh;
|
||||||
|
if (m_reload_delayed) {
|
||||||
|
set_as_dirty();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
PrinterTechnology printer_technology = current_printer_technology();
|
PrinterTechnology printer_technology = current_printer_technology();
|
||||||
|
|
||||||
@@ -2617,9 +2630,6 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
|||||||
//BBS clean hover_volume_idxs
|
//BBS clean hover_volume_idxs
|
||||||
m_hover_volume_idxs.clear();
|
m_hover_volume_idxs.clear();
|
||||||
|
|
||||||
if (m_reload_delayed)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// BBS: do not check wipe tower changes
|
// BBS: do not check wipe tower changes
|
||||||
bool update_object_list = false;
|
bool update_object_list = false;
|
||||||
if (deleted_volumes.size() != deleted_wipe_towers.size())
|
if (deleted_volumes.size() != deleted_wipe_towers.size())
|
||||||
@@ -3897,7 +3907,7 @@ void GLCanvas3D::on_mouse_wheel(wxMouseEvent& evt)
|
|||||||
if (m_gizmos.on_mouse_wheel(evt))
|
if (m_gizmos.on_mouse_wheel(evt))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_canvas_type == CanvasAssembleView && (evt.AltDown() || evt.CmdDown())) {
|
if (m_canvas_type == CanvasAssembleView && (evt.AltDown() || evt.CmdDown()) && m_gizmos.m_assemble_view_data != nullptr) {
|
||||||
float rotation = (float)evt.GetWheelRotation() / (float)evt.GetWheelDelta();
|
float rotation = (float)evt.GetWheelRotation() / (float)evt.GetWheelDelta();
|
||||||
if (evt.AltDown()) {
|
if (evt.AltDown()) {
|
||||||
auto clp_dist = m_gizmos.m_assemble_view_data->model_objects_clipper()->get_position();
|
auto clp_dist = m_gizmos.m_assemble_view_data->model_objects_clipper()->get_position();
|
||||||
@@ -8915,6 +8925,9 @@ float GLCanvas3D::_render_assembly_tooltip_button(ImGuiWrapper* imgui_wrapper) c
|
|||||||
//BBS
|
//BBS
|
||||||
void GLCanvas3D::_render_assemble_control()
|
void GLCanvas3D::_render_assemble_control()
|
||||||
{
|
{
|
||||||
|
if(m_gizmos.m_assemble_view_data == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
if (m_canvas_type != ECanvasType::CanvasAssembleView) {
|
if (m_canvas_type != ECanvasType::CanvasAssembleView) {
|
||||||
GLVolume::explosion_ratio = m_explosion_ratio = 1.0;
|
GLVolume::explosion_ratio = m_explosion_ratio = 1.0;
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -6923,6 +6923,12 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (load_model) {
|
if (load_model) {
|
||||||
|
if (!q->m_exported_file && view3D != nullptr) {
|
||||||
|
// Force a 3D scene refresh after view/plate selection to avoid losing the first load
|
||||||
|
// on platforms where the GL canvas mapping lags behind model loading.
|
||||||
|
view3D->reload_scene(true);
|
||||||
|
view3D->set_as_dirty();
|
||||||
|
}
|
||||||
if (!silence) wxGetApp().app_config->update_skein_dir(input_files[input_files.size() - 1].parent_path().make_preferred().string());
|
if (!silence) wxGetApp().app_config->update_skein_dir(input_files[input_files.size() - 1].parent_path().make_preferred().string());
|
||||||
// XXX: Plater.pm had @loaded_files, but didn't seem to fill them with the filenames...
|
// XXX: Plater.pm had @loaded_files, but didn't seem to fill them with the filenames...
|
||||||
}
|
}
|
||||||
@@ -9130,6 +9136,20 @@ void Plater::priv::set_current_panel(wxPanel* panel, bool no_slice)
|
|||||||
|
|
||||||
if (current_panel == panel)
|
if (current_panel == panel)
|
||||||
{
|
{
|
||||||
|
if (panel == view3D) {
|
||||||
|
if (view3D->is_reload_delayed()) {
|
||||||
|
// Delayed loading of the 3D scene when caller requests the already active tab.
|
||||||
|
if (printer_technology == ptSLA)
|
||||||
|
update_restart_background_process(true, false);
|
||||||
|
else
|
||||||
|
view3D->reload_scene(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
view3D->set_as_dirty();
|
||||||
|
view3D->get_canvas3d()->reset_old_size();
|
||||||
|
if (notification_manager != nullptr)
|
||||||
|
notification_manager->set_in_preview(false);
|
||||||
|
}
|
||||||
//BBS: add slice logic when switch to preview page
|
//BBS: add slice logic when switch to preview page
|
||||||
//BBS: add only gcode mode
|
//BBS: add only gcode mode
|
||||||
if (!q->only_gcode_mode() && (current_panel == preview) && (wxGetApp().is_editor())) {
|
if (!q->only_gcode_mode() && (current_panel == preview) && (wxGetApp().is_editor())) {
|
||||||
|
|||||||
Reference in New Issue
Block a user