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
43 return true;43 return true;
44}44}
45 45
46SelectionScriptingInterface::SelectionScriptingInterface(AbstractViewStateInterface* viewState) {46SelectionScriptingInterface::SelectionScriptingInterface() {
47 _viewState = viewState;
48}47}
49 48
50bool SelectionScriptingInterface::addToSelectedItemsList(const QString& listName, const QString& itemType, const QUuid& id) {49bool 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// END HANDLING GENERIC ITEMS96// END HANDLING GENERIC ITEMS
98//97//
99 98
99GameplayObjects* SelectionScriptingInterface::getList(const QString& listName) {
100 if (_selectedItemsListMap.contains(listName)) {
101 return _selectedItemsListMap.value(listName);
102 } else {
103 return NULL;
104 }
105}
106
100void SelectionScriptingInterface::printList(const QString& listName) {107void SelectionScriptingInterface::printList(const QString& listName) {
101 if (_selectedItemsListMap.contains(listName)) {108 if (_selectedItemsListMap.contains(listName)) {
102 auto currentList = _selectedItemsListMap.value(listName);109 auto currentList = _selectedItemsListMap.value(listName);
@@ -143,14 +150,15 @@ void SelectionToSceneHandler::initialize(render::ScenePointer mainScene, const Q · 40 unmodified lines
143 150
144void SelectionToSceneHandler::updateRendererSelectedList() {151void SelectionToSceneHandler::updateRendererSelectedList() {
145 if (_mainScene) {152 if (_mainScene) {
153 GameplayObjects* thisList = DependencyManager::get<SelectionScriptingInterface>()->getList(_listName);
146 render::Transaction transaction;154 render::Transaction transaction;
147 155
148 if (_selectedItemsListMap.contains(_listName)) {156 if (thisList != NULL) {
149 render::ItemIDs finalList;157 render::ItemIDs finalList;
150 render::ItemID currentID;158 render::ItemID currentID;
151 auto entityTree = qApp->getEntities()->getTree();159 auto entityTree = qApp->getEntities()->getTree();
152 auto& overlays = qApp->getOverlays();160 auto& overlays = qApp->getOverlays();
153 auto currentList = _selectedItemsListMap.value(_listName);161 auto currentList = thisList.value(_listName);
154 162
155 for (QUuid& currentAvatarID : currentList.getAvatarIDs()) {163 for (QUuid& currentAvatarID : currentList.getAvatarIDs()) {
156 auto avatar = std::static_pointer_cast<Avatar>(DependencyManager::get<AvatarManager>()->getAvatarBySessionID(currentAvatarID));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 _mainScene->enqueueTransaction(transaction);201 _mainScene->enqueueTransaction(transaction);
194 } else {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 } else {205 } else {
198 qWarning() << "SelectionScriptingInterface::updateRendererSelectedList(), Unexpected null scene, possibly during application shutdown";206 qWarning() << "SelectionScriptingInterface::updateRendererSelectedList(), Unexpected null scene, possibly during application shutdown";