20 void Canvas::handleSelectionChange(const QSet<ldraw::id_t>& selectedIds, const QSet<ldraw::id_t>& deselectedIds) |
20 void Canvas::handleSelectionChange(const QSet<ldraw::id_t>& selectedIds, const QSet<ldraw::id_t>& deselectedIds) |
21 { |
21 { |
22 Q_ASSERT(not selectedIds.contains(ldraw::NULL_ID)); |
22 Q_ASSERT(not selectedIds.contains(ldraw::NULL_ID)); |
23 this->selection.subtract(deselectedIds); |
23 this->selection.subtract(deselectedIds); |
24 this->selection.unite(selectedIds); |
24 this->selection.unite(selectedIds); |
25 this->compiler->setSelectedObjects(this->selection); |
25 gl::setModelShaderSelectedObjects(&this->shaders, this->selection); |
26 this->update(); |
26 this->update(); |
27 } |
27 } |
28 |
28 |
29 /** |
29 /** |
30 * @brief Updates vertex rendering |
30 * @brief Updates vertex rendering |
376 * @brief Clears the selection. |
376 * @brief Clears the selection. |
377 */ |
377 */ |
378 void Canvas::clearSelection() |
378 void Canvas::clearSelection() |
379 { |
379 { |
380 this->selection.clear(); |
380 this->selection.clear(); |
381 this->compiler->setSelectedObjects(this->selection); |
381 gl::setModelShaderSelectedObjects(&this->shaders, this->selection); |
382 Q_EMIT selectionChanged(this->selection); |
382 Q_EMIT selectionChanged(this->selection); |
383 this->update(); |
383 this->update(); |
384 } |
384 } |
385 |
385 |
386 /** |
386 /** |
388 * @param id ID of object to add |
388 * @param id ID of object to add |
389 */ |
389 */ |
390 void Canvas::addToSelection(ldraw::id_t id) |
390 void Canvas::addToSelection(ldraw::id_t id) |
391 { |
391 { |
392 this->selection.insert(id); |
392 this->selection.insert(id); |
393 this->compiler->setSelectedObjects(this->selection); |
393 gl::setModelShaderSelectedObjects(&this->shaders, this->selection); |
394 Q_EMIT selectionChanged(this->selection); |
394 Q_EMIT selectionChanged(this->selection); |
395 this->update(); |
395 this->update(); |
396 } |
396 } |
397 |
397 |
398 void Canvas::setOverpaintCallback(Canvas::OverpaintCallback fn) |
398 void Canvas::setOverpaintCallback(Canvas::OverpaintCallback fn) |