Set Measure Gizmo to be activable for single volume selections only

This commit is contained in:
enricoturri1966 2022-08-19 10:48:32 +02:00
parent a14c27b42e
commit 4d9c564b9a
2 changed files with 3 additions and 9 deletions

View file

@ -100,17 +100,12 @@ std::string GLGizmoMeasure::on_get_name() const
return _u8L("Measure");
}
bool GLGizmoMeasure::on_is_activable() const
{
// This is assumed in GLCanvas3D::do_rotate, do not change this
// without updating that function too.
return m_parent.get_selection().is_single_full_instance();
const Selection& selection = m_parent.get_selection();
return selection.is_single_volume() || selection.is_single_volume_instance();
}
void GLGizmoMeasure::on_render()
{
const Selection& selection = m_parent.get_selection();
@ -139,9 +134,7 @@ void GLGizmoMeasure::on_render()
shader->set_uniform("view_model_matrix", view_model_matrix);
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
update_if_needed();
m_imgui->begin(std::string("DEBUG"));

View file

@ -328,6 +328,7 @@ public:
#if ENABLE_WORLD_COORDINATE
bool is_single_volume_or_modifier() const { return is_single_volume() || is_single_modifier(); }
#endif // ENABLE_WORLD_COORDINATE
bool is_single_volume_instance() const { return is_single_full_instance() && m_list.size() == 1; }
bool contains_volume(unsigned int volume_idx) const { return m_list.find(volume_idx) != m_list.end(); }
// returns true if the selection contains all the given indices