Showing the changes to interface/src/scripting/SelectionScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -43,8 +43,7 @@ bool GameplayObjects::removeFromGameplayObjects(const OverlayID& overlayID) { · 42 unmodified lines | ||
| 43 | 43 | return true; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | −SelectionScriptingInterface::SelectionScriptingInterface(AbstractViewStateInterface* viewState) { | |
| 47 | − _viewState = viewState; | |
| 46 | +SelectionScriptingInterface::SelectionScriptingInterface() { | |
| 48 | 47 | } |
| 49 | 48 | |
| 50 | 49 | 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 | ||
| 97 | 96 | // END HANDLING GENERIC ITEMS |
| 98 | 97 | // |
| 99 | 98 | |
| 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 | + | |
| 100 | 107 | void SelectionScriptingInterface::printList(const QString& listName) { |
| 101 | 108 | if (_selectedItemsListMap.contains(listName)) { |
| 102 | 109 | auto currentList = _selectedItemsListMap.value(listName); |
| @@ -143,14 +150,15 @@ void SelectionToSceneHandler::initialize(render::ScenePointer mainScene, const Q · 40 unmodified lines | ||
| 143 | 150 | |
| 144 | 151 | void SelectionToSceneHandler::updateRendererSelectedList() { |
| 145 | 152 | if (_mainScene) { |
| 153 | + GameplayObjects* thisList = DependencyManager::get<SelectionScriptingInterface>()->getList(_listName); | |
| 146 | 154 | render::Transaction transaction; |
| 147 | 155 | |
| 148 | − if (_selectedItemsListMap.contains(_listName)) { | |
| 156 | + if (thisList != NULL) { | |
| 149 | 157 | render::ItemIDs finalList; |
| 150 | 158 | render::ItemID currentID; |
| 151 | 159 | auto entityTree = qApp->getEntities()->getTree(); |
| 152 | 160 | auto& overlays = qApp->getOverlays(); |
| 153 | − auto currentList = _selectedItemsListMap.value(_listName); | |
| 161 | + auto currentList = thisList.value(_listName); | |
| 154 | 162 | |
| 155 | 163 | for (QUuid& currentAvatarID : currentList.getAvatarIDs()) { |
| 156 | 164 | auto avatar = std::static_pointer_cast<Avatar>(DependencyManager::get<AvatarManager>()->getAvatarBySessionID(currentAvatarID)); |
| @@ -192,7 +200,7 @@ void SelectionToSceneHandler::updateRendererSelectedList() { · 35 unmodified lines | ||
| 192 | 200 | |
| 193 | 201 | _mainScene->enqueueTransaction(transaction); |
| 194 | 202 | } else { |
| 195 | − qWarning() << "List of GameplayObjects doesn't exist in _selectedItemsListMap"; | |
| 203 | + qWarning() << "List of GameplayObjects doesn't exist in thisList"; | |
| 196 | 204 | } |
| 197 | 205 | } else { |
| 198 | 206 | qWarning() << "SelectionScriptingInterface::updateRendererSelectedList(), Unexpected null scene, possibly during application shutdown"; |