History

more overlay wip

SamGondelman committed 7 years ago

Commit 5ce8f561 parent ca8d64b62 files · +620 −864Browse files

Showing the changes to interface/src/scripting/SelectionScriptingInterface.cpp (1 of 62 files). Show all

Unified · Split

interface/src/scripting/SelectionScriptingInterface.cpp+2−45
@@ -40,19 +40,6 @@ bool GameplayObjects::removeFromGameplayObjects(const EntityItemID& entityID) { · 39 unmodified lines
4040 return true;
4141 }
4242
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−
5643 SelectionScriptingInterface::SelectionScriptingInterface() {
5744 }
5845
@@ -64,7 +51,6 @@ SelectionScriptingInterface::SelectionScriptingInterface() { · 5 unmodified lines
6451 * <tbody>
6552 * <tr><td><code>"avatar"</code></td><td></td></tr>
6653 * <tr><td><code>"entity"</code></td><td></td></tr>
67− * <tr><td><code>"overlay"</code></td><td></td></tr>
6854 * </tbody>
6955 * </table>
7056 * @typedef {string} Selection.ItemType
@@ -72,20 +58,16 @@ SelectionScriptingInterface::SelectionScriptingInterface() { · 1 unmodified line
7258 bool SelectionScriptingInterface::addToSelectedItemsList(const QString& listName, const QString& itemType, const QUuid& id) {
7359 if (itemType == "avatar") {
7460 return addToGameplayObjects(listName, (QUuid)id);
75− } else if (itemType == "entity") {
61+ } else if (itemType == "entity" || itemType == "overlay") {
7662 return addToGameplayObjects(listName, (EntityItemID)id);
77− } else if (itemType == "overlay") {
78− return addToGameplayObjects(listName, (OverlayID)id);
7963 }
8064 return false;
8165 }
8266 bool SelectionScriptingInterface::removeFromSelectedItemsList(const QString& listName, const QString& itemType, const QUuid& id) {
8367 if (itemType == "avatar") {
8468 return removeFromGameplayObjects(listName, (QUuid)id);
85− } else if (itemType == "entity") {
69+ } else if (itemType == "entity" || itemType == "overlay") {
8670 return removeFromGameplayObjects(listName, (EntityItemID)id);
87− } else if (itemType == "overlay") {
88− return removeFromGameplayObjects(listName, (OverlayID)id);
8971 }
9072 return false;
9173 }
@@ -253,12 +235,6 @@ void SelectionScriptingInterface::printList(const QString& listName) { · 161 unmodified lines
253235 qDebug() << j << ';';
254236 }
255237 qDebug() << "";
256−
257− qDebug() << "Overlay IDs:";
258− for (auto k : (*currentList).getOverlayIDs()) {
259− qDebug() << k << ';';
260− }
261− qDebug() << "";
262238 }
263239 else {
264240 qDebug() << "List named " << listName << " empty";
@@ -272,7 +248,6 @@ void SelectionScriptingInterface::printList(const QString& listName) { · 7 unmodified lines
272248 * @typedef {object} Selection.SelectedItemsList
273249 * @property {Uuid[]} avatars - The IDs of the avatars in the selection.
274250 * @property {Uuid[]} entities - The IDs of the entities in the selection.
275− * @property {Uuid[]} overlays - The IDs of the overlays in the selection.
276251 */
277252 QVariantMap SelectionScriptingInterface::getSelectedItemsList(const QString& listName) const {
278253 QReadLocker lock(&_selectionListsLock);
@@ -281,7 +256,6 @@ QVariantMap SelectionScriptingInterface::getSelectedItemsList(const QString& lis · 2 unmodified lines
281256 if (currentList != _selectedItemsListMap.end()) {
282257 QList<QVariant> avatarIDs;
283258 QList<QVariant> entityIDs;
284− QList<QVariant> overlayIDs;
285259
286260 if ((*currentList).getContainsData()) {
287261 if (!(*currentList).getAvatarIDs().empty()) {
@@ -294,15 +268,9 @@ QVariantMap SelectionScriptingInterface::getSelectedItemsList(const QString& lis · 6 unmodified lines
294268 entityIDs.push_back((QUuid)j );
295269 }
296270 }
297− if (!(*currentList).getOverlayIDs().empty()) {
298− for (auto j : (*currentList).getOverlayIDs()) {
299− overlayIDs.push_back((QUuid)j);
300− }
301− }
302271 }
303272 list["avatars"] = (avatarIDs);
304273 list["entities"] = (entityIDs);
305− list["overlays"] = (overlayIDs);
306274
307275 return list;
308276 }
@@ -379,7 +347,6 @@ void SelectionToSceneHandler::updateSceneFromSelectedList() { · 70 unmodified lines
379347 render::ItemIDs finalList;
380348 render::ItemID currentID;
381349 auto entityTreeRenderer = DependencyManager::get<EntityTreeRenderer>();
382− auto& overlays = qApp->getOverlays();
383350
384351 for (QUuid& currentAvatarID : thisList.getAvatarIDs()) {
385352 auto avatar = std::static_pointer_cast<Avatar>(DependencyManager::get<AvatarManager>()->getAvatarBySessionID(currentAvatarID));
@@ -398,16 +365,6 @@ void SelectionToSceneHandler::updateSceneFromSelectedList() { · 12 unmodified lines
398365 }
399366 }
400367
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−
411368 render::Selection selection(_listName.toStdString(), finalList);
412369 transaction.resetSelection(selection);
413370