diff --git a/src/skeletondocumentwindow.cpp b/src/skeletondocumentwindow.cpp index 279dc22e..d17a32b0 100644 --- a/src/skeletondocumentwindow.cpp +++ b/src/skeletondocumentwindow.cpp @@ -401,6 +401,16 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() : connect(graphicsWidget, &SkeletonGraphicsWidget::partChecked, m_document, &SkeletonDocument::partChecked); connect(graphicsWidget, &SkeletonGraphicsWidget::partUnchecked, m_document, &SkeletonDocument::partUnchecked); + connect(graphicsWidget, &SkeletonGraphicsWidget::setPartLockState, m_document, &SkeletonDocument::setPartLockState); + connect(graphicsWidget, &SkeletonGraphicsWidget::setPartVisibleState, m_document, &SkeletonDocument::setPartVisibleState); + connect(graphicsWidget, &SkeletonGraphicsWidget::setPartSubdivState, m_document, &SkeletonDocument::setPartSubdivState); + connect(graphicsWidget, &SkeletonGraphicsWidget::setPartDisableState, m_document, &SkeletonDocument::setPartDisableState); + connect(graphicsWidget, &SkeletonGraphicsWidget::setPartXmirrorState, m_document, &SkeletonDocument::setPartXmirrorState); + + connect(graphicsWidget, &SkeletonGraphicsWidget::setXlockState, m_document, &SkeletonDocument::setXlockState); + connect(graphicsWidget, &SkeletonGraphicsWidget::setYlockState, m_document, &SkeletonDocument::setYlockState); + connect(graphicsWidget, &SkeletonGraphicsWidget::setZlockState, m_document, &SkeletonDocument::setZlockState); + connect(graphicsWidget, &SkeletonGraphicsWidget::changeTurnaround, this, &SkeletonDocumentWindow::changeTurnaround); connect(graphicsWidget, &SkeletonGraphicsWidget::save, this, &SkeletonDocumentWindow::save); connect(graphicsWidget, &SkeletonGraphicsWidget::open, this, &SkeletonDocumentWindow::open); diff --git a/src/skeletongraphicswidget.cpp b/src/skeletongraphicswidget.cpp index 9e8def2d..d2b3430f 100644 --- a/src/skeletongraphicswidget.cpp +++ b/src/skeletongraphicswidget.cpp @@ -999,16 +999,22 @@ bool SkeletonGraphicsWidget::keyPress(QKeyEvent *event) } else { emit undo(); } + } else { + emit setZlockState(!m_document->zlocked); } } else if (event->key() == Qt::Key_Y) { if (QGuiApplication::queryKeyboardModifiers().testFlag(Qt::ControlModifier)) { if (!QGuiApplication::queryKeyboardModifiers().testFlag(Qt::ShiftModifier)) { emit redo(); } + } else { + emit setYlockState(!m_document->ylocked); } } else if (event->key() == Qt::Key_X) { if (QGuiApplication::queryKeyboardModifiers().testFlag(Qt::ControlModifier)) { cut(); + } else { + emit setXlockState(!m_document->xlocked); } } else if (event->key() == Qt::Key_C) { if (QGuiApplication::queryKeyboardModifiers().testFlag(Qt::ControlModifier)) { @@ -1100,6 +1106,41 @@ bool SkeletonGraphicsWidget::keyPress(QKeyEvent *event) if (SkeletonDocumentEditMode::Select == m_document->editMode && hasSelection()) { switchProfileOnRangeSelection(); } + } else if (event->key() == Qt::Key_H) { + if (SkeletonDocumentEditMode::Select == m_document->editMode && !m_lastCheckedPart.isNull()) { + const SkeletonPart *part = m_document->findPart(m_lastCheckedPart); + bool partVisible = part && part->visible; + emit setPartVisibleState(m_lastCheckedPart, !partVisible); + emit groupOperationAdded(); + } + } else if (event->key() == Qt::Key_J) { + if (SkeletonDocumentEditMode::Select == m_document->editMode && !m_lastCheckedPart.isNull()) { + const SkeletonPart *part = m_document->findPart(m_lastCheckedPart); + bool partDisabled = part && part->disabled; + emit setPartDisableState(m_lastCheckedPart, !partDisabled); + emit groupOperationAdded(); + } + } else if (event->key() == Qt::Key_L) { + if (SkeletonDocumentEditMode::Select == m_document->editMode && !m_lastCheckedPart.isNull()) { + const SkeletonPart *part = m_document->findPart(m_lastCheckedPart); + bool partLocked = part && part->locked; + emit setPartLockState(m_lastCheckedPart, !partLocked); + emit groupOperationAdded(); + } + } else if (event->key() == Qt::Key_M) { + if (SkeletonDocumentEditMode::Select == m_document->editMode && !m_lastCheckedPart.isNull()) { + const SkeletonPart *part = m_document->findPart(m_lastCheckedPart); + bool partXmirrored = part && part->xMirrored; + emit setPartXmirrorState(m_lastCheckedPart, !partXmirrored); + emit groupOperationAdded(); + } + } else if (event->key() == Qt::Key_B) { + if (SkeletonDocumentEditMode::Select == m_document->editMode && !m_lastCheckedPart.isNull()) { + const SkeletonPart *part = m_document->findPart(m_lastCheckedPart); + bool partSubdived = part && part->subdived; + emit setPartSubdivState(m_lastCheckedPart, !partSubdived); + emit groupOperationAdded(); + } } return false; } diff --git a/src/skeletongraphicswidget.h b/src/skeletongraphicswidget.h index 056759cb..d5230a6d 100644 --- a/src/skeletongraphicswidget.h +++ b/src/skeletongraphicswidget.h @@ -357,6 +357,14 @@ signals: void moveOriginBy(float x, float y, float z); void partChecked(QUuid partId); void partUnchecked(QUuid partId); + void setPartLockState(QUuid partId, bool locked); + void setPartVisibleState(QUuid partId, bool visible); + void setPartSubdivState(QUuid partId, bool subdived); + void setPartDisableState(QUuid partId, bool disabled); + void setPartXmirrorState(QUuid partId, bool mirrored); + void setXlockState(bool locked); + void setYlockState(bool locked); + void setZlockState(bool locked); public: SkeletonGraphicsWidget(const SkeletonDocument *document); std::map> nodeItemMap; diff --git a/src/skeletonpartlistwidget.cpp b/src/skeletonpartlistwidget.cpp index 5e059417..ae81ae28 100644 --- a/src/skeletonpartlistwidget.cpp +++ b/src/skeletonpartlistwidget.cpp @@ -41,8 +41,8 @@ SkeletonPartWidget::SkeletonPartWidget(const SkeletonDocument *document, QUuid p miniTopToolLayout->setSpacing(0); miniTopToolLayout->setContentsMargins(0, 0, 0, 0); miniTopToolLayout->addWidget(m_visibleButton); - miniTopToolLayout->addWidget(m_lockButton); miniTopToolLayout->addWidget(m_disableButton); + miniTopToolLayout->addWidget(m_lockButton); miniTopToolLayout->addStretch(); QHBoxLayout *miniBottomToolLayout = new QHBoxLayout;