diff --git a/interface/src/scripting/SelectionScriptingInterface.cpp b/interface/src/scripting/SelectionScriptingInterface.cpp index a61dd05acf..c652136a5d 100644 --- a/interface/src/scripting/SelectionScriptingInterface.cpp +++ b/interface/src/scripting/SelectionScriptingInterface.cpp @@ -152,56 +152,51 @@ void SelectionToSceneHandler::updateSceneFromSelectedList() { auto mainScene = qApp->getMain3DScene(); if (mainScene) { GameplayObjects thisList = DependencyManager::get()->getList(_listName); + render::Transaction transaction; + render::ItemIDs finalList; + render::ItemID currentID; + auto entityTree = qApp->getEntities()->getTree(); + auto& overlays = qApp->getOverlays(); - if (thisList.getContainsData()) { - render::Transaction transaction; - render::ItemIDs finalList; - render::ItemID currentID; - auto entityTree = qApp->getEntities()->getTree(); - auto& overlays = qApp->getOverlays(); - - for (QUuid& currentAvatarID : thisList.getAvatarIDs()) { - auto avatar = std::static_pointer_cast(DependencyManager::get()->getAvatarBySessionID(currentAvatarID)); - if (avatar) { - currentID = avatar->getRenderItemID(); - if (currentID != render::Item::INVALID_ITEM_ID) { - finalList.push_back(currentID); - } + for (QUuid& currentAvatarID : thisList.getAvatarIDs()) { + auto avatar = std::static_pointer_cast(DependencyManager::get()->getAvatarBySessionID(currentAvatarID)); + if (avatar) { + currentID = avatar->getRenderItemID(); + if (currentID != render::Item::INVALID_ITEM_ID) { + finalList.push_back(currentID); } } + } - for (EntityItemID& currentEntityID : thisList.getEntityIDs()) { - entityTree->withReadLock([&] { - auto entityItem = entityTree->findEntityByEntityItemID(currentEntityID); - if (entityItem != NULL) { - auto renderableInterface = entityItem->getRenderableInterface(); - if (renderableInterface != NULL) { - currentID = renderableInterface->getMetaRenderItemID(); - if (currentID != render::Item::INVALID_ITEM_ID) { - finalList.push_back(currentID); - } + for (EntityItemID& currentEntityID : thisList.getEntityIDs()) { + entityTree->withReadLock([&] { + auto entityItem = entityTree->findEntityByEntityItemID(currentEntityID); + if (entityItem != NULL) { + auto renderableInterface = entityItem->getRenderableInterface(); + if (renderableInterface != NULL) { + currentID = renderableInterface->getMetaRenderItemID(); + if (currentID != render::Item::INVALID_ITEM_ID) { + finalList.push_back(currentID); } } - }); - } + } + }); + } - for (OverlayID& currentOverlayID : thisList.getOverlayIDs()) { - auto overlay = overlays.getOverlay(currentOverlayID); - if (overlay != NULL) { - currentID = overlay->getRenderItemID(); - if (currentID != render::Item::INVALID_ITEM_ID) { - finalList.push_back(currentID); - } + for (OverlayID& currentOverlayID : thisList.getOverlayIDs()) { + auto overlay = overlays.getOverlay(currentOverlayID); + if (overlay != NULL) { + currentID = overlay->getRenderItemID(); + if (currentID != render::Item::INVALID_ITEM_ID) { + finalList.push_back(currentID); } } - - render::Selection selection(_listName.toStdString(), finalList); - transaction.resetSelection(selection); - - mainScene->enqueueTransaction(transaction); - } else { - qWarning() << "List of GameplayObjects doesn't exist in thisList"; } + + render::Selection selection(_listName.toStdString(), finalList); + transaction.resetSelection(selection); + + mainScene->enqueueTransaction(transaction); } else { qWarning() << "SelectionToSceneHandler::updateRendererSelectedList(), Unexpected null scene, possibly during application shutdown"; } diff --git a/libraries/render/src/render/Scene.h b/libraries/render/src/render/Scene.h index 418dcd3bd0..3b61a20f24 100644 --- a/libraries/render/src/render/Scene.h +++ b/libraries/render/src/render/Scene.h @@ -60,8 +60,6 @@ public: // Selection transactions void resetSelection(const Selection& selection); - void pushSelection(const Selection& selection); - void popSelection(const Selection& selection); void merge(const Transaction& transaction);