Skip to content

Commit 884c34a

Browse files
committed
Parts can now be toggled inactive without first selecting an object.
1 parent 753a476 commit 884c34a

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

FEBioStudio/ModelDocument.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,18 +1277,12 @@ void CModelDocument::ToggleActiveParts()
12771277
{
12781278
if (GetSelectionMode() != SELECT_PART) return;
12791279

1280-
GObject* po = GetActiveObject();
1281-
if (po == nullptr) return;
1282-
1283-
vector<GPart*> selectedParts;
1284-
for (int i = 0; i < po->Parts(); ++i)
1280+
GPartSelection* sel = dynamic_cast<GPartSelection*>(GetCurrentSelection());
1281+
if (sel && (sel->Count() > 0))
12851282
{
1286-
GPart* pg = po->Part(i);
1287-
if (pg && pg->IsSelected()) selectedParts.push_back(pg);
1283+
vector<GPart*> selectedParts = sel->GetPartList();
1284+
DoCommand(new CCmdToggleActiveParts(selectedParts));
12881285
}
1289-
if (selectedParts.empty()) return;
1290-
1291-
DoCommand(new CCmdToggleActiveParts(selectedParts));
12921286
}
12931287

12941288
CModelDocument* CreateNewModelDocument(CMainWindow* wnd, int moduleID, std::string name, int units)

MeshTools/FESelection.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ class GPartSelection : public GSelection
170170

171171
GPart* Part(size_t n) { return m_partList[n]; }
172172

173+
const std::vector<GPart*>& GetPartList() const { return m_partList; }
173174

174175
FSItemListBuilder* CreateItemList();
175176

0 commit comments

Comments
 (0)