SpiecsEngine
 
Loading...
Searching...
No Matches

◆ OnRender()

void Spices::ImguiProperty::OnRender ( )
overridevirtual

This interface is called On SlateRenderer Render.

Begin render Property.

Search String.

Begin render Search Input Text.

End if not a select entity.

Render Datails.

Render All Component.

End render Property.

Begin render Property.

Search String.

Begin render Search Input Text.

End if not a select entity.

Render Datails.

Render All Component.

End render Property.

Implements Spices::ImguiSlate.

Definition at line 12 of file ImguiProperty.cpp.

13 {
15
19 Begin();
20
21 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(2.0f, 4.0f));
22
26 static std::string searchString;
27 static bool isEnableSearch = false;
28
32 {
33 SPICES_PROFILE_ZONEN("ImguiProperty::Search");
34
35 ImGui::Spacing();
36 ImGui::PushItemWidth(m_PanelSize.x - ImGuiH::GetLineItemSize().x * 2.0f - ImGui::GetStyle().WindowPadding.x);
37 static char search[256] = {};
38 if (ImGui::InputTextWithHint("##", ICON_TEXT(ICON_MD_SEARCH, Search), search, 128))
39 {
40 searchString = std::string(search);
41 if (searchString.size() == 0) isEnableSearch = false;
42 else isEnableSearch = true;
43 }
44 ImGui::PopItemWidth();
45
46 ImGui::SameLine(m_PanelSize.x - ImGuiH::GetLineItemSize().x * 2.0f);
47 ImGui::Button(ICON_MD_FILTER_ALT, ImGuiH::GetLineItemSize());
48 ImGui::SameLine(m_PanelSize.x - ImGuiH::GetLineItemSize().x * 1.0f);
49 ImGui::Button(ICON_MD_REORDER, ImGuiH::GetLineItemSize());
50 ImGui::Spacing();
51 }
52
57 {
58 SPICES_PROFILE_ZONEN("ImguiProperty::End");
59
60 ImGui::PopStyleVar();
61 End();
62
63 return;
64 }
65
69 {
70 SPICES_PROFILE_ZONEN("ImguiProperty::Datails");
71
72 {
73 ImGui::PushID("ImguiProperty::Add");
74
75 ImGui::Columns(2, 0, false);
76 ImGui::SetColumnWidth(0, ImGuiH::GetLineItemSize().x * 4.0f);
77 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.16f, 0.16f, 0.16f, 1.0f));
78 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.619f, 0.619f, 0.619f, 1.0f));
79 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.408f, 0.451f, 0.18f, 1.0f));
80 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.341f, 0.486f, 0.353f, 1.0f));
81 ImGui::Button(ICON_TEXT(ICON_MD_ADD, Add));
82 ImGui::PopStyleColor(4);
83 ImGui::NextColumn();
84
85 std::string ss;
87 ImGui::PushItemWidth(m_PanelSize.x - ImGuiH::GetLineItemSize().x * 4.0f);
88 char text[128] = "";
89 if (ImGui::InputTextWithHint("##", ICON_TEXT_ROW(" ", ss.c_str()), text, 128)) {}
90 ImGui::PopItemWidth();
91
92 ImGui::Columns(1);
93 ImGui::PopID();
94 }
95
96 {
97 ImGui::PushID("ImguiProperty::Prim Path");
98 ImGui::Columns(2, 0, false);
99 ImGui::SetColumnWidth(0, ImGuiH::GetLineItemSize().x * 4.0f);
100 ImGui::Text("Prim Path");
101 ImGui::NextColumn();
102
103 std::stringstream ss;
104 ss << "/" << *m_FrameInfo.m_PickEntityID.end();
105 ImGui::PushItemWidth(m_PanelSize.x - ImGuiH::GetLineItemSize().x * 4.0f);
106 char textpath[128] = "";
107 if (ImGui::InputTextWithHint("##", ICON_TEXT_ROW(" ", ss.str().c_str()), textpath, 128)) {}
108 ImGui::PopItemWidth();
109
110 ImGui::Columns(1);
111 ImGui::PopID();
112 }
113
114 {
115 ImGui::PushID("ImguiProperty::Instanceable");
116 ImGui::Columns(2, 0, false);
117 ImGui::SetColumnWidth(0, ImGuiH::GetLineItemSize().x * 4.0f);
118 ImGui::Text("Instanceable");
119 ImGui::NextColumn();
120
121 static bool isChecked;
122 ImGuiH::Checkbox(&isChecked);
123 ImGui::Columns(1);
124 ImGui::PopID();
125 }
126 }
127
131 {
132 SPICES_PROFILE_ZONEN("ImguiProperty::Components");
133
134 entt::entity item = static_cast<entt::entity>(*m_FrameInfo.m_PickEntityID.end_k());
135 Entity entity(item, m_FrameInfo.m_World.get());
136
137 DrawComponent<TransformComponent> ("Transform", entity);
138 DrawComponent<CameraComponent> ("Camera", entity);
139 DrawComponent<DirectionalLightComponent>("DirectionalLight", entity);
140 DrawComponent<PointLightComponent> ("PointLight", entity);
141 DrawComponent<MeshComponent> ("Mesh", entity);
142 DrawComponent<NativeScriptComponent> ("NativeScript", entity);
143 DrawComponent<SkyBoxComponent> ("SkyBox", entity);
144 DrawComponent<SpriteComponent> ("Sprite", entity);
145 DrawComponent<LandscapeComponent> ("Landscape", entity);
146 DrawComponent<ParticleComponent> ("Particle", entity);
147 DrawComponent<EntityComponent> ("Attachment", entity);
148 DrawComponent<TagComponent> ("Tag", entity);
149 DrawComponent<UUIDComponent> ("UUID", entity);
150
151 if (ImGui::BeginPopupContextWindow(0, ImGuiPopupFlags_MouseButtonRight))
152 {
153 if (ImGui::BeginMenu("Add Component"))
154 {
155 if (ImGui::MenuItem("CameraComponent"))
156 {
157 AsyncTask(ThreadPoolEnum::Game, [=]() { Entity(item, m_FrameInfo.m_World.get()).AddComponent<CameraComponent>(); });
158 }
159 if (ImGui::MenuItem("DirectionalLightComponent"))
160 {
161 AsyncTask(ThreadPoolEnum::Game, [=]() { Entity(item, m_FrameInfo.m_World.get()).AddComponent<DirectionalLightComponent>(); });
162 }
163 if (ImGui::MenuItem("LandscapeComponent"))
164 {
165 AsyncTask(ThreadPoolEnum::Game, [=]() { Entity(item, m_FrameInfo.m_World.get()).AddComponent<LandscapeComponent>(); });
166 }
167 if (ImGui::MenuItem("MeshComponent"))
168 {
169 AsyncTask(ThreadPoolEnum::Game, [=]() { Entity(item, m_FrameInfo.m_World.get()).AddComponent<MeshComponent>(); });
170 }
171 if (ImGui::MenuItem("NativeScriptComponent"))
172 {
173 AsyncTask(ThreadPoolEnum::Game, [=]() { Entity(item, m_FrameInfo.m_World.get()).AddComponent<NativeScriptComponent>(); });
174 }
175 if (ImGui::MenuItem("ParticleComponent"))
176 {
177 AsyncTask(ThreadPoolEnum::Game, [=]() { Entity(item, m_FrameInfo.m_World.get()).AddComponent<ParticleComponent>(); });
178 }
179 if (ImGui::MenuItem("PointLightComponent"))
180 {
181 AsyncTask(ThreadPoolEnum::Game, [=]() { Entity(item, m_FrameInfo.m_World.get()).AddComponent<PointLightComponent>(); });
182 }
183 if (ImGui::MenuItem("SkyBoxComponent"))
184 {
185 AsyncTask(ThreadPoolEnum::Game, [=]() { Entity(item, m_FrameInfo.m_World.get()).AddComponent<SkyBoxComponent>(); });
186 }
187 if (ImGui::MenuItem("SpriteComponent"))
188 {
189 AsyncTask(ThreadPoolEnum::Game, [=]() { Entity(item, m_FrameInfo.m_World.get()).AddComponent<SpriteComponent>(); });
190 }
191 ImGui::MenuItem("WidgetComponent");
192
193 ImGui::EndMenu();
194 }
195 ImGui::EndPopup();
196 }
197 }
198
202 ImGui::PopStyleVar();
203 End();
204 }
#define ICON_TEXT(icon, text)
Definition ImguiHelper.h:24
#define ICON_TEXT_ROW(icon, text)
Definition ImguiHelper.h:25
#define SPICES_PROFILE_ZONEN(...)
#define SPICES_PROFILE_ZONE
std::shared_ptr< World > m_World
The shared pointer of specific world.
Definition FrameInfo.h:94
scl::linked_unordered_map< int, std::string > m_PickEntityID
Definition FrameInfo.h:82
static ImVec2 GetLineItemSize()
Get Line Width's Square Size.
static void Checkbox(bool *isChecked)
ImGuiHelper Style Checkbox.
void Begin(float alpha=1.0f, ImGuiWindowFlags flags=0)
Begin a common slate.
FrameInfo & m_FrameInfo
The FrameData reference.
Definition ImguiUtils.h:166
void End()
End a slate.
ImVec2 m_PanelSize
This slate's size.
Definition ImguiUtils.h:151
V * end()
Get the end element of this container.
size_t size()
The container's element size.
static auto AsyncTask(ThreadPoolEnum pool, F &&func, Args &&... args) -> std::future< decltype(func(std::forward< Args >(args)...))>

References Spices::ImGuiH::Checkbox(), Spices::ImguiSlate::End(), and Spices::ImguiSlate::m_FrameInfo.