History

Just gotta test

Zach Fox committed 9 years ago

Commit d370eee1 parent e834e9d2 files · +14 −12Browse files

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

Unified · Split

interface/src/scripting/SelectionScriptingInterface.cpp+11−12
@@ -17,6 +17,7 @@ GameplayObjects::GameplayObjects() { · 16 unmodified lines
1717 }
1818
1919 bool GameplayObjects::addToGameplayObjects(const QUuid& avatarID) {
20+ containsData = true;
2021 _avatarIDs.push_back(avatarID);
2122 return true;
2223 }
@@ -26,6 +27,7 @@ bool GameplayObjects::removeFromGameplayObjects(const QUuid& avatarID) { · 3 unmodified lines
2627 }
2728
2829 bool GameplayObjects::addToGameplayObjects(const EntityItemID& entityID) {
30+ containsData = true;
2931 _entityIDs.push_back(entityID);
3032 return true;
3133 }
@@ -35,6 +37,7 @@ bool GameplayObjects::removeFromGameplayObjects(const EntityItemID& entityID) { · 3 unmodified lines
3537 }
3638
3739 bool GameplayObjects::addToGameplayObjects(const OverlayID& overlayID) {
40+ containsData = true;
3841 _overlayIDs.push_back(overlayID);
3942 return true;
4043 }
@@ -96,12 +99,8 @@ template <class T> bool SelectionScriptingInterface::removeFromGameplayObjects(c · 55 unmodified lines
9699 // END HANDLING GENERIC ITEMS
97100 //
98101
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);
105104 }
106105
107106 void SelectionScriptingInterface::printList(const QString& listName) {
@@ -132,7 +131,7 @@ void SelectionScriptingInterface::printList(const QString& listName) { · 24 unmodified lines
132131
133132 bool SelectionScriptingInterface::removeListFromMap(const QString& listName) {
134133 if (_selectedItemsListMap.remove(listName)) {
135− //updateRendererSelectedList(listName);
134+ emit selectedItemsListChanged(listName);
136135 return true;
137136 } else {
138137 return false;
@@ -156,16 +155,16 @@ void SelectionToSceneHandler::selectedItemsListChanged(const QString& listName) · 17 unmodified lines
156155
157156 void SelectionToSceneHandler::updateSceneFromSelectedList() {
158157 if (_mainScene) {
159− GameplayObjects* thisList = &DependencyManager::get<SelectionScriptingInterface>()->getList(_listName);
158+ GameplayObjects thisList = DependencyManager::get<SelectionScriptingInterface>()->getList(_listName);
160159 render::Transaction transaction;
161160
162− if (thisList != NULL) {
161+ if (thisList.getContainsData()) {
163162 render::ItemIDs finalList;
164163 render::ItemID currentID;
165164 auto entityTree = qApp->getEntities()->getTree();
166165 auto& overlays = qApp->getOverlays();
167166
168− for (QUuid& currentAvatarID : thisList->getAvatarIDs()) {
167+ for (QUuid& currentAvatarID : thisList.getAvatarIDs()) {
169168 auto avatar = std::static_pointer_cast<Avatar>(DependencyManager::get<AvatarManager>()->getAvatarBySessionID(currentAvatarID));
170169 if (avatar) {
171170 currentID = avatar->getRenderItemID();
@@ -175,7 +174,7 @@ void SelectionToSceneHandler::updateSceneFromSelectedList() { · 3 unmodified lines
175174 }
176175 }
177176
178− for (EntityItemID& currentEntityID : thisList->getEntityIDs()) {
177+ for (EntityItemID& currentEntityID : thisList.getEntityIDs()) {
179178 entityTree->withReadLock([&] {
180179 auto entityItem = entityTree->findEntityByEntityItemID(currentEntityID);
181180 if (entityItem != NULL) {
@@ -190,7 +189,7 @@ void SelectionToSceneHandler::updateSceneFromSelectedList() { · 8 unmodified lines
190189 });
191190 }
192191
193− for (OverlayID& currentOverlayID : thisList->getOverlayIDs()) {
192+ for (OverlayID& currentOverlayID : thisList.getOverlayIDs()) {
194193 auto overlay = overlays.getOverlay(currentOverlayID);
195194 if (overlay != NULL) {
196195 currentID = overlay->getRenderItemID();