diff --git a/docs/shortcuts.rst b/docs/shortcuts.rst index 43278247..c81ebff5 100644 --- a/docs/shortcuts.rst +++ b/docs/shortcuts.rst @@ -72,6 +72,10 @@ Keyboard +----------------------+--------------------------------------------------------------------------+ | F | Bring the part widget of current hovered part to visible area | +----------------------+--------------------------------------------------------------------------+ +| W | Toggle render wireframe | ++----------------------+--------------------------------------------------------------------------+ +| O | Toggle render flat shading | ++----------------------+--------------------------------------------------------------------------+ Mouse ====== diff --git a/src/documentwindow.cpp b/src/documentwindow.cpp index 49991f1d..f363fe78 100644 --- a/src/documentwindow.cpp +++ b/src/documentwindow.cpp @@ -856,6 +856,10 @@ DocumentWindow::DocumentWindow() : connect(graphicsWidget, &SkeletonGraphicsWidget::shortcutToggleWireframe, [=]() { m_modelRenderWidget->toggleWireframe(); }); + + connect(graphicsWidget, &SkeletonGraphicsWidget::shortcutToggleFlatShading, [=]() { + Preferences::instance().setFlatShading(!Preferences::instance().flatShading()); + }); connect(graphicsWidget, &SkeletonGraphicsWidget::zoomRenderedModelBy, m_modelRenderWidget, &ModelWidget::zoom); diff --git a/src/shortcuts.cpp b/src/shortcuts.cpp index 31f1d90a..2c38d518 100644 --- a/src/shortcuts.cpp +++ b/src/shortcuts.cpp @@ -48,4 +48,5 @@ void initShortCuts(QWidget *widget, SkeletonGraphicsWidget *graphicsWidget) defineKey(Qt::Key_W, &SkeletonGraphicsWidget::shortcutToggleWireframe); defineKey(Qt::Key_F, &SkeletonGraphicsWidget::shortcutCheckPartComponent); defineKey(Qt::Key_C, &SkeletonGraphicsWidget::shortcutChamferedOrNotSelectedPart); + defineKey(Qt::Key_O, &SkeletonGraphicsWidget::shortcutToggleFlatShading); } diff --git a/src/skeletongraphicswidget.h b/src/skeletongraphicswidget.h index 494a6c29..4fa3921b 100644 --- a/src/skeletongraphicswidget.h +++ b/src/skeletongraphicswidget.h @@ -417,6 +417,7 @@ signals: void shortcutToggleWireframe(); void partComponentChecked(QUuid partId); void showOrHideAllComponents(); + void shortcutToggleFlatShading(); public: SkeletonGraphicsWidget(const SkeletonDocument *document); std::map> nodeItemMap;