Showing the changes to interface/src/scripting/SelectionScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -17,6 +17,7 @@ GameplayObjects::GameplayObjects() { · 16 unmodified lines | |||
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | bool GameplayObjects::addToGameplayObjects(const QUuid& avatarID) { | 19 | bool GameplayObjects::addToGameplayObjects(const QUuid& avatarID) { |
| 20 | containsData = true; | ||
| 20 | _avatarIDs.push_back(avatarID); | 21 | _avatarIDs.push_back(avatarID); |
| 21 | return true; | 22 | return true; |
| 22 | } | 23 | } |
| @@ -26,6 +27,7 @@ bool GameplayObjects::removeFromGameplayObjects(const QUuid& avatarID) { · 3 unmodified lines | |||
| 26 | } | 27 | } |
| 27 | 28 | ||
| 28 | bool GameplayObjects::addToGameplayObjects(const EntityItemID& entityID) { | 29 | bool GameplayObjects::addToGameplayObjects(const EntityItemID& entityID) { |
| 30 | containsData = true; | ||
| 29 | _entityIDs.push_back(entityID); | 31 | _entityIDs.push_back(entityID); |
| 30 | return true; | 32 | return true; |
| 31 | } | 33 | } |
| @@ -35,6 +37,7 @@ bool GameplayObjects::removeFromGameplayObjects(const EntityItemID& entityID) { · 3 unmodified lines | |||
| 35 | } | 37 | } |
| 36 | 38 | ||
| 37 | bool GameplayObjects::addToGameplayObjects(const OverlayID& overlayID) { | 39 | bool GameplayObjects::addToGameplayObjects(const OverlayID& overlayID) { |
| 40 | containsData = true; | ||
| 38 | _overlayIDs.push_back(overlayID); | 41 | _overlayIDs.push_back(overlayID); |
| 39 | return true; | 42 | return true; |
| 40 | } | 43 | } |
| @@ -96,12 +99,8 @@ template <class T> bool SelectionScriptingInterface::removeFromGameplayObjects(c · 55 unmodified lines | |||
| 96 | // END HANDLING GENERIC ITEMS | 99 | // END HANDLING GENERIC ITEMS |
| 97 | // | 100 | // |
| 98 | 101 | ||
| 99 | GameplayObjects* SelectionScriptingInterface::getList(const QString& listName) { | 102 | GameplayObjects SelectionScriptingInterface::getList(const QString& listName) { |
| 100 | if (_selectedItemsListMap.contains(listName)) { | 103 | return _selectedItemsListMap.value(listName); |
| 101 | return _selectedItemsListMap.value(listName); | ||
| 102 | } else { | ||
| 103 | return NULL; | ||
| 104 | } | ||
| 105 | } | 104 | } |
| 106 | 105 | ||
| 107 | void SelectionScriptingInterface::printList(const QString& listName) { | 106 | void SelectionScriptingInterface::printList(const QString& listName) { |
| @@ -132,7 +131,7 @@ void SelectionScriptingInterface::printList(const QString& listName) { · 24 unmodified lines | |||
| 132 | 131 | ||
| 133 | bool SelectionScriptingInterface::removeListFromMap(const QString& listName) { | 132 | bool SelectionScriptingInterface::removeListFromMap(const QString& listName) { |
| 134 | if (_selectedItemsListMap.remove(listName)) { | 133 | if (_selectedItemsListMap.remove(listName)) { |
| 135 | //updateRendererSelectedList(listName); | 134 | emit selectedItemsListChanged(listName); |
| 136 | return true; | 135 | return true; |
| 137 | } else { | 136 | } else { |
| 138 | return false; | 137 | return false; |
| @@ -156,16 +155,16 @@ void SelectionToSceneHandler::selectedItemsListChanged(const QString& listName) · 17 unmodified lines | |||
| 156 | 155 | ||
| 157 | void SelectionToSceneHandler::updateSceneFromSelectedList() { | 156 | void SelectionToSceneHandler::updateSceneFromSelectedList() { |
| 158 | if (_mainScene) { | 157 | if (_mainScene) { |
| 159 | GameplayObjects* thisList = &DependencyManager::get<SelectionScriptingInterface>()->getList(_listName); | 158 | GameplayObjects thisList = DependencyManager::get<SelectionScriptingInterface>()->getList(_listName); |
| 160 | render::Transaction transaction; | 159 | render::Transaction transaction; |
| 161 | 160 | ||
| 162 | if (thisList != NULL) { | 161 | if (thisList.getContainsData()) { |
| 163 | render::ItemIDs finalList; | 162 | render::ItemIDs finalList; |
| 164 | render::ItemID currentID; | 163 | render::ItemID currentID; |
| 165 | auto entityTree = qApp->getEntities()->getTree(); | 164 | auto entityTree = qApp->getEntities()->getTree(); |
| 166 | auto& overlays = qApp->getOverlays(); | 165 | auto& overlays = qApp->getOverlays(); |
| 167 | 166 | ||
| 168 | for (QUuid& currentAvatarID : thisList->getAvatarIDs()) { | 167 | for (QUuid& currentAvatarID : thisList.getAvatarIDs()) { |
| 169 | auto avatar = std::static_pointer_cast<Avatar>(DependencyManager::get<AvatarManager>()->getAvatarBySessionID(currentAvatarID)); | 168 | auto avatar = std::static_pointer_cast<Avatar>(DependencyManager::get<AvatarManager>()->getAvatarBySessionID(currentAvatarID)); |
| 170 | if (avatar) { | 169 | if (avatar) { |
| 171 | currentID = avatar->getRenderItemID(); | 170 | currentID = avatar->getRenderItemID(); |
| @@ -175,7 +174,7 @@ void SelectionToSceneHandler::updateSceneFromSelectedList() { · 3 unmodified lines | |||
| 175 | } | 174 | } |
| 176 | } | 175 | } |
| 177 | 176 | ||
| 178 | for (EntityItemID& currentEntityID : thisList->getEntityIDs()) { | 177 | for (EntityItemID& currentEntityID : thisList.getEntityIDs()) { |
| 179 | entityTree->withReadLock([&] { | 178 | entityTree->withReadLock([&] { |
| 180 | auto entityItem = entityTree->findEntityByEntityItemID(currentEntityID); | 179 | auto entityItem = entityTree->findEntityByEntityItemID(currentEntityID); |
| 181 | if (entityItem != NULL) { | 180 | if (entityItem != NULL) { |
| @@ -190,7 +189,7 @@ void SelectionToSceneHandler::updateSceneFromSelectedList() { · 8 unmodified lines | |||
| 190 | }); | 189 | }); |
| 191 | } | 190 | } |
| 192 | 191 | ||
| 193 | for (OverlayID& currentOverlayID : thisList->getOverlayIDs()) { | 192 | for (OverlayID& currentOverlayID : thisList.getOverlayIDs()) { |
| 194 | auto overlay = overlays.getOverlay(currentOverlayID); | 193 | auto overlay = overlays.getOverlay(currentOverlayID); |
| 195 | if (overlay != NULL) { | 194 | if (overlay != NULL) { |
| 196 | currentID = overlay->getRenderItemID(); | 195 | currentID = overlay->getRenderItemID(); |