History

resolve conflicts on merge with upstream master

Stephen Birarda committed 12 years ago

Commit 33edcea2 parents 4bb72b9 3cfca7966 files · +2233 −743Browse files

Showing the changes to interface/src/Application.cpp (1 of 66 files). Show all

Unified · Split

interface/src/Application.cpp+81−7
@@ -253,7 +253,6 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 252 unmodified lines
253 _window->setCentralWidget(_glWidget);253 _window->setCentralWidget(_glWidget);
254 254
255 restoreSizeAndPosition();255 restoreSizeAndPosition();
256 loadScripts();
257 256
258 QFontDatabase fontDatabase; 257 QFontDatabase fontDatabase;
259 fontDatabase.addApplicationFont("resources/styles/Inconsolata.otf");258 fontDatabase.addApplicationFont("resources/styles/Inconsolata.otf");
@@ -283,6 +282,9 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 23 unmodified lines
283 _sixenseManager.setFilter(Menu::getInstance()->isOptionChecked(MenuOption::FilterSixense));282 _sixenseManager.setFilter(Menu::getInstance()->isOptionChecked(MenuOption::FilterSixense));
284 283
285 checkVersion();284 checkVersion();
285
286 // do this as late as possible so that all required subsystems are inialized
287 loadScripts();
286}288}
287 289
288Application::~Application() {290Application::~Application() {
@@ -676,6 +678,14 @@ void Application::controlledBroadcastToNodes(const QByteArray& packet, const Nod · 387 unmodified lines
676}678}
677 679
678void Application::keyPressEvent(QKeyEvent* event) {680void Application::keyPressEvent(QKeyEvent* event) {
681
682 _controllerScriptingInterface.emitKeyPressEvent(event); // send events to any registered scripts
683
684 // if one of our scripts have asked to capture this event, then stop processing it
685 if (_controllerScriptingInterface.isKeyCaptured(event)) {
686 return;
687 }
688
679 if (activeWindow() == _window) {689 if (activeWindow() == _window) {
680 if (_chatEntryOn) {690 if (_chatEntryOn) {
681 if (_chatEntry.keyPressEvent(event)) {691 if (_chatEntry.keyPressEvent(event)) {
@@ -1087,6 +1097,15 @@ void Application::keyPressEvent(QKeyEvent* event) { · 405 unmodified lines
1087}1097}
1088 1098
1089void Application::keyReleaseEvent(QKeyEvent* event) {1099void Application::keyReleaseEvent(QKeyEvent* event) {
1100
1101 _controllerScriptingInterface.emitKeyReleaseEvent(event); // send events to any registered scripts
1102
1103 // if one of our scripts have asked to capture this event, then stop processing it
1104 if (_controllerScriptingInterface.isKeyCaptured(event)) {
1105 return;
1106 }
1107
1108
1090 if (activeWindow() == _window) {1109 if (activeWindow() == _window) {
1091 if (_chatEntryOn) {1110 if (_chatEntryOn) {
1092 _myAvatar.setKeyState(NO_KEY_DOWN);1111 _myAvatar.setKeyState(NO_KEY_DOWN);
@@ -1149,6 +1168,14 @@ void Application::keyReleaseEvent(QKeyEvent* event) { · 56 unmodified lines
1149}1168}
1150 1169
1151void Application::mouseMoveEvent(QMouseEvent* event) {1170void Application::mouseMoveEvent(QMouseEvent* event) {
1171 _controllerScriptingInterface.emitMouseMoveEvent(event); // send events to any registered scripts
1172
1173 // if one of our scripts have asked to capture this event, then stop processing it
1174 if (_controllerScriptingInterface.isMouseCaptured()) {
1175 return;
1176 }
1177
1178
1152 _lastMouseMove = usecTimestampNow();1179 _lastMouseMove = usecTimestampNow();
1153 if (_mouseHidden) {1180 if (_mouseHidden) {
1154 getGLWidget()->setCursor(Qt::ArrowCursor);1181 getGLWidget()->setCursor(Qt::ArrowCursor);
@@ -1195,6 +1222,14 @@ const float HOVER_VOXEL_FREQUENCY = 7040.f; · 40 unmodified lines
1195const float HOVER_VOXEL_DECAY = 0.999f;1222const float HOVER_VOXEL_DECAY = 0.999f;
1196 1223
1197void Application::mousePressEvent(QMouseEvent* event) {1224void Application::mousePressEvent(QMouseEvent* event) {
1225 _controllerScriptingInterface.emitMousePressEvent(event); // send events to any registered scripts
1226
1227 // if one of our scripts have asked to capture this event, then stop processing it
1228 if (_controllerScriptingInterface.isMouseCaptured()) {
1229 return;
1230 }
1231
1232
1198 if (activeWindow() == _window) {1233 if (activeWindow() == _window) {
1199 if (event->button() == Qt::LeftButton) {1234 if (event->button() == Qt::LeftButton) {
1200 _mouseX = event->x();1235 _mouseX = event->x();
@@ -1262,6 +1297,13 @@ void Application::mousePressEvent(QMouseEvent* event) { · 61 unmodified lines
1262}1297}
1263 1298
1264void Application::mouseReleaseEvent(QMouseEvent* event) {1299void Application::mouseReleaseEvent(QMouseEvent* event) {
1300 _controllerScriptingInterface.emitMouseReleaseEvent(event); // send events to any registered scripts
1301
1302 // if one of our scripts have asked to capture this event, then stop processing it
1303 if (_controllerScriptingInterface.isMouseCaptured()) {
1304 return;
1305 }
1306
1265 if (activeWindow() == _window) {1307 if (activeWindow() == _window) {
1266 if (event->button() == Qt::LeftButton) {1308 if (event->button() == Qt::LeftButton) {
1267 _mouseX = event->x();1309 _mouseX = event->x();
@@ -1278,6 +1320,13 @@ void Application::mouseReleaseEvent(QMouseEvent* event) { · 10 unmodified lines
1278}1320}
1279 1321
1280void Application::touchUpdateEvent(QTouchEvent* event) {1322void Application::touchUpdateEvent(QTouchEvent* event) {
1323 _controllerScriptingInterface.emitTouchUpdateEvent(event); // send events to any registered scripts
1324
1325 // if one of our scripts have asked to capture this event, then stop processing it
1326 if (_controllerScriptingInterface.isTouchCaptured()) {
1327 return;
1328 }
1329
1281 bool validTouch = false;1330 bool validTouch = false;
1282 if (activeWindow() == _window) {1331 if (activeWindow() == _window) {
1283 const QList<QTouchEvent::TouchPoint>& tPoints = event->touchPoints();1332 const QList<QTouchEvent::TouchPoint>& tPoints = event->touchPoints();
@@ -1302,19 +1351,46 @@ void Application::touchUpdateEvent(QTouchEvent* event) { · 18 unmodified lines
1302}1351}
1303 1352
1304void Application::touchBeginEvent(QTouchEvent* event) {1353void Application::touchBeginEvent(QTouchEvent* event) {
1354 _controllerScriptingInterface.emitTouchBeginEvent(event); // send events to any registered scripts
1355
1305 touchUpdateEvent(event);1356 touchUpdateEvent(event);
1357
1358 // if one of our scripts have asked to capture this event, then stop processing it
1359 if (_controllerScriptingInterface.isTouchCaptured()) {
1360 return;
1361 }
1362
1363 // put any application specific touch behavior below here..
1306 _lastTouchAvgX = _touchAvgX;1364 _lastTouchAvgX = _touchAvgX;
1307 _lastTouchAvgY = _touchAvgY;1365 _lastTouchAvgY = _touchAvgY;
1366
1308}1367}
1309 1368
1310void Application::touchEndEvent(QTouchEvent* event) {1369void Application::touchEndEvent(QTouchEvent* event) {
1370 _controllerScriptingInterface.emitTouchEndEvent(event); // send events to any registered scripts
1371
1372 // if one of our scripts have asked to capture this event, then stop processing it
1373 if (_controllerScriptingInterface.isTouchCaptured()) {
1374 return;
1375 }
1376
1377 // put any application specific touch behavior below here..
1311 _touchDragStartedAvgX = _touchAvgX;1378 _touchDragStartedAvgX = _touchAvgX;
1312 _touchDragStartedAvgY = _touchAvgY;1379 _touchDragStartedAvgY = _touchAvgY;
1313 _isTouchPressed = false;1380 _isTouchPressed = false;
1381
1314}1382}
1315 1383
1316const bool USE_MOUSEWHEEL = false;1384const bool USE_MOUSEWHEEL = false;
1317void Application::wheelEvent(QWheelEvent* event) {1385void Application::wheelEvent(QWheelEvent* event) {
1386
1387 _controllerScriptingInterface.emitWheelEvent(event); // send events to any registered scripts
1388
1389 // if one of our scripts have asked to capture this event, then stop processing it
1390 if (_controllerScriptingInterface.isWheelCaptured()) {
1391 return;
1392 }
1393
1318 // Wheel Events disabled for now because they are also activated by touch look pitch up/down.1394 // Wheel Events disabled for now because they are also activated by touch look pitch up/down.
1319 if (USE_MOUSEWHEEL && (activeWindow() == _window)) {1395 if (USE_MOUSEWHEEL && (activeWindow() == _window)) {
1320 if (!Menu::getInstance()->isVoxelModeActionChecked()) {1396 if (!Menu::getInstance()->isVoxelModeActionChecked()) {
@@ -1749,6 +1825,7 @@ void Application::init() { · 428 unmodified lines
1749 _myCamera.setMode(CAMERA_MODE_FIRST_PERSON);1825 _myCamera.setMode(CAMERA_MODE_FIRST_PERSON);
1750 _myCamera.setModeShiftRate(1.0f);1826 _myCamera.setModeShiftRate(1.0f);
1751 _myAvatar.setDisplayingLookatVectors(false);1827 _myAvatar.setDisplayingLookatVectors(false);
1828 _avatarManager.setMyAvatar(&_myAvatar);
1752 1829
1753 _mirrorCamera.setMode(CAMERA_MODE_MIRROR);1830 _mirrorCamera.setMode(CAMERA_MODE_MIRROR);
1754 _mirrorCamera.setAspectRatio((float)MIRROR_VIEW_WIDTH / (float)MIRROR_VIEW_HEIGHT);1831 _mirrorCamera.setAspectRatio((float)MIRROR_VIEW_WIDTH / (float)MIRROR_VIEW_HEIGHT);
@@ -1795,7 +1872,7 @@ void Application::init() { · 40 unmodified lines
1795 1872
1796 _metavoxels.init();1873 _metavoxels.init();
1797 1874
1798 _particleCollisionSystem.init(&_particleEditSender, _particles.getTree(), _voxels.getTree(), &_audio, &_myAvatar);1875 _particleCollisionSystem.init(&_particleEditSender, _particles.getTree(), _voxels.getTree(), &_audio, &_avatarManager);
1799 1876
1800 _palette.init(_glWidget->width(), _glWidget->height());1877 _palette.init(_glWidget->width(), _glWidget->height());
1801 _palette.addAction(Menu::getInstance()->getActionForOption(MenuOption::VoxelAddMode), 0, 0);1878 _palette.addAction(Menu::getInstance()->getActionForOption(MenuOption::VoxelAddMode), 0, 0);
@@ -2309,7 +2386,7 @@ void Application::update(float deltaTime) { · 507 unmodified lines
2309 updateCursor(deltaTime); // Handle cursor updates2386 updateCursor(deltaTime); // Handle cursor updates
2310 2387
2311 _particles.update(); // update the particles...2388 _particles.update(); // update the particles...
2312 _particleCollisionSystem.update(); // handle collisions for the particles...2389 _particleCollisionSystem.update(); // collide the particles...
2313}2390}
2314 2391
2315void Application::updateAvatar(float deltaTime) {2392void Application::updateAvatar(float deltaTime) {
@@ -2322,10 +2399,7 @@ void Application::updateAvatar(float deltaTime) { · 6 unmodified lines
2322 _yawFromTouch = 0.f;2399 _yawFromTouch = 0.f;
2323 2400
2324 // apply pitch from touch2401 // apply pitch from touch
2325 _myAvatar.getHead().setMousePitch(_myAvatar.getHead().getMousePitch() +2402 _myAvatar.getHead().setPitch(_myAvatar.getHead().getPitch() + _pitchFromTouch);
2326 _myAvatar.getHand().getPitchUpdate() +
2327 _pitchFromTouch);
2328 _myAvatar.getHand().setPitchUpdate(0.f);
2329 _pitchFromTouch = 0.0f;2403 _pitchFromTouch = 0.0f;
2330 2404
2331 // Update my avatar's state from gyros2405 // Update my avatar's state from gyros

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t