summaryrefslogtreecommitdiffstats
path: root/src/core/nodes
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/nodes')
-rw-r--r--src/core/nodes/propertychangehandler_p.h11
-rw-r--r--src/core/nodes/qabstractnodefactory_p.h3
-rw-r--r--src/core/nodes/qbackendnode.cpp30
-rw-r--r--src/core/nodes/qbackendnode.h8
-rw-r--r--src/core/nodes/qbackendnode_p.h6
-rw-r--r--src/core/nodes/qcomponent.cpp8
-rw-r--r--src/core/nodes/qcomponent_p.h4
-rw-r--r--src/core/nodes/qdestructionidandtypecollector_p.h2
-rw-r--r--src/core/nodes/qentity.cpp13
-rw-r--r--src/core/nodes/qentity.h3
-rw-r--r--src/core/nodes/qentity_p.h7
-rw-r--r--src/core/nodes/qnode.cpp181
-rw-r--r--src/core/nodes/qnode.h38
-rw-r--r--src/core/nodes/qnode_p.h16
-rw-r--r--src/core/nodes/qnodecreatedchangegenerator.cpp1
-rw-r--r--src/core/nodes/qnodecreatedchangegenerator_p.h5
-rw-r--r--src/core/nodes/qnodeid.cpp2
-rw-r--r--src/core/nodes/qnodeid.h2
-rw-r--r--src/core/nodes/qnodevisitor_p.h4
19 files changed, 222 insertions, 122 deletions
diff --git a/src/core/nodes/propertychangehandler_p.h b/src/core/nodes/propertychangehandler_p.h
index e91df5016..4bcfdef75 100644
--- a/src/core/nodes/propertychangehandler_p.h
+++ b/src/core/nodes/propertychangehandler_p.h
@@ -52,12 +52,11 @@
//
#include <Qt3DCore/qt3dcore_global.h>
-
-#include <QObject>
-#include <QHash>
-#include <QVector>
-#include <QMetaMethod>
-#include <QDebug>
+#include <QtCore/QDebug>
+#include <QtCore/QHash>
+#include <QtCore/QMetaMethod>
+#include <QtCore/QObject>
+#include <QtCore/QVector>
QT_BEGIN_NAMESPACE
diff --git a/src/core/nodes/qabstractnodefactory_p.h b/src/core/nodes/qabstractnodefactory_p.h
index bb7533e94..dbe0adffe 100644
--- a/src/core/nodes/qabstractnodefactory_p.h
+++ b/src/core/nodes/qabstractnodefactory_p.h
@@ -51,9 +51,10 @@
// We mean it.
//
-#include <Qt3DCore/private/qt3dcore_global_p.h>
#include <Qt3DCore/qnode.h>
+#include <Qt3DCore/private/qt3dcore_global_p.h>
+
QT_BEGIN_NAMESPACE
namespace Qt3DCore {
diff --git a/src/core/nodes/qbackendnode.cpp b/src/core/nodes/qbackendnode.cpp
index 6970794b8..65d140067 100644
--- a/src/core/nodes/qbackendnode.cpp
+++ b/src/core/nodes/qbackendnode.cpp
@@ -39,9 +39,12 @@
#include "qbackendnode.h"
#include "qbackendnode_p.h"
-#include "qaspectengine.h"
-#include "qnode.h"
-#include "qpropertyupdatedchange.h"
+
+#include <Qt3DCore/qaspectengine.h>
+#include <Qt3DCore/qnode.h>
+#include <Qt3DCore/qnodecommand.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
#include <Qt3DCore/private/corelogging_p.h>
QT_BEGIN_NAMESPACE
@@ -204,6 +207,25 @@ void QBackendNode::notifyObservers(const QSceneChangePtr &e)
d->notifyObservers(e);
}
+QNodeCommand::CommandId QBackendNode::sendCommand(const QString &name,
+ const QVariant &data,
+ QNodeCommand::CommandId replyTo)
+{
+ auto e = QNodeCommandPtr::create(peerId());
+ e->setName(name);
+ e->setData(data);
+ e->setReplyToCommandId(replyTo);
+ e->setDeliveryFlags(QSceneChange::Nodes);
+ notifyObservers(e);
+ return e->commandId();
+}
+
+void QBackendNode::sendReply(const QNodeCommandPtr &command)
+{
+ command->setDeliveryFlags(QSceneChange::Nodes);
+ notifyObservers(command);
+}
+
void QBackendNode::initializeFromPeer(const QNodeCreatedChangeBasePtr &change)
{
Q_UNUSED(change);
@@ -231,7 +253,7 @@ void QBackendNode::sceneChangeEvent(const QSceneChangePtr &e)
switch (e->type()) {
case PropertyUpdated: {
if (propertyChange->propertyName() == QByteArrayLiteral("enabled"))
- d->m_enabled = propertyChange->value().value<bool>();
+ d->m_enabled = propertyChange->value().toBool();
break;
}
default:
diff --git a/src/core/nodes/qbackendnode.h b/src/core/nodes/qbackendnode.h
index 39114034d..99e483cff 100644
--- a/src/core/nodes/qbackendnode.h
+++ b/src/core/nodes/qbackendnode.h
@@ -40,10 +40,11 @@
#ifndef QT3DCORE_QBACKENDNODE_H
#define QT3DCORE_QBACKENDNODE_H
-#include <Qt3DCore/qt3dcore_global.h>
-#include <Qt3DCore/qscenechange.h>
#include <Qt3DCore/qnodecreatedchange.h>
#include <Qt3DCore/qnodeid.h>
+#include <Qt3DCore/qnodecommand.h>
+#include <Qt3DCore/qscenechange.h>
+#include <Qt3DCore/qt3dcore_global.h>
QT_BEGIN_NAMESPACE
@@ -90,6 +91,9 @@ protected:
Q_DECLARE_PRIVATE(QBackendNode)
explicit QBackendNode(QBackendNodePrivate &dd);
void notifyObservers(const QSceneChangePtr &e);
+ QNodeCommand::CommandId sendCommand(const QString &name, const QVariant &data,
+ QNodeCommand::CommandId replyTo = QNodeCommand::CommandId());
+ void sendReply(const QNodeCommandPtr &command);
virtual void sceneChangeEvent(const QSceneChangePtr &e);
QBackendNodePrivate *d_ptr;
diff --git a/src/core/nodes/qbackendnode_p.h b/src/core/nodes/qbackendnode_p.h
index 6cddfad11..6940f5623 100644
--- a/src/core/nodes/qbackendnode_p.h
+++ b/src/core/nodes/qbackendnode_p.h
@@ -51,13 +51,13 @@
// We mean it.
//
+#include <Qt3DCore/qbackendnode.h>
#include <Qt3DCore/qnodeid.h>
+
+#include <Qt3DCore/private/qlockableobserverinterface_p.h>
#include <Qt3DCore/private/qobservableinterface_p.h>
#include <Qt3DCore/private/qobserverinterface_p.h>
#include <Qt3DCore/private/qt3dcore_global_p.h>
-#include <Qt3DCore/qbackendnode.h>
-#include <Qt3DCore/private/qlockableobserverinterface_p.h>
-#include <Qt3DCore/private/qt3dcore_global_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/core/nodes/qcomponent.cpp b/src/core/nodes/qcomponent.cpp
index abedb6244..8e337adf6 100644
--- a/src/core/nodes/qcomponent.cpp
+++ b/src/core/nodes/qcomponent.cpp
@@ -39,12 +39,14 @@
#include "qcomponent.h"
#include "qcomponent_p.h"
-#include "qentity.h"
-#include "qentity_p.h"
-#include "qscene_p.h"
+
#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DCore/qcomponentaddedchange.h>
#include <Qt3DCore/qcomponentremovedchange.h>
+#include <Qt3DCore/qentity.h>
+
+#include <Qt3DCore/private/qentity_p.h>
+#include <Qt3DCore/private/qscene_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/core/nodes/qcomponent_p.h b/src/core/nodes/qcomponent_p.h
index 74cef1629..6c7c3c89d 100644
--- a/src/core/nodes/qcomponent_p.h
+++ b/src/core/nodes/qcomponent_p.h
@@ -51,8 +51,8 @@
// We mean it.
//
-#include <private/qnode_p.h>
-#include <private/qt3dcore_global_p.h>
+#include <Qt3DCore/private/qnode_p.h>
+#include <Qt3DCore/private/qt3dcore_global_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/core/nodes/qdestructionidandtypecollector_p.h b/src/core/nodes/qdestructionidandtypecollector_p.h
index 3e5fd9138..8557c27f0 100644
--- a/src/core/nodes/qdestructionidandtypecollector_p.h
+++ b/src/core/nodes/qdestructionidandtypecollector_p.h
@@ -48,8 +48,8 @@
// We mean it.
//
-#include <Qt3DCore/private/qnodevisitor_p.h>
#include <Qt3DCore/private/qentity_p.h>
+#include <Qt3DCore/private/qnodevisitor_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/core/nodes/qentity.cpp b/src/core/nodes/qentity.cpp
index b28898c60..9bc41f8cc 100644
--- a/src/core/nodes/qentity.cpp
+++ b/src/core/nodes/qentity.cpp
@@ -39,17 +39,18 @@
#include "qentity.h"
#include "qentity_p.h"
-#include "qcomponent.h"
-#include "qcomponent_p.h"
-#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/qcomponent.h>
#include <Qt3DCore/qcomponentaddedchange.h>
#include <Qt3DCore/qcomponentremovedchange.h>
-#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DCore/qnodecreatedchange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <QtCore/QMetaObject>
+#include <QtCore/QMetaProperty>
+
#include <Qt3DCore/private/corelogging_p.h>
-#include <QMetaObject>
-#include <QMetaProperty>
+#include <Qt3DCore/private/qcomponent_p.h>
+#include <Qt3DCore/private/qscene_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/core/nodes/qentity.h b/src/core/nodes/qentity.h
index a7f492a96..978f84ebe 100644
--- a/src/core/nodes/qentity.h
+++ b/src/core/nodes/qentity.h
@@ -42,8 +42,7 @@
#include <Qt3DCore/qnode.h>
#include <Qt3DCore/qt3dcore_global.h>
-
-#include <QMetaType>
+#include <QtCore/QMetaType>
QT_BEGIN_NAMESPACE
diff --git a/src/core/nodes/qentity_p.h b/src/core/nodes/qentity_p.h
index a9dfb9b0d..9e9dbbd24 100644
--- a/src/core/nodes/qentity_p.h
+++ b/src/core/nodes/qentity_p.h
@@ -51,9 +51,10 @@
// We mean it.
//
+#include <Qt3DCore/qentity.h>
+
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qt3dcore_global_p.h>
-#include "qentity.h"
QT_BEGIN_NAMESPACE
@@ -70,10 +71,6 @@ public :
QNodeId parentEntityId() const;
QComponentVector m_components;
- bool m_visible;
-
- // TODO: Is a bool enough here or do we need additional states for entities?
- // Perhaps aboutToBeDeleted would be useful?
mutable QNodeId m_parentEntityId;
};
diff --git a/src/core/nodes/qnode.cpp b/src/core/nodes/qnode.cpp
index ee327607f..58e016cda 100644
--- a/src/core/nodes/qnode.cpp
+++ b/src/core/nodes/qnode.cpp
@@ -40,25 +40,26 @@
#include "qnode.h"
#include "qnode_p.h"
-#include <Qt3DCore/qentity.h>
+#include <Qt3DCore/QComponent>
+#include <Qt3DCore/qaspectengine.h>
#include <Qt3DCore/qdynamicpropertyupdatedchange.h>
-#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qentity.h>
+#include <Qt3DCore/qnodedestroyedchange.h>
#include <Qt3DCore/qpropertynodeaddedchange.h>
#include <Qt3DCore/qpropertynoderemovedchange.h>
-#include <Qt3DCore/qnodedestroyedchange.h>
-#include <Qt3DCore/qaspectengine.h>
-#include <Qt3DCore/private/qdestructionidandtypecollector_p.h>
-#include <Qt3DCore/private/qscene_p.h>
-#include <Qt3DCore/private/qpostman_p.h>
-#include <QEvent>
-#include <QChildEvent>
-#include <QMetaObject>
-#include <QMetaProperty>
-#include <QtCore/private/qmetaobject_p.h>
-#include <Qt3DCore/QComponent>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <QtCore/QChildEvent>
+#include <QtCore/QEvent>
+#include <QtCore/QMetaObject>
+#include <QtCore/QMetaProperty>
+
#include <Qt3DCore/private/corelogging_p.h>
+#include <Qt3DCore/private/qdestructionidandtypecollector_p.h>
#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DCore/private/qnodevisitor_p.h>
+#include <Qt3DCore/private/qpostman_p.h>
+#include <Qt3DCore/private/qscene_p.h>
+#include <QtCore/private/qmetaobject_p.h>
QT_BEGIN_NAMESPACE
@@ -73,7 +74,7 @@ QNodePrivate::QNodePrivate()
, m_blockNotifications(false)
, m_hasBackendNode(false)
, m_enabled(true)
- , m_propertyTrackMode(QNode::DefaultTrackMode)
+ , m_defaultPropertyTrackMode(QNode::TrackFinalValues)
, m_propertyChangesSetup(false)
, m_signals(this)
{
@@ -113,7 +114,7 @@ void QNodePrivate::notifyCreationChange()
Q_Q(QNode);
// Do nothing if we already have already sent a node creation change
// and not a subsequent node destroyed change.
- if (m_hasBackendNode)
+ if (m_hasBackendNode || !m_scene)
return;
QNodeCreatedChangeGenerator generator(q);
const auto creationChanges = generator.creationChanges();
@@ -203,7 +204,7 @@ void QNodePrivate::_q_addChild(QNode *childNode)
// removed from the scene as part of the destruction of the parent, when the
// parent's children are deleted in the QObject dtor, we still have access to
// the parentId. If we didn't store this, we wouldn't have access at that time
- // because the parent woudl then only be a QObject, the QNode part would have
+ // because the parent would then only be a QObject, the QNode part would have
// been destroyed already.
QNodePrivate::get(childNode)->m_parentId = m_id;
@@ -304,7 +305,21 @@ void QNodePrivate::_q_setParentHelper(QNode *parent)
visitor.traverse(q, newParentNode->d_func(), &QNodePrivate::setSceneHelper);
}
- notifyCreationChange();
+ // We want to make sure that subTreeRoot is always created before
+ // child.
+ // Given a case such as below
+ // QEntity *subTreeRoot = new QEntity(someGlobalExisitingRoot)
+ // QEntity *child = new QEntity();
+ // child->setParent(subTreeRoot)
+ // We need to take into account that subTreeRoot needs to be
+ // created in the backend before the child.
+ // Therefore we only call notifyCreationChanges if the parent
+ // hasn't been created yet as we know that when the parent will be
+ // fully created, it will also send the changes for all of its
+ // children
+
+ if (QNodePrivate::get(newParentNode)->m_hasBackendNode)
+ notifyCreationChange();
}
// If we have a valid new parent, we let him know that we are its child
@@ -393,19 +408,22 @@ void QNodePrivate::setSceneHelper(QNode *root)
Recursively unsets and remove nodes in the subtree of base node \a root from
the scene. Also takes care of removing Components and Entities connections.
*/
-void QNodePrivate::unsetSceneHelper(QNode *root)
+void QNodePrivate::unsetSceneHelper(QNode *node)
{
+ QNodePrivate *nodePrivate = QNodePrivate::get(node);
+
// We also need to handle QEntity <-> QComponent relationships removal
- if (QComponent *c = qobject_cast<QComponent *>(root)) {
+ if (QComponent *c = qobject_cast<QComponent *>(node)) {
const QVector<QEntity *> entities = c->entities();
for (QEntity *entity : entities) {
- if (m_scene)
- m_scene->removeEntityForComponent(c->id(), entity->id());
+ if (nodePrivate->m_scene)
+ nodePrivate->m_scene->removeEntityForComponent(c->id(), entity->id());
}
}
- if (m_scene != nullptr)
- m_scene->removeObservable(root);
- root->d_func()->setScene(nullptr);
+
+ if (nodePrivate->m_scene != nullptr)
+ nodePrivate->m_scene->removeObservable(node);
+ nodePrivate->setScene(nullptr);
}
/*!
@@ -605,9 +623,9 @@ void QNodePrivate::updatePropertyTrackMode()
{
if (m_scene != nullptr) {
QScene::NodePropertyTrackData trackData;
- trackData.updateMode = m_propertyTrackMode;
- trackData.namedProperties = m_trackedProperties;
- m_scene->setPropertyTrackDataForNode(m_id,trackData);
+ trackData.defaultTrackMode = m_defaultPropertyTrackMode;
+ trackData.trackedPropertiesOverrides = m_trackedPropertiesOverrides;
+ m_scene->setPropertyTrackDataForNode(m_id, trackData);
}
}
@@ -800,30 +818,16 @@ void QNode::setEnabled(bool isEnabled)
emit enabledChanged(isEnabled);
}
-void QNode::setPropertyTrackMode(QNode::PropertyTrackMode mode)
+void QNode::setDefaultPropertyTrackingMode(QNode::PropertyTrackingMode mode)
{
Q_D(QNode);
- if (d->m_propertyTrackMode == mode)
+ if (d->m_defaultPropertyTrackMode == mode)
return;
- d->m_propertyTrackMode = mode;
+ d->m_defaultPropertyTrackMode = mode;
// The backend doesn't care about such notification
const bool blocked = blockNotifications(true);
- emit propertyUpdateModeChanged(mode);
- blockNotifications(blocked);
- d->updatePropertyTrackMode();
-}
-
-void QNode::setTrackedProperties(const QStringList &trackedProperties)
-{
- Q_D(QNode);
- if (d->m_trackedProperties == trackedProperties)
- return;
-
- d->m_trackedProperties = trackedProperties;
- // The backend doesn't care about such notification
- const bool blocked = blockNotifications(true);
- emit trackedPropertiesChanged(trackedProperties);
+ emit defaultPropertyTrackingModeChanged(mode);
blockNotifications(blocked);
d->updatePropertyTrackMode();
}
@@ -845,29 +849,45 @@ bool QNode::isEnabled() const
}
/*!
- \property Qt3DCore::QNode::propertyTrackMode
+ \property Qt3DCore::QNode::defaultPropertyTrackingMode
- Holds the property track mode which determines whether a QNode should
- be listening for property updates
+ Holds the default property tracking mode which determines whether a QNode should
+ be listening for property updates. This only applies to properties which
+ haven't been overridden by a call to setPropertyTracking.
- By default it is set to QNode::DontTrackProperties
+ By default it is set to QNode::TrackFinalValues
*/
-QNode::PropertyTrackMode QNode::propertyTrackMode() const
+QNode::PropertyTrackingMode QNode::defaultPropertyTrackingMode() const
{
Q_D(const QNode);
- return d->m_propertyTrackMode;
+ return d->m_defaultPropertyTrackMode;
}
-/*!
- \property Qt3DCore::QNode::trackedProperties
+void QNode::setPropertyTracking(const QString &propertyName, QNode::PropertyTrackingMode trackMode)
+{
+ Q_D(QNode);
+ d->m_trackedPropertiesOverrides.insert(propertyName, trackMode);
+ d->updatePropertyTrackMode();
+}
- Holds the names of the properties to be tracked when propertyTrackMode is
- set to TrackNamedProperties.
-*/
-QStringList QNode::trackedProperties() const
+QNode::PropertyTrackingMode QNode::propertyTracking(const QString &propertyName) const
{
Q_D(const QNode);
- return d->m_trackedProperties;
+ return d->m_trackedPropertiesOverrides.value(propertyName, d->m_defaultPropertyTrackMode);
+}
+
+void QNode::clearPropertyTracking(const QString &propertyName)
+{
+ Q_D(QNode);
+ d->m_trackedPropertiesOverrides.remove(propertyName);
+ d->updatePropertyTrackMode();
+}
+
+void QNode::clearPropertyTrackings()
+{
+ Q_D(QNode);
+ d->m_trackedPropertiesOverrides.clear();
+ d->updatePropertyTrackMode();
}
QNodeCreatedChangeBasePtr QNode::createNodeCreationChange() const
@@ -882,6 +902,51 @@ QNodeCreatedChangeBasePtr QNode::createNodeCreationChange() const
return QNodeCreatedChangeBasePtr::create(this);
}
+/*!
+ * \brief Sends a command messages to the backend node
+ *
+ * Creates a QNodeCommand message and dispatches it to the backend node. The
+ * command is given and a \a name and some \a data which can be used in the
+ * backend node to performe various operations.
+ * This returns a CommandId which can be used to identify the initial command
+ * when receiving a message in reply. If the command message is to be sent in
+ * reply to another command, \a replyTo contains the id of that command.
+ *
+ * \sa QNodeCommand, QNode::sendReply
+ */
+QNodeCommand::CommandId QNode::sendCommand(const QString &name,
+ const QVariant &data,
+ QNodeCommand::CommandId replyTo)
+{
+ Q_D(QNode);
+
+ // Bail out early if we can to avoid operator new
+ if (d->m_blockNotifications)
+ return QNodeCommand::CommandId(0);
+
+ auto e = QNodeCommandPtr::create(d->m_id);
+ e->setName(name);
+ e->setData(data);
+ e->setReplyToCommandId(replyTo);
+ d->notifyObservers(e);
+ return e->commandId();
+}
+
+/*!
+ * \brief Send a command back to the backend node
+ *
+ * Assumes the command is to be to sent back in reply to itself to the backend node
+ *
+ * \sa QNodeCommand, QNode::sendCommand
+ */
+void QNode::sendReply(const QNodeCommandPtr &command)
+{
+ Q_D(QNode);
+ command->setDeliveryFlags(QSceneChange::BackendNodes);
+ d->notifyObservers(command);
+}
+
+
namespace {
/*! \internal */
diff --git a/src/core/nodes/qnode.h b/src/core/nodes/qnode.h
index 75ea61cc7..1fe03f5e0 100644
--- a/src/core/nodes/qnode.h
+++ b/src/core/nodes/qnode.h
@@ -40,11 +40,12 @@
#ifndef QT3DCORE_QNODE_H
#define QT3DCORE_QNODE_H
-#include <QObject>
-#include <Qt3DCore/qt3dcore_global.h>
+#include <Qt3DCore/qnodecreatedchange.h>
#include <Qt3DCore/qnodeid.h>
+#include <Qt3DCore/qnodecommand.h>
#include <Qt3DCore/qscenechange.h>
-#include <Qt3DCore/qnodecreatedchange.h>
+#include <Qt3DCore/qt3dcore_global.h>
+#include <QtCore/QObject>
#define Q_NODE_NULLPTR static_cast<Qt3DCore::QNode *>(nullptr)
@@ -69,16 +70,15 @@ class QT3DCORESHARED_EXPORT QNode : public QObject
Q_OBJECT
Q_PROPERTY(Qt3DCore::QNode *parent READ parentNode WRITE setParent NOTIFY parentChanged)
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
- Q_PROPERTY(PropertyTrackMode propertyTrackMode READ propertyTrackMode WRITE setPropertyTrackMode NOTIFY propertyUpdateModeChanged)
- Q_PROPERTY(QStringList trackedProperties READ trackedProperties WRITE setTrackedProperties NOTIFY trackedPropertiesChanged)
+ Q_PROPERTY(PropertyTrackingMode defaultPropertyTrackingMode READ defaultPropertyTrackingMode WRITE setDefaultPropertyTrackingMode NOTIFY defaultPropertyTrackingModeChanged REVISION 9)
public:
- enum PropertyTrackMode {
- DefaultTrackMode,
- TrackNamedPropertiesMode,
- TrackAllPropertiesMode
+ enum PropertyTrackingMode : quint16 {
+ TrackFinalValues,
+ DontTrackValues,
+ TrackAllValues
};
- Q_ENUM(PropertyTrackMode)
+ Q_ENUM(PropertyTrackingMode)
explicit QNode(QNode *parent = nullptr);
virtual ~QNode();
@@ -92,20 +92,26 @@ public:
QNodeVector childNodes() const;
bool isEnabled() const;
- PropertyTrackMode propertyTrackMode() const;
- QStringList trackedProperties() const;
+ PropertyTrackingMode defaultPropertyTrackingMode() const;
+
+ void setPropertyTracking(const QString &propertyName, PropertyTrackingMode trackMode);
+ PropertyTrackingMode propertyTracking(const QString &propertyName) const;
+ void clearPropertyTracking(const QString &propertyName);
+ void clearPropertyTrackings();
+
+ QNodeCommand::CommandId sendCommand(const QString &name, const QVariant &data = QVariant(),
+ QNodeCommand::CommandId replyTo = QNodeCommand::CommandId());
+ void sendReply(const QNodeCommandPtr &command);
public Q_SLOTS:
void setParent(QNode *parent);
void setEnabled(bool isEnabled);
- void setPropertyTrackMode(PropertyTrackMode mode);
- void setTrackedProperties(const QStringList &trackedProperties);
+ void setDefaultPropertyTrackingMode(PropertyTrackingMode mode);
Q_SIGNALS:
void parentChanged(QObject *parent);
void enabledChanged(bool enabled);
- void propertyUpdateModeChanged(PropertyTrackMode mode);
- void trackedPropertiesChanged(const QStringList &trackedProperties);
+ void defaultPropertyTrackingModeChanged(PropertyTrackingMode mode);
void nodeDestroyed();
protected:
diff --git a/src/core/nodes/qnode_p.h b/src/core/nodes/qnode_p.h
index 5d6329e62..ad9d2376e 100644
--- a/src/core/nodes/qnode_p.h
+++ b/src/core/nodes/qnode_p.h
@@ -51,13 +51,15 @@
// We mean it.
//
-#include <private/qobject_p.h>
#include <Qt3DCore/qnode.h>
-#include <Qt3DCore/private/qobservableinterface_p.h>
+
+#include <functional>
+
+#include <Qt3DCore/private/propertychangehandler_p.h>
#include <Qt3DCore/private/qchangearbiter_p.h>
+#include <Qt3DCore/private/qobservableinterface_p.h>
#include <Qt3DCore/private/qt3dcore_global_p.h>
-#include "propertychangehandler_p.h"
-#include <functional>
+#include <QtCore/private/qobject_p.h>
QT_BEGIN_NAMESPACE
@@ -74,7 +76,7 @@ public:
void init(QNode *parent);
- void setScene(QScene *scene);
+ virtual void setScene(QScene *scene);
QScene *scene() const;
void setArbiter(QLockableObserverInterface *arbiter) Q_DECL_OVERRIDE;
@@ -98,8 +100,8 @@ public:
bool m_blockNotifications;
bool m_hasBackendNode;
bool m_enabled;
- QNode::PropertyTrackMode m_propertyTrackMode;
- QStringList m_trackedProperties;
+ QNode::PropertyTrackingMode m_defaultPropertyTrackMode;
+ QHash<QString, QNode::PropertyTrackingMode> m_trackedPropertiesOverrides;
static QNodePrivate *get(QNode *q);
static void nodePtrDeleter(QNode *q);
diff --git a/src/core/nodes/qnodecreatedchangegenerator.cpp b/src/core/nodes/qnodecreatedchangegenerator.cpp
index c350c866a..d91949fb1 100644
--- a/src/core/nodes/qnodecreatedchangegenerator.cpp
+++ b/src/core/nodes/qnodecreatedchangegenerator.cpp
@@ -35,6 +35,7 @@
****************************************************************************/
#include "qnodecreatedchangegenerator_p.h"
+
#include <Qt3DCore/private/qnodevisitor_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/core/nodes/qnodecreatedchangegenerator_p.h b/src/core/nodes/qnodecreatedchangegenerator_p.h
index f00241b39..42c2847cc 100644
--- a/src/core/nodes/qnodecreatedchangegenerator_p.h
+++ b/src/core/nodes/qnodecreatedchangegenerator_p.h
@@ -48,12 +48,13 @@
// We mean it.
//
-#include <Qt3DCore/qt3dcore_global.h>
#include <Qt3DCore/qnode.h>
#include <Qt3DCore/qnodecreatedchange.h>
-#include <Qt3DCore/private/qnode_p.h>
+#include <Qt3DCore/qt3dcore_global.h>
#include <QtCore/qvector.h>
+#include <Qt3DCore/private/qnode_p.h>
+
QT_BEGIN_NAMESPACE
namespace Qt3DCore {
diff --git a/src/core/nodes/qnodeid.cpp b/src/core/nodes/qnodeid.cpp
index f41627734..17bc4e8e1 100644
--- a/src/core/nodes/qnodeid.cpp
+++ b/src/core/nodes/qnodeid.cpp
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include "qnodeid.h"
+#include <Qt3DCore/qnodeid.h>
QT_BEGIN_NAMESPACE
diff --git a/src/core/nodes/qnodeid.h b/src/core/nodes/qnodeid.h
index 7e8b1c97c..a00559df3 100644
--- a/src/core/nodes/qnodeid.h
+++ b/src/core/nodes/qnodeid.h
@@ -41,7 +41,7 @@
#define QT3DCORE_QNODEID_H
#include <Qt3DCore/qt3dcore_global.h>
-#include <QDebug>
+#include <QtCore/QDebug>
#include <QtCore/QHashFunctions>
QT_BEGIN_NAMESPACE
diff --git a/src/core/nodes/qnodevisitor_p.h b/src/core/nodes/qnodevisitor_p.h
index 3637293f5..15bfa90db 100644
--- a/src/core/nodes/qnodevisitor_p.h
+++ b/src/core/nodes/qnodevisitor_p.h
@@ -51,9 +51,9 @@
// We mean it.
//
-#include <Qt3DCore/qt3dcore_global.h>
-#include <Qt3DCore/qnode.h>
#include <Qt3DCore/qentity.h>
+#include <Qt3DCore/qnode.h>
+#include <Qt3DCore/qt3dcore_global.h>
QT_BEGIN_NAMESPACE