From e26095981b51c355d537446624282969cdd2af67 Mon Sep 17 00:00:00 2001 From: Jeremy Hu Date: Fri, 15 Jun 2018 17:58:46 +0800 Subject: [PATCH] Add rotate operation to menu - Add rotate 90/-90 degree to facilitate nodes editing - Enable docs.dust3d.org domain --- README.md | 20 ++++++++++---------- docs/interface/menubar.rst | 8 ++++++++ dust3d.pro | 2 +- src/skeletondocumentwindow.cpp | 14 ++++++++++++++ src/skeletondocumentwindow.h | 2 ++ src/skeletongraphicswidget.cpp | 34 ++++++++++++++++++++++++++++++++++ src/skeletongraphicswidget.h | 2 ++ 7 files changed, 71 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 531283b2..90ca6117 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ - + -[![appveyor status](https://ci.appveyor.com/api/projects/status/github/huxingyi/dust3d?branch=master&svg=true)](https://ci.appveyor.com/project/huxingyi/dust3d) [![travis status](https://travis-ci.org/huxingyi/dust3d.svg?branch=master)](https://travis-ci.org/huxingyi/dust3d) [![readthedocs status](https://readthedocs.org/projects/dust3d/badge/?version=latest)](https://dust3d.readthedocs.io/en/latest/?badge=latest) +[![appveyor status](https://ci.appveyor.com/api/projects/status/github/huxingyi/dust3d?branch=master&svg=true)](https://ci.appveyor.com/project/huxingyi/dust3d) [![travis status](https://travis-ci.org/huxingyi/dust3d.svg?branch=master)](https://travis-ci.org/huxingyi/dust3d) [![readthedocs status](https://readthedocs.org/projects/dust3d/badge/?version=latest)](http://docs.dust3d.org/en/latest/?badge=latest) Overview ---------- Dust3D is a brand new 3D modeling software. It helps you create a 3D watertight base model in seconds. Use it to speed up your character modeling in game making, 3D printing, and so on. -[Download Dust3D](https://dust3d.readthedocs.io/en/latest/install.html) -[Online Dust3D Reference Guide](https://dust3d.readthedocs.io/en/latest/index.html) +[Download Dust3D](http://docs.dust3d.org/en/latest/install.html) +[Online Dust3D Reference Guide](http://docs.dust3d.org) Examples ---------------------- @@ -15,19 +15,19 @@ Examples -[Modeling Ant using Dust3D](https://dust3d.readthedocs.io/en/latest/examples/modeling-ant/index.html) +[Modeling Ant using Dust3D](http://docs.dust3d.org/en/latest/examples/modeling-ant/index.html) - + -[Modeling Camel using Dust3D](https://dust3d.readthedocs.io/en/latest/examples/modeling-camel/index.html) +[Modeling Camel using Dust3D](http://docs.dust3d.org/en/latest/examples/modeling-camel/index.html) - + -[Modeling Horse using Dust3D](https://dust3d.readthedocs.io/en/latest/examples/modeling-horse/index.html) +[Modeling Horse using Dust3D](http://docs.dust3d.org/en/latest/examples/modeling-horse/index.html) - + Free Dust3D Models diff --git a/docs/interface/menubar.rst b/docs/interface/menubar.rst index 7cc823c8..bb6ce102 100644 --- a/docs/interface/menubar.rst +++ b/docs/interface/menubar.rst @@ -85,6 +85,14 @@ V Flip ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Flip selected nodes vertically. +Rotate 90 (Clockwise) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Rotate selected nodes 90 degree. If you can hardly edit some nodes in normal front/side view, rotate it then edit it, and rotate it back after you finish editing. + +Rotate 90 (Counterclockwise) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Rotate selected nodes -90 degree. + Align To ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Align selected nodes with center anchor globally or selected nodes' center locally. Normally, the center anchor(a Triangle) is not show up, you can turn on the Part Mirror to make it visible, then turn Part Mirror off, the center anchor would not gone once showed. diff --git a/dust3d.pro b/dust3d.pro index ed017c2e..c7cd74a8 100644 --- a/dust3d.pro +++ b/dust3d.pro @@ -11,7 +11,7 @@ isEmpty(VERSION) { REPOSITORY_URL = "https://github.com/huxingyi/dust3d" ISSUES_URL = "https://github.com/huxingyi/dust3d/issues" -REFERENCE_GUIDE_URL = "https://dust3d.readthedocs.io" +REFERENCE_GUIDE_URL = "http://docs.dust3d.org" QMAKE_TARGET_COMPANY = Dust3D QMAKE_TARGET_PRODUCT = Dust3D diff --git a/src/skeletondocumentwindow.cpp b/src/skeletondocumentwindow.cpp index ac95d81c..60d07b2d 100644 --- a/src/skeletondocumentwindow.cpp +++ b/src/skeletondocumentwindow.cpp @@ -304,6 +304,18 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() : connect(m_flipVerticallyAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::flipVertically); m_editMenu->addAction(m_flipVerticallyAction); + m_rotateClockwiseAction = new QAction(tr("Rotate 90 (Clockwise)"), this); + connect(m_rotateClockwiseAction, &QAction::triggered, [=] { + m_graphicsWidget->rotateClockwise90Degree(); + }); + m_editMenu->addAction(m_rotateClockwiseAction); + + m_rotateCounterclockwiseAction = new QAction(tr("Rotate 90 (Counterclockwise)"), this); + connect(m_rotateCounterclockwiseAction, &QAction::triggered, [=] { + m_graphicsWidget->rotateCounterclockwise90Degree(); + }); + m_editMenu->addAction(m_rotateCounterclockwiseAction); + m_alignToMenu = new QMenu(tr("Align To")); m_alignToGlobalCenterAction = new QAction(tr("Global Center"), this); @@ -376,6 +388,8 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() : m_pasteAction->setEnabled(m_document->hasPastableContentInClipboard()); m_flipHorizontallyAction->setEnabled(m_graphicsWidget->hasMultipleSelection()); m_flipVerticallyAction->setEnabled(m_graphicsWidget->hasMultipleSelection()); + m_rotateClockwiseAction->setEnabled(m_graphicsWidget->hasMultipleSelection()); + m_rotateCounterclockwiseAction->setEnabled(m_graphicsWidget->hasMultipleSelection()); m_alignToGlobalCenterAction->setEnabled(m_graphicsWidget->hasSelection() && m_document->originSettled()); m_alignToGlobalVerticalCenterAction->setEnabled(m_graphicsWidget->hasSelection() && m_document->originSettled()); m_alignToGlobalHorizontalCenterAction->setEnabled(m_graphicsWidget->hasSelection() && m_document->originSettled()); diff --git a/src/skeletondocumentwindow.h b/src/skeletondocumentwindow.h index f13c1450..6deaf72b 100644 --- a/src/skeletondocumentwindow.h +++ b/src/skeletondocumentwindow.h @@ -94,6 +94,8 @@ private: QAction *m_pasteAction; QAction *m_flipHorizontallyAction; QAction *m_flipVerticallyAction; + QAction *m_rotateClockwiseAction; + QAction *m_rotateCounterclockwiseAction; QMenu *m_alignToMenu; QAction *m_alignToGlobalCenterAction; diff --git a/src/skeletongraphicswidget.cpp b/src/skeletongraphicswidget.cpp index bceecca1..6aea4302 100644 --- a/src/skeletongraphicswidget.cpp +++ b/src/skeletongraphicswidget.cpp @@ -174,6 +174,18 @@ void SkeletonGraphicsWidget::showContextMenu(const QPoint &pos) contextMenu.addAction(&flipVerticallyAction); } + QAction rotateClockwiseAction(tr("Rotate 90 (Clockwise)"), this); + if (hasMultipleSelection()) { + connect(&rotateClockwiseAction, &QAction::triggered, this, &SkeletonGraphicsWidget::rotateClockwise90Degree); + contextMenu.addAction(&rotateClockwiseAction); + } + + QAction rotateCounterclockwiseAction(tr("Rotate 90 (Counterclockwise)"), this); + if (hasMultipleSelection()) { + connect(&rotateCounterclockwiseAction, &QAction::triggered, this, &SkeletonGraphicsWidget::rotateCounterclockwise90Degree); + contextMenu.addAction(&rotateCounterclockwiseAction); + } + QAction alignToLocalCenterAction(tr("Local Center"), this); QAction alignToLocalVerticalCenterAction(tr("Local Vertical Center"), this); QAction alignToLocalHorizontalCenterAction(tr("Local Horizontal Center"), this); @@ -921,6 +933,7 @@ void SkeletonGraphicsWidget::flipHorizontally() if (nodeItems.empty()) return; QVector2D center = centerOfNodeItemSet(nodeItems); + emit batchChangeBegin(); for (const auto &nodeItem: nodeItems) { QPointF origin = nodeItem->origin(); float offset = origin.x() - center.x(); @@ -931,6 +944,8 @@ void SkeletonGraphicsWidget::flipHorizontally() emit moveNodeBy(nodeItem->id(), 0, 0, unifiedOffset); } } + emit batchChangeEnd(); + emit groupOperationAdded(); } void SkeletonGraphicsWidget::flipVertically() @@ -940,12 +955,31 @@ void SkeletonGraphicsWidget::flipVertically() if (nodeItems.empty()) return; QVector2D center = centerOfNodeItemSet(nodeItems); + emit batchChangeBegin(); for (const auto &nodeItem: nodeItems) { QPointF origin = nodeItem->origin(); float offset = origin.y() - center.y(); float unifiedOffset = -sceneRadiusToUnified(offset * 2); emit moveNodeBy(nodeItem->id(), 0, unifiedOffset, 0); } + emit batchChangeEnd(); + emit groupOperationAdded(); +} + +void SkeletonGraphicsWidget::rotateClockwise90Degree() +{ + emit batchChangeBegin(); + emit rotateSelected(90); + emit batchChangeEnd(); + emit groupOperationAdded(); +} + +void SkeletonGraphicsWidget::rotateCounterclockwise90Degree() +{ + emit batchChangeBegin(); + emit rotateSelected(360 - 90); + emit batchChangeEnd(); + emit groupOperationAdded(); } bool SkeletonGraphicsWidget::mouseRelease(QMouseEvent *event) diff --git a/src/skeletongraphicswidget.h b/src/skeletongraphicswidget.h index 7b559c71..70855606 100644 --- a/src/skeletongraphicswidget.h +++ b/src/skeletongraphicswidget.h @@ -436,6 +436,8 @@ public slots: void copy(); void flipHorizontally(); void flipVertically(); + void rotateClockwise90Degree(); + void rotateCounterclockwise90Degree(); void removeAllContent(); void breakSelected(); void connectSelected();