diff --git a/application/sources/bone_manage_widget.cc b/application/sources/bone_manage_widget.cc index 62973fbf..5d5923a6 100644 --- a/application/sources/bone_manage_widget.cc +++ b/application/sources/bone_manage_widget.cc @@ -27,9 +27,11 @@ BoneManageWidget::BoneManageWidget(Document* document, QWidget* parent) return button; }; + m_addButton = createButton(QChar(fa::plus), tr("Add new bone")); m_selectButton = createButton(QChar(fa::objectgroup), tr("Select them on canvas")); m_propertyButton = createButton(QChar(fa::sliders), tr("Configure properties")); + toolsLayout->addWidget(m_addButton); toolsLayout->addWidget(m_selectButton); toolsLayout->addWidget(m_propertyButton); toolsLayout->addStretch(); @@ -45,6 +47,12 @@ BoneManageWidget::BoneManageWidget(Document* document, QWidget* parent) connect(m_bonePreviewGridWidget, &BonePreviewGridWidget::unselectAllOnCanvas, this, &BoneManageWidget::unselectAllOnCanvas); connect(m_bonePreviewGridWidget, &BonePreviewGridWidget::selectNodeOnCanvas, this, &BoneManageWidget::selectNodeOnCanvas); + connect(m_addButton, &QPushButton::clicked, this, [this]() { + dust3d::Uuid boneId = dust3d::Uuid::createUuid(); + this->m_document->addBone(boneId); + this->m_document->saveSnapshot(); + }); + connect(m_propertyButton, &QPushButton::clicked, this, &BoneManageWidget::showSelectedBoneProperties); connect(this, &BoneManageWidget::groupOperationAdded, m_document, &Document::saveSnapshot); diff --git a/application/sources/bone_manage_widget.h b/application/sources/bone_manage_widget.h index f87a4446..d9314625 100644 --- a/application/sources/bone_manage_widget.h +++ b/application/sources/bone_manage_widget.h @@ -13,7 +13,7 @@ class BoneManageWidget : public QWidget { Q_OBJECT signals: void unselectAllOnCanvas(); - void selectNodeOnCanvas(const dust3d::Uuid& boneId); + void selectNodeOnCanvas(const dust3d::Uuid& nodeId); void groupOperationAdded(); public slots: void selectBoneByBoneId(const dust3d::Uuid& boneId); @@ -26,6 +26,7 @@ public: private: Document* m_document = nullptr; BonePreviewGridWidget* m_bonePreviewGridWidget = nullptr; + QPushButton* m_addButton = nullptr; QPushButton* m_selectButton = nullptr; QPushButton* m_propertyButton = nullptr; void updateToolButtons();