Add template based SelectionSingleton::countObjectsOfType

Also convert code to use this new method
This commit is contained in:
Benjamin Nauck
2025-01-10 19:09:50 +01:00
parent 7a5a3d1ffc
commit 08c9a191e2
22 changed files with 148 additions and 165 deletions

View File

@@ -173,11 +173,7 @@ void CmdMeshPartTrimByPlane::activated(int)
bool CmdMeshPartTrimByPlane::isActive()
{
// Check for the selected mesh feature (all Mesh types)
if (getSelection().countObjectsOfType(Mesh::Feature::getClassTypeId()) != 1) {
return false;
}
return true;
return getSelection().countObjectsOfType<Mesh::Feature>() == 1;
}
//===========================================================================
@@ -262,11 +258,7 @@ void CmdMeshPartSection::activated(int)
bool CmdMeshPartSection::isActive()
{
// Check for the selected mesh feature (all Mesh types)
if (getSelection().countObjectsOfType(Mesh::Feature::getClassTypeId()) != 1) {
return false;
}
return true;
return getSelection().countObjectsOfType<Mesh::Feature>() == 1;
}
//===========================================================================
@@ -304,7 +296,7 @@ void CmdMeshPartCrossSections::activated(int iMsg)
bool CmdMeshPartCrossSections::isActive()
{
return (Gui::Selection().countObjectsOfType(Mesh::Feature::getClassTypeId()) > 0
return (Gui::Selection().countObjectsOfType<Mesh::Feature>() > 0
&& !Gui::Control().activeDialog());
}