Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquick3djoint.cpp
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#include "qquick3djoint_p.h"
6#include "qquick3dobject_p.h"
8#include "qquick3dnode_p_p.h"
9
10#include <QtQuick3DRuntimeRender/private/qssgrendergraphobject_p.h>
11#include <QtQuick3DRuntimeRender/private/qssgrendernode_p.h>
12#include <QtQuick3DRuntimeRender/private/qssgrenderjoint_p.h>
13
15
51
53{
54 disconnect(m_skeletonConnection);
55}
56
70{
71 return m_index;
72}
73
86{
87 return m_skeletonRoot;
88}
89
91{
92 if (m_index == index)
93 return;
94 if (index < 0)
95 return;
96
97 m_index = index;
98 m_indexDirty = true;
100}
101
103{
104 if (skeleton == m_skeletonRoot)
105 return;
106
108 if (m_skeletonRoot)
109 QObject::disconnect(m_skeletonConnection);
110
111 m_skeletonRoot = skeleton;
112
113 if (m_skeletonRoot) {
114 m_skeletonConnection = connect(this, &QQuick3DJoint::sceneTransformChanged,
115 skeleton, [skeleton]() {
116 auto skeletonNode = static_cast<QSSGRenderSkeleton *>(QQuick3DNodePrivate::get(skeleton)->spatialNode);
117 if (skeletonNode)
118 skeletonNode->skinningDirty = true;
119 });
120 }
121 m_skeletonRootDirty = true;
123}
124
125
127{
128 m_indexDirty = true;
129 m_skeletonRootDirty = true;
131}
132
134{
135 if (!m_skeletonRoot)
136 return node;
137
138 if (!node) {
139 markAllDirty();
140 node = new QSSGRenderJoint();
141 }
142
144
145 auto jointNode = static_cast<QSSGRenderJoint *>(node);
146
147 QQuick3DObjectPrivate *skeletonPriv = QQuick3DObjectPrivate::get(m_skeletonRoot);
148
149 if (m_skeletonRootDirty) {
150 if (skeletonPriv && skeletonPriv->spatialNode)
151 jointNode->skeletonRoot = static_cast<QSSGRenderSkeleton *>(skeletonPriv->spatialNode);
152 }
153
154 if (m_indexDirty) {
155 jointNode->index = m_index;
156 m_indexDirty = false;
157
158 if (jointNode->skeletonRoot) {
159 Q_ASSERT(m_skeletonRoot);
160 m_skeletonRoot->skeletonNodeDirty();
161
162 if (jointNode->skeletonRoot->maxIndex < m_index) {
163 jointNode->skeletonRoot->maxIndex = m_index;
164 }
165 }
166 }
167 return node;
168}
169
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2960
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
Definition qobject.cpp:3236
void markAllDirty() override
QQuick3DSkeleton * skeletonRoot
void setIndex(qint32 index)
void indexChanged()
QQuick3DJoint(QQuick3DNode *parent=nullptr)
\qmltype Joint \inherits Node \inqmlmodule QtQuick3D
void skeletonRootChanged()
~QQuick3DJoint() override
void setSkeletonRoot(QQuick3DSkeleton *skeleton)
QSSGRenderGraphObject * updateSpatialNode(QSSGRenderGraphObject *node) override
static QQuick3DNodePrivate * get(QQuick3DNode *node)
void markAllDirty() override
QSSGRenderGraphObject * updateSpatialNode(QSSGRenderGraphObject *node) override
void sceneTransformChanged()
static QQuick3DObjectPrivate * get(QQuick3DObject *item)
static void attachWatcher(Context *context, Setter setter, Object3D *newO, Object3D *oldO)
Attach a object-destroyed-watcher to an object that's not owned.
void skeletonNodeDirty()
Combined button and popup list for selecting options.
GLuint index
[2]
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define emit
int qint32
Definition qtypes.h:49
myObject disconnect()
[26]
Definition moc.h:23