From 63db94caa659eb730a4060ad84ac93dd2bfb90ca Mon Sep 17 00:00:00 2001 From: codereader Date: Mon, 20 Apr 2020 07:42:37 +0200 Subject: [PATCH] Fix #5214: Changing classname moves entity back to the 'Default' layer --- libs/entitylib.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/entitylib.h b/libs/entitylib.h index 3927ae0dc0..45a31b5c46 100644 --- a/libs/entitylib.h +++ b/libs/entitylib.h @@ -467,7 +467,9 @@ inline scene::INodePtr changeEntityClassname(const scene::INodePtr& node, scene::removeNodeFromParent(oldNode); // Let the new node keep its layer information (#4710) - newNode->assignToLayers(oldNode->getLayers()); + // Apply the layers to the whole subgraph (#5214) + scene::AssignNodeToLayersWalker layerWalker(oldNode->getLayers()); + newNode->traverse(layerWalker); // Insert the new entity to the parent parent->addChildNode(newNode);