History

Merge branch 'RC-57' of https://github.com/highfidelity/hifi into pop_dynamicTests57

Zach Fox committed 9 years ago

Commit febc7252 parents bcbddb7 c25008c58 files · +675 −374Browse files

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

Unified · Split

interface/src/Application.cpp+21−69
@@ -79,8 +79,6 @@ · 78 unmodified lines
7979 #include <gpu/Batch.h>
8080 #include <gpu/Context.h>
8181 #include <gpu/gl/GLBackend.h>
82−#include <HFActionEvent.h>
83−#include <HFBackEvent.h>
8482 #include <InfoView.h>
8583 #include <input-plugins/InputPlugin.h>
8684 #include <controllers/UserInputMapper.h>
@@ -2859,10 +2857,6 @@ bool Application::event(QEvent* event) { · 2772 unmodified lines
28592857 break;
28602858 }
28612859
2862− if (HFActionEvent::types().contains(event->type())) {
2863− _controllerScriptingInterface->handleMetaEvent(static_cast<HFMetaEvent*>(event));
2864− }
2865−
28662860 return QApplication::event(event);
28672861 }
28682862
@@ -3167,25 +3161,8 @@ void Application::keyPressEvent(QKeyEvent* event) { · 298 unmodified lines
31673161 case Qt::Key_Equal:
31683162 getMyAvatar()->resetSize();
31693163 break;
3170− case Qt::Key_Space: {
3171− if (!event->isAutoRepeat()) {
3172− // FIXME -- I don't think we've tested the HFActionEvent in a while... this looks possibly dubious
3173− // this starts an HFActionEvent
3174− HFActionEvent startActionEvent(HFActionEvent::startType(),
3175− computePickRay(getMouse().x, getMouse().y));
3176− sendEvent(this, &startActionEvent);
3177− }
3178−
3179− break;
3180− }
31813164 case Qt::Key_Escape: {
31823165 getActiveDisplayPlugin()->abandonCalibration();
3183− if (!event->isAutoRepeat()) {
3184− // this starts the HFCancelEvent
3185− HFBackEvent startBackEvent(HFBackEvent::startType());
3186− sendEvent(this, &startBackEvent);
3187− }
3188−
31893166 break;
31903167 }
31913168
@@ -3211,30 +3188,6 @@ void Application::keyReleaseEvent(QKeyEvent* event) { · 19 unmodified lines
32113188 if (_keyboardMouseDevice->isActive()) {
32123189 _keyboardMouseDevice->keyReleaseEvent(event);
32133190 }
3214−
3215− switch (event->key()) {
3216− case Qt::Key_Space: {
3217− if (!event->isAutoRepeat()) {
3218− // FIXME -- I don't think we've tested the HFActionEvent in a while... this looks possibly dubious
3219− // this ends the HFActionEvent
3220− HFActionEvent endActionEvent(HFActionEvent::endType(),
3221− computePickRay(getMouse().x, getMouse().y));
3222− sendEvent(this, &endActionEvent);
3223− }
3224− break;
3225− }
3226− case Qt::Key_Escape: {
3227− if (!event->isAutoRepeat()) {
3228− // this ends the HFCancelEvent
3229− HFBackEvent endBackEvent(HFBackEvent::endType());
3230− sendEvent(this, &endBackEvent);
3231− }
3232− break;
3233− }
3234− default:
3235− event->ignore();
3236− break;
3237− }
32383191 }
32393192
32403193 void Application::focusOutEvent(QFocusEvent* event) {
@@ -3371,13 +3324,6 @@ void Application::mousePressEvent(QMouseEvent* event) { · 130 unmodified lines
33713324 if (_keyboardMouseDevice->isActive()) {
33723325 _keyboardMouseDevice->mousePressEvent(event);
33733326 }
3374−
3375− if (event->button() == Qt::LeftButton) {
3376− // nobody handled this - make it an action event on the _window object
3377− HFActionEvent actionEvent(HFActionEvent::startType(),
3378− computePickRay(mappedEvent.x(), mappedEvent.y()));
3379− sendEvent(this, &actionEvent);
3380− }
33813327 }
33823328 }
33833329
@@ -3432,13 +3378,6 @@ void Application::mouseReleaseEvent(QMouseEvent* event) { · 48 unmodified lines
34323378 if (_keyboardMouseDevice->isActive()) {
34333379 _keyboardMouseDevice->mouseReleaseEvent(event);
34343380 }
3435−
3436− if (event->button() == Qt::LeftButton) {
3437− // fire an action end event
3438− HFActionEvent actionEvent(HFActionEvent::endType(),
3439− computePickRay(mappedEvent.x(), mappedEvent.y()));
3440− sendEvent(this, &actionEvent);
3441− }
34423381 }
34433382 }
34443383
@@ -4025,9 +3964,14 @@ void Application::calibrateEyeTracker5Points() { · 580 unmodified lines
40253964 }
40263965 #endif
40273966
4028−bool Application::exportEntities(const QString& filename, const QVector<EntityItemID>& entityIDs, const glm::vec3* givenOffset) {
3967+bool Application::exportEntities(const QString& filename,
3968+ const QVector<EntityItemID>& entityIDs,
3969+ const glm::vec3* givenOffset) {
40293970 QHash<EntityItemID, EntityItemPointer> entities;
40303971
3972+ auto nodeList = DependencyManager::get<NodeList>();
3973+ const QUuid myAvatarID = nodeList->getSessionUUID();
3974+
40313975 auto entityTree = getEntities()->getTree();
40323976 auto exportTree = std::make_shared<EntityTree>();
40333977 exportTree->createRootElement();
@@ -4043,8 +3987,12 @@ bool Application::exportEntities(const QString& filename, const QVector<EntityIt · 9 unmodified lines
40433987
40443988 if (!givenOffset) {
40453989 EntityItemID parentID = entityItem->getParentID();
4046− if (parentID.isInvalidID() || !entityIDs.contains(parentID) || !entityTree->findEntityByEntityItemID(parentID)) {
4047− auto position = entityItem->getPosition(); // If parent wasn't selected, we want absolute position, which isn't in properties.
3990+ bool parentIsAvatar = (parentID == AVATAR_SELF_ID || parentID == myAvatarID);
3991+ if (!parentIsAvatar && (parentID.isInvalidID() ||
3992+ !entityIDs.contains(parentID) ||
3993+ !entityTree->findEntityByEntityItemID(parentID))) {
3994+ // If parent wasn't selected, we want absolute position, which isn't in properties.
3995+ auto position = entityItem->getPosition();
40483996 root.x = glm::min(root.x, position.x);
40493997 root.y = glm::min(root.y, position.y);
40503998 root.z = glm::min(root.z, position.z);
@@ -4064,12 +4012,16 @@ bool Application::exportEntities(const QString& filename, const QVector<EntityIt · 13 unmodified lines
40644012 for (EntityItemPointer& entityDatum : entities) {
40654013 auto properties = entityDatum->getProperties();
40664014 EntityItemID parentID = properties.getParentID();
4067− if (parentID.isInvalidID()) {
4068− properties.setPosition(properties.getPosition() - root);
4015+ bool parentIsAvatar = (parentID == AVATAR_SELF_ID || parentID == myAvatarID);
4016+ if (parentIsAvatar) {
4017+ properties.setParentID(AVATAR_SELF_ID);
4018+ } else {
4019+ if (parentID.isInvalidID()) {
4020+ properties.setPosition(properties.getPosition() - root);
4021+ } else if (!entities.contains(parentID)) {
4022+ entityDatum->globalizeProperties(properties, "Parent %3 of %2 %1 is not selected for export.", -root);
4023+ } // else valid parent -- don't offset
40694024 }
4070− else if (!entities.contains(parentID)) {
4071− entityDatum->globalizeProperties(properties, "Parent %3 of %2 %1 is not selected for export.", -root);
4072− } // else valid parent -- don't offset
40734025 exportTree->addEntity(entityDatum->getEntityItemID(), properties);
40744026 }
40754027 });