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
253253 _window->setCentralWidget(_glWidget);
254254
255255 restoreSizeAndPosition();
256− loadScripts();
257256
258257 QFontDatabase fontDatabase;
259258 fontDatabase.addApplicationFont("resources/styles/Inconsolata.otf");
@@ -283,6 +282,9 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 23 unmodified lines
283282 _sixenseManager.setFilter(Menu::getInstance()->isOptionChecked(MenuOption::FilterSixense));
284283
285284 checkVersion();
285+
286+ // do this as late as possible so that all required subsystems are inialized
287+ loadScripts();
286288 }
287289
288290 Application::~Application() {
@@ -676,6 +678,14 @@ void Application::controlledBroadcastToNodes(const QByteArray& packet, const Nod · 387 unmodified lines
676678 }
677679
678680 void 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+
679689 if (activeWindow() == _window) {
680690 if (_chatEntryOn) {
681691 if (_chatEntry.keyPressEvent(event)) {
@@ -1087,6 +1097,15 @@ void Application::keyPressEvent(QKeyEvent* event) { · 405 unmodified lines
10871097 }
10881098
10891099 void 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+
10901109 if (activeWindow() == _window) {
10911110 if (_chatEntryOn) {
10921111 _myAvatar.setKeyState(NO_KEY_DOWN);
@@ -1149,6 +1168,14 @@ void Application::keyReleaseEvent(QKeyEvent* event) { · 56 unmodified lines
11491168 }
11501169
11511170 void 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+
11521179 _lastMouseMove = usecTimestampNow();
11531180 if (_mouseHidden) {
11541181 getGLWidget()->setCursor(Qt::ArrowCursor);
@@ -1195,6 +1222,14 @@ const float HOVER_VOXEL_FREQUENCY = 7040.f; · 40 unmodified lines
11951222 const float HOVER_VOXEL_DECAY = 0.999f;
11961223
11971224 void 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+
11981233 if (activeWindow() == _window) {
11991234 if (event->button() == Qt::LeftButton) {
12001235 _mouseX = event->x();
@@ -1262,6 +1297,13 @@ void Application::mousePressEvent(QMouseEvent* event) { · 61 unmodified lines
12621297 }
12631298
12641299 void 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+
12651307 if (activeWindow() == _window) {
12661308 if (event->button() == Qt::LeftButton) {
12671309 _mouseX = event->x();
@@ -1278,6 +1320,13 @@ void Application::mouseReleaseEvent(QMouseEvent* event) { · 10 unmodified lines
12781320 }
12791321
12801322 void 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+
12811330 bool validTouch = false;
12821331 if (activeWindow() == _window) {
12831332 const QList<QTouchEvent::TouchPoint>& tPoints = event->touchPoints();
@@ -1302,19 +1351,46 @@ void Application::touchUpdateEvent(QTouchEvent* event) { · 18 unmodified lines
13021351 }
13031352
13041353 void Application::touchBeginEvent(QTouchEvent* event) {
1354+ _controllerScriptingInterface.emitTouchBeginEvent(event); // send events to any registered scripts
1355+
13051356 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..
13061364 _lastTouchAvgX = _touchAvgX;
13071365 _lastTouchAvgY = _touchAvgY;
1366+
13081367 }
13091368
13101369 void 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..
13111378 _touchDragStartedAvgX = _touchAvgX;
13121379 _touchDragStartedAvgY = _touchAvgY;
13131380 _isTouchPressed = false;
1381+
13141382 }
13151383
13161384 const bool USE_MOUSEWHEEL = false;
13171385 void 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+
13181394 // Wheel Events disabled for now because they are also activated by touch look pitch up/down.
13191395 if (USE_MOUSEWHEEL && (activeWindow() == _window)) {
13201396 if (!Menu::getInstance()->isVoxelModeActionChecked()) {
@@ -1749,6 +1825,7 @@ void Application::init() { · 428 unmodified lines
17491825 _myCamera.setMode(CAMERA_MODE_FIRST_PERSON);
17501826 _myCamera.setModeShiftRate(1.0f);
17511827 _myAvatar.setDisplayingLookatVectors(false);
1828+ _avatarManager.setMyAvatar(&_myAvatar);
17521829
17531830 _mirrorCamera.setMode(CAMERA_MODE_MIRROR);
17541831 _mirrorCamera.setAspectRatio((float)MIRROR_VIEW_WIDTH / (float)MIRROR_VIEW_HEIGHT);
@@ -1795,7 +1872,7 @@ void Application::init() { · 40 unmodified lines
17951872
17961873 _metavoxels.init();
17971874
1798− _particleCollisionSystem.init(&_particleEditSender, _particles.getTree(), _voxels.getTree(), &_audio, &_myAvatar);
1875+ _particleCollisionSystem.init(&_particleEditSender, _particles.getTree(), _voxels.getTree(), &_audio, &_avatarManager);
17991876
18001877 _palette.init(_glWidget->width(), _glWidget->height());
18011878 _palette.addAction(Menu::getInstance()->getActionForOption(MenuOption::VoxelAddMode), 0, 0);
@@ -2309,7 +2386,7 @@ void Application::update(float deltaTime) { · 507 unmodified lines
23092386 updateCursor(deltaTime); // Handle cursor updates
23102387
23112388 _particles.update(); // update the particles...
2312− _particleCollisionSystem.update(); // handle collisions for the particles...
2389+ _particleCollisionSystem.update(); // collide the particles...
23132390 }
23142391
23152392 void Application::updateAvatar(float deltaTime) {
@@ -2322,10 +2399,7 @@ void Application::updateAvatar(float deltaTime) { · 6 unmodified lines
23222399 _yawFromTouch = 0.f;
23232400
23242401 // apply pitch from touch
2325− _myAvatar.getHead().setMousePitch(_myAvatar.getHead().getMousePitch() +
2326− _myAvatar.getHand().getPitchUpdate() +
2327− _pitchFromTouch);
2328− _myAvatar.getHand().setPitchUpdate(0.f);
2402+ _myAvatar.getHead().setPitch(_myAvatar.getHead().getPitch() + _pitchFromTouch);
23292403 _pitchFromTouch = 0.0f;
23302404
23312405 // 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