Skip to content

Commit

Permalink
Force viewport buttons semitransparent
Browse files Browse the repository at this point in the history
  • Loading branch information
LunaTheFoxgirl committed Jan 2, 2025
1 parent 85c2f6b commit 29f736c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
7 changes: 7 additions & 0 deletions source/creator/panels/viewport.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Authors: Luna Nielsen
*/
module creator.panels.viewport;
import creator.viewport.common.utils;
import creator.viewport;
import creator.widgets;
import creator.widgets.viewport;
Expand Down Expand Up @@ -188,6 +189,9 @@ protected:
}
igPopStyleVar();

igPushStyleColor(ImGuiCol.Button, igGetStyleColorVec4(ImGuiCol.Button).setAlpha(0.5));
igPushStyleColor(ImGuiCol.ButtonHovered, igGetStyleColorVec4(ImGuiCol.ButtonHovered).setAlpha(0.5));
igPushStyleColor(ImGuiCol.FrameBgActive, igGetStyleColorVec4(ImGuiCol.ButtonActive).setAlpha(0.5));
igPushStyleVar(ImGuiStyleVar.FrameBorderSize, 0);
incBeginViewportToolArea("ToolArea", ImGuiDir.Left);
igPushStyleVar_Vec2(ImGuiStyleVar.FramePadding, ImVec2(6, 6));
Expand All @@ -204,9 +208,12 @@ protected:
incBeginViewportToolArea("ConfirmArea", ImGuiDir.Left, ImGuiDir.Down, false);
incViewportDrawConfirmBar();
incEndViewportToolArea();

if (incEditMode == EditMode.ModelEdit)
incViewportTransformHandle();

igPopStyleVar();
igPopStyleColor(3);

lastSize = currSize;
igEndChild();
Expand Down
17 changes: 17 additions & 0 deletions source/creator/viewport/common/utils.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
Copyright © 2024, Inochi2D Project
Distributed under the 2-Clause BSD License, see LICENSE file.
Author: Luna Nielsen
*/
module creator.viewport.common.utils;
import bindbc.imgui;

/**
Returns the given color with the alpha channel modified.
*/
ImVec4 setAlpha(inout(ImVec4)* in_, float alpha) {
ImVec4 out_ = *in_;
out_.w = alpha;
return out_;
}

0 comments on commit 29f736c

Please sign in to comment.