Add radius lock
parent
1988118179
commit
a9b379a77a
|
@ -21,6 +21,7 @@ SkeletonDocument::SkeletonDocument() :
|
||||||
xlocked(false),
|
xlocked(false),
|
||||||
ylocked(false),
|
ylocked(false),
|
||||||
zlocked(false),
|
zlocked(false),
|
||||||
|
radiusLocked(false),
|
||||||
textureGuideImage(nullptr),
|
textureGuideImage(nullptr),
|
||||||
textureImage(nullptr),
|
textureImage(nullptr),
|
||||||
textureBorderImage(nullptr),
|
textureBorderImage(nullptr),
|
||||||
|
@ -443,7 +444,8 @@ void SkeletonDocument::scaleNodeByAddRadius(QUuid nodeId, float amount)
|
||||||
}
|
}
|
||||||
if (isPartReadonly(it->second.partId))
|
if (isPartReadonly(it->second.partId))
|
||||||
return;
|
return;
|
||||||
it->second.setRadius(it->second.radius + amount);
|
if (!radiusLocked)
|
||||||
|
it->second.setRadius(it->second.radius + amount);
|
||||||
auto part = partMap.find(it->second.partId);
|
auto part = partMap.find(it->second.partId);
|
||||||
if (part != partMap.end())
|
if (part != partMap.end())
|
||||||
part->second.dirty = true;
|
part->second.dirty = true;
|
||||||
|
@ -527,7 +529,8 @@ void SkeletonDocument::setNodeRadius(QUuid nodeId, float radius)
|
||||||
}
|
}
|
||||||
if (isPartReadonly(it->second.partId))
|
if (isPartReadonly(it->second.partId))
|
||||||
return;
|
return;
|
||||||
it->second.setRadius(radius);
|
if (!radiusLocked)
|
||||||
|
it->second.setRadius(radius);
|
||||||
auto part = partMap.find(it->second.partId);
|
auto part = partMap.find(it->second.partId);
|
||||||
if (part != partMap.end())
|
if (part != partMap.end())
|
||||||
part->second.dirty = true;
|
part->second.dirty = true;
|
||||||
|
@ -1964,6 +1967,14 @@ void SkeletonDocument::setZlockState(bool locked)
|
||||||
emit zlockStateChanged();
|
emit zlockStateChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SkeletonDocument::setRadiusLockState(bool locked)
|
||||||
|
{
|
||||||
|
if (radiusLocked == locked)
|
||||||
|
return;
|
||||||
|
radiusLocked = locked;
|
||||||
|
emit radiusLockStateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
bool SkeletonDocument::isExportReady() const
|
bool SkeletonDocument::isExportReady() const
|
||||||
{
|
{
|
||||||
if (m_isResultMeshObsolete ||
|
if (m_isResultMeshObsolete ||
|
||||||
|
|
|
@ -370,6 +370,7 @@ signals:
|
||||||
void xlockStateChanged();
|
void xlockStateChanged();
|
||||||
void ylockStateChanged();
|
void ylockStateChanged();
|
||||||
void zlockStateChanged();
|
void zlockStateChanged();
|
||||||
|
void radiusLockStateChanged();
|
||||||
void checkPart(QUuid partId);
|
void checkPart(QUuid partId);
|
||||||
void partChecked(QUuid partId);
|
void partChecked(QUuid partId);
|
||||||
void partUnchecked(QUuid partId);
|
void partUnchecked(QUuid partId);
|
||||||
|
@ -388,6 +389,7 @@ public: // need initialize
|
||||||
bool xlocked;
|
bool xlocked;
|
||||||
bool ylocked;
|
bool ylocked;
|
||||||
bool zlocked;
|
bool zlocked;
|
||||||
|
bool radiusLocked;
|
||||||
QImage *textureGuideImage;
|
QImage *textureGuideImage;
|
||||||
QImage *textureImage;
|
QImage *textureImage;
|
||||||
QImage *textureBorderImage;
|
QImage *textureBorderImage;
|
||||||
|
@ -501,6 +503,7 @@ public slots:
|
||||||
void setXlockState(bool locked);
|
void setXlockState(bool locked);
|
||||||
void setYlockState(bool locked);
|
void setYlockState(bool locked);
|
||||||
void setZlockState(bool locked);
|
void setZlockState(bool locked);
|
||||||
|
void setRadiusLockState(bool locked);
|
||||||
void enableAllPositionRelatedLocks();
|
void enableAllPositionRelatedLocks();
|
||||||
void disableAllPositionRelatedLocks();
|
void disableAllPositionRelatedLocks();
|
||||||
void toggleSmoothNormal();
|
void toggleSmoothNormal();
|
||||||
|
|
|
@ -137,6 +137,10 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
||||||
initLockButton(m_zlockButton);
|
initLockButton(m_zlockButton);
|
||||||
updateZlockButtonState();
|
updateZlockButtonState();
|
||||||
|
|
||||||
|
m_radiusLockButton = new QPushButton(QChar(fa::bullseye));
|
||||||
|
Theme::initAwesomeButton(m_radiusLockButton);
|
||||||
|
updateRadiusLockButtonState();
|
||||||
|
|
||||||
QPushButton *rotateCounterclockwiseButton = new QPushButton(QChar(fa::rotateleft));
|
QPushButton *rotateCounterclockwiseButton = new QPushButton(QChar(fa::rotateleft));
|
||||||
Theme::initAwesomeButton(rotateCounterclockwiseButton);
|
Theme::initAwesomeButton(rotateCounterclockwiseButton);
|
||||||
|
|
||||||
|
@ -152,6 +156,7 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
||||||
toolButtonLayout->addWidget(m_xlockButton);
|
toolButtonLayout->addWidget(m_xlockButton);
|
||||||
toolButtonLayout->addWidget(m_ylockButton);
|
toolButtonLayout->addWidget(m_ylockButton);
|
||||||
toolButtonLayout->addWidget(m_zlockButton);
|
toolButtonLayout->addWidget(m_zlockButton);
|
||||||
|
toolButtonLayout->addWidget(m_radiusLockButton);
|
||||||
toolButtonLayout->addSpacing(10);
|
toolButtonLayout->addSpacing(10);
|
||||||
toolButtonLayout->addWidget(rotateCounterclockwiseButton);
|
toolButtonLayout->addWidget(rotateCounterclockwiseButton);
|
||||||
toolButtonLayout->addWidget(rotateClockwiseButton);
|
toolButtonLayout->addWidget(rotateClockwiseButton);
|
||||||
|
@ -524,6 +529,9 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
||||||
connect(m_zlockButton, &QPushButton::clicked, [=]() {
|
connect(m_zlockButton, &QPushButton::clicked, [=]() {
|
||||||
m_document->setZlockState(!m_document->zlocked);
|
m_document->setZlockState(!m_document->zlocked);
|
||||||
});
|
});
|
||||||
|
connect(m_radiusLockButton, &QPushButton::clicked, [=]() {
|
||||||
|
m_document->setRadiusLockState(!m_document->radiusLocked);
|
||||||
|
});
|
||||||
|
|
||||||
m_partListDockerVisibleSwitchConnection = connect(m_document, &SkeletonDocument::skeletonChanged, [=]() {
|
m_partListDockerVisibleSwitchConnection = connect(m_document, &SkeletonDocument::skeletonChanged, [=]() {
|
||||||
if (m_graphicsWidget->hasItems()) {
|
if (m_graphicsWidget->hasItems()) {
|
||||||
|
@ -678,6 +686,7 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
||||||
connect(m_document, &SkeletonDocument::xlockStateChanged, this, &SkeletonDocumentWindow::updateXlockButtonState);
|
connect(m_document, &SkeletonDocument::xlockStateChanged, this, &SkeletonDocumentWindow::updateXlockButtonState);
|
||||||
connect(m_document, &SkeletonDocument::ylockStateChanged, this, &SkeletonDocumentWindow::updateYlockButtonState);
|
connect(m_document, &SkeletonDocument::ylockStateChanged, this, &SkeletonDocumentWindow::updateYlockButtonState);
|
||||||
connect(m_document, &SkeletonDocument::zlockStateChanged, this, &SkeletonDocumentWindow::updateZlockButtonState);
|
connect(m_document, &SkeletonDocument::zlockStateChanged, this, &SkeletonDocumentWindow::updateZlockButtonState);
|
||||||
|
connect(m_document, &SkeletonDocument::radiusLockStateChanged, this, &SkeletonDocumentWindow::updateRadiusLockButtonState);
|
||||||
|
|
||||||
connect(this, &SkeletonDocumentWindow::initialized, m_document, &SkeletonDocument::uiReady);
|
connect(this, &SkeletonDocumentWindow::initialized, m_document, &SkeletonDocument::uiReady);
|
||||||
|
|
||||||
|
@ -1035,3 +1044,11 @@ void SkeletonDocumentWindow::updateZlockButtonState()
|
||||||
else
|
else
|
||||||
m_zlockButton->setStyleSheet("QPushButton {color: #aaebc4}");
|
m_zlockButton->setStyleSheet("QPushButton {color: #aaebc4}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SkeletonDocumentWindow::updateRadiusLockButtonState()
|
||||||
|
{
|
||||||
|
if (m_document->radiusLocked)
|
||||||
|
m_radiusLockButton->setStyleSheet("QPushButton {color: #252525}");
|
||||||
|
else
|
||||||
|
m_radiusLockButton->setStyleSheet("QPushButton {color: " + Theme::white.name() + "}");
|
||||||
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@ public slots:
|
||||||
void updateXlockButtonState();
|
void updateXlockButtonState();
|
||||||
void updateYlockButtonState();
|
void updateYlockButtonState();
|
||||||
void updateZlockButtonState();
|
void updateZlockButtonState();
|
||||||
|
void updateRadiusLockButtonState();
|
||||||
private:
|
private:
|
||||||
void initLockButton(QPushButton *button);
|
void initLockButton(QPushButton *button);
|
||||||
void setCurrentFilename(const QString &filename);
|
void setCurrentFilename(const QString &filename);
|
||||||
|
@ -128,6 +129,7 @@ private:
|
||||||
QPushButton *m_xlockButton;
|
QPushButton *m_xlockButton;
|
||||||
QPushButton *m_ylockButton;
|
QPushButton *m_ylockButton;
|
||||||
QPushButton *m_zlockButton;
|
QPushButton *m_zlockButton;
|
||||||
|
QPushButton *m_radiusLockButton;
|
||||||
|
|
||||||
QMetaObject::Connection m_partListDockerVisibleSwitchConnection;
|
QMetaObject::Connection m_partListDockerVisibleSwitchConnection;
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue