mirror of
https://github.com/overte-org/overte.git
synced 2025-07-25 12:45:33 +02:00
Merge pull request #10978 from zfox23/hoverOverlayInterface
New HoverOverlayInterface skeleton
This commit is contained in:
commit
aadf407842
6 changed files with 117 additions and 0 deletions
|
@ -69,6 +69,7 @@
|
|||
#include <EntityScriptClient.h>
|
||||
#include <EntityScriptServerLogClient.h>
|
||||
#include <EntityScriptingInterface.h>
|
||||
#include <HoverOverlayInterface.h>
|
||||
#include <ErrorDialog.h>
|
||||
#include <FileScriptingInterface.h>
|
||||
#include <Finally.h>
|
||||
|
@ -588,6 +589,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
|
|||
DependencyManager::set<Snapshot>();
|
||||
DependencyManager::set<CloseEventSender>();
|
||||
DependencyManager::set<ResourceManager>();
|
||||
DependencyManager::set<HoverOverlayInterface>();
|
||||
|
||||
return previousSessionCrashed;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <PerfStat.h>
|
||||
#include <SceneScriptingInterface.h>
|
||||
#include <ScriptEngine.h>
|
||||
#include <HoverOverlayInterface.h>
|
||||
|
||||
|
||||
#include "RenderableEntityItem.h"
|
||||
|
@ -452,6 +453,8 @@ RayToEntityIntersectionResult EntityTreeRenderer::findRayIntersectionWorker(cons
|
|||
|
||||
void EntityTreeRenderer::connectSignalsToSlots(EntityScriptingInterface* entityScriptingInterface) {
|
||||
|
||||
auto hoverOverlayInterface = DependencyManager::get<HoverOverlayInterface>().data();
|
||||
|
||||
connect(this, &EntityTreeRenderer::mousePressOnEntity, entityScriptingInterface, &EntityScriptingInterface::mousePressOnEntity);
|
||||
connect(this, &EntityTreeRenderer::mouseMoveOnEntity, entityScriptingInterface, &EntityScriptingInterface::mouseMoveOnEntity);
|
||||
connect(this, &EntityTreeRenderer::mouseReleaseOnEntity, entityScriptingInterface, &EntityScriptingInterface::mouseReleaseOnEntity);
|
||||
|
@ -461,8 +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, &EntityTreeRenderer::hoverOverEntity, entityScriptingInterface, &EntityScriptingInterface::hoverOverEntity);
|
||||
|
||||
connect(this, &EntityTreeRenderer::hoverLeaveEntity, entityScriptingInterface, &EntityScriptingInterface::hoverLeaveEntity);
|
||||
connect(this, &EntityTreeRenderer::hoverLeaveEntity, hoverOverlayInterface, &HoverOverlayInterface::destroyHoverOverlay);
|
||||
|
||||
connect(this, &EntityTreeRenderer::enterEntity, entityScriptingInterface, &EntityScriptingInterface::enterEntity);
|
||||
connect(this, &EntityTreeRenderer::leaveEntity, entityScriptingInterface, &EntityScriptingInterface::leaveEntity);
|
||||
|
|
30
libraries/entities/src/HoverOverlayInterface.cpp
Normal file
30
libraries/entities/src/HoverOverlayInterface.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
//
|
||||
// HoverOverlayInterface.cpp
|
||||
// libraries/entities/src
|
||||
//
|
||||
// Created by Zach Fox on 2017-07-14.
|
||||
// Copyright 2017 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include "HoverOverlayInterface.h"
|
||||
|
||||
HoverOverlayInterface::HoverOverlayInterface() {
|
||||
// "hover_overlay" debug log category disabled by default.
|
||||
// Create your own "qtlogging.ini" file and set your "QT_LOGGING_CONF" environment variable
|
||||
// if you'd like to enable/disable certain categories.
|
||||
// More details: http://doc.qt.io/qt-5/qloggingcategory.html#configuring-categories
|
||||
QLoggingCategory::setFilterRules(QStringLiteral("hifi.hover_overlay.debug=false"));
|
||||
}
|
||||
|
||||
void HoverOverlayInterface::createHoverOverlay(const EntityItemID& entityItemID, const PointerEvent& event) {
|
||||
qCDebug(hover_overlay) << "Creating Hover Overlay on top of entity with ID: " << entityItemID;
|
||||
setCurrentHoveredEntity(entityItemID);
|
||||
}
|
||||
|
||||
void HoverOverlayInterface::destroyHoverOverlay(const EntityItemID& entityItemID, const PointerEvent& event) {
|
||||
qCDebug(hover_overlay) << "Destroying Hover Overlay on top of entity with ID: " << entityItemID;
|
||||
setCurrentHoveredEntity(QUuid());
|
||||
}
|
44
libraries/entities/src/HoverOverlayInterface.h
Normal file
44
libraries/entities/src/HoverOverlayInterface.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
//
|
||||
// HoverOverlayInterface.h
|
||||
// libraries/entities/src
|
||||
//
|
||||
// Created by Zach Fox on 2017-07-14.
|
||||
// Copyright 2017 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#pragma once
|
||||
#ifndef hifi_HoverOverlayInterface_h
|
||||
#define hifi_HoverOverlayInterface_h
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QUuid>
|
||||
|
||||
#include <DependencyManager.h>
|
||||
#include <PointerEvent.h>
|
||||
|
||||
#include "EntityTree.h"
|
||||
#include "HoverOverlayLogging.h"
|
||||
|
||||
class HoverOverlayInterface : public QObject, public Dependency {
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QUuid currentHoveredEntity READ getCurrentHoveredEntity WRITE setCurrentHoveredEntity)
|
||||
public:
|
||||
HoverOverlayInterface();
|
||||
|
||||
Q_INVOKABLE QUuid getCurrentHoveredEntity() { return _currentHoveredEntity; }
|
||||
void setCurrentHoveredEntity(const QUuid& entityID) { _currentHoveredEntity = entityID; }
|
||||
|
||||
public slots:
|
||||
void createHoverOverlay(const EntityItemID& entityItemID, const PointerEvent& event);
|
||||
void destroyHoverOverlay(const EntityItemID& entityItemID, const PointerEvent& event);
|
||||
|
||||
private:
|
||||
bool _verboseLogging { true };
|
||||
QUuid _currentHoveredEntity{};
|
||||
};
|
||||
|
||||
#endif // hifi_HoverOverlayInterface_h
|
14
libraries/entities/src/HoverOverlayLogging.cpp
Normal file
14
libraries/entities/src/HoverOverlayLogging.cpp
Normal file
|
@ -0,0 +1,14 @@
|
|||
//
|
||||
// HoverOverlayLogging.cpp
|
||||
// libraries/entities/src
|
||||
//
|
||||
// Created by Zach Fox on 2017-07-17
|
||||
// Copyright 2017 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include "HoverOverlayLogging.h"
|
||||
|
||||
Q_LOGGING_CATEGORY(hover_overlay, "hifi.hover_overlay")
|
20
libraries/entities/src/HoverOverlayLogging.h
Normal file
20
libraries/entities/src/HoverOverlayLogging.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
//
|
||||
// HoverOverlayLogging.h
|
||||
// libraries/entities/src
|
||||
//
|
||||
// Created by Zach Fox on 2017-07-17
|
||||
// Copyright 2017 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#pragma once
|
||||
#ifndef hifi_HoverOverlayLogging_h
|
||||
#define hifi_HoverOverlayLogging_h
|
||||
|
||||
#include <QLoggingCategory>
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(hover_overlay)
|
||||
|
||||
#endif // hifi_HoverOverlayLogging_h
|
Loading…
Reference in a new issue