Showing the changes to interface/src/Application.cpp (1 of 12 files). Show all
Unified · Split
| @@ -772,13 +772,10 @@ void Application::paintGL() { · 771 unmodified lines | ||
| 772 | 772 | |
| 773 | 773 | DependencyManager::get<GlowEffect>()->render(); |
| 774 | 774 | |
| 775 | − { | |
| 775 | + if (Menu::getInstance()->isOptionChecked(MenuOption::UserInterface)) { | |
| 776 | 776 | PerformanceTimer perfTimer("renderOverlay"); |
| 777 | − // PrioVR will only work if renderOverlay is called, calibration is connected to Application::renderingOverlay() | |
| 778 | 777 | _applicationOverlay.renderOverlay(true); |
| 779 | − if (Menu::getInstance()->isOptionChecked(MenuOption::UserInterface)) { | |
| 780 | − _applicationOverlay.displayOverlayTexture(); | |
| 781 | − } | |
| 778 | + _applicationOverlay.displayOverlayTexture(); | |
| 782 | 779 | } |
| 783 | 780 | } |
| 784 | 781 | |
| @@ -1633,6 +1630,47 @@ void Application::setActiveFaceTracker() { · 848 unmodified lines | ||
| 1633 | 1630 | #endif |
| 1634 | 1631 | } |
| 1635 | 1632 | |
| 1633 | +bool Application::exportEntities(const QString& filename, const QVector<EntityItemID>& entityIDs) { | |
| 1634 | + QVector<EntityItem*> entities; | |
| 1635 | + | |
| 1636 | + auto entityTree = _entities.getTree(); | |
| 1637 | + EntityTree exportTree; | |
| 1638 | + | |
| 1639 | + glm::vec3 root(TREE_SCALE, TREE_SCALE, TREE_SCALE); | |
| 1640 | + for (auto entityID : entityIDs) { | |
| 1641 | + auto entityItem = entityTree->findEntityByEntityItemID(entityID); | |
| 1642 | + if (!entityItem) { | |
| 1643 | + continue; | |
| 1644 | + } | |
| 1645 | + | |
| 1646 | + auto properties = entityItem->getProperties(); | |
| 1647 | + auto position = properties.getPosition(); | |
| 1648 | + | |
| 1649 | + root.x = glm::min(root.x, position.x); | |
| 1650 | + root.y = glm::min(root.y, position.y); | |
| 1651 | + root.z = glm::min(root.z, position.z); | |
| 1652 | + | |
| 1653 | + entities << entityItem; | |
| 1654 | + } | |
| 1655 | + | |
| 1656 | + if (entities.size() == 0) { | |
| 1657 | + return false; | |
| 1658 | + } | |
| 1659 | + | |
| 1660 | + for (auto entityItem : entities) { | |
| 1661 | + auto properties = entityItem->getProperties(); | |
| 1662 | + | |
| 1663 | + properties.setPosition(properties.getPosition() - root); | |
| 1664 | + exportTree.addEntity(entityItem->getEntityItemID(), properties); | |
| 1665 | + } | |
| 1666 | + | |
| 1667 | + exportTree.writeToSVOFile(filename.toLocal8Bit().constData()); | |
| 1668 | + | |
| 1669 | + // restore the main window's active state | |
| 1670 | + _window->activateWindow(); | |
| 1671 | + return true; | |
| 1672 | +} | |
| 1673 | + | |
| 1636 | 1674 | bool Application::exportEntities(const QString& filename, float x, float y, float z, float scale) { |
| 1637 | 1675 | QVector<EntityItem*> entities; |
| 1638 | 1676 | _entities.getTree()->findEntities(AACube(glm::vec3(x, y, z), scale), entities); |
| @@ -1682,8 +1720,8 @@ bool Application::importEntities(const QString& filename) { · 43 unmodified lines | ||
| 1682 | 1720 | return success; |
| 1683 | 1721 | } |
| 1684 | 1722 | |
| 1685 | −void Application::pasteEntities(float x, float y, float z) { | |
| 1686 | − _entityClipboard.sendEntities(&_entityEditSender, _entities.getTree(), x, y, z); | |
| 1723 | +QVector<EntityItemID> Application::pasteEntities(float x, float y, float z) { | |
| 1724 | + return _entityClipboard.sendEntities(&_entityEditSender, _entities.getTree(), x, y, z); | |
| 1687 | 1725 | } |
| 1688 | 1726 | |
| 1689 | 1727 | void Application::initDisplay() { |