Showing the changes to interface/src/scripting/SelectionScriptingInterface.cpp (1 of 5 files). Show all
Unified · Split
| @@ -110,7 +110,6 @@ bool SelectionScriptingInterface::enableListHighlight(const QString& listName, c · 109 unmodified lines | |||
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | if (!(*highlightStyle).isBoundToList()) { | 112 | if (!(*highlightStyle).isBoundToList()) { |
| 113 | setupHandler(listName); | ||
| 114 | (*highlightStyle).setBoundToList(true); | 113 | (*highlightStyle).setBoundToList(true); |
| 115 | } | 114 | } |
| 116 | 115 | ||
| @@ -172,6 +171,18 @@ render::HighlightStyle SelectionScriptingInterface::getHighlightStyle(const QStr · 55 unmodified lines | |||
| 172 | } | 171 | } |
| 173 | } | 172 | } |
| 174 | 173 | ||
| 174 | bool SelectionScriptingInterface::enableListToScene(const QString& listName) { | ||
| 175 | setupHandler(listName); | ||
| 176 | |||
| 177 | return true; | ||
| 178 | } | ||
| 179 | |||
| 180 | bool SelectionScriptingInterface::disableListToScene(const QString& listName) { | ||
| 181 | removeHandler(listName); | ||
| 182 | |||
| 183 | return true; | ||
| 184 | } | ||
| 185 | |||
| 175 | template <class T> bool SelectionScriptingInterface::addToGameplayObjects(const QString& listName, T idToAdd) { | 186 | template <class T> bool SelectionScriptingInterface::addToGameplayObjects(const QString& listName, T idToAdd) { |
| 176 | { | 187 | { |
| 177 | QWriteLocker lock(&_selectionListsLock); | 188 | QWriteLocker lock(&_selectionListsLock); |
| @@ -303,6 +314,15 @@ void SelectionScriptingInterface::setupHandler(const QString& selectionName) { · 125 unmodified lines | |||
| 303 | (*handler)->initialize(selectionName); | 314 | (*handler)->initialize(selectionName); |
| 304 | } | 315 | } |
| 305 | 316 | ||
| 317 | void SelectionScriptingInterface::removeHandler(const QString& selectionName) { | ||
| 318 | QWriteLocker lock(&_selectionHandlersLock); | ||
| 319 | auto handler = _handlerMap.find(selectionName); | ||
| 320 | if (handler != _handlerMap.end()) { | ||
| 321 | delete handler.value(); | ||
| 322 | _handlerMap.erase(handler); | ||
| 323 | } | ||
| 324 | } | ||
| 325 | |||
| 306 | void SelectionScriptingInterface::onSelectedItemsListChanged(const QString& listName) { | 326 | void SelectionScriptingInterface::onSelectedItemsListChanged(const QString& listName) { |
| 307 | { | 327 | { |
| 308 | QWriteLocker lock(&_selectionHandlersLock); | 328 | QWriteLocker lock(&_selectionHandlersLock); |