SpiecsEngine
 
Loading...
Searching...
No Matches
ImguiPreferences.cpp
Go to the documentation of this file.
1/**
2* @file ImguiPreferences.cpp.
3* @brief The ImguiPreferences Class Implementation.
4* @author Spices.
5*/
6
7#include "Pchheader.h"
9
10#include "Systems/SlateSystem.h"
13
14namespace Spices {
15
17 const std::string& panelName ,
18 FrameInfo& frameInfo
19 )
20 : ImguiSlate(panelName, frameInfo)
21 {
23
24 /**
25 * @brief Instance.
26 */
27 m_ImguiDisplayOptions = SlateSystem::GetRegister()->Register<ImguiDisplayOptions>(false, "DisplayOptions");
28 m_ImguiPostProcessing = SlateSystem::GetRegister()->Register<ImguiPostProcessing>(false, "PostProcessing");
29 }
30
32 {
34
35 if (!m_IsSlateOn) return;
36
37 /**
38 * @brief Begin render Preferences.
39 */
40 Begin();
41
42 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(2.0f, 4.0f));
43
44 {
45 SPICES_PROFILE_ZONEN("ImguiPreferences::Reset");
46
47 ImGui::Spacing();
48 ImGui::SetWindowFontScale(1.15f);
49 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.204f, 0.78f, 1.0f, 1.0f));
50 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImGui::GetStyle().Colors[ImGuiCol_ButtonHovered]);
51 ImGui::Button(" Reset to Default ");
52 ImGui::PopStyleColor(2);
53 ImGui::SetWindowFontScale(1.0f);
54 ImGui::SetItemTooltip("This will reset all settings back to installed state after the application is restarted");
55 ImGui::Spacing();
56 }
57
58 const float columeWidth = ImGuiH::GetLineItemSize().x * 9.0f;
59 static ImguiSlate* selectedSlate = nullptr;
60
61 {
62 SPICES_PROFILE_ZONEN("ImguiPreferences::ItemLists");
63
64 ImGui::PushID("ImguiPreferences::ItemLists");
65 ImGui::Columns(2, 0, false);
66
67 ImGui::SetColumnWidth(0, columeWidth);
68
69 float itemHeight = ImGui::GetStyle().ItemSpacing.y;
70 if (ImGui::BeginChild("ImguiPreferences::ItemLists", ImVec2(0, -itemHeight), ImGuiChildFlags_None, ImGuiWindowFlags_HorizontalScrollbar))
71 {
72 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(6.0f, 6.0f));
73 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(4.0f, 4.0f));
74 ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImVec4(0.267f, 0.282f, 0.282f, 1.0f));
75 ImGui::PushStyleColor(ImGuiCol_HeaderActive, ImVec4(0.121f, 0.129f, 0.137f, 1.0f));
76
77 if (ImGui::MenuItem(ICON_TEXT(" ", Animation))) { selectedSlate = nullptr; }
78 if (ImGui::MenuItem(ICON_TEXT(" ", Audio))) { selectedSlate = nullptr; }
79 if (ImGui::MenuItem(ICON_TEXT(" ", Capture Screenshot))) { selectedSlate = nullptr; }
80 if (ImGui::MenuItem(ICON_TEXT(" ", Curve Tools))) { selectedSlate = nullptr; }
81 if (ImGui::MenuItem(ICON_TEXT(" ", Datetime Format))) { selectedSlate = nullptr; }
82 if (ImGui::MenuItem(ICON_TEXT(" ", Display Options))) { selectedSlate = m_ImguiDisplayOptions.get(); }
83 if (ImGui::MenuItem(ICON_TEXT(" ", Post Processing))) { selectedSlate = m_ImguiPostProcessing.get(); }
84 if (ImGui::MenuItem(ICON_TEXT(" ", Environment))) { selectedSlate = nullptr; }
85 if (ImGui::MenuItem(ICON_TEXT(" ", Live))) { selectedSlate = nullptr; }
86 if (ImGui::MenuItem(ICON_TEXT(" ", Material))) { selectedSlate = nullptr; }
87 if (ImGui::MenuItem(ICON_TEXT(" ", Material Thumbnail))) { selectedSlate = nullptr; }
88 if (ImGui::MenuItem(ICON_TEXT(" ", Measure))) { selectedSlate = nullptr; }
89 if (ImGui::MenuItem(ICON_TEXT(" ", Metrics Assembler))) { selectedSlate = nullptr; }
90 if (ImGui::MenuItem(ICON_TEXT(" ", Navigation))) { selectedSlate = nullptr; }
91 if (ImGui::MenuItem(ICON_TEXT(" ", Particle System))) { selectedSlate = nullptr; }
92 if (ImGui::MenuItem(ICON_TEXT(" ", Physics))) { selectedSlate = nullptr; }
93 if (ImGui::MenuItem(ICON_TEXT(" ", Property Widgets))) { selectedSlate = nullptr; }
94 if (ImGui::MenuItem(ICON_TEXT(" ", Rendering))) { selectedSlate = nullptr; }
95 if (ImGui::MenuItem(ICON_TEXT(" ", Resource Monitor))) { selectedSlate = nullptr; }
96 if (ImGui::MenuItem(ICON_TEXT(" ", Stage))) { selectedSlate = nullptr; }
97 if (ImGui::MenuItem(ICON_TEXT(" ", Tagging))) { selectedSlate = nullptr; }
98 if (ImGui::MenuItem(ICON_TEXT(" ", Template Startup))) { selectedSlate = nullptr; }
99 if (ImGui::MenuItem(ICON_TEXT(" ", Thumbnail Generation))) { selectedSlate = nullptr; }
100 if (ImGui::MenuItem(ICON_TEXT(" ", Viewport))) { selectedSlate = nullptr; }
101 if (ImGui::MenuItem(ICON_TEXT(" ", Visual Scripting))) { selectedSlate = nullptr; }
102 if (ImGui::MenuItem(ICON_TEXT(" ", Visualization))) { selectedSlate = nullptr; }
103
104 ImGui::PopStyleColor(2);
105 ImGui::PopStyleVar(2);
106 }
107 ImGui::EndChild();
108
109 ImGui::NextColumn();
110 }
111
112 {
113 SPICES_PROFILE_ZONEN("ImguiPreferences::Item");
114
115 float itemHeight = ImGui::GetStyle().ItemSpacing.y;
116 if (ImGui::BeginChild("ImguiPreferences::Item", ImVec2(0, -itemHeight), ImGuiChildFlags_None, ImGuiWindowFlags_HorizontalScrollbar))
117 {
118 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4, 1));
119
120 if (selectedSlate)
121 {
122 selectedSlate->OnRender();
123 }
124
125 ImGui::PopStyleVar();
126 }
127 ImGui::EndChild();
128
129 ImGui::Columns(1);
130 ImGui::PopID();
131 }
132
133 ImGui::PopStyleVar();
134
135 /**
136 * @brief End render GBuffer Preferences.
137 */
138 End();
139 }
140}
#define ICON_TEXT(icon, text)
Definition ImguiHelper.h:24
#define SPICES_PROFILE_ZONEN(...)
#define SPICES_PROFILE_ZONE
FrameInfo Class. This class defines the FrameInfo data.
Definition FrameInfo.h:32
ImguiPreferences(const std::string &panelName, FrameInfo &frameInfo)
Constructor Function.
virtual void OnRender() override
This interface is called On SlateRenderer Render.
The ImguiPreferences Class. This class defines how to render a edit menu.
void End()
End a slate.
ImguiSlate(const std::string &panelName, FrameInfo &frameInfo)
Constructor Function. Init with Slate's name.
Definition ImguiUtils.h:35
virtual void OnRender()=0
This interface is called on SlateRenderer Render.
This Class defines the basic behaves of specific slate. When we add an new Slate, we need inherit fro...
Definition ImguiUtils.h:27