mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-03 23:24:35 +02:00
Highlight using simple yellow bounding box
This commit is contained in:
parent
2bd46d35df
commit
40ec770bc1
2 changed files with 20 additions and 0 deletions
|
@ -28,10 +28,12 @@ ContextOverlayInterface::ContextOverlayInterface() {
|
|||
_entityPropertyFlags += PROP_POSITION;
|
||||
_entityPropertyFlags += PROP_ROTATION;
|
||||
_entityPropertyFlags += PROP_MARKETPLACE_ID;
|
||||
_entityPropertyFlags += PROP_DIMENSIONS;
|
||||
|
||||
auto entityTreeRenderer = DependencyManager::get<EntityTreeRenderer>().data();
|
||||
connect(entityTreeRenderer, SIGNAL(mousePressOnEntity(const EntityItemID&, const PointerEvent&)), this, SLOT(createOrDestroyContextOverlay(const EntityItemID&, const PointerEvent&)));
|
||||
}
|
||||
static const xColor BB_OVERLAY_COLOR = {255, 255, 0};
|
||||
|
||||
void ContextOverlayInterface::createOrDestroyContextOverlay(const EntityItemID& entityItemID, const PointerEvent& event) {
|
||||
if (event.getButton() == PointerEvent::SecondaryButton) {
|
||||
|
@ -42,6 +44,18 @@ void ContextOverlayInterface::createOrDestroyContextOverlay(const EntityItemID&
|
|||
_entityMarketplaceID = entityProperties.getMarketplaceID();
|
||||
setCurrentEntityWithContextOverlay(entityItemID);
|
||||
|
||||
if (_bbOverlayID == UNKNOWN_OVERLAY_ID || !qApp->getOverlays().isAddedOverlay(_bbOverlayID)) {
|
||||
_bbOverlay = std::make_shared<Cube3DOverlay>();
|
||||
_bbOverlay->setIsSolid(false);
|
||||
_bbOverlay->setColor(BB_OVERLAY_COLOR);
|
||||
_bbOverlay->setDrawInFront(true);
|
||||
_bbOverlayID = qApp->getOverlays().addOverlay(_bbOverlay);
|
||||
}
|
||||
_bbOverlay->setDimensions(entityProperties.getDimensions());
|
||||
_bbOverlay->setRotation(entityProperties.getRotation());
|
||||
_bbOverlay->setPosition(entityProperties.getPosition());
|
||||
_bbOverlay->setVisible(true);
|
||||
|
||||
if (_contextOverlayID == UNKNOWN_OVERLAY_ID || !qApp->getOverlays().isAddedOverlay(_contextOverlayID)) {
|
||||
_contextOverlay = std::make_shared<Image3DOverlay>();
|
||||
_contextOverlay->setAlpha(1.0f);
|
||||
|
@ -70,8 +84,11 @@ void ContextOverlayInterface::destroyContextOverlay(const EntityItemID& entityIt
|
|||
setCurrentEntityWithContextOverlay(QUuid());
|
||||
|
||||
qApp->getOverlays().deleteOverlay(_contextOverlayID);
|
||||
qApp->getOverlays().deleteOverlay(_bbOverlayID);
|
||||
_contextOverlay = NULL;
|
||||
_bbOverlay = NULL;
|
||||
_contextOverlayID = UNKNOWN_OVERLAY_ID;
|
||||
_bbOverlayID = UNKNOWN_OVERLAY_ID;
|
||||
_entityMarketplaceID.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "EntityScriptingInterface.h"
|
||||
#include "ui/overlays/Image3DOverlay.h"
|
||||
#include "ui/overlays/Cube3DOverlay.h"
|
||||
#include "ui/overlays/Overlays.h"
|
||||
#include "scripting/HMDScriptingInterface.h"
|
||||
|
||||
|
@ -40,7 +41,9 @@ class ContextOverlayInterface : public QObject, public Dependency {
|
|||
QSharedPointer<HMDScriptingInterface> _hmdScriptingInterface;
|
||||
QSharedPointer<TabletScriptingInterface> _tabletScriptingInterface;
|
||||
OverlayID _contextOverlayID { UNKNOWN_OVERLAY_ID };
|
||||
OverlayID _bbOverlayID { UNKNOWN_OVERLAY_ID };
|
||||
std::shared_ptr<Image3DOverlay> _contextOverlay { nullptr };
|
||||
std::shared_ptr<Cube3DOverlay> _bbOverlay { nullptr };
|
||||
public:
|
||||
ContextOverlayInterface();
|
||||
|
||||
|
|
Loading…
Reference in a new issue