Skip to content
Snippets Groups Projects
Commit 02d02acf authored by Kaj Grönholm's avatar Kaj Grönholm
Browse files

Fix importScene with external component


When importScene is used directly with external component, don't add
content as children again.

Task-number: QTBUG-83141
Change-Id: Ibe92c9fede694bd2df5b474d2f0132f117eb5b97
Reviewed-by: default avatarTomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: default avatarAntti Määttä <antti.maatta@qt.io>
Reviewed-by: default avatarAndy Nichols <andy.nichols@qt.io>
parent e25bbe52
No related branches found
No related tags found
No related merge requests found
......@@ -341,8 +341,14 @@ void QQuick3DSceneRenderer::synchronize(QQuick3DViewport *item, const QSize &siz
if (m_importRootNode)
removeNodeFromLayer(m_importRootNode);
if (importRootNode)
m_layer->addChildrenToLayer(*importRootNode);
if (importRootNode) {
// if root node has already parent at this point
// it means "importScene: MyScene { }" type of inclusion.
// In this case don't duplicate content by adding it again.
const bool isEmbedded = importRootNode->parent;
if (!isEmbedded)
m_layer->addChildrenToLayer(*importRootNode);
}
m_importRootNode = importRootNode;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment