From 07411fe4ef30ad6343d7b15e167fa0fb403886fa Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Mon, 15 Aug 2022 00:27:31 +1000 Subject: [PATCH] revert to main camera when removing assets --- ios/src/FilamentViewer.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ios/src/FilamentViewer.cpp b/ios/src/FilamentViewer.cpp index 81a01472..7717a511 100644 --- a/ios/src/FilamentViewer.cpp +++ b/ios/src/FilamentViewer.cpp @@ -353,8 +353,7 @@ void FilamentViewer::destroySwapChain() { } SceneAsset *FilamentViewer::loadGlb(const char *const uri) { - Log("Loading GLB at URI %s", uri); - SceneAsset *asset = _sceneAssetLoader->fromGlb(uri); + SceneAsset *asset = _sceneAssetLoader->fromGlb(uri); if (!asset) { Log("Unknown error loading asset."); } else { @@ -381,6 +380,7 @@ SceneAsset *FilamentViewer::loadGltf(const char *const uri, void FilamentViewer::clearAssets() { Log("Clearing all assets"); mtx.lock(); + _view->setCamera(_mainCamera); int i = 0; for (auto asset : _assets) { _sceneAssetLoader->remove(asset); @@ -393,8 +393,9 @@ void FilamentViewer::clearAssets() { void FilamentViewer::removeAsset(SceneAsset *asset) { mtx.lock(); - _sceneAssetLoader->remove(asset); // todo - what if we are using a camera from this asset? + _view->setCamera(_mainCamera); + _sceneAssetLoader->remove(asset); bool erased = false; for (auto it = _assets.begin(); it != _assets.end();) {