summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2017-08-26 15:32:11 +0100
committerSean Harmer <sean.harmer@kdab.com>2017-09-02 18:10:37 +0000
commitbbc14b772c323476a5cc41c1da06921f4e3dbf3e (patch)
tree3d203ed3e74e7209f98004e213a4de5b418d8b92 /src
parentdf1d871a83b415313a02415366dd0682944ad211 (diff)
Extend QChannel and Channel to support jointIndex members
Needed for animartion aspect support of skeletons. Change-Id: I89027a62ffcac68318ef8c8645b4720e71ff1697 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/animation/backend/fcurve.cpp4
-rw-r--r--src/animation/backend/fcurve_p.h1
-rw-r--r--src/animation/frontend/qchannel.cpp11
-rw-r--r--src/animation/frontend/qchannel.h3
4 files changed, 19 insertions, 0 deletions
diff --git a/src/animation/backend/fcurve.cpp b/src/animation/backend/fcurve.cpp
index 4db5d2169..edb2b6df8 100644
--- a/src/animation/backend/fcurve.cpp
+++ b/src/animation/backend/fcurve.cpp
@@ -186,6 +186,9 @@ void ChannelComponent::setFromQChannelComponent(const QChannelComponent &qcc)
void Channel::read(const QJsonObject &json)
{
name = json[QLatin1String("channelName")].toString();
+ const auto jointIndexValue = json[QLatin1String("jointIndex")];
+ if (!jointIndexValue.isUndefined())
+ jointIndex = jointIndexValue.toInt();
const QJsonArray channelComponentsArray = json[QLatin1String("channelComponents")].toArray();
const int channelCount = channelComponentsArray.size();
channelComponents.resize(channelCount);
@@ -199,6 +202,7 @@ void Channel::read(const QJsonObject &json)
void Channel::setFromQChannel(const QChannel &qch)
{
name = qch.name();
+ jointIndex = qch.jointIndex();
channelComponents.resize(qch.channelComponentCount());
int i = 0;
for (const auto &frontendChannelComponent : qch)
diff --git a/src/animation/backend/fcurve_p.h b/src/animation/backend/fcurve_p.h
index 7ab1593d1..f2148d1e9 100644
--- a/src/animation/backend/fcurve_p.h
+++ b/src/animation/backend/fcurve_p.h
@@ -133,6 +133,7 @@ inline QDebug operator<<(QDebug dbg, const ChannelComponent &channelComponent)
struct Channel
{
QString name;
+ int jointIndex = -1;
QVector<ChannelComponent> channelComponents;
void read(const QJsonObject &json);
diff --git a/src/animation/frontend/qchannel.cpp b/src/animation/frontend/qchannel.cpp
index 9c74fad09..f5e4ac7a3 100644
--- a/src/animation/frontend/qchannel.cpp
+++ b/src/animation/frontend/qchannel.cpp
@@ -50,6 +50,7 @@ class QChannelPrivate
public:
QVector<QChannelComponent> m_channelComponents;
QString m_name;
+ int m_jointIndex = -1;
};
QChannel::QChannel()
@@ -90,6 +91,16 @@ QString QChannel::name() const
return d->m_name;
}
+void QChannel::setJointIndex(int jointIndex)
+{
+ d->m_jointIndex = jointIndex;
+}
+
+int QChannel::jointIndex() const
+{
+ return d->m_jointIndex;
+}
+
int QChannel::channelComponentCount() const
{
return d->m_channelComponents.size();
diff --git a/src/animation/frontend/qchannel.h b/src/animation/frontend/qchannel.h
index b94780689..50e574756 100644
--- a/src/animation/frontend/qchannel.h
+++ b/src/animation/frontend/qchannel.h
@@ -63,6 +63,9 @@ public:
void setName(const QString &name);
QString name() const;
+ void setJointIndex(int jointIndex);
+ int jointIndex() const;
+
int channelComponentCount() const;
void appendChannelComponent(const QChannelComponent &component);
void insertChannelComponent(int index, const QChannelComponent &component);