summaryrefslogtreecommitdiffstats
path: root/editorlib/src/editorscene.cpp
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2016-06-13 10:30:32 +0300
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2016-06-13 08:19:21 +0000
commitdc8bbd27ac5a85115838f9219458a7097501c37b (patch)
tree2695ee326812d8b8cc7de26a69f4f7085097bc48 /editorlib/src/editorscene.cpp
parent22af34b58ad8dd57e428215198611f27f6ac71c7 (diff)
Fix drag translating of camera that was broken by recent changes
Change-Id: I2b90fc69eb493c954528d9659c485db3aa7257c3 Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'editorlib/src/editorscene.cpp')
-rw-r--r--editorlib/src/editorscene.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/editorlib/src/editorscene.cpp b/editorlib/src/editorscene.cpp
index 7d9843e..27112c0 100644
--- a/editorlib/src/editorscene.cpp
+++ b/editorlib/src/editorscene.cpp
@@ -877,7 +877,7 @@ void EditorScene::dragTranslateSelectedEntity(const QPoint &newPos, bool shiftDo
// If entity has parents with transfroms, those need to be applied in inverse
QMatrix4x4 totalTransform = EditorUtils::totalAncestralTransform(m_selectedEntity);
- if (m_dragHandleIndex == 0) {
+ if (m_dragHandleIndex == 0 && !cameraEntity) {
intersection = totalTransform.inverted()
* (intersection + m_dragHandlesTransform->rotation()
* m_dragHandleTranslateTransform->translation());
@@ -2045,12 +2045,6 @@ void EditorScene::handleSelectionTransformChange()
m_viewport->width(), m_viewport->height(),
m_dragHandlesTransform->matrix() * QVector3D());
- QVector3D itemCenterHandlePos = EditorUtils::projectRay(
- camera->viewMatrix(), camera->projectionMatrix(),
- m_viewport->width(), m_viewport->height(),
- m_dragHandlesTransform->matrix() * m_dragHandleTranslateTransform->matrix()
- * QVector3D());
-
QVector3D cornerHandlePositions[dragCornerHandleCount];
for (int i = 0; i < dragCornerHandleCount; i++) {
m_dragHandleScaleTransforms.at(i)->setTranslation(
@@ -2111,9 +2105,22 @@ void EditorScene::handleSelectionTransformChange()
}
QPoint translatePoint(translateHandlePos.x(), translateHandlePos.y());
- QPoint centerPoint(itemCenterHandlePos.x(), itemCenterHandlePos.y());
- bool showCenterHandle = translatePoint != centerPoint;
+ QPoint centerPoint;
+ QVector3D itemCenterHandlePos;
+ bool showCenterHandle = false;
+ if (item->itemType() != EditorSceneItem::Camera
+ && item->itemType() != EditorSceneItem::Light) {
+ itemCenterHandlePos = EditorUtils::projectRay(
+ camera->viewMatrix(), camera->projectionMatrix(),
+ m_viewport->width(), m_viewport->height(),
+ m_dragHandlesTransform->matrix() * m_dragHandleTranslateTransform->matrix()
+ * QVector3D());
+
+ centerPoint = QPoint(itemCenterHandlePos.x(), itemCenterHandlePos.y());
+ showCenterHandle = translatePoint != centerPoint;
+ }
+
m_meshCenterIndicatorLine->setEnabled(showCenterHandle);
if (showCenterHandle) {
QQuaternion rot = QQuaternion::rotationTo(QVector3D(0.0f, 0.0f, 1.0f),