Add shortcut key O

Toggle render flat shading
master
Jeremy Hu 2019-10-19 11:37:23 +09:30
parent 8e7d1ceb05
commit dd371387a4
4 changed files with 10 additions and 0 deletions

View File

@ -72,6 +72,10 @@ Keyboard
+----------------------+--------------------------------------------------------------------------+ +----------------------+--------------------------------------------------------------------------+
| F | Bring the part widget of current hovered part to visible area | | F | Bring the part widget of current hovered part to visible area |
+----------------------+--------------------------------------------------------------------------+ +----------------------+--------------------------------------------------------------------------+
| W | Toggle render wireframe |
+----------------------+--------------------------------------------------------------------------+
| O | Toggle render flat shading |
+----------------------+--------------------------------------------------------------------------+
Mouse Mouse
====== ======

View File

@ -857,6 +857,10 @@ DocumentWindow::DocumentWindow() :
m_modelRenderWidget->toggleWireframe(); m_modelRenderWidget->toggleWireframe();
}); });
connect(graphicsWidget, &SkeletonGraphicsWidget::shortcutToggleFlatShading, [=]() {
Preferences::instance().setFlatShading(!Preferences::instance().flatShading());
});
connect(graphicsWidget, &SkeletonGraphicsWidget::zoomRenderedModelBy, m_modelRenderWidget, &ModelWidget::zoom); connect(graphicsWidget, &SkeletonGraphicsWidget::zoomRenderedModelBy, m_modelRenderWidget, &ModelWidget::zoom);
connect(graphicsWidget, &SkeletonGraphicsWidget::addNode, m_document, &Document::addNode); connect(graphicsWidget, &SkeletonGraphicsWidget::addNode, m_document, &Document::addNode);

View File

@ -48,4 +48,5 @@ void initShortCuts(QWidget *widget, SkeletonGraphicsWidget *graphicsWidget)
defineKey(Qt::Key_W, &SkeletonGraphicsWidget::shortcutToggleWireframe); defineKey(Qt::Key_W, &SkeletonGraphicsWidget::shortcutToggleWireframe);
defineKey(Qt::Key_F, &SkeletonGraphicsWidget::shortcutCheckPartComponent); defineKey(Qt::Key_F, &SkeletonGraphicsWidget::shortcutCheckPartComponent);
defineKey(Qt::Key_C, &SkeletonGraphicsWidget::shortcutChamferedOrNotSelectedPart); defineKey(Qt::Key_C, &SkeletonGraphicsWidget::shortcutChamferedOrNotSelectedPart);
defineKey(Qt::Key_O, &SkeletonGraphicsWidget::shortcutToggleFlatShading);
} }

View File

@ -417,6 +417,7 @@ signals:
void shortcutToggleWireframe(); void shortcutToggleWireframe();
void partComponentChecked(QUuid partId); void partComponentChecked(QUuid partId);
void showOrHideAllComponents(); void showOrHideAllComponents();
void shortcutToggleFlatShading();
public: public:
SkeletonGraphicsWidget(const SkeletonDocument *document); SkeletonGraphicsWidget(const SkeletonDocument *document);
std::map<QUuid, std::pair<SkeletonGraphicsNodeItem *, SkeletonGraphicsNodeItem *>> nodeItemMap; std::map<QUuid, std::pair<SkeletonGraphicsNodeItem *, SkeletonGraphicsNodeItem *>> nodeItemMap;