enabled property so we can turn it off during edit, etc...

This commit is contained in:
David Kelly 2017-07-20 08:08:49 -07:00
parent b236a21adc
commit 110efd63c8
2 changed files with 6 additions and 1 deletions

View file

@ -33,10 +33,11 @@ ContextOverlayInterface::ContextOverlayInterface() {
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) {
if (_enabled && event.getButton() == PointerEvent::SecondaryButton) {
EntityItemProperties entityProperties = _entityScriptingInterface->getEntityProperties(entityItemID, _entityPropertyFlags);
if (entityProperties.getMarketplaceID().length() != 0) {

View file

@ -36,6 +36,7 @@ class ContextOverlayInterface : public QObject, public Dependency {
Q_OBJECT
Q_PROPERTY(QUuid entityWithContextOverlay READ getCurrentEntityWithContextOverlay WRITE setCurrentEntityWithContextOverlay)
Q_PROPERTY(bool enabled READ getEnabled WRITE setEnabled);
QSharedPointer<EntityScriptingInterface> _entityScriptingInterface;
EntityPropertyFlags _entityPropertyFlags;
QSharedPointer<HMDScriptingInterface> _hmdScriptingInterface;
@ -49,6 +50,8 @@ public:
Q_INVOKABLE QUuid getCurrentEntityWithContextOverlay() { return _currentEntityWithContextOverlay; }
void setCurrentEntityWithContextOverlay(const QUuid& entityID) { _currentEntityWithContextOverlay = entityID; }
void setEnabled(bool enabled) { _enabled = enabled; }
bool getEnabled() { return _enabled; }
public slots:
void createOrDestroyContextOverlay(const EntityItemID& entityItemID, const PointerEvent& event);
@ -58,6 +61,7 @@ public slots:
private:
bool _verboseLogging { true };
bool _enabled { true };
QUuid _currentEntityWithContextOverlay{};
QString _entityMarketplaceID;