1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#include "qquick3dparticleabstractshape_p.h"
5#include <QtQuick3D/private/qquick3dnode_p.h>
6
7QT_BEGIN_NAMESPACE
8
9/*!
10 \qmltype ParticleAbstractShape3D
11 \inherits QtObject
12 \inqmlmodule QtQuick3D.Particles3D
13 \brief Abstract base type of particle shapes.
14 \since 6.2
15
16 The ParticleAbstractShape3D is an abstract base type of shapes like \l ParticleShape3D
17 and \l ParticleModelShape3D. Shapes can be used to provide start and end positions
18 for the particles.
19*/
20QQuick3DParticleAbstractShape::QQuick3DParticleAbstractShape(QObject *parent)
21 : QObject(parent)
22{
23}
24
25void QQuick3DParticleAbstractShape::componentComplete()
26{
27 if (!parentNode())
28 qWarning() << "Shape requires parent Node to function correctly!";
29}
30
31QQuick3DNode *QQuick3DParticleAbstractShape::parentNode()
32{
33 QQuick3DNode *node = qobject_cast<QQuick3DNode *>(object: parent());
34 if (!m_parentNode || m_parentNode != node)
35 m_parentNode = node;
36 return m_parentNode;
37}
38
39QT_END_NAMESPACE
40

source code of qtquick3d/src/quick3dparticles/qquick3dparticleabstractshape.cpp