diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2017-04-07 16:40:55 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2017-04-12 18:37:29 +0000 |
commit | 7fccf4f96efab3daaeef7fceceaeea776b50ff0a (patch) | |
tree | a33eb9fd85f7d32b298d157522c5f02bf72e3bec /src/animation | |
parent | 90667286d9ab851f6735fc53dd7aaa3881167b3d (diff) |
Rename AnimationClipLoader to AnimationClip
It handles both loadign from file and from data constructed using the
public API.
Change-Id: Ic9e71dc60c36869548323312f7129df6c9edd763
Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'src/animation')
17 files changed, 49 insertions, 49 deletions
diff --git a/src/animation/backend/animationcliploader.cpp b/src/animation/backend/animationclip.cpp index 36390a284..6a3c3c15b 100644 --- a/src/animation/backend/animationcliploader.cpp +++ b/src/animation/backend/animationclip.cpp @@ -34,7 +34,7 @@ ** ****************************************************************************/ -#include "animationcliploader_p.h" +#include "animationclip_p.h" #include <Qt3DAnimation/qanimationclip.h> #include <Qt3DAnimation/qanimationcliploader.h> #include <Qt3DAnimation/private/qanimationclip_p.h> @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE namespace Qt3DAnimation { namespace Animation { -AnimationClipLoader::AnimationClipLoader() +AnimationClip::AnimationClip() : BackendNode(ReadWrite) , m_source() , m_status(QAnimationClipLoader::NotReady) @@ -66,7 +66,7 @@ AnimationClipLoader::AnimationClipLoader() { } -void AnimationClipLoader::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) +void AnimationClip::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) { const auto loaderTypedChange = qSharedPointerDynamicCast<Qt3DCore::QNodeCreatedChange<QAnimationClipLoaderData>>(change); if (loaderTypedChange) { @@ -89,7 +89,7 @@ void AnimationClipLoader::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeB } } -void AnimationClipLoader::cleanup() +void AnimationClip::cleanup() { setEnabled(false); m_handler = nullptr; @@ -103,7 +103,7 @@ void AnimationClipLoader::cleanup() clearData(); } -void AnimationClipLoader::setStatus(QAnimationClipLoader::Status status) +void AnimationClip::setStatus(QAnimationClipLoader::Status status) { if (status != m_status) { m_status = status; @@ -115,7 +115,7 @@ void AnimationClipLoader::setStatus(QAnimationClipLoader::Status status) } } -void AnimationClipLoader::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) +void AnimationClip::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) { switch (e->type()) { case Qt3DCore::PropertyUpdated: { @@ -143,7 +143,7 @@ void AnimationClipLoader::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) \internal Called by LoadAnimationClipJob on the threadpool */ -void AnimationClipLoader::loadAnimation() +void AnimationClip::loadAnimation() { qCDebug(Jobs) << Q_FUNC_INFO << m_source; clearData(); @@ -179,7 +179,7 @@ void AnimationClipLoader::loadAnimation() qCDebug(Jobs) << "Loaded animation data:" << *this; } -void AnimationClipLoader::loadAnimationFromUrl() +void AnimationClip::loadAnimationFromUrl() { // TODO: Handle remote files QString filePath = Qt3DRender::QUrlHelper::urlToLocalFileOrQrc(m_source); @@ -215,7 +215,7 @@ void AnimationClipLoader::loadAnimationFromUrl() } } -void AnimationClipLoader::loadAnimationFromData() +void AnimationClip::loadAnimationFromData() { // Reformat data from QAnimationClipData to backend format m_channels.resize(m_clipData.channelCount()); @@ -224,7 +224,7 @@ void AnimationClipLoader::loadAnimationFromData() m_channels[i++].setFromQChannel(frontendChannel); } -void AnimationClipLoader::setDuration(float duration) +void AnimationClip::setDuration(float duration) { if (qFuzzyCompare(duration, m_duration)) return; @@ -239,7 +239,7 @@ void AnimationClipLoader::setDuration(float duration) notifyObservers(e); } -int AnimationClipLoader::channelIndex(const QString &channelName) const +int AnimationClip::channelIndex(const QString &channelName) const { const int channelCount = m_channels.size(); for (int i = 0; i < channelCount; ++i) { @@ -259,7 +259,7 @@ int AnimationClipLoader::channelIndex(const QString &channelName) const for the first group, so the first channel of the second group occurs at index 3. */ -int AnimationClipLoader::channelComponentBaseIndex(int channelIndex) const +int AnimationClip::channelComponentBaseIndex(int channelIndex) const { int index = 0; for (int i = 0; i < channelIndex; ++i) @@ -267,13 +267,13 @@ int AnimationClipLoader::channelComponentBaseIndex(int channelIndex) const return index; } -void AnimationClipLoader::clearData() +void AnimationClip::clearData() { m_name.clear(); m_channels.clear(); } -float AnimationClipLoader::findDuration() +float AnimationClip::findDuration() { // Iterate over the contained fcurves and find the longest one double tMax = 0.0; @@ -287,7 +287,7 @@ float AnimationClipLoader::findDuration() return tMax; } -int AnimationClipLoader::findChannelComponentCount() +int AnimationClip::findChannelComponentCount() { int channelCount = 0; for (const Channel &channel : qAsConst(m_channels)) diff --git a/src/animation/backend/animationcliploader_p.h b/src/animation/backend/animationclip_p.h index b9f21615c..286ec38c0 100644 --- a/src/animation/backend/animationcliploader_p.h +++ b/src/animation/backend/animationclip_p.h @@ -61,10 +61,10 @@ namespace Animation { class Handler; -class Q_AUTOTEST_EXPORT AnimationClipLoader : public BackendNode +class Q_AUTOTEST_EXPORT AnimationClip : public BackendNode { public: - AnimationClipLoader(); + AnimationClip(); void cleanup(); void setSource(const QUrl &source) { m_source = source; } @@ -118,7 +118,7 @@ private: }; #ifndef QT_NO_DEBUG_STREAM -inline QDebug operator<<(QDebug dbg, const AnimationClipLoader &animationClip) +inline QDebug operator<<(QDebug dbg, const AnimationClip &animationClip) { QDebugStateSaver saver(dbg); dbg << "QNodeId =" << animationClip.peerId() << endl diff --git a/src/animation/backend/animationutils.cpp b/src/animation/backend/animationutils.cpp index f0f2c3bbb..c9c7c29d4 100644 --- a/src/animation/backend/animationutils.cpp +++ b/src/animation/backend/animationutils.cpp @@ -84,7 +84,7 @@ int componentsForType(int type) return componentCount; } -ClipEvaluationData evaluationDataForClip(AnimationClipLoader *clip, +ClipEvaluationData evaluationDataForClip(AnimationClip *clip, const AnimatorEvaluationData &animatorData) { // global time values expected in seconds @@ -185,7 +185,7 @@ ComponentIndices channelComponentsToIndicesHelper(const Channel &channel, return indices; } -ClipResults evaluateClipAtLocalTime(AnimationClipLoader *clip, float localTime) +ClipResults evaluateClipAtLocalTime(AnimationClip *clip, float localTime) { QVector<float> channelResults; Q_ASSERT(clip); @@ -203,7 +203,7 @@ ClipResults evaluateClipAtLocalTime(AnimationClipLoader *clip, float localTime) return channelResults; } -ClipResults evaluateClipAtPhase(AnimationClipLoader *clip, float phase) +ClipResults evaluateClipAtPhase(AnimationClip *clip, float phase) { // Calculate the clip local time from the phase and clip duration const double localTime = phase * clip->duration(); @@ -293,7 +293,7 @@ QVector<Qt3DCore::QSceneChangePtr> preparePropertyChanges(Qt3DCore::QNodeId anim //TODO: Remove this and use new implementation below for both the unblended // and blended animation cases. QVector<MappingData> buildPropertyMappings(Handler *handler, - const AnimationClipLoader *clip, + const AnimationClip *clip, const ChannelMapper *mapper) { QVector<MappingData> mappingDataVec; @@ -468,7 +468,7 @@ QVector<Qt3DCore::QNodeId> gatherValueNodesToEvaluate(Handler *handler, ComponentIndices generateClipFormatIndices(const QVector<ChannelNameAndType> &targetChannels, const QVector<ComponentIndices> &targetIndices, - const AnimationClipLoader *clip) + const AnimationClip *clip) { Q_ASSERT(targetChannels.size() == targetIndices.size()); diff --git a/src/animation/backend/animationutils_p.h b/src/animation/backend/animationutils_p.h index 178e69b9b..f8fcbafa7 100644 --- a/src/animation/backend/animationutils_p.h +++ b/src/animation/backend/animationutils_p.h @@ -60,7 +60,7 @@ namespace Animation { struct Channel; class BlendedClipAnimator; class Handler; -class AnimationClipLoader; +class AnimationClip; class ChannelMapper; class ChannelMapping; @@ -128,7 +128,7 @@ Q_AUTOTEST_EXPORT int componentsForType(int type); Q_AUTOTEST_EXPORT -ClipEvaluationData evaluationDataForClip(AnimationClipLoader *clip, +ClipEvaluationData evaluationDataForClip(AnimationClip *clip, const AnimatorEvaluationData &animatorData); Q_AUTOTEST_EXPORT @@ -143,11 +143,11 @@ ComponentIndices channelComponentsToIndicesHelper(const Channel &channelGroup, const QVector<char> &suffixes); Q_AUTOTEST_EXPORT -ClipResults evaluateClipAtLocalTime(AnimationClipLoader *clip, +ClipResults evaluateClipAtLocalTime(AnimationClip *clip, float localTime); Q_AUTOTEST_EXPORT -ClipResults evaluateClipAtPhase(AnimationClipLoader *clip, +ClipResults evaluateClipAtPhase(AnimationClip *clip, float phase); Q_AUTOTEST_EXPORT @@ -158,7 +158,7 @@ QVector<Qt3DCore::QSceneChangePtr> preparePropertyChanges(Qt3DCore::QNodeId anim Q_AUTOTEST_EXPORT QVector<MappingData> buildPropertyMappings(Handler *handler, - const AnimationClipLoader *clip, + const AnimationClip *clip, const ChannelMapper *mapper); Q_AUTOTEST_EXPORT @@ -190,7 +190,7 @@ QVector<Qt3DCore::QNodeId> gatherValueNodesToEvaluate(Handler *handler, Q_AUTOTEST_EXPORT ComponentIndices generateClipFormatIndices(const QVector<ChannelNameAndType> &targetChannels, const QVector<ComponentIndices> &targetIndices, - const AnimationClipLoader *clip); + const AnimationClip *clip); Q_AUTOTEST_EXPORT ClipResults formatClipResults(const ClipResults &rawClipResults, diff --git a/src/animation/backend/backend.pri b/src/animation/backend/backend.pri index ec87ee2a2..2bc72e1d3 100644 --- a/src/animation/backend/backend.pri +++ b/src/animation/backend/backend.pri @@ -23,10 +23,10 @@ HEADERS += \ $$PWD/animationutils_p.h \ $$PWD/buildblendtreesjob_p.h \ $$PWD/evaluateblendclipanimatorjob_p.h \ - $$PWD/animationcliploader_p.h \ $$PWD/lerpclipblend_p.h \ $$PWD/additiveclipblend_p.h \ - $$PWD/clipblendvalue_p.h + $$PWD/clipblendvalue_p.h \ + $$PWD/animationclip_p.h SOURCES += \ $$PWD/handler.cpp \ @@ -47,7 +47,7 @@ SOURCES += \ $$PWD/animationutils.cpp \ $$PWD/buildblendtreesjob.cpp \ $$PWD/evaluateblendclipanimatorjob.cpp \ - $$PWD/animationcliploader.cpp \ $$PWD/lerpclipblend.cpp \ $$PWD/additiveclipblend.cpp \ - $$PWD/clipblendvalue.cpp + $$PWD/clipblendvalue.cpp \ + $$PWD/animationclip.cpp diff --git a/src/animation/backend/buildblendtreesjob.cpp b/src/animation/backend/buildblendtreesjob.cpp index d2fd5c03e..ac95808bc 100644 --- a/src/animation/backend/buildblendtreesjob.cpp +++ b/src/animation/backend/buildblendtreesjob.cpp @@ -95,7 +95,7 @@ void BuildBlendTreesJob::run() Q_ASSERT(valueNode); const Qt3DCore::QNodeId clipId = valueNode->clipId(); - const AnimationClipLoader *clip = m_handler->animationClipLoaderManager()->lookupResource(clipId); + const AnimationClip *clip = m_handler->animationClipLoaderManager()->lookupResource(clipId); Q_ASSERT(clip); const ComponentIndices formatIndices diff --git a/src/animation/backend/clipanimator.cpp b/src/animation/backend/clipanimator.cpp index 8ba759a36..65fd0f57f 100644 --- a/src/animation/backend/clipanimator.cpp +++ b/src/animation/backend/clipanimator.cpp @@ -37,7 +37,7 @@ #include "clipanimator_p.h" #include <Qt3DAnimation/qclipanimator.h> #include <Qt3DAnimation/private/qclipanimator_p.h> -#include <Qt3DAnimation/private/animationcliploader_p.h> +#include <Qt3DAnimation/private/animationclip_p.h> #include <Qt3DAnimation/private/managers_p.h> #include <Qt3DAnimation/private/animationlogging_p.h> #include <Qt3DCore/qpropertyupdatedchange.h> diff --git a/src/animation/backend/clipblendvalue.cpp b/src/animation/backend/clipblendvalue.cpp index 8a9262faa..2d4ed99d2 100644 --- a/src/animation/backend/clipblendvalue.cpp +++ b/src/animation/backend/clipblendvalue.cpp @@ -84,7 +84,7 @@ double ClipBlendValue::duration() const { if (m_clipId.isNull()) return 0.0; - AnimationClipLoader *clip = m_handler->animationClipLoaderManager()->lookupResource(m_clipId); + AnimationClip *clip = m_handler->animationClipLoaderManager()->lookupResource(m_clipId); Q_ASSERT(clip); return clip->duration(); } diff --git a/src/animation/backend/evaluateblendclipanimatorjob.cpp b/src/animation/backend/evaluateblendclipanimatorjob.cpp index 08e6689ca..df4466d1c 100644 --- a/src/animation/backend/evaluateblendclipanimatorjob.cpp +++ b/src/animation/backend/evaluateblendclipanimatorjob.cpp @@ -91,7 +91,7 @@ void EvaluateBlendClipAnimatorJob::run() for (const auto valueNodeId : valueNodeIdsToEvaluate) { ClipBlendValue *valueNode = static_cast<ClipBlendValue *>(blendNodeManager->lookupNode(valueNodeId)); Q_ASSERT(valueNode); - AnimationClipLoader *clip = clipLoaderManager->lookupResource(valueNode->clipId()); + AnimationClip *clip = clipLoaderManager->lookupResource(valueNode->clipId()); Q_ASSERT(clip); ClipResults rawClipResults = evaluateClipAtPhase(clip, phase); diff --git a/src/animation/backend/evaluateclipanimatorjob.cpp b/src/animation/backend/evaluateclipanimatorjob.cpp index b8cad20cb..e89405d63 100644 --- a/src/animation/backend/evaluateclipanimatorjob.cpp +++ b/src/animation/backend/evaluateclipanimatorjob.cpp @@ -63,7 +63,7 @@ void EvaluateClipAnimatorJob::run() Q_ASSERT(clipAnimator); // Evaluate the fcurves - AnimationClipLoader *clip = m_handler->animationClipLoaderManager()->lookupResource(clipAnimator->clipId()); + AnimationClip *clip = m_handler->animationClipLoaderManager()->lookupResource(clipAnimator->clipId()); Q_ASSERT(clip); // Prepare for evaluation (convert global time to local time ....) const AnimatorEvaluationData animatorEvaluationData = evaluationDataForAnimator(clipAnimator, globalTime); diff --git a/src/animation/backend/findrunningclipanimatorsjob.cpp b/src/animation/backend/findrunningclipanimatorsjob.cpp index d5599c0fe..80739a02b 100644 --- a/src/animation/backend/findrunningclipanimatorsjob.cpp +++ b/src/animation/backend/findrunningclipanimatorsjob.cpp @@ -73,7 +73,7 @@ void FindRunningClipAnimatorsJob::run() // TODO: Should be possible to parallelise this with the fcurve evaluation as // sending the property change events doesn't happen until after evaluation if (canRun) { - const AnimationClipLoader *clip = m_handler->animationClipLoaderManager()->lookupResource(clipAnimator->clipId()); + const AnimationClip *clip = m_handler->animationClipLoaderManager()->lookupResource(clipAnimator->clipId()); const ChannelMapper *mapper = m_handler->channelMapperManager()->lookupResource(clipAnimator->mapperId()); Q_ASSERT(clip && mapper); const QVector<MappingData> mappingData = buildPropertyMappings(m_handler, clip, mapper); diff --git a/src/animation/backend/handle_types_p.h b/src/animation/backend/handle_types_p.h index f5093783b..f6f77eb20 100644 --- a/src/animation/backend/handle_types_p.h +++ b/src/animation/backend/handle_types_p.h @@ -58,13 +58,13 @@ QT_BEGIN_NAMESPACE namespace Qt3DAnimation { namespace Animation { -class AnimationClipLoader; +class AnimationClip; class ClipAnimator; class BlendedClipAnimator; class ChannelMapping; class ChannelMapper; -typedef Qt3DCore::QHandle<AnimationClipLoader, 16> HAnimationClip; +typedef Qt3DCore::QHandle<AnimationClip, 16> HAnimationClip; typedef Qt3DCore::QHandle<ClipAnimator, 16> HClipAnimator; typedef Qt3DCore::QHandle<BlendedClipAnimator, 12> HBlendedClipAnimator; typedef Qt3DCore::QHandle<ChannelMapping, 16> HChannelMapping; diff --git a/src/animation/backend/handler_p.h b/src/animation/backend/handler_p.h index dcabf6088..52892f9d0 100644 --- a/src/animation/backend/handler_p.h +++ b/src/animation/backend/handler_p.h @@ -63,7 +63,7 @@ class tst_Handler; namespace Qt3DAnimation { namespace Animation { -class AnimationClipLoader; +class AnimationClip; class AnimationClipLoaderManager; class ClipAnimator; class ClipAnimatorManager; diff --git a/src/animation/backend/loadanimationclipjob.cpp b/src/animation/backend/loadanimationclipjob.cpp index 152b60a58..c0201e0e9 100644 --- a/src/animation/backend/loadanimationclipjob.cpp +++ b/src/animation/backend/loadanimationclipjob.cpp @@ -36,7 +36,7 @@ #include "loadanimationclipjob_p.h" -#include <Qt3DAnimation/private/animationcliploader_p.h> +#include <Qt3DAnimation/private/animationclip_p.h> #include <Qt3DAnimation/private/handler_p.h> #include <Qt3DAnimation/private/managers_p.h> #include <Qt3DAnimation/private/job_common_p.h> @@ -71,7 +71,7 @@ void LoadAnimationClipJob::run() Q_ASSERT(m_handler); AnimationClipLoaderManager *animationClipManager = m_handler->animationClipLoaderManager(); for (const auto animationClipHandle : qAsConst(m_animationClipHandles)) { - AnimationClipLoader *animationClip = animationClipManager->data(animationClipHandle); + AnimationClip *animationClip = animationClipManager->data(animationClipHandle); animationClip->loadAnimation(); } diff --git a/src/animation/backend/managers_p.h b/src/animation/backend/managers_p.h index 1680dc7bf..f99ed0698 100644 --- a/src/animation/backend/managers_p.h +++ b/src/animation/backend/managers_p.h @@ -53,7 +53,7 @@ #include <QtGlobal> #include <Qt3DAnimation/private/handle_types_p.h> -#include <Qt3DAnimation/private/animationcliploader_p.h> +#include <Qt3DAnimation/private/animationclip_p.h> #include <Qt3DAnimation/private/blendedclipanimator_p.h> #include <Qt3DAnimation/private/clipanimator_p.h> #include <Qt3DAnimation/private/channelmapping_p.h> @@ -68,7 +68,7 @@ namespace Animation { class ClipBlendNode; class AnimationClipLoaderManager : public Qt3DCore::QResourceManager< - AnimationClipLoader, + AnimationClip, Qt3DCore::QNodeId, 16, Qt3DCore::ArrayAllocatingPolicy> @@ -135,7 +135,7 @@ private: } // namespace Animation } // namespace Qt3DAnimation -Q_DECLARE_RESOURCE_INFO(Qt3DAnimation::Animation::AnimationClipLoader, Q_REQUIRES_CLEANUP) +Q_DECLARE_RESOURCE_INFO(Qt3DAnimation::Animation::AnimationClip, Q_REQUIRES_CLEANUP) Q_DECLARE_RESOURCE_INFO(Qt3DAnimation::Animation::ClipAnimator, Q_REQUIRES_CLEANUP) Q_DECLARE_RESOURCE_INFO(Qt3DAnimation::Animation::BlendedClipAnimator, Q_REQUIRES_CLEANUP) Q_DECLARE_RESOURCE_INFO(Qt3DAnimation::Animation::ChannelMapping, Q_REQUIRES_CLEANUP) diff --git a/src/animation/frontend/frontend.pri b/src/animation/frontend/frontend.pri index 129bb9782..9ea438395 100644 --- a/src/animation/frontend/frontend.pri +++ b/src/animation/frontend/frontend.pri @@ -32,7 +32,7 @@ HEADERS += \ $$PWD/qvertexblendanimation.h \ $$PWD/qvertexblendanimation_p.h \ $$PWD/qanimationcliploader.h \ - $$PWD/qanimationcliploader_p.h \ + $$PWD/qanimationclip_p.h \ $$PWD/qlerpclipblend.h \ $$PWD/qlerpclipblend_p.h \ $$PWD/qadditiveclipblend.h \ diff --git a/src/animation/frontend/qanimationaspect.cpp b/src/animation/frontend/qanimationaspect.cpp index 4270531f6..00f97d5b6 100644 --- a/src/animation/frontend/qanimationaspect.cpp +++ b/src/animation/frontend/qanimationaspect.cpp @@ -94,7 +94,7 @@ QAnimationAspect::QAnimationAspect(QAnimationAspectPrivate &dd, QObject *parent) qRegisterMetaType<Qt3DAnimation::QChannelMapper*>(); registerBackendType<QAbstractAnimationClip>( - QSharedPointer<Animation::NodeFunctor<Animation::AnimationClipLoader, Animation::AnimationClipLoaderManager>>::create(d->m_handler.data(), + QSharedPointer<Animation::NodeFunctor<Animation::AnimationClip, Animation::AnimationClipLoaderManager>>::create(d->m_handler.data(), d->m_handler->animationClipLoaderManager())); registerBackendType<QClipAnimator>( QSharedPointer<Animation::NodeFunctor<Animation::ClipAnimator, Animation::ClipAnimatorManager>>::create(d->m_handler.data(), |