diff options
author | Mahmoud Badri <mahmoud.badri@qt.io> | 2019-08-16 21:34:44 +0300 |
---|---|---|
committer | Mahmoud Badri <mahmoud.badri@qt.io> | 2019-08-19 16:11:55 +0300 |
commit | a133b3cab2c3c5b01153a106e6efa5ab738a6ae9 (patch) | |
tree | d38cb83c1a79609354fa29dbc8fea055ae7b957a | |
parent | 24b489ea4dba40431e29fbd18cc0afac8d718c42 (diff) |
Cleanup Qt3DSDMAnimation.h
Some tweaks, method renamings. This should be merged after the
ogl-runtime commit 3fd04bb21795172e1d4d05cd69546652e20b7317
Change-Id: Ie5c7c2690cf375c7f6a8f7ddaf088ee4c0d40dd6
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Janne Kangas <janne.kangas@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
10 files changed, 33 insertions, 34 deletions
diff --git a/src/Authoring/Client/Code/Core/Commands/CmdDataModelChangeKeyframe.h b/src/Authoring/Client/Code/Core/Commands/CmdDataModelChangeKeyframe.h index 692e9634..99b33509 100644 --- a/src/Authoring/Client/Code/Core/Commands/CmdDataModelChangeKeyframe.h +++ b/src/Authoring/Client/Code/Core/Commands/CmdDataModelChangeKeyframe.h @@ -61,7 +61,7 @@ public: // Construction { qt3dsdm::IAnimationCore *theAnimationCore = m_Doc->GetStudioSystem()->GetAnimationCore(); qt3dsdm::TKeyframe theKeyframe = theAnimationCore->GetKeyframeData(m_Keyframe); - theKeyframe = SetKeyframeSeconds(theKeyframe, m_Value); + theKeyframe = setKeyframeTime(theKeyframe, m_Value); theAnimationCore->SetKeyframeData(m_Keyframe, theKeyframe); } @@ -93,7 +93,7 @@ public: // Construction { qt3dsdm::IAnimationCore *theAnimationCore = m_Doc->GetStudioSystem()->GetAnimationCore(); qt3dsdm::TKeyframe theKeyframe = theAnimationCore->GetKeyframeData(m_Keyframe); - theKeyframe = SetKeyframeValue(theKeyframe, m_Value); + theKeyframe = setKeyframeValue(theKeyframe, m_Value); theAnimationCore->SetKeyframeData(m_Keyframe, theKeyframe); } diff --git a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp index 8e3796be..e5bda07a 100644 --- a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp +++ b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp @@ -2835,10 +2835,10 @@ public: TKeyframe kfData = m_AnimationCore.GetKeyframeData(inKeyframe); // offset control points for bezier keyframes - offsetBezier(kfData, timeInSecs - GetKeyframeSeconds(kfData)); + offsetBezier(kfData, timeInSecs - getKeyframeTime(kfData)); // Functional programming paradigm, returns new value instead of changing current value. - kfData = qt3dsdm::SetKeyframeSeconds(kfData, timeInSecs); + kfData = qt3dsdm::setKeyframeTime(kfData, timeInSecs); m_AnimationCore.SetKeyframeData(inKeyframe, kfData); } diff --git a/src/Authoring/Client/Code/Core/Doc/IComposerSerializer.cpp b/src/Authoring/Client/Code/Core/Doc/IComposerSerializer.cpp index b0d4c626..96ca4937 100644 --- a/src/Authoring/Client/Code/Core/Doc/IComposerSerializer.cpp +++ b/src/Authoring/Client/Code/Core/Doc/IComposerSerializer.cpp @@ -976,7 +976,7 @@ struct SComposerSerializerImpl : public IComposerSerializer SMetaDataPropertyInfo thePropertyInfo( m_MetaData.GetMetaDataPropertyInfo(theMetaDataProperty)); wstring theName = thePropertyInfo.m_Name.wide_str(); - size_t theArity = GetDatatypeAnimatableArity(thePropertyInfo.GetDataType()); + size_t theArity = getDatatypeAnimatableArity(thePropertyInfo.GetDataType()); if (theArity > 1) { theName.append(L"."); switch (theInfo.m_Index) { @@ -1080,7 +1080,7 @@ struct SComposerSerializerImpl : public IComposerSerializer return; } SMetaDataPropertyInfo theInfo(m_MetaData.GetMetaDataPropertyInfo(theProperty)); - size_t theArity = GetDatatypeAnimatableArity(theInfo.GetDataType()); + size_t theArity = getDatatypeAnimatableArity(theInfo.GetDataType()); if (theArity == 0 || theArity <= subIndex) { QT3DS_ASSERT(false); return; diff --git a/src/Authoring/QT3DSIMP/Qt3DSImportLib/Qt3DSImport.cpp b/src/Authoring/QT3DSIMP/Qt3DSImportLib/Qt3DSImport.cpp index b6be2041..df6e7279 100644 --- a/src/Authoring/QT3DSIMP/Qt3DSImportLib/Qt3DSImport.cpp +++ b/src/Authoring/QT3DSIMP/Qt3DSImportLib/Qt3DSImport.cpp @@ -1153,7 +1153,7 @@ public: SImportComposerTypes theTypes; SImportAsset &theAsset(theTypes.GetImportAssetForType(inType)); DataModelDataType::Value theType(theAsset.GetPropertyDataType(thePropName.wide_str())); - size_t arity = GetDatatypeAnimatableArity(theType); + size_t arity = getDatatypeAnimatableArity(theType); if (arity == 0) { QT3DS_ASSERT(false); return; diff --git a/src/Authoring/QT3DSIMP/Qt3DSImportLib/Qt3DSImport.h b/src/Authoring/QT3DSIMP/Qt3DSImportLib/Qt3DSImport.h index bc988166..02bbbe2e 100644 --- a/src/Authoring/QT3DSIMP/Qt3DSImportLib/Qt3DSImport.h +++ b/src/Authoring/QT3DSIMP/Qt3DSImportLib/Qt3DSImport.h @@ -359,7 +359,7 @@ public: void AddAnimation(TCharPtr instance, const SImportPropertyDefinition<TDataType> &inProperty, QT3DSU32 subPropIndex, EAnimationType type, NVConstDataRef<QT3DSF32> values) { - size_t arity = GetDatatypeAnimatableArity(TypeToDataType<TDataType>()); + size_t arity = getDatatypeAnimatableArity(TypeToDataType<TDataType>()); if (arity) { if (subPropIndex >= arity) { QT3DS_ASSERT(false); diff --git a/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp b/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp index 68a04fe9..bc9cefe7 100644 --- a/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp +++ b/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp @@ -97,7 +97,7 @@ void Qt3DSDMTimelineItemProperty::CreateKeyframes() DataModelDataType::Value theDataType = thePropertySystem->GetDataType(m_PropertyHandle); IStudioAnimationSystem *theAnimationSystem = m_TransMgr->GetStudioSystem()->GetAnimationSystem(); - size_t arity = GetDatatypeAnimatableArity(theDataType); + size_t arity = getDatatypeAnimatableArity(theDataType); for (size_t i = 0; i < arity; ++i) { Qt3DSDMAnimationHandle theAnimationHandle = theAnimationSystem->GetControllingAnimation(m_InstanceHandle, m_PropertyHandle, i); @@ -387,16 +387,16 @@ bool Qt3DSDMTimelineItemProperty::CreateKeyframeIfNonExistent( if (m_AnimationHandles.size() > 1) { // assert assumption that is only called for the first handle Q_ASSERT(m_AnimationHandles[0] == inOwningAnimation); - IAnimationCore *theAnimationCore = m_TransMgr->GetStudioSystem()->GetAnimationCore(); - float theKeyframeTime = KeyframeTime(theAnimationCore->GetKeyframeData(inKeyframeHandle)); + IAnimationCore *animCore = m_TransMgr->GetStudioSystem()->GetAnimationCore(); + float keyframeTime = getKeyframeTime(animCore->GetKeyframeData(inKeyframeHandle)); for (size_t i = 1; i < m_AnimationHandles.size(); ++i) { TKeyframeHandleList theKeyframes; - theAnimationCore->GetKeyframes(m_AnimationHandles[i], theKeyframes); + animCore->GetKeyframes(m_AnimationHandles[i], theKeyframes); // the data model ensures that there is only 1 keyframe created for a given time for (size_t theKeyIndex = 0; theKeyIndex < theKeyframes.size(); ++theKeyIndex) { float theValue = - KeyframeTime(theAnimationCore->GetKeyframeData(theKeyframes[theKeyIndex])); - if (theValue == theKeyframeTime) { + getKeyframeTime(animCore->GetKeyframeData(theKeyframes[theKeyIndex])); + if (theValue == keyframeTime) { theNewKeyframe->AddKeyframeHandle(theKeyframes[theKeyIndex]); break; } diff --git a/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineKeyframe.cpp b/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineKeyframe.cpp index 238ee360..d447307c 100644 --- a/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineKeyframe.cpp +++ b/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineKeyframe.cpp @@ -64,11 +64,10 @@ float my_roundf(float r) long Qt3DSDMTimelineKeyframe::GetTime() const { if (!m_KeyframeHandles.empty()) { - IAnimationCore *theAnimationCore = m_Doc->GetStudioSystem()->GetAnimationCore(); - Qt3DSDMKeyframeHandle theKeyframeHandle = *m_KeyframeHandles.begin(); - if (theAnimationCore->KeyframeValid(theKeyframeHandle)) { - float theTimeinSecs = - KeyframeTime(theAnimationCore->GetKeyframeData(theKeyframeHandle)); + IAnimationCore *animaCore = m_Doc->GetStudioSystem()->GetAnimationCore(); + Qt3DSDMKeyframeHandle kfHandle = *m_KeyframeHandles.begin(); + if (animaCore->KeyframeValid(kfHandle)) { + float theTimeinSecs = getKeyframeTime(animaCore->GetKeyframeData(kfHandle)); // We always convert back and forth between between long and float. // This causes especially issues when we do comparisons return (long)my_roundf(theTimeinSecs * 1000); @@ -106,7 +105,7 @@ void Qt3DSDMTimelineKeyframe::SetTime(const long inNewTime) // we have a precision issue from converting from long to float.. IAnimationCore *theAnimationCore = m_Doc->GetStudioSystem()->GetAnimationCore(); long theTest = static_cast<long>( - KeyframeTime(theAnimationCore->GetKeyframeData(*m_KeyframeHandles.begin())) * 1000); + getKeyframeTime(theAnimationCore->GetKeyframeData(*m_KeyframeHandles.begin())) * 1000); Q_ASSERT(inNewTime == theTest); #endif } diff --git a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/KeyframeManager.cpp b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/KeyframeManager.cpp index 9d75edad..7d037fd8 100644 --- a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/KeyframeManager.cpp +++ b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/KeyframeManager.cpp @@ -568,7 +568,7 @@ void KeyframeManager::SetKeyframeInterpolation() float easeIn = CStudioPreferences::GetInterpolation() ? 100 : 0; float easeOut = CStudioPreferences::GetInterpolation() ? 100 : 0; - GetEaseInOutValues(keyframeData, easeIn, easeOut); + getEaseInOutValues(keyframeData, easeIn, easeOut); if (g_StudioApp.GetDialogs()->displayKeyframeInterpolation(easeIn, easeOut)) { // Having "editor" variable here is important as its destructor creates proper transaction @@ -579,7 +579,7 @@ void KeyframeManager::SetKeyframeInterpolation() keyframe->binding->GetKeyframeHandles(keyframeHandles); for (size_t i = 0; i < keyframeHandles.size(); ++i) { TKeyframe keyframeData = animCore->GetKeyframeData(keyframeHandles[i]); - SetEaseInOutValues(keyframeData, easeIn, easeOut); + setEaseInOutValues(keyframeData, easeIn, easeOut); animCore->SetKeyframeData(keyframeHandles[i], keyframeData); } } diff --git a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTimelineContextMenu.cpp b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTimelineContextMenu.cpp index c6b2a062..c7d88be7 100644 --- a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTimelineContextMenu.cpp +++ b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTimelineContextMenu.cpp @@ -239,8 +239,8 @@ void RowTimelineContextMenu::onAnimTypeChange(QAction *action) QVector<SLinearKeyframe> keyframes; for (Qt3DSDMKeyframeHandle kfHandle : keyframeHandles) { TKeyframe kfData = animCore->GetKeyframeData(kfHandle); - keyframes.append(SLinearKeyframe(KeyframeTime(kfData), - KeyframeValueValue(kfData))); + keyframes.append(SLinearKeyframe(getKeyframeTime(kfData), + getKeyframeValue(kfData))); } long numFloatsPerKeyframe = sizeof(SLinearKeyframe) / sizeof(float); long numValues = long(keyframeHandles.size()) * numFloatsPerKeyframe; @@ -254,8 +254,8 @@ void RowTimelineContextMenu::onAnimTypeChange(QAction *action) QVector<SEaseInEaseOutKeyframe> keyframes; for (Qt3DSDMKeyframeHandle kfHandle : keyframeHandles) { TKeyframe kfData = animCore->GetKeyframeData(kfHandle); - keyframes.append(SEaseInEaseOutKeyframe(KeyframeTime(kfData), - KeyframeValueValue(kfData), + keyframes.append(SEaseInEaseOutKeyframe(getKeyframeTime(kfData), + getKeyframeValue(kfData), easeIn, easeOut)); } long numFloatsPerKeyframe = sizeof(SEaseInEaseOutKeyframe) / sizeof(float); @@ -268,8 +268,8 @@ void RowTimelineContextMenu::onAnimTypeChange(QAction *action) QVector<SBezierKeyframe> keyframes; for (Qt3DSDMKeyframeHandle kfHandle : keyframeHandles) { TKeyframe kfData = animCore->GetKeyframeData(kfHandle); - float kfTime = KeyframeTime(kfData); - float kfValue = KeyframeValueValue(kfData); + float kfTime = getKeyframeTime(kfData); + float kfValue = getKeyframeValue(kfData); keyframes.append(SBezierKeyframe(kfTime, kfValue, kfTime - .5f, kfValue, kfTime + .5f, kfValue)); diff --git a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTimelinePropertyGraph.cpp b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTimelinePropertyGraph.cpp index 7fd54e93..b12dbea7 100644 --- a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTimelinePropertyGraph.cpp +++ b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTimelinePropertyGraph.cpp @@ -110,7 +110,7 @@ void RowTimelinePropertyGraph::paintGraphs(QPainter *painter, const QRectF &rect m_animCore->GetKeyframes(m_activeChannels[0], keyframeHandles); for (size_t i = 0; i < keyframeHandles.size(); ++i) { TKeyframe kf = m_animCore->GetKeyframeData(keyframeHandles[i]); - QPointF centerPos = getKeyframePosition(GetKeyframeSeconds(kf), KeyframeValueValue(kf)) + QPointF centerPos = getKeyframePosition(getKeyframeTime(kf), getKeyframeValue(kf)) + edgeOffset; painter->drawLine(centerPos.x(), rect.y(), centerPos.x(), rect.height()); } @@ -318,11 +318,11 @@ void RowTimelinePropertyGraph::updateBezierControlValue(TimelineControlType cont m_animCore->GetKeyframes(anim, keyframeHandles); for (size_t i = 0; i < keyframeHandles.size(); ++i) { if (keyframeHandles[i] == m_currKeyframeData.first) { - float currKfTime = KeyframeTime(m_animCore->GetKeyframeData(keyframeHandles[i])); + float currKfTime = getKeyframeTime(m_animCore->GetKeyframeData(keyframeHandles[i])); float prevKfTime = i > 0 - ? KeyframeTime(m_animCore->GetKeyframeData(keyframeHandles[i - 1])) : -FLT_MAX; + ? getKeyframeTime(m_animCore->GetKeyframeData(keyframeHandles[i - 1])) : -FLT_MAX; float nextKfTime = i < keyframeHandles.size() - 1 - ? KeyframeTime(m_animCore->GetKeyframeData(keyframeHandles[i + 1])) : FLT_MAX; + ? getKeyframeTime(m_animCore->GetKeyframeData(keyframeHandles[i + 1])) : FLT_MAX; if (isBezierIn) { if (time < prevKfTime) time = prevKfTime; @@ -384,7 +384,7 @@ void RowTimelinePropertyGraph::fitGraph() m_animCore->GetKeyframes(m_activeChannels[i], keyframeHandles); for (auto kfHandle : keyframeHandles) { TKeyframe keyframeData = m_animCore->GetKeyframeData(kfHandle); - float value = KeyframeValueValue(keyframeData); + float value = getKeyframeValue(keyframeData); if (value < minVal) minVal = value; if (value > maxVal) @@ -450,7 +450,7 @@ void RowTimelinePropertyGraph::selectBezierKeyframesInRange(const QRectF &rect) for (auto kfHandle : keyframeHandles) { SBezierKeyframe kf = get<SBezierKeyframe>(m_animCore->GetKeyframeData(kfHandle)); - QPointF kfPosition = getKeyframePosition(KeyframeTime(kf), KeyframeValueValue(kf)); + QPointF kfPosition = getKeyframePosition(getKeyframeTime(kf), getKeyframeValue(kf)); if (localRect.contains(kfPosition)) m_selectedBezierKeyframes.insert(kfHandle); else |