History

More progress

Zach Fox committed 9 years ago

Commit 52ef0f21 parent 88c24c13 files · +56 −23Browse files

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

Unified · Split

interface/src/scripting/SelectionScriptingInterface.cpp+42−12
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010 //
1111
1212 #include "SelectionScriptingInterface.h"
13+#include <QDebug>
1314 #include "Application.h"
1415
1516 GameplayObjects::GameplayObjects() {
@@ -49,10 +50,10 @@ SelectionScriptingInterface::SelectionScriptingInterface(AbstractViewStateInterf · 33 unmodified lines
4950 //
5051 // START HANDLING AVATARS
5152 //
52−bool SelectionScriptingInterface::addToSelectedItemsList(const render::Selection::Name& listName, const QUuid& avatarSessionID) {
53+bool SelectionScriptingInterface::addToSelectedItemsList(const QString& listName, const QUuid& avatarSessionID) {
5354 return addToGameplayObjects(listName, avatarSessionID);
5455 }
55−bool SelectionScriptingInterface::removeFromSelectedItemsList(const render::Selection::Name& listName, const QUuid& avatarSessionID) {
56+bool SelectionScriptingInterface::removeFromSelectedItemsList(const QString& listName, const QUuid& avatarSessionID) {
5657 return addToGameplayObjects(listName, avatarSessionID);
5758 }
5859 //
@@ -62,10 +63,10 @@ bool SelectionScriptingInterface::removeFromSelectedItemsList(const render::Sele · 3 unmodified lines
6263 //
6364 // START HANDLING ENTITIES
6465 //
65−bool SelectionScriptingInterface::addToSelectedItemsList(const render::Selection::Name& listName, const EntityItemID& entityID) {
66+bool SelectionScriptingInterface::addToSelectedItemsList(const QString& listName, const EntityItemID& entityID) {
6667 return addToGameplayObjects(listName, entityID);
6768 }
68−bool SelectionScriptingInterface::removeFromSelectedItemsList(const render::Selection::Name& listName, const EntityItemID& entityID) {
69+bool SelectionScriptingInterface::removeFromSelectedItemsList(const QString& listName, const EntityItemID& entityID) {
6970 return addToGameplayObjects(listName, entityID);
7071 }
7172 //
@@ -75,10 +76,10 @@ bool SelectionScriptingInterface::removeFromSelectedItemsList(const render::Sele · 3 unmodified lines
7576 //
7677 // START HANDLING OVERLAYS
7778 //
78−bool SelectionScriptingInterface::addToSelectedItemsList(const render::Selection::Name& listName, const OverlayID& overlayID) {
79+bool SelectionScriptingInterface::addToSelectedItemsList(const QString& listName, const OverlayID& overlayID) {
7980 return addToGameplayObjects(listName, overlayID);
8081 }
81−bool SelectionScriptingInterface::removeFromSelectedItemsList(const render::Selection::Name& listName, const OverlayID& overlayID) {
82+bool SelectionScriptingInterface::removeFromSelectedItemsList(const QString& listName, const OverlayID& overlayID) {
8283 return addToGameplayObjects(listName, overlayID);
8384 }
8485 //
@@ -88,23 +89,25 @@ bool SelectionScriptingInterface::removeFromSelectedItemsList(const render::Sele · 3 unmodified lines
8889 //
8990 // START HANDLING GENERIC ITEMS
9091 //
91−template <class T> bool SelectionScriptingInterface::addToGameplayObjects(const render::Selection::Name& listName, T idToAdd) {
92+template <class T> bool SelectionScriptingInterface::addToGameplayObjects(const QString& listName, T idToAdd) {
9293 if (_selectedItemsListMap.contains(listName)) {
9394 auto currentList = _selectedItemsListMap.take(listName);
9495 currentList.addToGameplayObjects(idToAdd);
9596 _selectedItemsListMap.insert(listName, currentList);
97+
9698 updateRendererSelectedList(listName);
9799 return true;
98100 } else {
99101 _selectedItemsListMap.insert(listName, GameplayObjects());
100− return addToSelectedItemsList(listName, idToAdd);
102+ return addToGameplayObjects(listName, idToAdd);
101103 }
102104 }
103−template <class T> bool SelectionScriptingInterface::removeFromGameplayObjects(const render::Selection::Name& listName, T idToRemove) {
105+template <class T> bool SelectionScriptingInterface::removeFromGameplayObjects(const QString& listName, T idToRemove) {
104106 if (_selectedItemsListMap.contains(listName)) {
105107 auto currentList = _selectedItemsListMap.take(listName);
106108 currentList.removeFromGameplayObjects(idToRemove);
107109 _selectedItemsListMap.insert(listName, currentList);
110+
108111 updateRendererSelectedList(listName);
109112 return true;
110113 } else {
@@ -115,15 +118,42 @@ template <class T> bool SelectionScriptingInterface::removeFromGameplayObjects(c · 4 unmodified lines
115118 // END HANDLING GENERIC ITEMS
116119 //
117120
118−bool SelectionScriptingInterface::removeListFromMap(const render::Selection::Name& listName) {
121+void SelectionScriptingInterface::printList(const QString& listName) {
122+ if (_selectedItemsListMap.contains(listName)) {
123+ auto currentList = _selectedItemsListMap.value(listName);
124+
125+ qDebug() << "Avatar IDs:";
126+ for (auto i : currentList.getAvatarIDs()) {
127+ qDebug() << i << '; ';
128+ }
129+ qDebug() << "";
130+
131+ qDebug() << "Entity IDs:";
132+ for (auto j : currentList.getEntityIDs()) {
133+ qDebug() << j << '; ';
134+ }
135+ qDebug() << "";
136+
137+ qDebug() << "Overlay IDs:";
138+ for (auto k : currentList.getOverlayIDs()) {
139+ qDebug() << k << '; ';
140+ }
141+ qDebug() << "";
142+ } else {
143+ qDebug() << "List named" << listName << "doesn't exist.";
144+ }
145+}
146+
147+bool SelectionScriptingInterface::removeListFromMap(const QString& listName) {
119148 if (_selectedItemsListMap.remove(listName)) {
149+ updateRendererSelectedList(listName);
120150 return true;
121151 } else {
122152 return false;
123153 }
124154 }
125155
126−void SelectionScriptingInterface::updateRendererSelectedList(const render::Selection::Name& listName) {
156+void SelectionScriptingInterface::updateRendererSelectedList(const QString& listName) {
127157 auto scene = _viewState->getMain3DScene();
128158 if (scene) {
129159 render::Transaction transaction;
@@ -170,7 +200,7 @@ void SelectionScriptingInterface::updateRendererSelectedList(const render::Selec · 40 unmodified lines
170200 }
171201 }
172202
173− render::Selection selection(listName, finalList);
203+ render::Selection selection(listName.toStdString(), finalList);
174204 transaction.resetSelection(selection);
175205
176206 scene->enqueueTransaction(transaction);