mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-11 21:52:43 +02:00
Hack to mod tablet orientation when clicking context overlay
This commit is contained in:
parent
e7c6ba9ae2
commit
223ed5b59a
3 changed files with 16 additions and 1 deletions
|
@ -33,6 +33,18 @@ ContextOverlayInterface::ContextOverlayInterface() {
|
|||
|
||||
auto entityTreeRenderer = DependencyManager::get<EntityTreeRenderer>().data();
|
||||
connect(entityTreeRenderer, SIGNAL(mousePressOnEntity(const EntityItemID&, const PointerEvent&)), this, SLOT(createOrDestroyContextOverlay(const EntityItemID&, const PointerEvent&)));
|
||||
connect(_tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system"), &TabletProxy::tabletShownChanged, this, [&]() {
|
||||
if (_contextOverlayJustClicked && _hmdScriptingInterface->isMounted()) {
|
||||
QUuid tabletFrameID = _hmdScriptingInterface->getCurrentTabletFrameID();
|
||||
QVariantMap props;
|
||||
auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||
glm::vec3 position = myAvatar->getJointPosition("Head") + 0.6f * (myAvatar->getOrientation() * Vectors::FRONT);
|
||||
props.insert("position", vec3toVariant(position));
|
||||
props.insert("orientation", quatToVariant(myAvatar->getOrientation() * glm::quat(0.0f, 0.0f, 1.0f, 0.0f)));
|
||||
qApp->getOverlays().editOverlay(tabletFrameID, props);
|
||||
_contextOverlayJustClicked = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static const xColor BB_OVERLAY_COLOR = {255, 255, 0};
|
||||
|
@ -149,6 +161,7 @@ void ContextOverlayInterface::clickContextOverlay(const OverlayID& overlayID, co
|
|||
qCDebug(context_overlay) << "Clicked Context Overlay. Entity ID:" << _currentEntityWithContextOverlay << "Overlay ID:" << overlayID;
|
||||
openMarketplace();
|
||||
destroyContextOverlay(_currentEntityWithContextOverlay, PointerEvent());
|
||||
_contextOverlayJustClicked = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <DependencyManager.h>
|
||||
#include <PointerEvent.h>
|
||||
#include <ui/TabletScriptingInterface.h>
|
||||
#include "avatar/AvatarManager.h"
|
||||
|
||||
#include "EntityScriptingInterface.h"
|
||||
#include "ui/overlays/Image3DOverlay.h"
|
||||
|
@ -66,6 +67,7 @@ private:
|
|||
bool _enabled { true };
|
||||
QUuid _currentEntityWithContextOverlay{};
|
||||
QString _entityMarketplaceID;
|
||||
bool _contextOverlayJustClicked { false };
|
||||
|
||||
void openMarketplace();
|
||||
};
|
||||
|
|
|
@ -104,7 +104,6 @@
|
|||
|
||||
function showTabletUI() {
|
||||
checkTablet()
|
||||
gTablet.tabletShown = true;
|
||||
|
||||
if (!tabletRezzed || !tabletIsValid()) {
|
||||
closeTabletUI();
|
||||
|
@ -123,6 +122,7 @@
|
|||
Overlays.editOverlay(HMD.tabletScreenID, { visible: true });
|
||||
Overlays.editOverlay(HMD.tabletScreenID, { maxFPS: 90 });
|
||||
}
|
||||
gTablet.tabletShown = true;
|
||||
}
|
||||
|
||||
function hideTabletUI() {
|
||||
|
|
Loading…
Reference in a new issue