diff options
author | Mahmoud Badri <mahmoud.badri@qt.io> | 2019-08-20 09:51:22 +0300 |
---|---|---|
committer | Mahmoud Badri <mahmoud.badri@qt.io> | 2019-08-20 13:00:19 +0300 |
commit | 4b0bfbaf222b2a732e61a13cb32ec0e8376dfd8b (patch) | |
tree | be7fbc44919f0eb27413b94e9313c648c88cbbd3 /src/Authoring/Qt3DStudio/Palettes | |
parent | 53c5ed746a611befd2932a0434619d4c5a17e126 (diff) |
Fix crash when undoing change animation type
Also correct locked state for the curves
Task-number: QT3DS-3881
Change-Id: Ia710d9735d6478f6a5307cb2736aeb12ca7f263f
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/Authoring/Qt3DStudio/Palettes')
3 files changed, 14 insertions, 5 deletions
diff --git a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineWidget.cpp b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineWidget.cpp index 9be51e9c..66159d27 100644 --- a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineWidget.cpp +++ b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineWidget.cpp @@ -619,6 +619,10 @@ void TimelineWidget::onAnimationCreated(qt3dsdm::Qt3DSDMInstanceHandle parentIns } propRow->update(); + } else { + // prop binding exists in the case of undoing changing animation type. Must refresh the + // recreated animation handles within the prop binding + propBinding->getRowTree()->refreshPropBinding(); } } } diff --git a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp index 61bf727f..cb8d3480 100644 --- a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp +++ b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp @@ -556,7 +556,7 @@ TimelineControlType RowTimeline::getClickedControl(const QPointF &scenePos, bool p.setX(p.x() - TimelineConstants::RULER_EDGE_OFFSET); if (!m_rowTree->hasDurationBar()) { - if (m_propertyGraph) + if (m_propertyGraph && !m_rowTree->locked()) return m_propertyGraph->getClickedBezierControl(p, isHover); return TimelineControlType::None; diff --git a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTimelinePropertyGraph.cpp b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTimelinePropertyGraph.cpp index 14615598..b05aca0f 100644 --- a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTimelinePropertyGraph.cpp +++ b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTimelinePropertyGraph.cpp @@ -116,6 +116,7 @@ void RowTimelinePropertyGraph::paintGraphs(QPainter *painter, const QRectF &rect } // draw channel curves + painter->setPen(CStudioPreferences::studioColor3()); // default to locked color for (size_t i = 0; i < m_activeChannels.size(); ++i) { QPainterPath path; int start_j = qMax(rect.x(), edgeOffset.x()); @@ -139,7 +140,8 @@ void RowTimelinePropertyGraph::paintGraphs(QPainter *painter, const QRectF &rect CStudioPreferences::GetWAxisColor() }; - painter->setPen(QPen(chColors[m_activeChannelsIndex[i]], 1)); + if (!m_rowTimeline->rowTree()->locked()) + painter->setPen(chColors[m_activeChannelsIndex[i]]); painter->drawPath(path); } @@ -158,7 +160,8 @@ void RowTimelinePropertyGraph::paintGraphs(QPainter *painter, const QRectF &rect QPointF centerPos = getBezierControlPosition(kf) + edgeOffset; const QPointF PIX_HALF_W = QPointF(8.0, 8.0); - bool kfSelected = m_selectedBezierKeyframes.contains(kfHandle); + bool kfSelected = m_selectedBezierKeyframes.contains(kfHandle) + && !m_rowTimeline->rowTree()->locked(); if (kfSelected) { // draw tangent-in part painter->setPen(CStudioPreferences::getBezierControlColor()); @@ -183,8 +186,10 @@ void RowTimelinePropertyGraph::paintGraphs(QPainter *painter, const QRectF &rect } // draw center point - painter->setPen(QPen(CStudioPreferences::getBezierControlColor(), kfSelected - ? 6 : 3)); + painter->setPen(QPen(m_rowTimeline->rowTree()->locked() + ? CStudioPreferences::studioColor3() + : CStudioPreferences::getBezierControlColor(), kfSelected + ? 6 : 3)); painter->drawPoint(centerPos); } } |