diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2014-09-19 08:37:03 +0200 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2014-09-30 12:16:39 +0200 |
commit | 94bb50fba66435a078f30b1da9cf5507522ab136 (patch) | |
tree | 1c48f4e4463dd0f28fcd38efb259017987bbc8d6 /src/render/io/gltfparser.cpp | |
parent | 616e8083872c953a31acc871749e05c621c18bd1 (diff) |
Improved/Refactored cloning and doClone off all subclasses
Note: As we are using QScene during cloning, it is important that node hierarchy
be created and added in the proper order (parent then child).
Change-Id: I8fd53f7ca696ec9aca19cc70dc116ccba4154911
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/io/gltfparser.cpp')
-rw-r--r-- | src/render/io/gltfparser.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/render/io/gltfparser.cpp b/src/render/io/gltfparser.cpp index dee13b261..571f07354 100644 --- a/src/render/io/gltfparser.cpp +++ b/src/render/io/gltfparser.cpp @@ -73,6 +73,7 @@ // need to move these to somewhere common? #include <Qt3DRenderer/private/renderstate_p.h> #include <Qt3DRenderer/private/blendstate_p.h> +#include <Qt3DCore/private/qabstractmesh_p.h> QT_BEGIN_NAMESPACE @@ -227,7 +228,7 @@ public: private: QMeshDataPtr m_meshData; - GLTFParserMesh *doClone(QNode *clonedParent) const Q_DECL_OVERRIDE; + GLTFParserMesh *doClone(bool isClone = true) const Q_DECL_OVERRIDE; }; GLTFParser::GLTFParser() : AbstractSceneParser(), @@ -1014,9 +1015,12 @@ QAbstractMeshFunctorPtr GLTFParserMesh::meshFunctor() const return QAbstractMeshFunctorPtr(new GLTFParserMeshFunctor(m_meshData)); } -GLTFParserMesh *GLTFParserMesh::doClone(QNode *clonedParent) const +GLTFParserMesh *GLTFParserMesh::doClone(bool isClone) const { - return new GLTFParserMesh(clonedParent); + GLTFParserMesh *clone = new GLTFParserMesh(); + clone->copy(this); + clone->d_func()->m_isClone = isClone; + return clone; } GLTFParserMesh::GLTFParserMeshFunctor::GLTFParserMeshFunctor(QMeshDataPtr meshData) |