Implement add bone button

master
Jeremy HU 2022-11-12 02:31:20 +11:00
parent d4be107518
commit cfc26649f2
2 changed files with 10 additions and 1 deletions

View File

@ -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);

View File

@ -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();