Fix sidebar not shown when open 3mf file from command line arg (#3172)

* Show sidebar when open file from cmd

* Fix issue that sidebar collapse button is not enabled when load 3mf file with gcode
This commit is contained in:
Noisyfox 2023-12-19 11:15:26 +08:00 committed by GitHub
parent 60a9b38404
commit cc06a2e83b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View file

@ -7167,6 +7167,10 @@ void GLCanvas3D::_render_selection_center()
void GLCanvas3D::_check_and_update_toolbar_icon_scale()
{
// Update collapse toolbar
GLToolbar& collapse_toolbar = wxGetApp().plater()->get_collapse_toolbar();
collapse_toolbar.set_enabled(wxGetApp().plater()->get_sidebar_docking_state() != Sidebar::None);
// Don't update a toolbar scale, when we are on a Preview
if (wxGetApp().plater()->is_preview_shown()) {
IMSlider *m_layers_slider = get_gcode_viewer().get_layers_slider();
@ -7194,7 +7198,6 @@ void GLCanvas3D::_check_and_update_toolbar_icon_scale()
//float main_size = GLGizmosManager::Default_Icons_Size * scale;
// Set current size for all top toolbars. It will be used for next calculations
GLToolbar& collapse_toolbar = wxGetApp().plater()->get_collapse_toolbar();
#if ENABLE_RETINA_GL
const float sc = m_retina_helper->get_scale_factor() * scale;
//BBS: GUI refactor: GLToolbar
@ -7216,9 +7219,6 @@ void GLCanvas3D::_check_and_update_toolbar_icon_scale()
m_gizmos.set_overlay_icon_size(size);
#endif // ENABLE_RETINA_GL
// Update collapse toolbar
collapse_toolbar.set_enabled(wxGetApp().plater()->get_sidebar_docking_state() != Sidebar::None);
//BBS: GUI refactor: GLToolbar
#if BBS_TOOLBAR_ON_TOP
float collapse_toolbar_width = collapse_toolbar.is_enabled() ? collapse_toolbar.get_width() : 0;

View file

@ -5828,8 +5828,10 @@ void Plater::priv::set_current_panel(wxPanel* panel, bool no_slice)
};
//BBS: add the collapse logic
if (panel == preview) {
this->enable_sidebar(!q->only_gcode_mode());
}
if (panel == preview && q->only_gcode_mode()) {
this->enable_sidebar(false);
preview->get_canvas3d()->enable_select_plate_toolbar(false);
}
else if (panel == preview && q->using_exported_file() && (q->m_valid_plates_count <= 1)) {