From 319481d3bb532e65f76b00e77510c458b029516f Mon Sep 17 00:00:00 2001 From: Mahmoud Badri Date: Wed, 6 Jun 2018 13:17:52 +0300 Subject: Allow drag-select keyframes from an object row Currently only possible to drag-select keyframes from property rows Task-number: QT3DS-1886 Change-Id: I6673e5ec52a73d48f0c9cd98abc7a53a63915ee0 Reviewed-by: Miikka Heikkinen --- .../Palettes/TimelineGraphicsView/KeyframeManager.cpp | 7 +++---- .../Palettes/TimelineGraphicsView/ui/RowTimeline.cpp | 15 ++------------- .../Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.h | 2 +- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/KeyframeManager.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/KeyframeManager.cpp index e234e99e..570c3981 100644 --- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/KeyframeManager.cpp +++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/KeyframeManager.cpp @@ -173,11 +173,10 @@ void KeyframeManager::selectKeyframesInRect(const QRectF &rect) m_scene->rowManager()->clampIndex(idx1); m_scene->rowManager()->clampIndex(idx2); - RowTimeline *rowTimeline; for (int i = idx1; i <= idx2; ++i) { - rowTimeline = m_scene->rowManager()->rowTimelineAt(i); + RowTimeline *rowTimeline = m_scene->rowManager()->rowTimelineAt(i); - if (rowTimeline != nullptr) { + if (rowTimeline) { const auto keyframes = rowTimeline->getKeyframesInRange(rect.left(), rect.right()); for (auto keyframe : keyframes) { if (!m_selectedKeyframes.contains(keyframe)) { @@ -402,7 +401,7 @@ bool KeyframeManager::hasSelectedKeyframes() const bool KeyframeManager::hasCopiedKeyframes() const { - return m_pasteKeyframeCommandHelper != nullptr && + return m_pasteKeyframeCommandHelper && m_pasteKeyframeCommandHelper->HasCopiedKeyframes(); } diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp index 0c58f7dd..e768283d 100644 --- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp +++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp @@ -285,26 +285,15 @@ Keyframe *RowTimeline::getClickedKeyframe(const QPointF &scenePos) return nullptr; } -QList RowTimeline::getKeyframesInRange(const double left, const double right) +QList RowTimeline::getKeyframesInRange(double left, double right) { double x; double x1 = mapFromScene(left, 0).x(); double x2 = mapFromScene(right, 0).x(); QList result; - QList keyframes; - if (m_rowTree->hasPropertyChildren()) { - const auto childRows = m_rowTree->childRows(); - for (auto child : childRows) { - if (child->isProperty()) - keyframes.append(child->rowTimeline()->m_keyframes); - } - } else { - keyframes = m_keyframes; - } - - for (auto keyframe : qAsConst(keyframes)) { + for (auto keyframe : qAsConst(m_keyframes)) { x = timeToX(keyframe->time); if (x1 < x && x2 > x) diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.h index 3c12a26a..831c02e0 100644 --- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.h +++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.h @@ -76,7 +76,7 @@ public: RowTimeline *parentRow() const; RowTree *rowTree() const; Keyframe *getClickedKeyframe(const QPointF &scenePos); - QList getKeyframesInRange(const double left, const double right); + QList getKeyframesInRange(double left, double right); QList keyframes() const; void showToolTip(const QPointF &pos); -- cgit v1.2.3