Showing the changes to interface/src/Application.cpp (1 of 52 files). Show all
Unified · Split
| @@ -88,6 +88,7 @@ · 87 unmodified lines | ||
| 88 | 88 | #include <RenderDeferredTask.h> |
| 89 | 89 | #include <ResourceCache.h> |
| 90 | 90 | #include <SceneScriptingInterface.h> |
| 91 | +#include <RecordingScriptingInterface.h> | |
| 91 | 92 | #include <ScriptCache.h> |
| 92 | 93 | #include <SoundCache.h> |
| 93 | 94 | #include <TextureCache.h> |
| @@ -128,7 +129,6 @@ · 34 unmodified lines | ||
| 128 | 129 | #include "scripting/LocationScriptingInterface.h" |
| 129 | 130 | #include "scripting/MenuScriptingInterface.h" |
| 130 | 131 | #include "scripting/SettingsScriptingInterface.h" |
| 131 | −#include "scripting/RecordingScriptingInterface.h" | |
| 132 | 132 | #include "scripting/WebWindowClass.h" |
| 133 | 133 | #include "scripting/WindowScriptingInterface.h" |
| 134 | 134 | #include "scripting/ControllerScriptingInterface.h" |
| @@ -745,6 +745,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 610 unmodified lines | ||
| 745 | 745 | connect(applicationUpdater.data(), &AutoUpdater::newVersionIsAvailable, dialogsManager.data(), &DialogsManager::showUpdateDialog); |
| 746 | 746 | applicationUpdater->checkForUpdate(); |
| 747 | 747 | |
| 748 | + // Assign MyAvatar to th eRecording Singleton | |
| 749 | + DependencyManager::get<RecordingScriptingInterface>()->setControlledAvatar(getMyAvatar()); | |
| 750 | + | |
| 751 | + | |
| 748 | 752 | // Now that menu is initalized we can sync myAvatar with it's state. |
| 749 | 753 | getMyAvatar()->updateMotionBehaviorFromMenu(); |
| 750 | 754 | |
| @@ -839,6 +843,7 @@ void Application::cleanupBeforeQuit() { · 88 unmodified lines | ||
| 839 | 843 | #ifdef HAVE_IVIEWHMD |
| 840 | 844 | DependencyManager::get<EyeTracker>()->setEnabled(false, true); |
| 841 | 845 | #endif |
| 846 | + DependencyManager::get<RecordingScriptingInterface>()->setControlledAvatar(nullptr); | |
| 842 | 847 | |
| 843 | 848 | AnimDebugDraw::getInstance().shutdown(); |
| 844 | 849 | |
| @@ -1005,10 +1010,6 @@ void Application::initializeGL() { · 160 unmodified lines | ||
| 1005 | 1010 | connect(&_octreeProcessor, &OctreePacketProcessor::packetVersionMismatch, this, &Application::notifyPacketVersionMismatch); |
| 1006 | 1011 | _entityEditSender.initialize(_enableProcessOctreeThread); |
| 1007 | 1012 | |
| 1008 | − // call our timer function every second | |
| 1009 | − connect(&pingTimer, &QTimer::timeout, this, &Application::ping); | |
| 1010 | − pingTimer.start(1000); | |
| 1011 | − | |
| 1012 | 1013 | _idleLoopStdev.reset(); |
| 1013 | 1014 | |
| 1014 | 1015 | // update before the first render |
| @@ -1232,6 +1233,19 @@ void Application::paintGL() { · 217 unmodified lines | ||
| 1232 | 1233 | glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); |
| 1233 | 1234 | } |
| 1234 | 1235 | renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE; |
| 1236 | + } else if (_myCamera.getMode() == CAMERA_MODE_ENTITY) { | |
| 1237 | + EntityItemPointer cameraEntity = _myCamera.getCameraEntityPointer(); | |
| 1238 | + if (cameraEntity != nullptr) { | |
| 1239 | + if (isHMDMode()) { | |
| 1240 | + glm::quat hmdRotation = extractRotation(myAvatar->getHMDSensorMatrix()); | |
| 1241 | + _myCamera.setRotation(cameraEntity->getRotation() * hmdRotation); | |
| 1242 | + glm::vec3 hmdOffset = extractTranslation(myAvatar->getHMDSensorMatrix()); | |
| 1243 | + _myCamera.setPosition(cameraEntity->getPosition() + (hmdRotation * hmdOffset)); | |
| 1244 | + } else { | |
| 1245 | + _myCamera.setRotation(cameraEntity->getRotation()); | |
| 1246 | + _myCamera.setPosition(cameraEntity->getPosition()); | |
| 1247 | + } | |
| 1248 | + } | |
| 1235 | 1249 | } |
| 1236 | 1250 | // Update camera position |
| 1237 | 1251 | if (!isHMDMode()) { |
| @@ -2136,13 +2150,6 @@ bool Application::acceptSnapshot(const QString& urlString) { · 898 unmodified lines | ||
| 2136 | 2150 | return true; |
| 2137 | 2151 | } |
| 2138 | 2152 | |
| 2139 | −// Every second, send a ping, if menu item is checked. | |
| 2140 | −void Application::ping() { | |
| 2141 | − if (Menu::getInstance()->isOptionChecked(MenuOption::TestPing)) { | |
| 2142 | − DependencyManager::get<NodeList>()->sendPingPackets(); | |
| 2143 | − } | |
| 2144 | −} | |
| 2145 | − | |
| 2146 | 2153 | void Application::idle(uint64_t now) { |
| 2147 | 2154 | if (_aboutToQuit) { |
| 2148 | 2155 | return; // bail early, nothing to do here. |
| @@ -2682,8 +2689,8 @@ void Application::cycleCamera() { · 533 unmodified lines | ||
| 2682 | 2689 | menu->setIsOptionChecked(MenuOption::ThirdPerson, false); |
| 2683 | 2690 | menu->setIsOptionChecked(MenuOption::FullscreenMirror, true); |
| 2684 | 2691 | |
| 2685 | − } else if (menu->isOptionChecked(MenuOption::IndependentMode)) { | |
| 2686 | − // do nothing if in independe mode | |
| 2692 | + } else if (menu->isOptionChecked(MenuOption::IndependentMode) || menu->isOptionChecked(MenuOption::CameraEntityMode)) { | |
| 2693 | + // do nothing if in independent or camera entity modes | |
| 2687 | 2694 | return; |
| 2688 | 2695 | } |
| 2689 | 2696 | cameraMenuChanged(); // handle the menu change |
| @@ -2710,6 +2717,10 @@ void Application::cameraMenuChanged() { · 20 unmodified lines | ||
| 2710 | 2717 | if (_myCamera.getMode() != CAMERA_MODE_INDEPENDENT) { |
| 2711 | 2718 | _myCamera.setMode(CAMERA_MODE_INDEPENDENT); |
| 2712 | 2719 | } |
| 2720 | + } else if (Menu::getInstance()->isOptionChecked(MenuOption::CameraEntityMode)) { | |
| 2721 | + if (_myCamera.getMode() != CAMERA_MODE_ENTITY) { | |
| 2722 | + _myCamera.setMode(CAMERA_MODE_ENTITY); | |
| 2723 | + } | |
| 2713 | 2724 | } |
| 2714 | 2725 | } |
| 2715 | 2726 | |
| @@ -3995,7 +4006,6 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 1279 unmodified lines | ||
| 3995 | 4006 | RayToOverlayIntersectionResultFromScriptValue); |
| 3996 | 4007 | |
| 3997 | 4008 | scriptEngine->registerGlobalObject("Desktop", DependencyManager::get<DesktopScriptingInterface>().data()); |
| 3998 | − scriptEngine->registerGlobalObject("Recording", DependencyManager::get<RecordingScriptingInterface>().data()); | |
| 3999 | 4009 | |
| 4000 | 4010 | scriptEngine->registerGlobalObject("Window", DependencyManager::get<WindowScriptingInterface>().data()); |
| 4001 | 4011 | scriptEngine->registerGetterSetter("location", LocationScriptingInterface::locationGetter, |