Skip to content

Commit

Permalink
Merge pull request #823 from HifiExperiments/snap
Browse files Browse the repository at this point in the history
Fix Developer > UI > Show Overlays + Snap UI not hiding
  • Loading branch information
ksuprynowicz authored Mar 1, 2024
2 parents 9284797 + 214c9c4 commit 9b89b3f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 21 deletions.
11 changes: 8 additions & 3 deletions interface/src/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,13 +388,18 @@ Menu::Menu() {

// Developer > UI >>>
MenuWrapper* uiOptionsMenu = developerMenu->addMenu("UI");
action = addCheckableActionToQMenuAndActionHash(uiOptionsMenu, MenuOption::DesktopTabletToToolbar, 0,
qApp->getDesktopTabletBecomesToolbarSetting());

// Developer > UI > Show Overlays
addCheckableActionToQMenuAndActionHash(uiOptionsMenu, MenuOption::Overlays, 0, true);
action = addCheckableActionToQMenuAndActionHash(uiOptionsMenu, MenuOption::Overlays, 0, true);

connect(action, &QAction::triggered, [action] {
qApp->getApplicationOverlay().setEnabled(action->isChecked());
});

// Developer > UI > Desktop Tablet Becomes Toolbar
action = addCheckableActionToQMenuAndActionHash(uiOptionsMenu, MenuOption::DesktopTabletToToolbar, 0,
qApp->getDesktopTabletBecomesToolbarSetting());

connect(action, &QAction::triggered, [action] {
qApp->setDesktopTabletBecomesToolbarSetting(action->isChecked());
});
Expand Down
2 changes: 1 addition & 1 deletion interface/src/graphics/GraphicsEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ void GraphicsEngine::render_performFrame() {

{
PROFILE_RANGE(render, "/runRenderFrame");
renderArgs._hudOperator = displayPlugin->getHUDOperator();
renderArgs._hudOperator = qApp->getApplicationOverlay().enabled() ? displayPlugin->getHUDOperator() : nullptr;
renderArgs._hudTexture = qApp->getApplicationOverlay().getOverlayTexture();
renderArgs._takingSnapshot = qApp->takeSnapshotOperators(snapshotOperators);
renderArgs._blitFramebuffer = finalFramebuffer;
Expand Down
11 changes: 6 additions & 5 deletions interface/src/ui/ApplicationOverlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,17 @@ class ApplicationOverlay : public QObject {

void renderOverlay(RenderArgs* renderArgs);

gpu::TexturePointer getOverlayTexture();
gpu::TexturePointer getOverlayTexture();

bool enabled() const { return _enabled; }
void setEnabled(bool enabled) { _enabled = enabled; }

private:
void renderStatsAndLogs(RenderArgs* renderArgs);
void renderDomainConnectionStatusBorder(RenderArgs* renderArgs);
void renderQmlUi(RenderArgs* renderArgs);
void renderOverlays(RenderArgs* renderArgs);
void buildFramebufferObject();

float _alpha{ 1.0f };
float _trailingAudioLoudness{ 0.0f };

int _domainStatusBorder;
int _magnifierBorder;

Expand All @@ -47,6 +46,8 @@ class ApplicationOverlay : public QObject {
gpu::TexturePointer _overlayColorTexture;
gpu::FramebufferPointer _overlayFramebuffer;
int _qmlGeometryId { 0 };

bool _enabled { true };
};

#endif // hifi_ApplicationOverlay_h
10 changes: 1 addition & 9 deletions interface/src/ui/overlays/Overlays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,6 @@ void Overlays::render(RenderArgs* renderArgs) {
}
}

void Overlays::disable() {
_enabled = false;
}

void Overlays::enable() {
_enabled = true;
}

Overlay::Pointer Overlays::take2DOverlay(const QUuid& id) {
if (_shuttingDown) {
return nullptr;
Expand Down Expand Up @@ -378,7 +370,7 @@ QObject* Overlays::getOverlayObject(const QUuid& id) {
}

QUuid Overlays::getOverlayAtPoint(const glm::vec2& point) {
if (_shuttingDown || !_enabled) {
if (_shuttingDown) {
return UNKNOWN_ENTITY_ID;
}

Expand Down
3 changes: 0 additions & 3 deletions interface/src/ui/overlays/Overlays.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ class Overlays : public QObject {
void init();
void update(float deltatime);
void render(RenderArgs* renderArgs);
void disable();
void enable();

Overlay::Pointer take2DOverlay(const QUuid& id);
Overlay::Pointer get2DOverlay(const QUuid& id) const;
Expand Down Expand Up @@ -683,7 +681,6 @@ public slots:

unsigned int _stackOrder { 1 };

bool _enabled { true };
std::atomic<bool> _shuttingDown { false };

PointerEvent calculateOverlayPointerEvent(const QUuid& id, const PickRay& ray, const RayToOverlayIntersectionResult& rayPickResult,
Expand Down

0 comments on commit 9b89b3f

Please sign in to comment.