Showing the changes to interface/src/scripting/SelectionScriptingInterface.cpp (1 of 4 files). Show all
Unified · Split
| @@ -73,7 +73,7 @@ template <class T> bool SelectionScriptingInterface::addToGameplayObjects(const · 72 unmodified lines | ||
| 73 | 73 | currentList.addToGameplayObjects(idToAdd); |
| 74 | 74 | _selectedItemsListMap.insert(listName, currentList); |
| 75 | 75 | |
| 76 | − updateRendererSelectedList(listName); | |
| 76 | + emit selectedItemsListChanged(listName); | |
| 77 | 77 | return true; |
| 78 | 78 | } else { |
| 79 | 79 | _selectedItemsListMap.insert(listName, GameplayObjects()); |
| @@ -86,7 +86,7 @@ template <class T> bool SelectionScriptingInterface::removeFromGameplayObjects(c · 6 unmodified lines | ||
| 86 | 86 | currentList.removeFromGameplayObjects(idToRemove); |
| 87 | 87 | _selectedItemsListMap.insert(listName, currentList); |
| 88 | 88 | |
| 89 | − updateRendererSelectedList(listName); | |
| 89 | + emit selectedItemsListChanged(listName); | |
| 90 | 90 | return true; |
| 91 | 91 | } else { |
| 92 | 92 | return false; |
| @@ -132,7 +132,7 @@ void SelectionScriptingInterface::printList(const QString& listName) { · 39 unmodified lines | ||
| 132 | 132 | |
| 133 | 133 | bool SelectionScriptingInterface::removeListFromMap(const QString& listName) { |
| 134 | 134 | if (_selectedItemsListMap.remove(listName)) { |
| 135 | − updateRendererSelectedList(listName); | |
| 135 | + //updateRendererSelectedList(listName); | |
| 136 | 136 | return true; |
| 137 | 137 | } else { |
| 138 | 138 | return false; |
| @@ -148,9 +148,15 @@ void SelectionToSceneHandler::initialize(render::ScenePointer mainScene, const Q · 9 unmodified lines | ||
| 148 | 148 | _listName = listName; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | −void SelectionToSceneHandler::updateRendererSelectedList() { | |
| 151 | +void SelectionToSceneHandler::selectedItemsListChanged(const QString& listName) { | |
| 152 | + if (listName == _listName) { | |
| 153 | + updateSceneFromSelectedList(); | |
| 154 | + } | |
| 155 | +} | |
| 156 | + | |
| 157 | +void SelectionToSceneHandler::updateSceneFromSelectedList() { | |
| 152 | 158 | if (_mainScene) { |
| 153 | − GameplayObjects* thisList = DependencyManager::get<SelectionScriptingInterface>()->getList(_listName); | |
| 159 | + GameplayObjects* thisList = &DependencyManager::get<SelectionScriptingInterface>()->getList(_listName); | |
| 154 | 160 | render::Transaction transaction; |
| 155 | 161 | |
| 156 | 162 | if (thisList != NULL) { |
| @@ -158,9 +164,8 @@ void SelectionToSceneHandler::updateRendererSelectedList() { · 1 unmodified line | ||
| 158 | 164 | render::ItemID currentID; |
| 159 | 165 | auto entityTree = qApp->getEntities()->getTree(); |
| 160 | 166 | auto& overlays = qApp->getOverlays(); |
| 161 | − auto currentList = thisList.value(_listName); | |
| 162 | 167 | |
| 163 | − for (QUuid& currentAvatarID : currentList.getAvatarIDs()) { | |
| 168 | + for (QUuid& currentAvatarID : thisList->getAvatarIDs()) { | |
| 164 | 169 | auto avatar = std::static_pointer_cast<Avatar>(DependencyManager::get<AvatarManager>()->getAvatarBySessionID(currentAvatarID)); |
| 165 | 170 | if (avatar) { |
| 166 | 171 | currentID = avatar->getRenderItemID(); |
| @@ -170,7 +175,7 @@ void SelectionToSceneHandler::updateRendererSelectedList() { · 3 unmodified lines | ||
| 170 | 175 | } |
| 171 | 176 | } |
| 172 | 177 | |
| 173 | − for (EntityItemID& currentEntityID : currentList.getEntityIDs()) { | |
| 178 | + for (EntityItemID& currentEntityID : thisList->getEntityIDs()) { | |
| 174 | 179 | entityTree->withReadLock([&] { |
| 175 | 180 | auto entityItem = entityTree->findEntityByEntityItemID(currentEntityID); |
| 176 | 181 | if (entityItem != NULL) { |
| @@ -185,7 +190,7 @@ void SelectionToSceneHandler::updateRendererSelectedList() { · 8 unmodified lines | ||
| 185 | 190 | }); |
| 186 | 191 | } |
| 187 | 192 | |
| 188 | − for (OverlayID& currentOverlayID : currentList.getOverlayIDs()) { | |
| 193 | + for (OverlayID& currentOverlayID : thisList->getOverlayIDs()) { | |
| 189 | 194 | auto overlay = overlays.getOverlay(currentOverlayID); |
| 190 | 195 | if (overlay != NULL) { |
| 191 | 196 | currentID = overlay->getRenderItemID(); |
| @@ -203,6 +208,6 @@ void SelectionToSceneHandler::updateRendererSelectedList() { · 11 unmodified lines | ||
| 203 | 208 | qWarning() << "List of GameplayObjects doesn't exist in thisList"; |
| 204 | 209 | } |
| 205 | 210 | } else { |
| 206 | − qWarning() << "SelectionScriptingInterface::updateRendererSelectedList(), Unexpected null scene, possibly during application shutdown"; | |
| 211 | + qWarning() << "SelectionToSceneHandler::updateRendererSelectedList(), Unexpected null scene, possibly during application shutdown"; | |
| 207 | 212 | } |
| 208 | 213 | } |