Showing the changes to interface/src/Application.cpp (1 of 58 files). Show all
Unified · Split
| @@ -79,8 +79,6 @@ · 78 unmodified lines | ||
| 79 | 79 | #include <gpu/Batch.h> |
| 80 | 80 | #include <gpu/Context.h> |
| 81 | 81 | #include <gpu/gl/GLBackend.h> |
| 82 | −#include <HFActionEvent.h> | |
| 83 | −#include <HFBackEvent.h> | |
| 84 | 82 | #include <InfoView.h> |
| 85 | 83 | #include <input-plugins/InputPlugin.h> |
| 86 | 84 | #include <controllers/UserInputMapper.h> |
| @@ -2859,10 +2857,6 @@ bool Application::event(QEvent* event) { · 2772 unmodified lines | ||
| 2859 | 2857 | break; |
| 2860 | 2858 | } |
| 2861 | 2859 | |
| 2862 | − if (HFActionEvent::types().contains(event->type())) { | |
| 2863 | − _controllerScriptingInterface->handleMetaEvent(static_cast<HFMetaEvent*>(event)); | |
| 2864 | − } | |
| 2865 | − | |
| 2866 | 2860 | return QApplication::event(event); |
| 2867 | 2861 | } |
| 2868 | 2862 | |
| @@ -3167,25 +3161,8 @@ void Application::keyPressEvent(QKeyEvent* event) { · 298 unmodified lines | ||
| 3167 | 3161 | case Qt::Key_Equal: |
| 3168 | 3162 | getMyAvatar()->resetSize(); |
| 3169 | 3163 | 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 | − } | |
| 3181 | 3164 | case Qt::Key_Escape: { |
| 3182 | 3165 | getActiveDisplayPlugin()->abandonCalibration(); |
| 3183 | − if (!event->isAutoRepeat()) { | |
| 3184 | − // this starts the HFCancelEvent | |
| 3185 | − HFBackEvent startBackEvent(HFBackEvent::startType()); | |
| 3186 | − sendEvent(this, &startBackEvent); | |
| 3187 | − } | |
| 3188 | − | |
| 3189 | 3166 | break; |
| 3190 | 3167 | } |
| 3191 | 3168 | |
| @@ -3211,30 +3188,6 @@ void Application::keyReleaseEvent(QKeyEvent* event) { · 19 unmodified lines | ||
| 3211 | 3188 | if (_keyboardMouseDevice->isActive()) { |
| 3212 | 3189 | _keyboardMouseDevice->keyReleaseEvent(event); |
| 3213 | 3190 | } |
| 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 | − } | |
| 3238 | 3191 | } |
| 3239 | 3192 | |
| 3240 | 3193 | void Application::focusOutEvent(QFocusEvent* event) { |
| @@ -3371,13 +3324,6 @@ void Application::mousePressEvent(QMouseEvent* event) { · 130 unmodified lines | ||
| 3371 | 3324 | if (_keyboardMouseDevice->isActive()) { |
| 3372 | 3325 | _keyboardMouseDevice->mousePressEvent(event); |
| 3373 | 3326 | } |
| 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 | − } | |
| 3381 | 3327 | } |
| 3382 | 3328 | } |
| 3383 | 3329 | |
| @@ -3432,13 +3378,6 @@ void Application::mouseReleaseEvent(QMouseEvent* event) { · 48 unmodified lines | ||
| 3432 | 3378 | if (_keyboardMouseDevice->isActive()) { |
| 3433 | 3379 | _keyboardMouseDevice->mouseReleaseEvent(event); |
| 3434 | 3380 | } |
| 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 | − } | |
| 3442 | 3381 | } |
| 3443 | 3382 | } |
| 3444 | 3383 | |
| @@ -4025,9 +3964,14 @@ void Application::calibrateEyeTracker5Points() { · 580 unmodified lines | ||
| 4025 | 3964 | } |
| 4026 | 3965 | #endif |
| 4027 | 3966 | |
| 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) { | |
| 4029 | 3970 | QHash<EntityItemID, EntityItemPointer> entities; |
| 4030 | 3971 | |
| 3972 | + auto nodeList = DependencyManager::get<NodeList>(); | |
| 3973 | + const QUuid myAvatarID = nodeList->getSessionUUID(); | |
| 3974 | + | |
| 4031 | 3975 | auto entityTree = getEntities()->getTree(); |
| 4032 | 3976 | auto exportTree = std::make_shared<EntityTree>(); |
| 4033 | 3977 | exportTree->createRootElement(); |
| @@ -4043,8 +3987,12 @@ bool Application::exportEntities(const QString& filename, const QVector<EntityIt · 9 unmodified lines | ||
| 4043 | 3987 | |
| 4044 | 3988 | if (!givenOffset) { |
| 4045 | 3989 | 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(); | |
| 4048 | 3996 | root.x = glm::min(root.x, position.x); |
| 4049 | 3997 | root.y = glm::min(root.y, position.y); |
| 4050 | 3998 | root.z = glm::min(root.z, position.z); |
| @@ -4064,12 +4012,16 @@ bool Application::exportEntities(const QString& filename, const QVector<EntityIt · 13 unmodified lines | ||
| 4064 | 4012 | for (EntityItemPointer& entityDatum : entities) { |
| 4065 | 4013 | auto properties = entityDatum->getProperties(); |
| 4066 | 4014 | 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 | |
| 4069 | 4024 | } |
| 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 | |
| 4073 | 4025 | exportTree->addEntity(entityDatum->getEntityItemID(), properties); |
| 4074 | 4026 | } |
| 4075 | 4027 | }); |