Gizmos can be shown depending on current mode

This commit is contained in:
Lukas Matena 2020-08-05 13:30:05 +02:00
parent 4ef52af906
commit 7fd2209b48
3 changed files with 12 additions and 5 deletions

View file

@ -41,6 +41,7 @@
#include "3DScene.hpp" #include "3DScene.hpp"
#include "MainFrame.hpp" #include "MainFrame.hpp"
#include "Plater.hpp" #include "Plater.hpp"
#include "GLCanvas3D.hpp"
#include "../Utils/PresetUpdater.hpp" #include "../Utils/PresetUpdater.hpp"
#include "../Utils/PrintHost.hpp" #include "../Utils/PrintHost.hpp"
@ -1012,6 +1013,7 @@ void GUI_App::update_mode()
tab->update_mode(); tab->update_mode();
plater()->update_object_menu(); plater()->update_object_menu();
plater()->canvas3D()->update_gizmos_on_off_state();
} }
void GUI_App::add_config_menu(wxMenuBar *menu) void GUI_App::add_config_menu(wxMenuBar *menu)

View file

@ -631,7 +631,8 @@ bool GLGizmoFdmSupports::on_is_activable() const
bool GLGizmoFdmSupports::on_is_selectable() const bool GLGizmoFdmSupports::on_is_selectable() const
{ {
return (wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptFFF ); return (wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptFFF
&& wxGetApp().get_mode() != comSimple );
} }
std::string GLGizmoFdmSupports::on_get_name() const std::string GLGizmoFdmSupports::on_get_name() const

View file

@ -144,8 +144,11 @@ void GLGizmosManager::refresh_on_off_state()
if (m_serializing || m_current == Undefined || m_gizmos.empty()) if (m_serializing || m_current == Undefined || m_gizmos.empty())
return; return;
if (m_current != Undefined && ! m_gizmos[m_current]->is_activable()) if (m_current != Undefined
&& (! m_gizmos[m_current]->is_activable() || ! m_gizmos[m_current]->is_selectable())) {
activate_gizmo(Undefined); activate_gizmo(Undefined);
update_data();
}
} }
void GLGizmosManager::reset_all_states() void GLGizmosManager::reset_all_states()
@ -204,9 +207,10 @@ void GLGizmosManager::update_data()
enable_grabber(Scale, i, enable_scale_xyz); enable_grabber(Scale, i, enable_scale_xyz);
} }
m_common_gizmos_data->update(get_current() if (m_common_gizmos_data)
? get_current()->get_requirements() m_common_gizmos_data->update(get_current()
: CommonGizmosDataID(0)); ? get_current()->get_requirements()
: CommonGizmosDataID(0));
if (selection.is_single_full_instance()) if (selection.is_single_full_instance())
{ {