MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / DrawObject

Method DrawObject

modules/experimental/inspector/src/inspect_value.cpp:169–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167};
168
169void inspect_system::DrawObject(const skr_value_ref_t &object, const skr::String &name)
170{
171 SKR_ASSERT(object.type->type == SKR_TYPE_CATEGORY_OBJ);
172 ImGui::PushID(object.ptr);
173 SKR_DEFER({ ImGui::PopID(); });
174 ImGui::TableNextRow();
175 ImGui::TableSetColumnIndex(0);
176 ImGui::AlignTextToFramePadding();
177 bool nodeOpen = ImGui::TreeNodeEx("Object", ImGuiTreeNodeFlags_SpanFullWidth, "%s", name.c_str());
178 if(nodeOpen)
179 {
180 auto& rtype = *(skr::type::RecordType*)object.type;
181 for(auto& field : rtype.GetFields())
182 {
183 skr_value_ref_t child = {(char*)object.ptr + field.offset, field.type};
184 if(field.type->type == SKR_TYPE_CATEGORY_OBJ)
185 DrawObject(child, field.name);
186 else
187 {
188 ImGui::PushID(&field);
189 SKR_DEFER({ ImGui::PopID(); });
190 DrawLeaf(child, field.name);
191 }
192 }
193 }
194}
195
196void inspect_system::DrawLeaf(const skr_value_ref_t &value, const skr::String &name)
197{

Callers

nothing calls this directly

Calls 1

c_strMethod · 0.45

Tested by

no test coverage detected