Showing the changes to interface/src/Application.cpp (1 of 265 files). Show all
Unified · Split
| @@ -194,8 +194,13 @@ · 193 unmodified lines | |||
| 194 | #include <EntityScriptClient.h> | 194 | #include <EntityScriptClient.h> |
| 195 | #include <ModelScriptingInterface.h> | 195 | #include <ModelScriptingInterface.h> |
| 196 | 196 | ||
| 197 | #include <PickManager.h> | ||
| 198 | #include <PointerManager.h> | ||
| 197 | #include <raypick/RayPickScriptingInterface.h> | 199 | #include <raypick/RayPickScriptingInterface.h> |
| 198 | #include <raypick/LaserPointerScriptingInterface.h> | 200 | #include <raypick/LaserPointerScriptingInterface.h> |
| 201 | #include <raypick/PickScriptingInterface.h> | ||
| 202 | #include <raypick/PointerScriptingInterface.h> | ||
| 203 | #include <raypick/MouseRayPick.h> | ||
| 199 | 204 | ||
| 200 | #include <FadeEffect.h> | 205 | #include <FadeEffect.h> |
| 201 | 206 | ||
| @@ -620,6 +625,12 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 418 unmodified lines | |||
| 620 | DependencyManager::registerInheritance<SpatialParentFinder, InterfaceParentFinder>(); | 625 | DependencyManager::registerInheritance<SpatialParentFinder, InterfaceParentFinder>(); |
| 621 | 626 | ||
| 622 | // Set dependencies | 627 | // Set dependencies |
| 628 | DependencyManager::set<PickManager>(); | ||
| 629 | DependencyManager::set<PointerManager>(); | ||
| 630 | DependencyManager::set<LaserPointerScriptingInterface>(); | ||
| 631 | DependencyManager::set<RayPickScriptingInterface>(); | ||
| 632 | DependencyManager::set<PointerScriptingInterface>(); | ||
| 633 | DependencyManager::set<PickScriptingInterface>(); | ||
| 623 | DependencyManager::set<Cursor::Manager>(); | 634 | DependencyManager::set<Cursor::Manager>(); |
| 624 | DependencyManager::set<AccountManager>(std::bind(&Application::getUserAgent, qApp)); | 635 | DependencyManager::set<AccountManager>(std::bind(&Application::getUserAgent, qApp)); |
| 625 | DependencyManager::set<StatTracker>(); | 636 | DependencyManager::set<StatTracker>(); |
| @@ -700,9 +711,6 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 74 unmodified lines | |||
| 700 | 711 | ||
| 701 | DependencyManager::set<FadeEffect>(); | 712 | DependencyManager::set<FadeEffect>(); |
| 702 | 713 | ||
| 703 | DependencyManager::set<LaserPointerScriptingInterface>(); | ||
| 704 | DependencyManager::set<RayPickScriptingInterface>(); | ||
| 705 | |||
| 706 | return previousSessionCrashed; | 714 | return previousSessionCrashed; |
| 707 | } | 715 | } |
| 708 | 716 | ||
| @@ -895,7 +903,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 186 unmodified lines | |||
| 895 | connect(audioIO.data(), &AudioClient::muteEnvironmentRequested, [](glm::vec3 position, float radius) { | 903 | connect(audioIO.data(), &AudioClient::muteEnvironmentRequested, [](glm::vec3 position, float radius) { |
| 896 | auto audioClient = DependencyManager::get<AudioClient>(); | 904 | auto audioClient = DependencyManager::get<AudioClient>(); |
| 897 | auto audioScriptingInterface = DependencyManager::get<AudioScriptingInterface>(); | 905 | auto audioScriptingInterface = DependencyManager::get<AudioScriptingInterface>(); |
| 898 | auto myAvatarPosition = DependencyManager::get<AvatarManager>()->getMyAvatar()->getPosition(); | 906 | auto myAvatarPosition = DependencyManager::get<AvatarManager>()->getMyAvatar()->getWorldPosition(); |
| 899 | float distance = glm::distance(myAvatarPosition, position); | 907 | float distance = glm::distance(myAvatarPosition, position); |
| 900 | bool shouldMute = !audioClient->isMuted() && (distance < radius); | 908 | bool shouldMute = !audioClient->isMuted() && (distance < radius); |
| 901 | 909 | ||
| @@ -968,8 +976,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 66 unmodified lines | |||
| 968 | auto addressManager = DependencyManager::get<AddressManager>(); | 976 | auto addressManager = DependencyManager::get<AddressManager>(); |
| 969 | 977 | ||
| 970 | // use our MyAvatar position and quat for address manager path | 978 | // use our MyAvatar position and quat for address manager path |
| 971 | addressManager->setPositionGetter([this]{ return getMyAvatar()->getPosition(); }); | 979 | addressManager->setPositionGetter([this]{ return getMyAvatar()->getWorldPosition(); }); |
| 972 | addressManager->setOrientationGetter([this]{ return getMyAvatar()->getOrientation(); }); | 980 | addressManager->setOrientationGetter([this]{ return getMyAvatar()->getWorldOrientation(); }); |
| 973 | 981 | ||
| 974 | connect(addressManager.data(), &AddressManager::hostChanged, this, &Application::updateWindowTitle); | 982 | connect(addressManager.data(), &AddressManager::hostChanged, this, &Application::updateWindowTitle); |
| 975 | connect(this, &QCoreApplication::aboutToQuit, addressManager.data(), &AddressManager::storeCurrentAddress); | 983 | connect(this, &QCoreApplication::aboutToQuit, addressManager.data(), &AddressManager::storeCurrentAddress); |
| @@ -1470,13 +1478,15 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 494 unmodified lines | |||
| 1470 | 1478 | ||
| 1471 | // If the user clicks an an entity, we will check that it's an unlocked web entity, and if so, set the focus to it | 1479 | // If the user clicks an an entity, we will check that it's an unlocked web entity, and if so, set the focus to it |
| 1472 | auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>(); | 1480 | auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>(); |
| 1473 | connect(entityScriptingInterface.data(), &EntityScriptingInterface::clickDownOnEntity, | 1481 | connect(entityScriptingInterface.data(), &EntityScriptingInterface::mousePressOnEntity, |
| 1474 | [this](const EntityItemID& entityItemID, const PointerEvent& event) { | 1482 | [this](const EntityItemID& entityItemID, const PointerEvent& event) { |
| 1475 | if (getEntities()->wantsKeyboardFocus(entityItemID)) { | 1483 | if (event.shouldFocus()) { |
| 1476 | setKeyboardFocusOverlay(UNKNOWN_OVERLAY_ID); | 1484 | if (getEntities()->wantsKeyboardFocus(entityItemID)) { |
| 1477 | setKeyboardFocusEntity(entityItemID); | 1485 | setKeyboardFocusOverlay(UNKNOWN_OVERLAY_ID); |
| 1478 | } else { | 1486 | setKeyboardFocusEntity(entityItemID); |
| 1479 | setKeyboardFocusEntity(UNKNOWN_ENTITY_ID); | 1487 | } else { |
| 1488 | setKeyboardFocusEntity(UNKNOWN_ENTITY_ID); | ||
| 1489 | } | ||
| 1480 | } | 1490 | } |
| 1481 | }); | 1491 | }); |
| 1482 | 1492 | ||
| @@ -1507,7 +1517,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 24 unmodified lines | |||
| 1507 | static const QString FAST_STATS_ARG = "--fast-heartbeat"; | 1517 | static const QString FAST_STATS_ARG = "--fast-heartbeat"; |
| 1508 | static int SEND_STATS_INTERVAL_MS = arguments().indexOf(FAST_STATS_ARG) != -1 ? 1000 : 10000; | 1518 | static int SEND_STATS_INTERVAL_MS = arguments().indexOf(FAST_STATS_ARG) != -1 ? 1000 : 10000; |
| 1509 | 1519 | ||
| 1510 | static glm::vec3 lastAvatarPosition = myAvatar->getPosition(); | 1520 | static glm::vec3 lastAvatarPosition = myAvatar->getWorldPosition(); |
| 1511 | static glm::mat4 lastHMDHeadPose = getHMDSensorPose(); | 1521 | static glm::mat4 lastHMDHeadPose = getHMDSensorPose(); |
| 1512 | static controller::Pose lastLeftHandPose = myAvatar->getLeftHandPose(); | 1522 | static controller::Pose lastLeftHandPose = myAvatar->getLeftHandPose(); |
| 1513 | static controller::Pose lastRightHandPose = myAvatar->getRightHandPose(); | 1523 | static controller::Pose lastRightHandPose = myAvatar->getRightHandPose(); |
| @@ -1635,7 +1645,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 121 unmodified lines | |||
| 1635 | properties["bytes_downloaded"] = bytesDownloaded; | 1645 | properties["bytes_downloaded"] = bytesDownloaded; |
| 1636 | 1646 | ||
| 1637 | auto myAvatar = getMyAvatar(); | 1647 | auto myAvatar = getMyAvatar(); |
| 1638 | glm::vec3 avatarPosition = myAvatar->getPosition(); | 1648 | glm::vec3 avatarPosition = myAvatar->getWorldPosition(); |
| 1639 | properties["avatar_has_moved"] = lastAvatarPosition != avatarPosition; | 1649 | properties["avatar_has_moved"] = lastAvatarPosition != avatarPosition; |
| 1640 | lastAvatarPosition = avatarPosition; | 1650 | lastAvatarPosition = avatarPosition; |
| 1641 | 1651 | ||
| @@ -1715,7 +1725,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 73 unmodified lines | |||
| 1715 | checkNearbyAvatarsTimer->setInterval(CHECK_NEARBY_AVATARS_INTERVAL_MS); // 10 seconds, Qt::CoarseTimer ok | 1725 | checkNearbyAvatarsTimer->setInterval(CHECK_NEARBY_AVATARS_INTERVAL_MS); // 10 seconds, Qt::CoarseTimer ok |
| 1716 | connect(checkNearbyAvatarsTimer, &QTimer::timeout, this, [this]() { | 1726 | connect(checkNearbyAvatarsTimer, &QTimer::timeout, this, [this]() { |
| 1717 | auto avatarManager = DependencyManager::get<AvatarManager>(); | 1727 | auto avatarManager = DependencyManager::get<AvatarManager>(); |
| 1718 | int nearbyAvatars = avatarManager->numberOfAvatarsInRange(avatarManager->getMyAvatar()->getPosition(), | 1728 | int nearbyAvatars = avatarManager->numberOfAvatarsInRange(avatarManager->getMyAvatar()->getWorldPosition(), |
| 1719 | NEARBY_AVATAR_RADIUS_METERS) - 1; | 1729 | NEARBY_AVATAR_RADIUS_METERS) - 1; |
| 1720 | if (nearbyAvatars != lastCountOfNearbyAvatars) { | 1730 | if (nearbyAvatars != lastCountOfNearbyAvatars) { |
| 1721 | lastCountOfNearbyAvatars = nearbyAvatars; | 1731 | lastCountOfNearbyAvatars = nearbyAvatars; |
| @@ -1804,25 +1814,35 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 82 unmodified lines | |||
| 1804 | 1814 | ||
| 1805 | connect(&_myCamera, &Camera::modeUpdated, this, &Application::cameraModeChanged); | 1815 | connect(&_myCamera, &Camera::modeUpdated, this, &Application::cameraModeChanged); |
| 1806 | 1816 | ||
| 1817 | DependencyManager::get<PickManager>()->setShouldPickHUDOperator([&]() { return DependencyManager::get<HMDScriptingInterface>()->isHMDMode(); }); | ||
| 1818 | DependencyManager::get<PickManager>()->setCalculatePos2DFromHUDOperator([&](const glm::vec3& intersection) { | ||
| 1819 | const glm::vec2 MARGIN(25.0f); | ||
| 1820 | glm::vec2 maxPos = _controllerScriptingInterface->getViewportDimensions() - MARGIN; | ||
| 1821 | glm::vec2 pos2D = DependencyManager::get<HMDScriptingInterface>()->overlayFromWorldPoint(intersection); | ||
| 1822 | return glm::max(MARGIN, glm::min(pos2D, maxPos)); | ||
| 1823 | }); | ||
| 1824 | |||
| 1807 | // Setup the mouse ray pick and related operators | 1825 | // Setup the mouse ray pick and related operators |
| 1808 | DependencyManager::get<EntityTreeRenderer>()->setMouseRayPickID(_rayPickManager.createRayPick( | 1826 | DependencyManager::get<EntityTreeRenderer>()->setMouseRayPickID(DependencyManager::get<PickManager>()->addPick(PickQuery::Ray, std::make_shared<MouseRayPick>( |
| 1809 | RayPickFilter(DependencyManager::get<RayPickScriptingInterface>()->PICK_ENTITIES() | DependencyManager::get<RayPickScriptingInterface>()->PICK_INCLUDE_NONCOLLIDABLE()), | 1827 | PickFilter(PickScriptingInterface::PICK_ENTITIES() | PickScriptingInterface::PICK_INCLUDE_NONCOLLIDABLE()), 0.0f, true))); |
| 1810 | 0.0f, true)); | 1828 | DependencyManager::get<EntityTreeRenderer>()->setMouseRayPickResultOperator([&](unsigned int rayPickID) { |
| 1811 | DependencyManager::get<EntityTreeRenderer>()->setMouseRayPickResultOperator([&](QUuid rayPickID) { | ||
| 1812 | RayToEntityIntersectionResult entityResult; | 1829 | RayToEntityIntersectionResult entityResult; |
| 1813 | RayPickResult result = _rayPickManager.getPrevRayPickResult(rayPickID); | 1830 | entityResult.intersects = false; |
| 1814 | entityResult.intersects = result.type != DependencyManager::get<RayPickScriptingInterface>()->INTERSECTED_NONE(); | 1831 | auto pickResult = DependencyManager::get<PickManager>()->getPrevPickResultTyped<RayPickResult>(rayPickID); |
| 1815 | if (entityResult.intersects) { | 1832 | if (pickResult) { |
| 1816 | entityResult.intersection = result.intersection; | 1833 | entityResult.intersects = pickResult->type != IntersectionType::NONE; |
| 1817 | entityResult.distance = result.distance; | 1834 | if (entityResult.intersects) { |
| 1818 | entityResult.surfaceNormal = result.surfaceNormal; | 1835 | entityResult.intersection = pickResult->intersection; |
| 1819 | entityResult.entityID = result.objectID; | 1836 | entityResult.distance = pickResult->distance; |
| 1820 | entityResult.entity = DependencyManager::get<EntityTreeRenderer>()->getTree()->findEntityByID(entityResult.entityID); | 1837 | entityResult.surfaceNormal = pickResult->surfaceNormal; |
| 1838 | entityResult.entityID = pickResult->objectID; | ||
| 1839 | entityResult.entity = DependencyManager::get<EntityTreeRenderer>()->getTree()->findEntityByID(entityResult.entityID); | ||
| 1840 | } | ||
| 1821 | } | 1841 | } |
| 1822 | return entityResult; | 1842 | return entityResult; |
| 1823 | }); | 1843 | }); |
| 1824 | DependencyManager::get<EntityTreeRenderer>()->setSetPrecisionPickingOperator([&](QUuid rayPickID, bool value) { | 1844 | DependencyManager::get<EntityTreeRenderer>()->setSetPrecisionPickingOperator([&](unsigned int rayPickID, bool value) { |
| 1825 | _rayPickManager.setPrecisionPicking(rayPickID, value); | 1845 | DependencyManager::get<PickManager>()->setPrecisionPicking(rayPickID, value); |
| 1826 | }); | 1846 | }); |
| 1827 | 1847 | ||
| 1828 | // Preload Tablet sounds | 1848 | // Preload Tablet sounds |
| @@ -2408,7 +2428,7 @@ void Application::updateCamera(RenderArgs& renderArgs) { · 579 unmodified lines | |||
| 2408 | auto hmdWorldMat = myAvatar->getSensorToWorldMatrix() * myAvatar->getHMDSensorMatrix(); | 2428 | auto hmdWorldMat = myAvatar->getSensorToWorldMatrix() * myAvatar->getHMDSensorMatrix(); |
| 2409 | _myCamera.setOrientation(glm::normalize(glmExtractRotation(hmdWorldMat))); | 2429 | _myCamera.setOrientation(glm::normalize(glmExtractRotation(hmdWorldMat))); |
| 2410 | _myCamera.setPosition(extractTranslation(hmdWorldMat) + | 2430 | _myCamera.setPosition(extractTranslation(hmdWorldMat) + |
| 2411 | myAvatar->getOrientation() * boomOffset); | 2431 | myAvatar->getWorldOrientation() * boomOffset); |
| 2412 | } | 2432 | } |
| 2413 | else { | 2433 | else { |
| 2414 | _myCamera.setOrientation(myAvatar->getHead()->getOrientation()); | 2434 | _myCamera.setOrientation(myAvatar->getHead()->getOrientation()); |
| @@ -2418,13 +2438,13 @@ void Application::updateCamera(RenderArgs& renderArgs) { · 3 unmodified lines | |||
| 2418 | } | 2438 | } |
| 2419 | else { | 2439 | else { |
| 2420 | _myCamera.setPosition(myAvatar->getDefaultEyePosition() | 2440 | _myCamera.setPosition(myAvatar->getDefaultEyePosition() |
| 2421 | + myAvatar->getOrientation() * boomOffset); | 2441 | + myAvatar->getWorldOrientation() * boomOffset); |
| 2422 | } | 2442 | } |
| 2423 | } | 2443 | } |
| 2424 | } | 2444 | } |
| 2425 | else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { | 2445 | else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { |
| 2426 | if (isHMDMode()) { | 2446 | if (isHMDMode()) { |
| 2427 | auto mirrorBodyOrientation = myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)); | 2447 | auto mirrorBodyOrientation = myAvatar->getWorldOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)); |
| 2428 | 2448 | ||
| 2429 | glm::quat hmdRotation = extractRotation(myAvatar->getHMDSensorMatrix()); | 2449 | glm::quat hmdRotation = extractRotation(myAvatar->getHMDSensorMatrix()); |
| 2430 | // Mirror HMD yaw and roll | 2450 | // Mirror HMD yaw and roll |
| @@ -2447,11 +2467,11 @@ void Application::updateCamera(RenderArgs& renderArgs) { · 16 unmodified lines | |||
| 2447 | + mirrorBodyOrientation * hmdOffset); | 2467 | + mirrorBodyOrientation * hmdOffset); |
| 2448 | } | 2468 | } |
| 2449 | else { | 2469 | else { |
| 2450 | _myCamera.setOrientation(myAvatar->getOrientation() | 2470 | _myCamera.setOrientation(myAvatar->getWorldOrientation() |
| 2451 | * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))); | 2471 | * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))); |
| 2452 | _myCamera.setPosition(myAvatar->getDefaultEyePosition() | 2472 | _myCamera.setPosition(myAvatar->getDefaultEyePosition() |
| 2453 | + glm::vec3(0, _raiseMirror * myAvatar->getModelScale(), 0) | 2473 | + glm::vec3(0, _raiseMirror * myAvatar->getModelScale(), 0) |
| 2454 | + (myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, _rotateMirror, 0.0f))) * | 2474 | + (myAvatar->getWorldOrientation() * glm::quat(glm::vec3(0.0f, _rotateMirror, 0.0f))) * |
| 2455 | glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); | 2475 | glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); |
| 2456 | } | 2476 | } |
| 2457 | renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE; | 2477 | renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE; |
| @@ -2461,13 +2481,13 @@ void Application::updateCamera(RenderArgs& renderArgs) { · 3 unmodified lines | |||
| 2461 | if (cameraEntity != nullptr) { | 2481 | if (cameraEntity != nullptr) { |
| 2462 | if (isHMDMode()) { | 2482 | if (isHMDMode()) { |
| 2463 | glm::quat hmdRotation = extractRotation(myAvatar->getHMDSensorMatrix()); | 2483 | glm::quat hmdRotation = extractRotation(myAvatar->getHMDSensorMatrix()); |
| 2464 | _myCamera.setOrientation(cameraEntity->getRotation() * hmdRotation); | 2484 | _myCamera.setOrientation(cameraEntity->getWorldOrientation() * hmdRotation); |
| 2465 | glm::vec3 hmdOffset = extractTranslation(myAvatar->getHMDSensorMatrix()); | 2485 | glm::vec3 hmdOffset = extractTranslation(myAvatar->getHMDSensorMatrix()); |
| 2466 | _myCamera.setPosition(cameraEntity->getPosition() + (hmdRotation * hmdOffset)); | 2486 | _myCamera.setPosition(cameraEntity->getWorldPosition() + (hmdRotation * hmdOffset)); |
| 2467 | } | 2487 | } |
| 2468 | else { | 2488 | else { |
| 2469 | _myCamera.setOrientation(cameraEntity->getRotation()); | 2489 | _myCamera.setOrientation(cameraEntity->getWorldOrientation()); |
| 2470 | _myCamera.setPosition(cameraEntity->getPosition()); | 2490 | _myCamera.setPosition(cameraEntity->getWorldPosition()); |
| 2471 | } | 2491 | } |
| 2472 | } | 2492 | } |
| 2473 | } | 2493 | } |
| @@ -3283,7 +3303,7 @@ void Application::mouseMoveEvent(QMouseEvent* event) { · 809 unmodified lines | |||
| 3283 | 3303 | ||
| 3284 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); | 3304 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); |
| 3285 | auto eventPosition = compositor.getMouseEventPosition(event); | 3305 | auto eventPosition = compositor.getMouseEventPosition(event); |
| 3286 | QPointF transformedPos = offscreenUi->mapToVirtualScreen(eventPosition, _glWidget); | 3306 | QPointF transformedPos = offscreenUi->mapToVirtualScreen(eventPosition); |
| 3287 | auto button = event->button(); | 3307 | auto button = event->button(); |
| 3288 | auto buttons = event->buttons(); | 3308 | auto buttons = event->buttons(); |
| 3289 | // Determine if the ReticleClick Action is 1 and if so, fake include the LeftMouseButton | 3309 | // Determine if the ReticleClick Action is 1 and if so, fake include the LeftMouseButton |
| @@ -3329,7 +3349,7 @@ void Application::mousePressEvent(QMouseEvent* event) { · 39 unmodified lines | |||
| 3329 | offscreenUi->unfocusWindows(); | 3349 | offscreenUi->unfocusWindows(); |
| 3330 | 3350 | ||
| 3331 | auto eventPosition = getApplicationCompositor().getMouseEventPosition(event); | 3351 | auto eventPosition = getApplicationCompositor().getMouseEventPosition(event); |
| 3332 | QPointF transformedPos = offscreenUi->mapToVirtualScreen(eventPosition, _glWidget); | 3352 | QPointF transformedPos = offscreenUi->mapToVirtualScreen(eventPosition); |
| 3333 | QMouseEvent mappedEvent(event->type(), | 3353 | QMouseEvent mappedEvent(event->type(), |
| 3334 | transformedPos, | 3354 | transformedPos, |
| 3335 | event->screenPos(), event->button(), | 3355 | event->screenPos(), event->button(), |
| @@ -3359,7 +3379,7 @@ void Application::mousePressEvent(QMouseEvent* event) { · 23 unmodified lines | |||
| 3359 | void Application::mouseDoublePressEvent(QMouseEvent* event) { | 3379 | void Application::mouseDoublePressEvent(QMouseEvent* event) { |
| 3360 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); | 3380 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); |
| 3361 | auto eventPosition = getApplicationCompositor().getMouseEventPosition(event); | 3381 | auto eventPosition = getApplicationCompositor().getMouseEventPosition(event); |
| 3362 | QPointF transformedPos = offscreenUi->mapToVirtualScreen(eventPosition, _glWidget); | 3382 | QPointF transformedPos = offscreenUi->mapToVirtualScreen(eventPosition); |
| 3363 | QMouseEvent mappedEvent(event->type(), | 3383 | QMouseEvent mappedEvent(event->type(), |
| 3364 | transformedPos, | 3384 | transformedPos, |
| 3365 | event->screenPos(), event->button(), | 3385 | event->screenPos(), event->button(), |
| @@ -3385,7 +3405,7 @@ void Application::mouseReleaseEvent(QMouseEvent* event) { · 19 unmodified lines | |||
| 3385 | 3405 | ||
| 3386 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); | 3406 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); |
| 3387 | auto eventPosition = getApplicationCompositor().getMouseEventPosition(event); | 3407 | auto eventPosition = getApplicationCompositor().getMouseEventPosition(event); |
| 3388 | QPointF transformedPos = offscreenUi->mapToVirtualScreen(eventPosition, _glWidget); | 3408 | QPointF transformedPos = offscreenUi->mapToVirtualScreen(eventPosition); |
| 3389 | QMouseEvent mappedEvent(event->type(), | 3409 | QMouseEvent mappedEvent(event->type(), |
| 3390 | transformedPos, | 3410 | transformedPos, |
| 3391 | event->screenPos(), event->button(), | 3411 | event->screenPos(), event->button(), |
| @@ -3878,16 +3898,16 @@ void Application::idle() { · 486 unmodified lines | |||
| 3878 | if (!_keyboardFocusedEntity.get().isInvalidID()) { | 3898 | if (!_keyboardFocusedEntity.get().isInvalidID()) { |
| 3879 | auto entity = getEntities()->getTree()->findEntityByID(_keyboardFocusedEntity.get()); | 3899 | auto entity = getEntities()->getTree()->findEntityByID(_keyboardFocusedEntity.get()); |
| 3880 | if (entity && _keyboardFocusHighlight) { | 3900 | if (entity && _keyboardFocusHighlight) { |
| 3881 | _keyboardFocusHighlight->setRotation(entity->getRotation()); | 3901 | _keyboardFocusHighlight->setWorldOrientation(entity->getWorldOrientation()); |
| 3882 | _keyboardFocusHighlight->setPosition(entity->getPosition()); | 3902 | _keyboardFocusHighlight->setWorldPosition(entity->getWorldPosition()); |
| 3883 | } | 3903 | } |
| 3884 | } else { | 3904 | } else { |
| 3885 | // Only Web overlays can have focus. | 3905 | // Only Web overlays can have focus. |
| 3886 | auto overlay = | 3906 | auto overlay = |
| 3887 | std::dynamic_pointer_cast<Web3DOverlay>(getOverlays().getOverlay(_keyboardFocusedOverlay.get())); | 3907 | std::dynamic_pointer_cast<Web3DOverlay>(getOverlays().getOverlay(_keyboardFocusedOverlay.get())); |
| 3888 | if (overlay && _keyboardFocusHighlight) { | 3908 | if (overlay && _keyboardFocusHighlight) { |
| 3889 | _keyboardFocusHighlight->setRotation(overlay->getRotation()); | 3909 | _keyboardFocusHighlight->setWorldOrientation(overlay->getWorldOrientation()); |
| 3890 | _keyboardFocusHighlight->setPosition(overlay->getPosition()); | 3910 | _keyboardFocusHighlight->setWorldPosition(overlay->getWorldPosition()); |
| 3891 | } | 3911 | } |
| 3892 | } | 3912 | } |
| 3893 | } | 3913 | } |
| @@ -4022,7 +4042,7 @@ bool Application::exportEntities(const QString& filename, · 128 unmodified lines | |||
| 4022 | !entityIDs.contains(parentID) || | 4042 | !entityIDs.contains(parentID) || |
| 4023 | !entityTree->findEntityByEntityItemID(parentID))) { | 4043 | !entityTree->findEntityByEntityItemID(parentID))) { |
| 4024 | // If parent wasn't selected, we want absolute position, which isn't in properties. | 4044 | // If parent wasn't selected, we want absolute position, which isn't in properties. |
| 4025 | auto position = entityItem->getPosition(); | 4045 | auto position = entityItem->getWorldPosition(); |
| 4026 | root.x = glm::min(root.x, position.x); | 4046 | root.x = glm::min(root.x, position.x); |
| 4027 | root.y = glm::min(root.y, position.y); | 4047 | root.y = glm::min(root.y, position.y); |
| 4028 | root.z = glm::min(root.z, position.z); | 4048 | root.z = glm::min(root.z, position.z); |
| @@ -4225,7 +4245,7 @@ void Application::init() { · 196 unmodified lines | |||
| 4225 | return 0.0f; | 4245 | return 0.0f; |
| 4226 | } | 4246 | } |
| 4227 | 4247 | ||
| 4228 | auto distance = glm::distance(getMyAvatar()->getPosition(), item.getPosition()); | 4248 | auto distance = glm::distance(getMyAvatar()->getWorldPosition(), item.getWorldPosition()); |
| 4229 | return atan2(maxSize, distance); | 4249 | return atan2(maxSize, distance); |
| 4230 | }); | 4250 | }); |
| 4231 | 4251 | ||
| @@ -4302,7 +4322,7 @@ void Application::updateMyAvatarLookAtPosition() { · 70 unmodified lines | |||
| 4302 | // TODO -- this code is probably wrong, getHeadPose() returns something in sensor frame, not avatar | 4322 | // TODO -- this code is probably wrong, getHeadPose() returns something in sensor frame, not avatar |
| 4303 | glm::mat4 headPose = getActiveDisplayPlugin()->getHeadPose(); | 4323 | glm::mat4 headPose = getActiveDisplayPlugin()->getHeadPose(); |
| 4304 | glm::quat hmdRotation = glm::quat_cast(headPose); | 4324 | glm::quat hmdRotation = glm::quat_cast(headPose); |
| 4305 | lookAtSpot = _myCamera.getPosition() + myAvatar->getOrientation() * (hmdRotation * lookAtPosition); | 4325 | lookAtSpot = _myCamera.getPosition() + myAvatar->getWorldOrientation() * (hmdRotation * lookAtPosition); |
| 4306 | } else { | 4326 | } else { |
| 4307 | lookAtSpot = myAvatar->getHead()->getEyePosition() | 4327 | lookAtSpot = myAvatar->getHead()->getEyePosition() |
| 4308 | + (myAvatar->getHead()->getFinalOrientationInWorldFrame() * lookAtPosition); | 4328 | + (myAvatar->getHead()->getFinalOrientationInWorldFrame() * lookAtPosition); |
| @@ -4531,8 +4551,8 @@ void Application::setKeyboardFocusHighlight(const glm::vec3& position, const glm · 222 unmodified lines | |||
| 4531 | } | 4551 | } |
| 4532 | 4552 | ||
| 4533 | // Position focus | 4553 | // Position focus |
| 4534 | _keyboardFocusHighlight->setRotation(rotation); | 4554 | _keyboardFocusHighlight->setWorldOrientation(rotation); |
| 4535 | _keyboardFocusHighlight->setPosition(position); | 4555 | _keyboardFocusHighlight->setWorldPosition(position); |
| 4536 | _keyboardFocusHighlight->setDimensions(dimensions); | 4556 | _keyboardFocusHighlight->setDimensions(dimensions); |
| 4537 | _keyboardFocusHighlight->setVisible(true); | 4557 | _keyboardFocusHighlight->setVisible(true); |
| 4538 | } | 4558 | } |
| @@ -4569,7 +4589,7 @@ void Application::setKeyboardFocusEntity(const EntityItemID& entityItemID) { · 30 unmodified lines | |||
| 4569 | } | 4589 | } |
| 4570 | _lastAcceptedKeyPress = usecTimestampNow(); | 4590 | _lastAcceptedKeyPress = usecTimestampNow(); |
| 4571 | 4591 | ||
| 4572 | setKeyboardFocusHighlight(entity->getPosition(), entity->getRotation(), | 4592 | setKeyboardFocusHighlight(entity->getWorldPosition(), entity->getWorldOrientation(), |
| 4573 | entity->getDimensions() * FOCUS_HIGHLIGHT_EXPANSION_FACTOR); | 4593 | entity->getDimensions() * FOCUS_HIGHLIGHT_EXPANSION_FACTOR); |
| 4574 | } | 4594 | } |
| 4575 | } | 4595 | } |
| @@ -4606,7 +4626,7 @@ void Application::setKeyboardFocusOverlay(const OverlayID& overlayID) { · 30 unmodified lines | |||
| 4606 | if (overlay->getProperty("showKeyboardFocusHighlight").toBool()) { | 4626 | if (overlay->getProperty("showKeyboardFocusHighlight").toBool()) { |
| 4607 | auto size = overlay->getSize() * FOCUS_HIGHLIGHT_EXPANSION_FACTOR; | 4627 | auto size = overlay->getSize() * FOCUS_HIGHLIGHT_EXPANSION_FACTOR; |
| 4608 | const float OVERLAY_DEPTH = 0.0105f; | 4628 | const float OVERLAY_DEPTH = 0.0105f; |
| 4609 | setKeyboardFocusHighlight(overlay->getPosition(), overlay->getRotation(), glm::vec3(size.x, size.y, OVERLAY_DEPTH)); | 4629 | setKeyboardFocusHighlight(overlay->getWorldPosition(), overlay->getWorldOrientation(), glm::vec3(size.x, size.y, OVERLAY_DEPTH)); |
| 4610 | } else if (_keyboardFocusHighlight) { | 4630 | } else if (_keyboardFocusHighlight) { |
| 4611 | _keyboardFocusHighlight->setVisible(false); | 4631 | _keyboardFocusHighlight->setVisible(false); |
| 4612 | } | 4632 | } |
| @@ -4698,7 +4718,7 @@ void Application::update(float deltaTime) { · 85 unmodified lines | |||
| 4698 | 4718 | ||
| 4699 | controller::InputCalibrationData calibrationData = { | 4719 | controller::InputCalibrationData calibrationData = { |
| 4700 | myAvatar->getSensorToWorldMatrix(), | 4720 | myAvatar->getSensorToWorldMatrix(), |
| 4701 | createMatFromQuatAndPos(myAvatar->getOrientation(), myAvatar->getPosition()), | 4721 | createMatFromQuatAndPos(myAvatar->getWorldOrientation(), myAvatar->getWorldPosition()), |
| 4702 | myAvatar->getHMDSensorMatrix(), | 4722 | myAvatar->getHMDSensorMatrix(), |
| 4703 | myAvatar->getCenterEyeCalibrationMat(), | 4723 | myAvatar->getCenterEyeCalibrationMat(), |
| 4704 | myAvatar->getHeadCalibrationMat(), | 4724 | myAvatar->getHeadCalibrationMat(), |
| @@ -4808,7 +4828,7 @@ void Application::update(float deltaTime) { · 103 unmodified lines | |||
| 4808 | }; | 4828 | }; |
| 4809 | 4829 | ||
| 4810 | // copy controller poses from userInputMapper to myAvatar. | 4830 | // copy controller poses from userInputMapper to myAvatar. |
| 4811 | glm::mat4 myAvatarMatrix = createMatFromQuatAndPos(myAvatar->getOrientation(), myAvatar->getPosition()); | 4831 | glm::mat4 myAvatarMatrix = createMatFromQuatAndPos(myAvatar->getWorldOrientation(), myAvatar->getWorldPosition()); |
| 4812 | glm::mat4 worldToSensorMatrix = glm::inverse(myAvatar->getSensorToWorldMatrix()); | 4832 | glm::mat4 worldToSensorMatrix = glm::inverse(myAvatar->getSensorToWorldMatrix()); |
| 4813 | glm::mat4 avatarToSensorMatrix = worldToSensorMatrix * myAvatarMatrix; | 4833 | glm::mat4 avatarToSensorMatrix = worldToSensorMatrix * myAvatarMatrix; |
| 4814 | for (auto& action : avatarControllerActions) { | 4834 | for (auto& action : avatarControllerActions) { |
| @@ -4948,13 +4968,13 @@ void Application::update(float deltaTime) { · 133 unmodified lines | |||
| 4948 | 4968 | ||
| 4949 | // TODO: break these out into distinct perfTimers when they prove interesting | 4969 | // TODO: break these out into distinct perfTimers when they prove interesting |
| 4950 | { | 4970 | { |
| 4951 | PROFILE_RANGE(app, "RayPickManager"); | 4971 | PROFILE_RANGE(app, "PickManager"); |
| 4952 | _rayPickManager.update(); | 4972 | DependencyManager::get<PickManager>()->update(); |
| 4953 | } | 4973 | } |
| 4954 | 4974 | ||
| 4955 | { | 4975 | { |
| 4956 | PROFILE_RANGE(app, "LaserPointerManager"); | 4976 | PROFILE_RANGE(app, "PointerManager"); |
| 4957 | _laserPointerManager.update(); | 4977 | DependencyManager::get<PointerManager>()->update(); |
| 4958 | } | 4978 | } |
| 4959 | 4979 | ||
| 4960 | { | 4980 | { |
| @@ -5424,7 +5444,7 @@ std::shared_ptr<MyAvatar> Application::getMyAvatar() const { · 463 unmodified lines | |||
| 5424 | } | 5444 | } |
| 5425 | 5445 | ||
| 5426 | glm::vec3 Application::getAvatarPosition() const { | 5446 | glm::vec3 Application::getAvatarPosition() const { |
| 5427 | return getMyAvatar()->getPosition(); | 5447 | return getMyAvatar()->getWorldPosition(); |
| 5428 | } | 5448 | } |
| 5429 | 5449 | ||
| 5430 | void Application::copyViewFrustum(ViewFrustum& viewOut) const { | 5450 | void Application::copyViewFrustum(ViewFrustum& viewOut) const { |
| @@ -5639,7 +5659,7 @@ bool Application::nearbyEntitiesAreReadyForPhysics() { · 208 unmodified lines | |||
| 5639 | // whose bounding boxes cannot be computed (it is too loose for our purposes here). Instead we manufacture | 5659 | // whose bounding boxes cannot be computed (it is too loose for our purposes here). Instead we manufacture |
| 5640 | // custom filters and use the general-purpose EntityTree::findEntities(filter, ...) | 5660 | // custom filters and use the general-purpose EntityTree::findEntities(filter, ...) |
| 5641 | QVector<EntityItemPointer> entities; | 5661 | QVector<EntityItemPointer> entities; |
| 5642 | AABox avatarBox(getMyAvatar()->getPosition() - glm::vec3(PHYSICS_READY_RANGE), glm::vec3(2 * PHYSICS_READY_RANGE)); | 5662 | AABox avatarBox(getMyAvatar()->getWorldPosition() - glm::vec3(PHYSICS_READY_RANGE), glm::vec3(2 * PHYSICS_READY_RANGE)); |
| 5643 | // create two functions that use avatarBox (entityScan and elementScan), the second calls the first | 5663 | // create two functions that use avatarBox (entityScan and elementScan), the second calls the first |
| 5644 | std::function<bool (EntityItemPointer&)> entityScan = [=](EntityItemPointer& entity) { | 5664 | std::function<bool (EntityItemPointer&)> entityScan = [=](EntityItemPointer& entity) { |
| 5645 | if (entity->shouldBePhysical()) { | 5665 | if (entity->shouldBePhysical()) { |
| @@ -5841,6 +5861,8 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe · 195 unmodified lines | |||
| 5841 | 5861 | ||
| 5842 | scriptEngine->registerGlobalObject("RayPick", DependencyManager::get<RayPickScriptingInterface>().data()); | 5862 | scriptEngine->registerGlobalObject("RayPick", DependencyManager::get<RayPickScriptingInterface>().data()); |
| 5843 | scriptEngine->registerGlobalObject("LaserPointers", DependencyManager::get<LaserPointerScriptingInterface>().data()); | 5863 | scriptEngine->registerGlobalObject("LaserPointers", DependencyManager::get<LaserPointerScriptingInterface>().data()); |
| 5864 | scriptEngine->registerGlobalObject("Picks", DependencyManager::get<PickScriptingInterface>().data()); | ||
| 5865 | scriptEngine->registerGlobalObject("Pointers", DependencyManager::get<PointerScriptingInterface>().data()); | ||
| 5844 | 5866 | ||
| 5845 | // Caches | 5867 | // Caches |
| 5846 | scriptEngine->registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCache>().data()); | 5868 | scriptEngine->registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCache>().data()); |
| @@ -5898,6 +5920,8 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe · 51 unmodified lines | |||
| 5898 | 5920 | ||
| 5899 | qScriptRegisterMetaType(scriptEngine.data(), OverlayIDtoScriptValue, OverlayIDfromScriptValue); | 5921 | qScriptRegisterMetaType(scriptEngine.data(), OverlayIDtoScriptValue, OverlayIDfromScriptValue); |
| 5900 | 5922 | ||
| 5923 | DependencyManager::get<PickScriptingInterface>()->registerMetaTypes(scriptEngine.data()); | ||
| 5924 | |||
| 5901 | // connect this script engines printedMessage signal to the global ScriptEngines these various messages | 5925 | // connect this script engines printedMessage signal to the global ScriptEngines these various messages |
| 5902 | connect(scriptEngine.data(), &ScriptEngine::printedMessage, | 5926 | connect(scriptEngine.data(), &ScriptEngine::printedMessage, |
| 5903 | DependencyManager::get<ScriptEngines>().data(), &ScriptEngines::onPrintedMessage); | 5927 | DependencyManager::get<ScriptEngines>().data(), &ScriptEngines::onPrintedMessage); |
| @@ -6139,46 +6163,60 @@ bool Application::askToReplaceDomainContent(const QString& url) { · 235 unmodified lines | |||
| 6139 | "and restoring content, visit the documentation page at: ", MAX_CHARACTERS_PER_LINE) + | 6163 | "and restoring content, visit the documentation page at: ", MAX_CHARACTERS_PER_LINE) + |
| 6140 | "\nhttps://docs.highfidelity.com/create-and-explore/start-working-in-your-sandbox/restoring-sandbox-content"; | 6164 | "\nhttps://docs.highfidelity.com/create-and-explore/start-working-in-your-sandbox/restoring-sandbox-content"; |
| 6141 | 6165 | ||
| 6142 | bool agreeToReplaceContent = false; // assume false | 6166 | ModalDialogListener* dig = OffscreenUi::asyncQuestion("Are you sure you want to replace this domain's content set?", |
| 6143 | agreeToReplaceContent = QMessageBox::Yes == OffscreenUi::question("Are you sure you want to replace this domain's content set?", | 6167 | infoText, QMessageBox::Yes | QMessageBox::No, QMessageBox::No); |
| 6144 | infoText, QMessageBox::Yes | QMessageBox::No, QMessageBox::No); | 6168 | |
| 6145 | 6169 | QObject::connect(dig, &ModalDialogListener::response, this, [=] (QVariant answer) { | |
| 6146 | if (agreeToReplaceContent) { | 6170 | QString details; |
| 6147 | // Given confirmation, send request to domain server to replace content | 6171 | if (static_cast<QMessageBox::StandardButton>(answer.toInt()) == QMessageBox::Yes) { |
| 6148 | qCDebug(interfaceapp) << "Attempting to replace domain content: " << url; | 6172 | // Given confirmation, send request to domain server to replace content |
| 6149 | QByteArray urlData(url.toUtf8()); | 6173 | qCDebug(interfaceapp) << "Attempting to replace domain content: " << url; |
| 6150 | auto limitedNodeList = DependencyManager::get<LimitedNodeList>(); | 6174 | QByteArray urlData(url.toUtf8()); |
| 6151 | limitedNodeList->eachMatchingNode([](const SharedNodePointer& node) { | 6175 | auto limitedNodeList = DependencyManager::get<LimitedNodeList>(); |
| 6152 | return node->getType() == NodeType::EntityServer && node->getActiveSocket(); | 6176 | limitedNodeList->eachMatchingNode([](const SharedNodePointer& node) { |
| 6153 | }, [&urlData, limitedNodeList](const SharedNodePointer& octreeNode) { | 6177 | return node->getType() == NodeType::EntityServer && node->getActiveSocket(); |
| 6154 | auto octreeFilePacket = NLPacket::create(PacketType::OctreeFileReplacementFromUrl, urlData.size(), true); | 6178 | }, [&urlData, limitedNodeList](const SharedNodePointer& octreeNode) { |
| 6155 | octreeFilePacket->write(urlData); | 6179 | auto octreeFilePacket = NLPacket::create(PacketType::OctreeFileReplacementFromUrl, urlData.size(), true); |
| 6156 | limitedNodeList->sendPacket(std::move(octreeFilePacket), *octreeNode); | 6180 | octreeFilePacket->write(urlData); |
| 6157 | }); | 6181 | limitedNodeList->sendPacket(std::move(octreeFilePacket), *octreeNode); |
| 6158 | auto addressManager = DependencyManager::get<AddressManager>(); | 6182 | }); |
| 6159 | addressManager->handleLookupString(DOMAIN_SPAWNING_POINT); | 6183 | auto addressManager = DependencyManager::get<AddressManager>(); |
| 6160 | QString newHomeAddress = addressManager->getHost() + DOMAIN_SPAWNING_POINT; | 6184 | addressManager->handleLookupString(DOMAIN_SPAWNING_POINT); |
| 6161 | qCDebug(interfaceapp) << "Setting new home bookmark to: " << newHomeAddress; | 6185 | QString newHomeAddress = addressManager->getHost() + DOMAIN_SPAWNING_POINT; |
| 6162 | DependencyManager::get<LocationBookmarks>()->setHomeLocationToAddress(newHomeAddress); | 6186 | qCDebug(interfaceapp) << "Setting new home bookmark to: " << newHomeAddress; |
| 6163 | methodDetails = "SuccessfulRequestToReplaceContent"; | 6187 | DependencyManager::get<LocationBookmarks>()->setHomeLocationToAddress(newHomeAddress); |
| 6164 | } else { | 6188 | details = "SuccessfulRequestToReplaceContent"; |
| 6165 | methodDetails = "UserDeclinedToReplaceContent"; | 6189 | } else { |
| 6166 | } | 6190 | details = "UserDeclinedToReplaceContent"; |
| 6191 | } | ||
| 6192 | QJsonObject messageProperties = { | ||
| 6193 | { "status", details }, | ||
| 6194 | { "content_set_url", url } | ||
| 6195 | }; | ||
| 6196 | UserActivityLogger::getInstance().logAction("replace_domain_content", messageProperties); | ||
| 6197 | QObject::disconnect(dig, &ModalDialogListener::response, this, nullptr); | ||
| 6198 | }); | ||
| 6167 | } else { | 6199 | } else { |
| 6168 | methodDetails = "ContentSetDidNotOriginateFromMarketplace"; | 6200 | methodDetails = "ContentSetDidNotOriginateFromMarketplace"; |
| 6201 | QJsonObject messageProperties = { | ||
| 6202 | { "status", methodDetails }, | ||
| 6203 | { "content_set_url", url } | ||
| 6204 | }; | ||
| 6205 | UserActivityLogger::getInstance().logAction("replace_domain_content", messageProperties); | ||
| 6169 | } | 6206 | } |
| 6170 | } else { | 6207 | } else { |
| 6171 | methodDetails = "UserDoesNotHavePermissionToReplaceContent"; | 6208 | methodDetails = "UserDoesNotHavePermissionToReplaceContent"; |
| 6172 | static const QString warningMessage = simpleWordWrap("The domain owner must enable 'Replace Content' " | 6209 | static const QString warningMessage = simpleWordWrap("The domain owner must enable 'Replace Content' " |
| 6173 | "permissions for you in this domain's server settings before you can continue.", MAX_CHARACTERS_PER_LINE); | 6210 | "permissions for you in this domain's server settings before you can continue.", MAX_CHARACTERS_PER_LINE); |
| 6174 | OffscreenUi::warning("You do not have permissions to replace domain content", warningMessage, | 6211 | OffscreenUi::asyncWarning("You do not have permissions to replace domain content", warningMessage, |
| 6175 | QMessageBox::Ok, QMessageBox::Ok); | 6212 | QMessageBox::Ok, QMessageBox::Ok); |
| 6213 | |||
| 6214 | QJsonObject messageProperties = { | ||
| 6215 | { "status", methodDetails }, | ||
| 6216 | { "content_set_url", url } | ||
| 6217 | }; | ||
| 6218 | UserActivityLogger::getInstance().logAction("replace_domain_content", messageProperties); | ||
| 6176 | } | 6219 | } |
| 6177 | QJsonObject messageProperties = { | ||
| 6178 | { "status", methodDetails }, | ||
| 6179 | { "content_set_url", url } | ||
| 6180 | }; | ||
| 6181 | UserActivityLogger::getInstance().logAction("replace_domain_content", messageProperties); | ||
| 6182 | return true; | 6220 | return true; |
| 6183 | } | 6221 | } |
| 6184 | 6222 | ||
| @@ -6451,9 +6489,9 @@ void Application::addAssetToWorldAddEntity(QString filePath, QString mapping) { · 266 unmodified lines | |||
| 6451 | properties.setShapeType(SHAPE_TYPE_SIMPLE_COMPOUND); | 6489 | properties.setShapeType(SHAPE_TYPE_SIMPLE_COMPOUND); |
| 6452 | properties.setCollisionless(true); // Temporarily set so that doesn't collide with avatar. | 6490 | properties.setCollisionless(true); // Temporarily set so that doesn't collide with avatar. |
| 6453 | properties.setVisible(false); // Temporarily set so that don't see at large unresized dimensions. | 6491 | properties.setVisible(false); // Temporarily set so that don't see at large unresized dimensions. |
| 6454 | glm::vec3 positionOffset = getMyAvatar()->getOrientation() * (getMyAvatar()->getSensorToWorldScale() * glm::vec3(0.0f, 0.0f, -2.0f)); | 6492 | glm::vec3 positionOffset = getMyAvatar()->getWorldOrientation() * (getMyAvatar()->getSensorToWorldScale() * glm::vec3(0.0f, 0.0f, -2.0f)); |
| 6455 | properties.setPosition(getMyAvatar()->getPosition() + positionOffset); | 6493 | properties.setPosition(getMyAvatar()->getWorldPosition() + positionOffset); |
| 6456 | properties.setRotation(getMyAvatar()->getOrientation()); | 6494 | properties.setRotation(getMyAvatar()->getWorldOrientation()); |
| 6457 | properties.setGravity(glm::vec3(0.0f, 0.0f, 0.0f)); | 6495 | properties.setGravity(glm::vec3(0.0f, 0.0f, 0.0f)); |
| 6458 | auto entityID = DependencyManager::get<EntityScriptingInterface>()->addEntity(properties); | 6496 | auto entityID = DependencyManager::get<EntityScriptingInterface>()->addEntity(properties); |
| 6459 | 6497 | ||
| @@ -7037,11 +7075,11 @@ QRect Application::getRecommendedHUDRect() const { · 577 unmodified lines | |||
| 7037 | return result; | 7075 | return result; |
| 7038 | } | 7076 | } |
| 7039 | 7077 | ||
| 7040 | QSize Application::getDeviceSize() const { | 7078 | glm::vec2 Application::getDeviceSize() const { |
| 7041 | static const int MIN_SIZE = 1; | 7079 | static const int MIN_SIZE = 1; |
| 7042 | QSize result(MIN_SIZE, MIN_SIZE); | 7080 | glm::vec2 result(MIN_SIZE); |
| 7043 | if (_displayPlugin) { | 7081 | if (_displayPlugin) { |
| 7044 | result = fromGlm(getActiveDisplayPlugin()->getRecommendedRenderSize()); | 7082 | result = getActiveDisplayPlugin()->getRecommendedRenderSize(); |
| 7045 | } | 7083 | } |
| 7046 | return result; | 7084 | return result; |
| 7047 | } | 7085 | } |
| @@ -7060,10 +7098,6 @@ bool Application::hasFocus() const { · 12 unmodified lines | |||
| 7060 | return (QApplication::activeWindow() != nullptr); | 7098 | return (QApplication::activeWindow() != nullptr); |
| 7061 | } | 7099 | } |
| 7062 | 7100 | ||
| 7063 | glm::vec2 Application::getViewportDimensions() const { | ||
| 7064 | return toGlm(getDeviceSize()); | ||
| 7065 | } | ||
| 7066 | |||
| 7067 | void Application::setMaxOctreePacketsPerSecond(int maxOctreePPS) { | 7101 | void Application::setMaxOctreePacketsPerSecond(int maxOctreePPS) { |
| 7068 | if (maxOctreePPS != _maxOctreePPS) { | 7102 | if (maxOctreePPS != _maxOctreePPS) { |
| 7069 | _maxOctreePPS = maxOctreePPS; | 7103 | _maxOctreePPS = maxOctreePPS; |