FIX:open cut gizmo check selection.is_empty() again

jira: STUDIO-8310
Change-Id: I5265ccb54345595fefb9a3775f45e96be55cc9dd
This commit is contained in:
zhou.xu 2024-09-29 15:07:44 +08:00 committed by Lane.Wei
parent 9e313d5d48
commit 0faf8d5e10
2 changed files with 13 additions and 0 deletions

View File

@ -479,6 +479,11 @@ void GLGizmoAdvancedCut::on_set_state()
// Reset m_cut_z on gizmo activation
if (get_state() == On) {
const Selection &selection = m_parent.get_selection();
if (selection.is_empty()) {//check selection again
close();
return;
}
m_hover_id = -1;
m_connectors_editing = false;
@ -515,6 +520,13 @@ void GLGizmoAdvancedCut::on_set_state()
}
}
void GLGizmoAdvancedCut::close()
{//close gizmo == open it again
auto &mng = m_parent.get_gizmos_manager();
if (mng.get_current_type() == GLGizmosManager::Cut)
mng.open_gizmo(GLGizmosManager::Cut);
}
bool GLGizmoAdvancedCut::on_is_activable() const
{
const Selection &selection = m_parent.get_selection();

View File

@ -229,6 +229,7 @@ protected:
virtual std::string on_get_name() const;
virtual std::string on_get_name_str() override { return "Cut"; }
virtual void on_set_state();
void close();
virtual bool on_is_activable() const;
virtual CommonGizmosDataID on_get_requirements() const override;
virtual void on_start_dragging() override;