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