From 825c6e1a8098e33a08a66bcfd68cfac2450beebd Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Sun, 8 Sep 2024 13:55:25 +0800 Subject: [PATCH] feat: parent the cloned entity instance when setting stencil highlight --- thermion_dart/native/src/HighlightOverlay.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/thermion_dart/native/src/HighlightOverlay.cpp b/thermion_dart/native/src/HighlightOverlay.cpp index 2d6ffe6b..9e4b5a96 100644 --- a/thermion_dart/native/src/HighlightOverlay.cpp +++ b/thermion_dart/native/src/HighlightOverlay.cpp @@ -71,8 +71,6 @@ namespace thermion_filament { return; } - Log("Not geometry"); - if(sceneManager->isGltfAsset(entityId)) { auto *asset = sceneManager->getAssetByEntityId(entityId); @@ -98,10 +96,13 @@ namespace thermion_filament { _entity = newInstance->getRoot(); + auto newTransformInstance = tm.getInstance(_entity); + + auto entityTransformInstance = tm.getInstance(asset->getRoot()); + tm.setParent(newTransformInstance, entityTransformInstance); if(!newInstance) { Log("Couldn't create new instance"); } else { - auto& tm = engine->getTransformManager(); for(int i = 0; i < newInstance->getEntityCount(); i++) { auto entity = newInstance->getEntities()[i]; auto renderableInstance = rm.getInstance(entity); @@ -149,7 +150,6 @@ namespace thermion_filament { } SceneManager::HighlightOverlay::~HighlightOverlay() { - Log("DEsturctor called!"); if (_entity.isNull()) { return; }