From fceb9036ef806e3c7c415274d08bc5cef61bcb8e Mon Sep 17 00:00:00 2001 From: SteveMaas1978 Date: Wed, 29 Jan 2025 15:35:40 -0700 Subject: [PATCH 1/4] Fixed issue with clear recent files list. --- FEBioStudio/DlgSettings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FEBioStudio/DlgSettings.cpp b/FEBioStudio/DlgSettings.cpp index e19ddf6a9..a91bcb03c 100644 --- a/FEBioStudio/DlgSettings.cpp +++ b/FEBioStudio/DlgSettings.cpp @@ -162,7 +162,7 @@ class CUIProps : public CDataPropertyList void SetPropertyValue(int i, const QVariant& v) override { - if (i == 3) + if (i == 2) { if (QMessageBox::question(m_dlg, "FEBio Studio", "Are you sure you want to clear all the recent files list.\nThis can not be undone!") == QMessageBox::Yes) { From 47434d8b90cccf843d2d83fdcbee70ddb8c335b7 Mon Sep 17 00:00:00 2001 From: SteveMaas1978 Date: Thu, 30 Jan 2025 09:01:36 -0700 Subject: [PATCH 2/4] Fixed issue when rendering quads in GLMeshRender. --- GLLib/GLMeshRender.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/GLLib/GLMeshRender.cpp b/GLLib/GLMeshRender.cpp index 085029759..5ec8e8e08 100644 --- a/GLLib/GLMeshRender.cpp +++ b/GLLib/GLMeshRender.cpp @@ -3068,7 +3068,7 @@ void GLMeshRender::RenderFESurfaceMeshFace(FSFace& face, FSMeshBase* pm, GLColor vec3d& r1 = pm->Node(face.n[0]).r; vec3d& r2 = pm->Node(face.n[1]).r; vec3d& r3 = pm->Node(face.n[2]).r; - vec3d r4 = (face.n[3] >= 0 ? pm->Node(face.n[3]).r : r3); + vec3d r4; vec3f& n1 = face.m_nn[0]; vec3f& n2 = face.m_nn[1]; @@ -3085,6 +3085,7 @@ void GLMeshRender::RenderFESurfaceMeshFace(FSFace& face, FSMeshBase* pm, GLColor case FE_FACE_QUAD4: case FE_FACE_QUAD8: case FE_FACE_QUAD9: + r4 = pm->Node(face.n[3]).r; if (m_ndivs <= 1) { glNormal3f(n1.x, n1.y, n1.z); glColor4ub(c[0].r, c[0].g, c[0].b, c[0].a); glTexCoord1f(t[0]); glVertex3f(r1.x, r1.y, r1.z); From 97300ce3082ad4281f14f3848dce2b4a8a0e021a Mon Sep 17 00:00:00 2001 From: SteveMaas1978 Date: Thu, 30 Jan 2025 13:16:00 -0700 Subject: [PATCH 3/4] Highlighting is now supported for selections in the Selection box. --- FEBioStudio/ModelPropsPanel.cpp | 30 +++++++++++++++++++ FEBioStudio/ModelPropsPanel.h | 3 ++ FEBioStudio/ModelViewer.cpp | 52 +++++++++++++++++++++++++++++++++ FEBioStudio/ModelViewer.h | 1 + FEBioStudio/SelectionBox.cpp | 14 ++++++++- FEBioStudio/SelectionBox.h | 8 +++++ 6 files changed, 107 insertions(+), 1 deletion(-) diff --git a/FEBioStudio/ModelPropsPanel.cpp b/FEBioStudio/ModelPropsPanel.cpp index b1af55e3e..1b04f938a 100644 --- a/FEBioStudio/ModelPropsPanel.cpp +++ b/FEBioStudio/ModelPropsPanel.cpp @@ -1406,6 +1406,36 @@ void CModelPropsPanel::on_select2_clearButtonClicked() { clearSelection(1); } void CModelPropsPanel::on_select1_pickClicked() { PickSelection(0); } void CModelPropsPanel::on_select2_pickClicked() { PickSelection(1); } +void CModelPropsPanel::on_select1_currentItemChanged(int nrow) +{ + CModelDocument* pdoc = m_wnd->GetModelDocument(); + if ((pdoc == nullptr) || !pdoc->IsValid()) return; + + FSItemListBuilder* itemList = ui->sel1->GetItemList(); + if (itemList) + { + std::vector allItems; + ui->sel1->getAllItems(allItems); + + std::vector l; + if (!ui->sel1->isCollapsed()) l = allItems; + else + { + if ((nrow >= 0) && (nrow < allItems.size())) l.push_back(allItems[nrow]); + } + + if (!l.empty()) + { + emit itemSelected(itemList, l); + } + } +} + +void CModelPropsPanel::on_select2_currentItemChanged(int nrow) +{ + +} + void CModelPropsPanel::PickSelection(int n) { CModelDocument* pdoc = m_wnd->GetModelDocument(); diff --git a/FEBioStudio/ModelPropsPanel.h b/FEBioStudio/ModelPropsPanel.h index fe913b00f..b3d987064 100644 --- a/FEBioStudio/ModelPropsPanel.h +++ b/FEBioStudio/ModelPropsPanel.h @@ -215,6 +215,8 @@ private slots: void on_select2_nameChanged(const QString& t); void on_select1_pickClicked(); void on_select2_pickClicked(); + void on_select1_currentItemChanged(int nrow); + void on_select2_currentItemChanged(int nrow); void on_object_nameChanged(const QString&); void on_bcobject_nameChanged(const QString&); void on_itemInfo_nameChanged(const QString&); @@ -255,6 +257,7 @@ private slots: void dataChanged(bool b); void modelChanged(); void paramChanged(FSCoreBase* pc, Param* p); + void itemSelected(FSItemListBuilder* il, std::vector& items); private: Ui::CModelPropsPanel* ui; diff --git a/FEBioStudio/ModelViewer.cpp b/FEBioStudio/ModelViewer.cpp index 07674a4a5..c11951f7c 100644 --- a/FEBioStudio/ModelViewer.cpp +++ b/FEBioStudio/ModelViewer.cpp @@ -62,6 +62,7 @@ SOFTWARE.*/ #include #include "FEObjectProps.h" #include "PropertyList.h" +#include "GLHighlighter.h" using namespace std; class CDlgWarnings : public QDialog @@ -690,6 +691,57 @@ void CModelViewer::on_props_modelChanged() Update(); } +void CModelViewer::on_props_itemSelected(FSItemListBuilder* il, std::vector& items) +{ + if (IsHighlightSelectionEnabled()) + { + GLHighlighter::ClearHighlights(); + GNodeList* nl = dynamic_cast(il); + if (nl) { + std::vector nodes = nl->GetNodeList(); + for (int i : items) { + for (GNode* pn : nodes) { + if (pn->GetID() == i) + GLHighlighter::PickItem(pn); + } + } + } + + GEdgeList* el = dynamic_cast(il); + if (el) { + std::vector edges = el->GetEdgeList(); + for (int i : items) { + for (GEdge * pe : edges) { + if (pe->GetID() == i) + GLHighlighter::PickItem(pe); + } + } + } + + GFaceList* fl = dynamic_cast(il); + if (fl) { + std::vector surfaces = fl->GetFaceList(); + for (int i : items) { + for (GFace* pf : surfaces) { + if (pf->GetID() == i) + GLHighlighter::PickItem(pf); + } + } + } + + GPartList* pl = dynamic_cast(il); + if (pl) { + std::vector parts = pl->GetPartList(); + for (int i : items) { + for (GPart* pg : parts) { + if (pg->GetID() == i) + GLHighlighter::PickItem(pg); + } + } + } + } +} + void CModelViewer::on_filter_currentIndexChanged(int n) { FSObject* po = GetCurrentObject(); diff --git a/FEBioStudio/ModelViewer.h b/FEBioStudio/ModelViewer.h index d753904e9..bb6c9b345 100644 --- a/FEBioStudio/ModelViewer.h +++ b/FEBioStudio/ModelViewer.h @@ -119,6 +119,7 @@ public slots: void on_props_selectionChanged(); void on_props_dataChanged(bool b); void on_props_modelChanged(); + void on_props_itemSelected(FSItemListBuilder* il, std::vector& items); void on_filter_currentIndexChanged(int n); void on_warnings_clicked(); void on_props_paramChanged(FSCoreBase* pc, Param* p); diff --git a/FEBioStudio/SelectionBox.cpp b/FEBioStudio/SelectionBox.cpp index c45ebcee6..3b115c233 100644 --- a/FEBioStudio/SelectionBox.cpp +++ b/FEBioStudio/SelectionBox.cpp @@ -185,6 +185,11 @@ void CSelectionBox::setCollapsed(bool b) ui->collapse->setChecked(!b); } +bool CSelectionBox::isCollapsed() const +{ + return ui->collapse->isChecked(); +} + void CSelectionBox::on_addButton_clicked() { emit addButtonClicked(); @@ -248,6 +253,11 @@ void CSelectionBox::on_list_itemDoubleClicked(QListWidgetItem *item) } } +void CSelectionBox::on_list_currentRowChanged(int nrow) +{ + emit currentItemChanged(nrow); +} + void CSelectionBox::clearData() { ui->list->clear(); @@ -429,11 +439,13 @@ void CSelectionBox::removeSelectedItems() //----------------------------------------------------------------------------- CItemListSelectionBox::CItemListSelectionBox(QWidget* parent) : CSelectionBox(parent) { - + itemList = nullptr; } void CItemListSelectionBox::SetItemList(FSItemListBuilder* item) { + itemList = item; + // make sure we have an item list if (item == 0) { diff --git a/FEBioStudio/SelectionBox.h b/FEBioStudio/SelectionBox.h index 158a1d72c..18d7b935c 100644 --- a/FEBioStudio/SelectionBox.h +++ b/FEBioStudio/SelectionBox.h @@ -82,6 +82,7 @@ class CSelectionBox : public QWidget void enableAllButtons(bool b); void setCollapsed(bool b); + bool isCollapsed() const; signals: void addButtonClicked(); @@ -91,6 +92,7 @@ class CSelectionBox : public QWidget void clearButtonClicked(); void nameChanged(const QString& t); void pickClicked(); + void currentItemChanged(int item); private slots: void on_addButton_clicked(); @@ -99,6 +101,7 @@ private slots: void on_selButton_clicked(); void on_name_textEdited(const QString& t); void on_list_itemDoubleClicked(QListWidgetItem *item); + void on_list_currentRowChanged(int nrow); void on_clearSelection_clicked(); void on_toggleCollapse_toggled(bool b); void on_pick_clicked(bool b); @@ -117,6 +120,11 @@ class CItemListSelectionBox : public CSelectionBox CItemListSelectionBox(QWidget* parent = nullptr); void SetItemList(FSItemListBuilder* pItem); + + FSItemListBuilder* GetItemList() { return itemList; } + +private: + FSItemListBuilder* itemList; }; class CMainWindow; From 9b2f0fc4eec1c29fe16e2b087ba27215514d4a0f Mon Sep 17 00:00:00 2001 From: SteveMaas1978 Date: Thu, 30 Jan 2025 13:57:47 -0700 Subject: [PATCH 4/4] Forgot to add new selection highlight to second selection box. --- FEBioStudio/ModelPropsPanel.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/FEBioStudio/ModelPropsPanel.cpp b/FEBioStudio/ModelPropsPanel.cpp index 1b04f938a..d14addf45 100644 --- a/FEBioStudio/ModelPropsPanel.cpp +++ b/FEBioStudio/ModelPropsPanel.cpp @@ -1433,7 +1433,27 @@ void CModelPropsPanel::on_select1_currentItemChanged(int nrow) void CModelPropsPanel::on_select2_currentItemChanged(int nrow) { + CModelDocument* pdoc = m_wnd->GetModelDocument(); + if ((pdoc == nullptr) || !pdoc->IsValid()) return; + FSItemListBuilder* itemList = ui->sel2->GetItemList(); + if (itemList) + { + std::vector allItems; + ui->sel2->getAllItems(allItems); + + std::vector l; + if (!ui->sel2->isCollapsed()) l = allItems; + else + { + if ((nrow >= 0) && (nrow < allItems.size())) l.push_back(allItems[nrow]); + } + + if (!l.empty()) + { + emit itemSelected(itemList, l); + } + } } void CModelPropsPanel::PickSelection(int n)