ImGui: Added FindContainerByName() helper (#7313)

Added a helper function to find a container by name in the histogram container.

Signed-off-by: Benjamin Jillich <jillich@amazon.com>
This commit is contained in:
Benjamin Jillich
2022-02-02 09:55:39 +01:00
committed by GitHub
parent d6c419d630
commit 5e85e0e397
2 changed files with 13 additions and 0 deletions
@@ -36,6 +36,8 @@ namespace ImGui::LYImGuiUtils
void SetHistogramBinCount(int count) { m_histogramBinCount = count; }
ImGui::LYImGuiUtils::HistogramContainer* FindContainerByName(const char* name);
//! Needs to be public for l-value access for ImGui::MenuItem()
bool m_show = true;
@@ -77,6 +77,17 @@ namespace ImGui::LYImGuiUtils
}
}
}
ImGui::LYImGuiUtils::HistogramContainer* HistogramGroup::FindContainerByName(const char* name)
{
const auto iterator = m_histogramIndexByName.find(name);
if (iterator != m_histogramIndexByName.end())
{
return &m_histograms[iterator->second];
}
return nullptr;
}
} // namespace ImGui::LYImGuiUtils
#endif // IMGUI_ENABLED