summaryrefslogtreecommitdiffstats
path: root/src/core/transforms
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2017-08-21 22:13:43 +0100
committerSean Harmer <sean.harmer@kdab.com>2017-08-30 12:59:18 +0000
commitdab7c73e04cf850819827c3e4c4e7bea6e1a223c (patch)
tree4bc7f15f15f13c5e06304be33e943cefa7919cad /src/core/transforms
parent2a772a50b6001b1e12dd3cdee4128f5b534c36c3 (diff)
Add name property to QJoint
And set it from the backend when creating frontend joints. Change-Id: I26d37c7f516944eb353af38716aab4c55bd2f79f Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/core/transforms')
-rw-r--r--src/core/transforms/qjoint.cpp17
-rw-r--r--src/core/transforms/qjoint.h4
-rw-r--r--src/core/transforms/qjoint_p.h2
3 files changed, 23 insertions, 0 deletions
diff --git a/src/core/transforms/qjoint.cpp b/src/core/transforms/qjoint.cpp
index 57603b54f..84d75d55d 100644
--- a/src/core/transforms/qjoint.cpp
+++ b/src/core/transforms/qjoint.cpp
@@ -310,6 +310,16 @@ void QJoint::setRotationZ(float rotationZ)
blockNotifications(wasBlocked);
}
+void QJoint::setName(const QString &name)
+{
+ Q_D(QJoint);
+ if (d->m_name == name)
+ return;
+
+ d->m_name = name;
+ emit nameChanged(name);
+}
+
/*!
Adds \a joint as a child of this joint. If \a joint has no parent, then
this joint takes ownership of it. Child joints are in the coordinate system
@@ -366,6 +376,12 @@ QVector<QJoint *> QJoint::childJoints() const
return d->m_childJoints;
}
+QString QJoint::name() const
+{
+ Q_D(const QJoint);
+ return d->m_name;
+}
+
/*! \internal */
Qt3DCore::QNodeCreatedChangeBasePtr QJoint::createNodeCreationChange() const
{
@@ -377,6 +393,7 @@ Qt3DCore::QNodeCreatedChangeBasePtr QJoint::createNodeCreationChange() const
data.rotation = d->m_rotation;
data.scale = d->m_scale;
data.translation = d->m_translation;
+ data.name = d->m_name;
return creationChange;
}
diff --git a/src/core/transforms/qjoint.h b/src/core/transforms/qjoint.h
index 3160d74ab..732cfdddb 100644
--- a/src/core/transforms/qjoint.h
+++ b/src/core/transforms/qjoint.h
@@ -63,6 +63,7 @@ class QT3DCORESHARED_EXPORT QJoint : public QNode
Q_PROPERTY(float rotationX READ rotationX WRITE setRotationX NOTIFY rotationXChanged)
Q_PROPERTY(float rotationY READ rotationY WRITE setRotationY NOTIFY rotationYChanged)
Q_PROPERTY(float rotationZ READ rotationZ WRITE setRotationZ NOTIFY rotationZChanged)
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
public:
explicit QJoint(Qt3DCore::QNode *parent = nullptr);
@@ -75,6 +76,7 @@ public:
float rotationX() const;
float rotationY() const;
float rotationZ() const;
+ QString name() const;
void addChildJoint(QJoint *joint);
void removeChildJoint(QJoint *joint);
@@ -88,6 +90,7 @@ public Q_SLOTS:
void setRotationX(float rotationX);
void setRotationY(float rotationY);
void setRotationZ(float rotationZ);
+ void setName(const QString &name);
Q_SIGNALS:
void scaleChanged(const QVector3D &scale);
@@ -97,6 +100,7 @@ Q_SIGNALS:
void rotationXChanged(float rotationX);
void rotationYChanged(float rotationY);
void rotationZChanged(float rotationZ);
+ void nameChanged(const QString &name);
private:
Q_DECLARE_PRIVATE(QJoint)
diff --git a/src/core/transforms/qjoint_p.h b/src/core/transforms/qjoint_p.h
index f7ab244bd..82439d55a 100644
--- a/src/core/transforms/qjoint_p.h
+++ b/src/core/transforms/qjoint_p.h
@@ -72,6 +72,7 @@ public:
QQuaternion m_rotation;
QVector3D m_translation;
QVector3D m_scale;
+ QString m_name;
// Not sent to backend. Purely internal convenience
QVector3D m_eulerRotationAngles;
@@ -84,6 +85,7 @@ struct QJointData
QQuaternion rotation;
QVector3D translation;
QVector3D scale;
+ QString name;
};
} // namespace Qt3DCore