From 7a3648ef4e884429dbe4bb60ab5a0a838bc5abfc Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Thu, 16 Feb 2017 17:38:52 +0000 Subject: Introduce QAbstractAnimationClip and rename QAnimationClip Introduced an abstract base class for types of animation clip. Also renamed QAnimationClip to QAnimationClipLoader since it loads data from files. Also renamed corresponding backend type and fixed up unit tests accordingly. Task-number: QTBUG-58898 Change-Id: I01a96e108cbbcd12e01913693e96610598965018 Reviewed-by: Kevin Ottens --- src/animation/frontend/qanimationclip.cpp | 120 ------------------------------ 1 file changed, 120 deletions(-) delete mode 100644 src/animation/frontend/qanimationclip.cpp (limited to 'src/animation/frontend/qanimationclip.cpp') diff --git a/src/animation/frontend/qanimationclip.cpp b/src/animation/frontend/qanimationclip.cpp deleted file mode 100644 index 56fe3978c..000000000 --- a/src/animation/frontend/qanimationclip.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qanimationclip.h" -#include "qanimationclip_p.h" -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DAnimation { - -QAnimationClipPrivate::QAnimationClipPrivate() - : Qt3DCore::QNodePrivate() - , m_duration(0.0f) -{ -} - -void QAnimationClipPrivate::setDuration(float duration) -{ - if (qFuzzyCompare(duration, m_duration)) - return; - - Q_Q(QAnimationClip); - bool wasBlocked = q->blockNotifications(true); - m_duration = duration; - emit q->durationChanged(duration); - q->blockNotifications(wasBlocked); -} - -QAnimationClip::QAnimationClip(Qt3DCore::QNode *parent) - : Qt3DCore::QNode(*new QAnimationClipPrivate, parent) -{ -} - -QAnimationClip::QAnimationClip(QAnimationClipPrivate &dd, Qt3DCore::QNode *parent) - : Qt3DCore::QNode(dd, parent) -{ -} - -QAnimationClip::~QAnimationClip() -{ -} - -QUrl QAnimationClip::source() const -{ - Q_D(const QAnimationClip); - return d->m_source; -} - -float QAnimationClip::duration() const -{ - Q_D(const QAnimationClip); - return d->m_duration; -} - -void QAnimationClip::setSource(QUrl source) -{ - Q_D(QAnimationClip); - if (d->m_source == source) - return; - - d->m_source = source; - emit sourceChanged(source); -} - -void QAnimationClip::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) -{ - Q_D(QAnimationClip); - if (change->type() == Qt3DCore::PropertyUpdated) { - Qt3DCore::QPropertyUpdatedChangePtr e = qSharedPointerCast(change); - if (e->propertyName() == QByteArrayLiteral("duration")) - d->setDuration(e->value().toFloat()); - } -} - -Qt3DCore::QNodeCreatedChangeBasePtr QAnimationClip::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QAnimationClip); - data.source = d->m_source; - return creationChange; -} - -} // namespace Qt3DAnimation - -QT_END_NAMESPACE -- cgit v1.2.3 From e72efe886d21edb18db9e297cf48ce690b87b282 Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Tue, 4 Apr 2017 10:05:23 +0100 Subject: Add QAnimationClip class Analogous to QAnimationClipLoader but gets the animation data from the application rather than from a baked file. Change-Id: I85cb29fb021e6969b82b814077f68eeef5927f04 Reviewed-by: Mike Krus --- src/animation/frontend/qanimationclip.cpp | 94 +++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 src/animation/frontend/qanimationclip.cpp (limited to 'src/animation/frontend/qanimationclip.cpp') diff --git a/src/animation/frontend/qanimationclip.cpp b/src/animation/frontend/qanimationclip.cpp new file mode 100644 index 000000000..d9a1eb979 --- /dev/null +++ b/src/animation/frontend/qanimationclip.cpp @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qanimationclip.h" +#include "qanimationclip_p.h" + +QT_BEGIN_NAMESPACE + +namespace Qt3DAnimation { + +QAnimationClipPrivate::QAnimationClipPrivate() + : QAbstractAnimationClipPrivate() + , m_clipData() +{ +} + +QAnimationClip::QAnimationClip(Qt3DCore::QNode *parent) + : QAbstractAnimationClip(*new QAnimationClipPrivate, parent) +{ +} + +QAnimationClip::QAnimationClip(QAnimationClipPrivate &dd, Qt3DCore::QNode *parent) + : QAbstractAnimationClip(dd, parent) +{ +} + +QAnimationClip::~QAnimationClip() +{ +} + +QAnimationClipData QAnimationClip::clipData() const +{ + Q_D(const QAnimationClip); + return d->m_clipData; +} + +void QAnimationClip::setClipData(const Qt3DAnimation::QAnimationClipData &clipData) +{ + Q_D(QAnimationClip); + if (d->m_clipData == clipData) + return; + + d->m_clipData = clipData; + emit clipDataChanged(clipData); +} + +Qt3DCore::QNodeCreatedChangeBasePtr QAnimationClip::createNodeCreationChange() const +{ + auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); + auto &data = creationChange->data; + Q_D(const QAnimationClip); + // TODO: Send data members in creation change + return creationChange; +} + +} // namespace Qt3DAnimation + +QT_END_NAMESPACE -- cgit v1.2.3 From e8c351478fe9f2b8bb5381480fbb3637855f145e Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Wed, 5 Apr 2017 16:10:59 +0100 Subject: Start adding support for programmatic clips to the backend node Change-Id: I7503f87550487528956cd97606a24e25cf2e5144 Reviewed-by: Mike Krus --- src/animation/frontend/qanimationclip.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/animation/frontend/qanimationclip.cpp') diff --git a/src/animation/frontend/qanimationclip.cpp b/src/animation/frontend/qanimationclip.cpp index d9a1eb979..c21d94b02 100644 --- a/src/animation/frontend/qanimationclip.cpp +++ b/src/animation/frontend/qanimationclip.cpp @@ -85,7 +85,7 @@ Qt3DCore::QNodeCreatedChangeBasePtr QAnimationClip::createNodeCreationChange() c auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); auto &data = creationChange->data; Q_D(const QAnimationClip); - // TODO: Send data members in creation change + data.clipData = d->m_clipData; return creationChange; } -- cgit v1.2.3