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 | return true; | 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 | SelectionScriptingInterface::SelectionScriptingInterface() { | 43 | SelectionScriptingInterface::SelectionScriptingInterface() { |
| 57 | } | 44 | } |
| 58 | 45 | ||
| @@ -64,7 +51,6 @@ SelectionScriptingInterface::SelectionScriptingInterface() { · 5 unmodified lines | |||
| 64 | * <tbody> | 51 | * <tbody> |
| 65 | * <tr><td><code>"avatar"</code></td><td></td></tr> | 52 | * <tr><td><code>"avatar"</code></td><td></td></tr> |
| 66 | * <tr><td><code>"entity"</code></td><td></td></tr> | 53 | * <tr><td><code>"entity"</code></td><td></td></tr> |
| 67 | * <tr><td><code>"overlay"</code></td><td></td></tr> | ||
| 68 | * </tbody> | 54 | * </tbody> |
| 69 | * </table> | 55 | * </table> |
| 70 | * @typedef {string} Selection.ItemType | 56 | * @typedef {string} Selection.ItemType |
| @@ -72,20 +58,16 @@ SelectionScriptingInterface::SelectionScriptingInterface() { · 1 unmodified line | |||
| 72 | bool SelectionScriptingInterface::addToSelectedItemsList(const QString& listName, const QString& itemType, const QUuid& id) { | 58 | bool SelectionScriptingInterface::addToSelectedItemsList(const QString& listName, const QString& itemType, const QUuid& id) { |
| 73 | if (itemType == "avatar") { | 59 | if (itemType == "avatar") { |
| 74 | return addToGameplayObjects(listName, (QUuid)id); | 60 | return addToGameplayObjects(listName, (QUuid)id); |
| 75 | } else if (itemType == "entity") { | 61 | } else if (itemType == "entity" || itemType == "overlay") { |
| 76 | return addToGameplayObjects(listName, (EntityItemID)id); | 62 | return addToGameplayObjects(listName, (EntityItemID)id); |
| 77 | } else if (itemType == "overlay") { | ||
| 78 | return addToGameplayObjects(listName, (OverlayID)id); | ||
| 79 | } | 63 | } |
| 80 | return false; | 64 | return false; |
| 81 | } | 65 | } |
| 82 | bool SelectionScriptingInterface::removeFromSelectedItemsList(const QString& listName, const QString& itemType, const QUuid& id) { | 66 | bool SelectionScriptingInterface::removeFromSelectedItemsList(const QString& listName, const QString& itemType, const QUuid& id) { |
| 83 | if (itemType == "avatar") { | 67 | if (itemType == "avatar") { |
| 84 | return removeFromGameplayObjects(listName, (QUuid)id); | 68 | return removeFromGameplayObjects(listName, (QUuid)id); |
| 85 | } else if (itemType == "entity") { | 69 | } else if (itemType == "entity" || itemType == "overlay") { |
| 86 | return removeFromGameplayObjects(listName, (EntityItemID)id); | 70 | return removeFromGameplayObjects(listName, (EntityItemID)id); |
| 87 | } else if (itemType == "overlay") { | ||
| 88 | return removeFromGameplayObjects(listName, (OverlayID)id); | ||
| 89 | } | 71 | } |
| 90 | return false; | 72 | return false; |
| 91 | } | 73 | } |
| @@ -253,12 +235,6 @@ void SelectionScriptingInterface::printList(const QString& listName) { · 161 unmodified lines | |||
| 253 | qDebug() << j << ';'; | 235 | qDebug() << j << ';'; |
| 254 | } | 236 | } |
| 255 | qDebug() << ""; | 237 | qDebug() << ""; |
| 256 | |||
| 257 | qDebug() << "Overlay IDs:"; | ||
| 258 | for (auto k : (*currentList).getOverlayIDs()) { | ||
| 259 | qDebug() << k << ';'; | ||
| 260 | } | ||
| 261 | qDebug() << ""; | ||
| 262 | } | 238 | } |
| 263 | else { | 239 | else { |
| 264 | qDebug() << "List named " << listName << " empty"; | 240 | qDebug() << "List named " << listName << " empty"; |
| @@ -272,7 +248,6 @@ void SelectionScriptingInterface::printList(const QString& listName) { · 7 unmodified lines | |||
| 272 | * @typedef {object} Selection.SelectedItemsList | 248 | * @typedef {object} Selection.SelectedItemsList |
| 273 | * @property {Uuid[]} avatars - The IDs of the avatars in the selection. | 249 | * @property {Uuid[]} avatars - The IDs of the avatars in the selection. |
| 274 | * @property {Uuid[]} entities - The IDs of the entities in the selection. | 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 | QVariantMap SelectionScriptingInterface::getSelectedItemsList(const QString& listName) const { | 252 | QVariantMap SelectionScriptingInterface::getSelectedItemsList(const QString& listName) const { |
| 278 | QReadLocker lock(&_selectionListsLock); | 253 | QReadLocker lock(&_selectionListsLock); |
| @@ -281,7 +256,6 @@ QVariantMap SelectionScriptingInterface::getSelectedItemsList(const QString& lis · 2 unmodified lines | |||
| 281 | if (currentList != _selectedItemsListMap.end()) { | 256 | if (currentList != _selectedItemsListMap.end()) { |
| 282 | QList<QVariant> avatarIDs; | 257 | QList<QVariant> avatarIDs; |
| 283 | QList<QVariant> entityIDs; | 258 | QList<QVariant> entityIDs; |
| 284 | QList<QVariant> overlayIDs; | ||
| 285 | 259 | ||
| 286 | if ((*currentList).getContainsData()) { | 260 | if ((*currentList).getContainsData()) { |
| 287 | if (!(*currentList).getAvatarIDs().empty()) { | 261 | if (!(*currentList).getAvatarIDs().empty()) { |
| @@ -294,15 +268,9 @@ QVariantMap SelectionScriptingInterface::getSelectedItemsList(const QString& lis · 6 unmodified lines | |||
| 294 | entityIDs.push_back((QUuid)j ); | 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 | list["avatars"] = (avatarIDs); | 272 | list["avatars"] = (avatarIDs); |
| 304 | list["entities"] = (entityIDs); | 273 | list["entities"] = (entityIDs); |
| 305 | list["overlays"] = (overlayIDs); | ||
| 306 | 274 | ||
| 307 | return list; | 275 | return list; |
| 308 | } | 276 | } |
| @@ -379,7 +347,6 @@ void SelectionToSceneHandler::updateSceneFromSelectedList() { · 70 unmodified lines | |||
| 379 | render::ItemIDs finalList; | 347 | render::ItemIDs finalList; |
| 380 | render::ItemID currentID; | 348 | render::ItemID currentID; |
| 381 | auto entityTreeRenderer = DependencyManager::get<EntityTreeRenderer>(); | 349 | auto entityTreeRenderer = DependencyManager::get<EntityTreeRenderer>(); |
| 382 | auto& overlays = qApp->getOverlays(); | ||
| 383 | 350 | ||
| 384 | for (QUuid& currentAvatarID : thisList.getAvatarIDs()) { | 351 | for (QUuid& currentAvatarID : thisList.getAvatarIDs()) { |
| 385 | auto avatar = std::static_pointer_cast<Avatar>(DependencyManager::get<AvatarManager>()->getAvatarBySessionID(currentAvatarID)); | 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 | render::Selection selection(_listName.toStdString(), finalList); | 368 | render::Selection selection(_listName.toStdString(), finalList); |
| 412 | transaction.resetSelection(selection); | 369 | transaction.resetSelection(selection); |
| 413 | 370 | ||