diff --git a/application/sources/bone_manage_widget.cc b/application/sources/bone_manage_widget.cc index 30f389c7..023eb10c 100644 --- a/application/sources/bone_manage_widget.cc +++ b/application/sources/bone_manage_widget.cc @@ -52,6 +52,16 @@ BoneManageWidget::BoneManageWidget(Document* document, QWidget* parent) this->m_document->saveSnapshot(); }); + connect(m_selectButton, &QPushButton::clicked, [this]() { + for (const auto& boneId : this->m_bonePreviewGridWidget->getSelectedBoneIds()) { + for (const auto& nodeIt : m_document->nodeMap) { + if (nodeIt.second.boneIds.end() == nodeIt.second.boneIds.find(boneId)) + continue; + emit this->selectNodeOnCanvas(nodeIt.first); + } + } + }); + connect(m_propertyButton, &QPushButton::clicked, this, &BoneManageWidget::showSelectedBoneProperties); connect(this, &BoneManageWidget::groupOperationAdded, m_document, &Document::saveSnapshot); diff --git a/application/sources/document_window.cc b/application/sources/document_window.cc index 141c9688..aae19926 100644 --- a/application/sources/document_window.cc +++ b/application/sources/document_window.cc @@ -615,6 +615,8 @@ DocumentWindow::DocumentWindow() connect(canvasGraphicsWidget, &SkeletonGraphicsWidget::partComponentChecked, m_partManageWidget, &PartManageWidget::selectComponentByPartId); + connect(m_boneManageWidget, &BoneManageWidget::selectNodeOnCanvas, canvasGraphicsWidget, &SkeletonGraphicsWidget::addNodeToSelection); + connect(m_document, &Document::skeletonChanged, m_document, &Document::generateMesh); connect(m_document, &Document::textureChanged, m_document, &Document::generateTexture); connect(m_document, &Document::resultMeshChanged, m_document, &Document::postProcess); diff --git a/application/sources/skeleton_graphics_widget.cc b/application/sources/skeleton_graphics_widget.cc index a529ca68..e5e18672 100644 --- a/application/sources/skeleton_graphics_widget.cc +++ b/application/sources/skeleton_graphics_widget.cc @@ -2515,6 +2515,21 @@ void SkeletonGraphicsWidget::addPartToSelection(dust3d::Uuid partId) } } +void SkeletonGraphicsWidget::addNodeToSelection(const dust3d::Uuid& nodeId) +{ + Document::Profile choosenProfile = Document::Profile::Main; + if (m_hoveredNodeItem) { + choosenProfile = m_hoveredNodeItem->profile(); + } else if (m_hoveredEdgeItem) { + choosenProfile = m_hoveredEdgeItem->profile(); + } + auto findNodeItem = nodeItemMap.find(nodeId); + if (findNodeItem == nodeItemMap.end()) + return; + SkeletonGraphicsNodeItem* item = Document::Profile::Main == choosenProfile ? findNodeItem->second.first : findNodeItem->second.second; + addItemToRangeSelection(item); +} + void SkeletonGraphicsWidget::selectConnectedAll() { unselectAll(); diff --git a/application/sources/skeleton_graphics_widget.h b/application/sources/skeleton_graphics_widget.h index 7cba9c06..8ae5dfcf 100644 --- a/application/sources/skeleton_graphics_widget.h +++ b/application/sources/skeleton_graphics_widget.h @@ -137,6 +137,7 @@ public slots: void selectPartAll(); void selectConnectedAll(); void addPartToSelection(dust3d::Uuid partId); + void addNodeToSelection(const dust3d::Uuid& nodeId); void cut(); void copy(); void flipHorizontally();