From 200723cf13977e95b12c4640eeb20eaba6919561 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 15 Jun 2021 14:50:15 +0300 Subject: [PATCH] QmlDesigner: Fix pasting 3D nodes Pasting multiple 3D nodes are now pasted in correct scope instead of always pasting under scene root. Fixes: QDS-4534 Change-Id: I233bf360e2bd335c952b1e727a9ee775d2cdd23a Reviewed-by: Mahmoud Badri Reviewed-by: Thomas Hartmann --- .../qmldesigner/components/integration/designdocument.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/qmldesigner/components/integration/designdocument.cpp b/src/plugins/qmldesigner/components/integration/designdocument.cpp index 412a7f0a737..d5e5757f9e7 100644 --- a/src/plugins/qmldesigner/components/integration/designdocument.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocument.cpp @@ -517,13 +517,13 @@ void DesignDocument::paste() // in case we copy and paste a selection we paste in the parent item if ((view.selectedModelNodes().count() == selectedNodes.count()) && targetNode.isValid() && targetNode.hasParentProperty()) { targetNode = targetNode.parentProperty().parentModelNode(); - } else { + } else if (view.selectedModelNodes().isEmpty()) { // if selection is empty and copied nodes are all 3D nodes, paste them under the active scene bool all3DNodes = std::find_if(selectedNodes.cbegin(), selectedNodes.cend(), [](const ModelNode &node) { return !node.isSubclassOf("QtQuick3D.Node"); }) == selectedNodes.cend(); if (all3DNodes) { - int activeSceneId = rootModelNode().auxiliaryData("active3dScene").toInt(); + int activeSceneId = rootModelNode().auxiliaryData("active3dScene@Internal").toInt(); if (activeSceneId != -1) { NodeListProperty sceneNodeProperty = QmlVisualNode::findSceneNodeProperty(rootModelNode().view(), activeSceneId); @@ -570,7 +570,7 @@ void DesignDocument::paste() } else { // if selection is empty and this is a 3D Node, paste it under the active scene if (pastedNode.isSubclassOf("QtQuick3D.Node")) { - int activeSceneId = rootModelNode().auxiliaryData("active3dScene").toInt(); + int activeSceneId = rootModelNode().auxiliaryData("active3dScene@Internal").toInt(); if (activeSceneId != -1) { NodeListProperty sceneNodeProperty = QmlVisualNode::findSceneNodeProperty(rootModelNode().view(), activeSceneId);