void PropertyGrid::onGUI() { auto& ents = m_editor.getSelectedEntities(); if (ImGui::BeginDock("Properties", &m_is_opened) && ents.size() == 1) { if (ImGui::Button("Add component")) { ImGui::OpenPopup("AddComponentPopup"); } if (ImGui::BeginPopup("AddComponentPopup")) { for (int i = 0; i < Lumix::PropertyRegister::getComponentTypesCount(); ++i) { if (ImGui::Selectable(Lumix::PropertyRegister::getComponentTypeLabel(i))) { m_editor.addComponent( Lumix::crc32(Lumix::PropertyRegister::getComponentTypeID(i))); break; } } ImGui::EndPopup(); } showCoreProperties(ents[0]); auto& cmps = m_editor.getComponents(ents[0]); for (auto cmp : cmps) { showComponentProperties(cmp); } } ImGui::EndDock(); }
void PropertyGrid::onGUI() { auto& ents = m_editor.getSelectedEntities(); if (ImGui::BeginDock("Properties", &m_is_opened) && ents.size() == 1) { if (ImGui::Button("Add component")) { ImGui::OpenPopup("AddComponentPopup"); } if (ImGui::BeginPopup("AddComponentPopup")) { ImGui::FilterInput("Filter", m_component_filter, sizeof(m_component_filter)); for (auto* plugin : m_app.getAddComponentPlugins()) { const char* label = plugin->getLabel(); if (!m_component_filter[0] || Lumix::stristr(label, m_component_filter)) plugin->onGUI(false); } ImGui::EndPopup(); } showCoreProperties(ents[0]); auto& cmps = m_editor.getComponents(ents[0]); for (auto cmp : cmps) { showComponentProperties(cmp); } } ImGui::EndDock(); }