mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 03:53:52 +02:00
Merge pull request #10979 from zfox23/hoverOverlay_lasers
Create/Destroy Hover Overlays using hand controller lasers
This commit is contained in:
commit
d94365cc44
5 changed files with 33 additions and 2 deletions
|
@ -2124,6 +2124,7 @@ void Application::initializeUi() {
|
|||
surfaceContext->setContextProperty("ApplicationCompositor", &getApplicationCompositor());
|
||||
|
||||
surfaceContext->setContextProperty("AvatarInputs", AvatarInputs::getInstance());
|
||||
surfaceContext->setContextProperty("HoverOverlay", DependencyManager::get<HoverOverlayInterface>().data());
|
||||
|
||||
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
|
||||
surfaceContext->setContextProperty("Steam", new SteamScriptingInterface(engine, steamClient.get()));
|
||||
|
@ -5826,6 +5827,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri
|
|||
auto entityScriptServerLog = DependencyManager::get<EntityScriptServerLogClient>();
|
||||
scriptEngine->registerGlobalObject("EntityScriptServerLog", entityScriptServerLog.data());
|
||||
scriptEngine->registerGlobalObject("AvatarInputs", AvatarInputs::getInstance());
|
||||
scriptEngine->registerGlobalObject("HoverOverlay", DependencyManager::get<HoverOverlayInterface>().data());
|
||||
|
||||
qScriptRegisterMetaType(scriptEngine, OverlayIDtoScriptValue, OverlayIDfromScriptValue);
|
||||
|
||||
|
|
|
@ -464,12 +464,12 @@ void EntityTreeRenderer::connectSignalsToSlots(EntityScriptingInterface* entityS
|
|||
connect(this, &EntityTreeRenderer::clickReleaseOnEntity, entityScriptingInterface, &EntityScriptingInterface::clickReleaseOnEntity);
|
||||
|
||||
connect(this, &EntityTreeRenderer::hoverEnterEntity, entityScriptingInterface, &EntityScriptingInterface::hoverEnterEntity);
|
||||
connect(this, &EntityTreeRenderer::hoverEnterEntity, hoverOverlayInterface, &HoverOverlayInterface::createHoverOverlay);
|
||||
connect(this, SIGNAL(hoverEnterEntity(const EntityItemID&, const PointerEvent&)), hoverOverlayInterface, SLOT(createHoverOverlay(const EntityItemID&, const PointerEvent&)));
|
||||
|
||||
connect(this, &EntityTreeRenderer::hoverOverEntity, entityScriptingInterface, &EntityScriptingInterface::hoverOverEntity);
|
||||
|
||||
connect(this, &EntityTreeRenderer::hoverLeaveEntity, entityScriptingInterface, &EntityScriptingInterface::hoverLeaveEntity);
|
||||
connect(this, &EntityTreeRenderer::hoverLeaveEntity, hoverOverlayInterface, &HoverOverlayInterface::destroyHoverOverlay);
|
||||
connect(this, SIGNAL(hoverLeaveEntity(const EntityItemID&, const PointerEvent&)), hoverOverlayInterface, SLOT(destroyHoverOverlay(const EntityItemID&, const PointerEvent&)));
|
||||
|
||||
connect(this, &EntityTreeRenderer::enterEntity, entityScriptingInterface, &EntityScriptingInterface::enterEntity);
|
||||
connect(this, &EntityTreeRenderer::leaveEntity, entityScriptingInterface, &EntityScriptingInterface::leaveEntity);
|
||||
|
|
|
@ -24,7 +24,15 @@ void HoverOverlayInterface::createHoverOverlay(const EntityItemID& entityItemID,
|
|||
setCurrentHoveredEntity(entityItemID);
|
||||
}
|
||||
|
||||
void HoverOverlayInterface::createHoverOverlay(const EntityItemID& entityItemID) {
|
||||
HoverOverlayInterface::createHoverOverlay(entityItemID, PointerEvent());
|
||||
}
|
||||
|
||||
void HoverOverlayInterface::destroyHoverOverlay(const EntityItemID& entityItemID, const PointerEvent& event) {
|
||||
qCDebug(hover_overlay) << "Destroying Hover Overlay on top of entity with ID: " << entityItemID;
|
||||
setCurrentHoveredEntity(QUuid());
|
||||
}
|
||||
|
||||
void HoverOverlayInterface::destroyHoverOverlay(const EntityItemID& entityItemID) {
|
||||
HoverOverlayInterface::destroyHoverOverlay(entityItemID, PointerEvent());
|
||||
}
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
#include "EntityTree.h"
|
||||
#include "HoverOverlayLogging.h"
|
||||
|
||||
/**jsdoc
|
||||
* @namespace HoverOverlay
|
||||
*/
|
||||
class HoverOverlayInterface : public QObject, public Dependency {
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -34,7 +37,9 @@ public:
|
|||
|
||||
public slots:
|
||||
void createHoverOverlay(const EntityItemID& entityItemID, const PointerEvent& event);
|
||||
void createHoverOverlay(const EntityItemID& entityItemID);
|
||||
void destroyHoverOverlay(const EntityItemID& entityItemID, const PointerEvent& event);
|
||||
void destroyHoverOverlay(const EntityItemID& entityItemID);
|
||||
|
||||
private:
|
||||
bool _verboseLogging { true };
|
||||
|
|
|
@ -187,6 +187,8 @@ var DEFAULT_GRABBABLE_DATA = {
|
|||
var USE_BLACKLIST = true;
|
||||
var blacklist = [];
|
||||
|
||||
var entitiesWithHoverOverlays = [];
|
||||
|
||||
var FORBIDDEN_GRAB_NAMES = ["Grab Debug Entity", "grab pointer"];
|
||||
var FORBIDDEN_GRAB_TYPES = ["Unknown", "Light", "PolyLine", "Zone"];
|
||||
|
||||
|
@ -2201,6 +2203,15 @@ function MyController(hand) {
|
|||
entityPropertiesCache.addEntity(rayPickInfo.entityID);
|
||||
}
|
||||
|
||||
if (rayPickInfo.entityID && entitiesWithHoverOverlays.indexOf(rayPickInfo.entityID) == -1) {
|
||||
entitiesWithHoverOverlays.forEach(function (element) {
|
||||
HoverOverlay.destroyHoverOverlay(element);
|
||||
});
|
||||
entitiesWithHoverOverlays = [];
|
||||
HoverOverlay.createHoverOverlay(rayPickInfo.entityID);
|
||||
entitiesWithHoverOverlays.push(rayPickInfo.entityID);
|
||||
}
|
||||
|
||||
var candidateHotSpotEntities = Entities.findEntities(handPosition, MAX_EQUIP_HOTSPOT_RADIUS);
|
||||
entityPropertiesCache.addEntities(candidateHotSpotEntities);
|
||||
|
||||
|
@ -3763,6 +3774,11 @@ function MyController(hand) {
|
|||
this.release = function() {
|
||||
this.turnOffVisualizations();
|
||||
|
||||
entitiesWithHoverOverlays.forEach(function (element) {
|
||||
HoverOverlay.destroyHoverOverlay(element);
|
||||
});
|
||||
entitiesWithHoverOverlays = [];
|
||||
|
||||
if (this.grabbedThingID !== null) {
|
||||
|
||||
Messages.sendMessage('Hifi-Teleport-Ignore-Remove', this.grabbedThingID);
|
||||
|
|
Loading…
Reference in a new issue