Showing the changes to interface/src/scripting/SelectionScriptingInterface.cpp (1 of 62 files). Show all
Unified · Split
| @@ -40,19 +40,6 @@ bool GameplayObjects::removeFromGameplayObjects(const EntityItemID& entityID) { · 39 unmodified lines | ||
| 40 | 40 | return true; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | −bool GameplayObjects::addToGameplayObjects(const OverlayID& overlayID) { | |
| 44 | − containsData = true; | |
| 45 | − if (std::find(_overlayIDs.begin(), _overlayIDs.end(), overlayID) == _overlayIDs.end()) { | |
| 46 | − _overlayIDs.push_back(overlayID); | |
| 47 | − } | |
| 48 | − return true; | |
| 49 | −} | |
| 50 | −bool GameplayObjects::removeFromGameplayObjects(const OverlayID& overlayID) { | |
| 51 | − _overlayIDs.erase(std::remove(_overlayIDs.begin(), _overlayIDs.end(), overlayID), _overlayIDs.end()); | |
| 52 | − return true; | |
| 53 | −} | |
| 54 | − | |
| 55 | − | |
| 56 | 43 | SelectionScriptingInterface::SelectionScriptingInterface() { |
| 57 | 44 | } |
| 58 | 45 | |
| @@ -64,7 +51,6 @@ SelectionScriptingInterface::SelectionScriptingInterface() { · 5 unmodified lines | ||
| 64 | 51 | * <tbody> |
| 65 | 52 | * <tr><td><code>"avatar"</code></td><td></td></tr> |
| 66 | 53 | * <tr><td><code>"entity"</code></td><td></td></tr> |
| 67 | − * <tr><td><code>"overlay"</code></td><td></td></tr> | |
| 68 | 54 | * </tbody> |
| 69 | 55 | * </table> |
| 70 | 56 | * @typedef {string} Selection.ItemType |
| @@ -72,20 +58,16 @@ SelectionScriptingInterface::SelectionScriptingInterface() { · 1 unmodified line | ||
| 72 | 58 | bool SelectionScriptingInterface::addToSelectedItemsList(const QString& listName, const QString& itemType, const QUuid& id) { |
| 73 | 59 | if (itemType == "avatar") { |
| 74 | 60 | return addToGameplayObjects(listName, (QUuid)id); |
| 75 | − } else if (itemType == "entity") { | |
| 61 | + } else if (itemType == "entity" || itemType == "overlay") { | |
| 76 | 62 | return addToGameplayObjects(listName, (EntityItemID)id); |
| 77 | − } else if (itemType == "overlay") { | |
| 78 | − return addToGameplayObjects(listName, (OverlayID)id); | |
| 79 | 63 | } |
| 80 | 64 | return false; |
| 81 | 65 | } |
| 82 | 66 | bool SelectionScriptingInterface::removeFromSelectedItemsList(const QString& listName, const QString& itemType, const QUuid& id) { |
| 83 | 67 | if (itemType == "avatar") { |
| 84 | 68 | return removeFromGameplayObjects(listName, (QUuid)id); |
| 85 | − } else if (itemType == "entity") { | |
| 69 | + } else if (itemType == "entity" || itemType == "overlay") { | |
| 86 | 70 | return removeFromGameplayObjects(listName, (EntityItemID)id); |
| 87 | − } else if (itemType == "overlay") { | |
| 88 | − return removeFromGameplayObjects(listName, (OverlayID)id); | |
| 89 | 71 | } |
| 90 | 72 | return false; |
| 91 | 73 | } |
| @@ -253,12 +235,6 @@ void SelectionScriptingInterface::printList(const QString& listName) { · 161 unmodified lines | ||
| 253 | 235 | qDebug() << j << ';'; |
| 254 | 236 | } |
| 255 | 237 | qDebug() << ""; |
| 256 | − | |
| 257 | − qDebug() << "Overlay IDs:"; | |
| 258 | − for (auto k : (*currentList).getOverlayIDs()) { | |
| 259 | − qDebug() << k << ';'; | |
| 260 | − } | |
| 261 | − qDebug() << ""; | |
| 262 | 238 | } |
| 263 | 239 | else { |
| 264 | 240 | qDebug() << "List named " << listName << " empty"; |
| @@ -272,7 +248,6 @@ void SelectionScriptingInterface::printList(const QString& listName) { · 7 unmodified lines | ||
| 272 | 248 | * @typedef {object} Selection.SelectedItemsList |
| 273 | 249 | * @property {Uuid[]} avatars - The IDs of the avatars in the selection. |
| 274 | 250 | * @property {Uuid[]} entities - The IDs of the entities in the selection. |
| 275 | − * @property {Uuid[]} overlays - The IDs of the overlays in the selection. | |
| 276 | 251 | */ |
| 277 | 252 | QVariantMap SelectionScriptingInterface::getSelectedItemsList(const QString& listName) const { |
| 278 | 253 | QReadLocker lock(&_selectionListsLock); |
| @@ -281,7 +256,6 @@ QVariantMap SelectionScriptingInterface::getSelectedItemsList(const QString& lis · 2 unmodified lines | ||
| 281 | 256 | if (currentList != _selectedItemsListMap.end()) { |
| 282 | 257 | QList<QVariant> avatarIDs; |
| 283 | 258 | QList<QVariant> entityIDs; |
| 284 | − QList<QVariant> overlayIDs; | |
| 285 | 259 | |
| 286 | 260 | if ((*currentList).getContainsData()) { |
| 287 | 261 | if (!(*currentList).getAvatarIDs().empty()) { |
| @@ -294,15 +268,9 @@ QVariantMap SelectionScriptingInterface::getSelectedItemsList(const QString& lis · 6 unmodified lines | ||
| 294 | 268 | entityIDs.push_back((QUuid)j ); |
| 295 | 269 | } |
| 296 | 270 | } |
| 297 | − if (!(*currentList).getOverlayIDs().empty()) { | |
| 298 | − for (auto j : (*currentList).getOverlayIDs()) { | |
| 299 | − overlayIDs.push_back((QUuid)j); | |
| 300 | − } | |
| 301 | − } | |
| 302 | 271 | } |
| 303 | 272 | list["avatars"] = (avatarIDs); |
| 304 | 273 | list["entities"] = (entityIDs); |
| 305 | − list["overlays"] = (overlayIDs); | |
| 306 | 274 | |
| 307 | 275 | return list; |
| 308 | 276 | } |
| @@ -379,7 +347,6 @@ void SelectionToSceneHandler::updateSceneFromSelectedList() { · 70 unmodified lines | ||
| 379 | 347 | render::ItemIDs finalList; |
| 380 | 348 | render::ItemID currentID; |
| 381 | 349 | auto entityTreeRenderer = DependencyManager::get<EntityTreeRenderer>(); |
| 382 | − auto& overlays = qApp->getOverlays(); | |
| 383 | 350 | |
| 384 | 351 | for (QUuid& currentAvatarID : thisList.getAvatarIDs()) { |
| 385 | 352 | auto avatar = std::static_pointer_cast<Avatar>(DependencyManager::get<AvatarManager>()->getAvatarBySessionID(currentAvatarID)); |
| @@ -398,16 +365,6 @@ void SelectionToSceneHandler::updateSceneFromSelectedList() { · 12 unmodified lines | ||
| 398 | 365 | } |
| 399 | 366 | } |
| 400 | 367 | |
| 401 | − for (OverlayID& currentOverlayID : thisList.getOverlayIDs()) { | |
| 402 | − auto overlay = overlays.getOverlay(currentOverlayID); | |
| 403 | − if (overlay != NULL) { | |
| 404 | − currentID = overlay->getRenderItemID(); | |
| 405 | − if (currentID != render::Item::INVALID_ITEM_ID) { | |
| 406 | − finalList.push_back(currentID); | |
| 407 | − } | |
| 408 | − } | |
| 409 | − } | |
| 410 | − | |
| 411 | 368 | render::Selection selection(_listName.toStdString(), finalList); |
| 412 | 369 | transaction.resetSelection(selection); |
| 413 | 370 | |