History

I understood last night at midnight

Zach Fox committed 9 years ago

Commit 92e8f841 parent 657beef2 files · +16 −6Browse files

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

Unified · Split

interface/src/scripting/SelectionScriptingInterface.cpp+13−5
@@ -43,8 +43,7 @@ bool GameplayObjects::removeFromGameplayObjects(const OverlayID& overlayID) { · 42 unmodified lines
4343 return true;
4444 }
4545
46−SelectionScriptingInterface::SelectionScriptingInterface(AbstractViewStateInterface* viewState) {
47− _viewState = viewState;
46+SelectionScriptingInterface::SelectionScriptingInterface() {
4847 }
4948
5049 bool SelectionScriptingInterface::addToSelectedItemsList(const QString& listName, const QString& itemType, const QUuid& id) {
@@ -97,6 +96,14 @@ template <class T> bool SelectionScriptingInterface::removeFromGameplayObjects(c · 46 unmodified lines
9796 // END HANDLING GENERIC ITEMS
9897 //
9998
99+GameplayObjects* SelectionScriptingInterface::getList(const QString& listName) {
100+ if (_selectedItemsListMap.contains(listName)) {
101+ return _selectedItemsListMap.value(listName);
102+ } else {
103+ return NULL;
104+ }
105+}
106+
100107 void SelectionScriptingInterface::printList(const QString& listName) {
101108 if (_selectedItemsListMap.contains(listName)) {
102109 auto currentList = _selectedItemsListMap.value(listName);
@@ -143,14 +150,15 @@ void SelectionToSceneHandler::initialize(render::ScenePointer mainScene, const Q · 40 unmodified lines
143150
144151 void SelectionToSceneHandler::updateRendererSelectedList() {
145152 if (_mainScene) {
153+ GameplayObjects* thisList = DependencyManager::get<SelectionScriptingInterface>()->getList(_listName);
146154 render::Transaction transaction;
147155
148− if (_selectedItemsListMap.contains(_listName)) {
156+ if (thisList != NULL) {
149157 render::ItemIDs finalList;
150158 render::ItemID currentID;
151159 auto entityTree = qApp->getEntities()->getTree();
152160 auto& overlays = qApp->getOverlays();
153− auto currentList = _selectedItemsListMap.value(_listName);
161+ auto currentList = thisList.value(_listName);
154162
155163 for (QUuid& currentAvatarID : currentList.getAvatarIDs()) {
156164 auto avatar = std::static_pointer_cast<Avatar>(DependencyManager::get<AvatarManager>()->getAvatarBySessionID(currentAvatarID));
@@ -192,7 +200,7 @@ void SelectionToSceneHandler::updateRendererSelectedList() { · 35 unmodified lines
192200
193201 _mainScene->enqueueTransaction(transaction);
194202 } else {
195− qWarning() << "List of GameplayObjects doesn't exist in _selectedItemsListMap";
203+ qWarning() << "List of GameplayObjects doesn't exist in thisList";
196204 }
197205 } else {
198206 qWarning() << "SelectionScriptingInterface::updateRendererSelectedList(), Unexpected null scene, possibly during application shutdown";