Camera orbit bugfixes

This commit is contained in:
parax0 2015-11-27 14:18:22 -07:00
parent c549cdcf42
commit 4bad61acec
8 changed files with 21 additions and 5 deletions

View File

@ -78,8 +78,8 @@ void CWaypointExtra::LinksModified()
void CWaypointExtra::AddToRenderer(CRenderer *pRenderer, const SViewInfo& ViewInfo)
{
// This call is necessary because if we try to build links in the constructor, it'll
// fail because we haven't finished loading the scene yet.
// This call is necessary because if we try to build links in the constructor, it
// won't work properly because we haven't finished loading the scene yet.
if (!mLinksBuilt) BuildLinks();
if (!ViewInfo.GameMode && mpParent->IsVisible() && !mpParent->IsSelected())

View File

@ -113,9 +113,10 @@ void CSceneViewport::keyPressEvent(QKeyEvent* pEvent)
{
CBasicViewport::keyPressEvent(pEvent);
if (!pEvent->modifiers() && pEvent->key() == Qt::Key_Z)
if (!pEvent->modifiers() && pEvent->key() == Qt::Key_Z && !pEvent->isAutoRepeat())
{
mCamera.SetMoveMode(eOrbitCamera);
emit CameraOrbit();
}
}
@ -123,7 +124,7 @@ void CSceneViewport::keyReleaseEvent(QKeyEvent* pEvent)
{
CBasicViewport::keyReleaseEvent(pEvent);
if (pEvent->key() == Qt::Key_Z)
if (pEvent->key() == Qt::Key_Z && !pEvent->isAutoRepeat())
{
mCamera.SetMoveMode(eFreeCamera);
}

View File

@ -39,6 +39,7 @@ public:
signals:
void GizmoMoved();
void CameraOrbit();
protected slots:
void CheckUserInput();

View File

@ -64,8 +64,9 @@ CWorldEditor::CWorldEditor(QWidget *parent) :
// Connect signals and slots
connect(ui->MainViewport, SIGNAL(GizmoMoved()), this, SLOT(OnGizmoMoved()));
connect(ui->MainViewport, SIGNAL(GizmoMoved()), this, SLOT(UpdateCameraOrbit()));
connect(ui->MainViewport, SIGNAL(CameraOrbit()), this, SLOT(UpdateCameraOrbit()));
connect(this, SIGNAL(SelectionModified()), this, SLOT(UpdateCameraOrbit()));
connect(this, SIGNAL(SelectionTransformed()), this, SLOT(UpdateCameraOrbit()));
connect(ui->TransformSpinBox, SIGNAL(ValueChanged(CVector3f)), this, SLOT(OnTransformSpinBoxModified(CVector3f)));
connect(ui->TransformSpinBox, SIGNAL(EditingDone(CVector3f)), this, SLOT(OnTransformSpinBoxEdited(CVector3f)));
connect(ui->CamSpeedSpinBox, SIGNAL(valueChanged(double)), this, SLOT(OnCameraSpeedChange(double)));

View File

@ -62,6 +62,7 @@ public:
signals:
void SelectionModified();
void SelectionTransformed();
public slots:
void OnGizmoMoved();

View File

@ -27,6 +27,8 @@ CRotateNodeCommand::CRotateNodeCommand(INodeEditor *pEditor, const QList<CSceneN
rotate.newRot = pNode->LocalRotation();
mNodeList.push_back(rotate);
}
mpEditor->SelectionTransformed();
}
CRotateNodeCommand::~CRotateNodeCommand()
@ -78,6 +80,7 @@ void CRotateNodeCommand::undo()
}
mpEditor->RecalculateSelectionBounds();
mpEditor->SelectionTransformed();
mpEditor->UpdateGizmoUI();
}
@ -92,6 +95,7 @@ void CRotateNodeCommand::redo()
}
mpEditor->RecalculateSelectionBounds();
mpEditor->SelectionTransformed();
mpEditor->UpdateGizmoUI();
}

View File

@ -27,6 +27,8 @@ CScaleNodeCommand::CScaleNodeCommand(INodeEditor *pEditor, const QList<CSceneNod
scale.newScale = pNode->LocalScale();
mNodeList.push_back(scale);
}
mpEditor->SelectionTransformed();
}
CScaleNodeCommand::~CScaleNodeCommand()
@ -78,6 +80,7 @@ void CScaleNodeCommand::undo()
}
mpEditor->RecalculateSelectionBounds();
mpEditor->SelectionTransformed();
mpEditor->UpdateGizmoUI();
}
@ -92,6 +95,7 @@ void CScaleNodeCommand::redo()
}
mpEditor->RecalculateSelectionBounds();
mpEditor->SelectionTransformed();
mpEditor->UpdateGizmoUI();
}

View File

@ -25,6 +25,8 @@ CTranslateNodeCommand::CTranslateNodeCommand(INodeEditor *pEditor, const QList<C
translate.newPos = pNode->LocalPosition();
mNodeList.push_back(translate);
}
mpEditor->SelectionTransformed();
}
CTranslateNodeCommand::~CTranslateNodeCommand()
@ -70,6 +72,7 @@ void CTranslateNodeCommand::undo()
translate.pNode->SetPosition(translate.initialPos);
mpEditor->RecalculateSelectionBounds();
mpEditor->SelectionTransformed();
mpEditor->UpdateGizmoUI();
}
@ -81,6 +84,7 @@ void CTranslateNodeCommand::redo()
translate.pNode->SetPosition(translate.newPos);
mpEditor->RecalculateSelectionBounds();
mpEditor->SelectionTransformed();
mpEditor->UpdateGizmoUI();
}