Begin render Property.
Search String.
End if not a select entity.
Render Datails.
Render All Parameter.
End render Property.
Begin render Property.
Search String.
End if not a select entity.
Render Datails.
Render All Parameter.
End render Property.
13 {
15
20
21 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(2.0f, 4.0f));
22
26 static std::string searchString;
27 static bool isEnableSearch = false;
28
32 {
34
35 ImGui::Spacing();
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
50 ImGui::Spacing();
51 }
52
54 {
55 ImGui::PopStyleVar();
57 return;
58 }
59
61 if(!entity.HasComponent<MeshComponent>())
62 {
63 ImGui::PopStyleVar();
65 return;
66 }
67
68 MeshComponent meshComp = entity.GetComponent<MeshComponent>();
70
71 if(!meshComp.GetMesh()->GetPacks().has_key(materialIndex))
72 {
73 ImGui::PopStyleVar();
75 return;
76 }
77
79 ImGuiTreeNodeFlags treeNodeFlags =
80 ImGuiTreeNodeFlags_DefaultOpen |
81 ImGuiTreeNodeFlags_AllowItemOverlap |
82 ImGuiTreeNodeFlags_Framed |
83 ImGuiTreeNodeFlags_FramePadding ;
84
85
86 const std::shared_ptr<MeshPack>& meshPack = *meshComp.GetMesh()->GetPacks().find_value(materialIndex);
87 std::shared_ptr<Material> material = meshPack->GetMaterial();
88
93 {
95
96 ImGui::PopStyleVar();
98
99 return;
100 }
101
105 {
107
108 {
109 ImGui::PushID("ImguiMaterialPanel::Add");
110
111 ImGui::Columns(2, 0, false);
113 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.16f, 0.16f, 0.16f, 1.0f));
114 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.619f, 0.619f, 0.619f, 1.0f));
115 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.408f, 0.451f, 0.18f, 1.0f));
116 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.341f, 0.486f, 0.353f, 1.0f));
117 ImGui::Button(
ICON_TEXT(ICON_MD_ADD, Add));
118 ImGui::PopStyleColor(4);
119 ImGui::NextColumn();
120
122 char text[128] = "";
123 if (ImGui::InputTextWithHint(
"##",
ICON_TEXT_ROW(
" ", material->GetName().c_str()), text, 128)) {}
124 ImGui::PopItemWidth();
125
126 ImGui::Columns(1);
127 ImGui::PopID();
128 }
129
130 {
131 ImGui::PushID("ImguiMaterialPanel::Prim Path");
132 ImGui::Columns(2, 0, false);
134 ImGui::Text("Prim Path");
135 ImGui::NextColumn();
136
137 std::stringstream ss;
138 ss << "/" << material->GetName();
140 char textpath[128] = "";
141 if (ImGui::InputTextWithHint(
"##",
ICON_TEXT_ROW(
" ", ss.str().c_str()), textpath, 128)) {}
142 ImGui::PopItemWidth();
143
144 ImGui::Columns(1);
145 ImGui::PopID();
146 }
147
148 {
149 ImGui::PushID("ImguiMaterialPanel::Instanceable");
150 ImGui::Columns(2, 0, false);
152 ImGui::Text("Instanceable");
153 ImGui::NextColumn();
154
155 static bool isChecked;
157 ImGui::Columns(1);
158 ImGui::PopID();
159 }
160 }
161
162
166 {
168
169 {
171
173 for(auto& pair : material->GetShaderPath())
174 {
176
177 ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - ImGuiH::GetLineItemSize().x);
178 char buffer[128] = {};
179 ImGui::InputTextWithHint(
"##",
ICON_TEXT_ROW(
" ", pair.second[0].c_str()), buffer,
sizeof(buffer));
180 ImGui::PopItemWidth();
181
182 ImGui::SameLine();
184 });
185 }
186 });
187 }
188
189 {
191
193 material->GetTextureParams().for_each([&](const auto& k, const auto& v) {
194
196
198 char buffer[128] = {};
199 ImGui::InputTextWithHint(
"##",
ICON_TEXT_ROW(
" ", v.texturePath.c_str()), buffer,
sizeof(buffer));
200 ImGui::PopItemWidth();
201
202 ImGui::SameLine();
204 });
205 return false;
206 });
207 });
208 }
209
210 {
212
214 material->GetConstantParams().for_each([&](const std::string& k, ConstantParams& v){
216 if (v.value.paramType == "float")
217 {
218 if (ImGuiH::DrawMaterialConstParams<float>(material, ImGuiDataType_Float, 1, "%.3f", v))
219 {
220 FrameInfo::Get().m_World->Mark(World::NeedUpdateTLAS | World::FrushStableFrame);
221 }
222 }
223 else if (v.value.paramType == "float2")
224 {
225 if (ImGuiH::DrawMaterialConstParams<glm::vec2>(material, ImGuiDataType_Float, 2, "%.3f", v))
226 {
227 FrameInfo::Get().m_World->Mark(World::NeedUpdateTLAS | World::FrushStableFrame);
228 }
229 }
230 else if (v.value.paramType == "float3")
231 {
232 if (ImGuiH::DrawMaterialConstParams<glm::vec3>(material, ImGuiDataType_Float, 3, "%.3f", v))
233 {
234 FrameInfo::Get().m_World->Mark(World::NeedUpdateTLAS | World::FrushStableFrame);
235 }
236 }
237 else if (v.value.paramType == "float4")
238 {
239 if (ImGuiH::DrawMaterialConstParams<glm::vec4>(material, ImGuiDataType_Float, 4, "%.3f", v))
240 {
241 FrameInfo::Get().m_World->Mark(World::NeedUpdateTLAS | World::FrushStableFrame);
242 }
243 }
244 else if (v.value.paramType == "int")
245 {
246 if (ImGuiH::DrawMaterialConstParams<int>(material, ImGuiDataType_S32, 1, "%d", v))
247 {
248 FrameInfo::Get().m_World->Mark(World::NeedUpdateTLAS | World::FrushStableFrame);
249 }
250 }
251 else if (v.value.paramType == "bool")
252 {
253
254 }
255 });
256 return false;
257 });
258 });
259 }
260
261 {
263
264
265 }
266 }
267
271 ImGui::PopStyleVar();
273 }
#define ICON_TEXT(icon, text)
#define ICON_TEXT_ROW(icon, text)
#define SPICES_PROFILE_ZONEN(...)
#define SPICES_PROFILE_ZONE
uint32_t m_PickMaterial
Identify of selected material.
static FrameInfo & Get()
Get FrameInfo.
std::shared_ptr< World > m_World
The shared pointer of specific world.
scl::linked_unordered_map< int, std::string > m_PickEntityID
static ImVec2 GetLineItemSize()
Get Line Width's Square Size.
static bool DrawResetIcon(const bool &isMove)
Draw Reset Icon.
static void DrawPropertyItem(const std::string &itemName, float columeWidth, std::function< void()> nameFunc, std::function< void()> valFunc)
Draw a single property.
static void Checkbox(bool *isChecked)
ImGuiHelper Style Checkbox.
static void DrawTreeTitle(const std::string &treeName, std::function< void()> optionFunc, std::function< void()> treeFunc)
Draw a stylized tree title bar.
void Begin(float alpha=1.0f, ImGuiWindowFlags flags=0)
Begin a common slate.
FrameInfo & m_FrameInfo
The FrameData reference.
ImVec2 m_PanelSize
This slate's size.
size_t size()
The container's element size.