MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / renderConfigPanel

Method renderConfigPanel

apps/tools/Studio/StudioApp.cpp:2825–2897  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2823 collectConfigResults(*configFile, "", q, configSearchResults);
2824 }
2825}
2826
2827void StudioApp::renderConfigPanel(float, float, float, float)
2828{
2829 std::string path = resolveFilePath(selectedEntry);
2830 if (path != configFilePath)
2831 {
2832 configFilePath = path;
2833 configSearchActive = false;
2834 memset(configSearch, 0, sizeof(configSearch));
2835 configSearchResults.clear();
2836 if (!path.empty())
2837 {
2838 auto cf = std::make_shared<ParamFile>();
2839 std::string ext = selectedEntry.extension;
2840 std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower);
2841 bool ok = false;
2842 if (ext == ".bin")
2843 ok = cf->ParseBin(path.c_str());
2844 else if (ext == ".hpp")
2845 ok = cf->Parse(path.c_str()) == LSOK;
2846 else
2847 ok = cf->ParseBin(path.c_str()) || cf->Parse(path.c_str()) == LSOK;
2848 configFile = ok ? std::move(cf) : nullptr;
2849 }
2850 else
2851 {
2852 configFile = nullptr;
2853 }
2854 }
2855
2856 if (!configFile)
2857 {
2858 ImGui::TextDisabled("Failed to parse config");
2859 return;
2860 }
2861
2862 if (configSearchActive)
2863 {
2864 if (configSearchResults.empty())
2865 {
2866 ImGui::TextDisabled("No results for \"%s\"", configSearch);
2867 }
2868 else
2869 {
2870 ImGui::Text("%d result(s):", (int)configSearchResults.size());
2871 ImGui::Separator();
2872 for (const auto& r : configSearchResults)
2873 {
2874 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.8f, 0.9f, 0.6f, 1.0f));
2875 ImGui::TextUnformatted(r.path.c_str());
2876 ImGui::PopStyleColor();
2877 if (r.entry && !r.entry->IsClass() && !r.entry->IsArray())
2878 {
2879 ImGui::SameLine();
2880 if (r.entry->IsFloatValue())
2881 {
2882 char buf[32];

Callers

nothing calls this directly

Calls 11

clearMethod · 0.80
sizeMethod · 0.80
emptyMethod · 0.45
ParseBinMethod · 0.45
ParseMethod · 0.45
IsClassMethod · 0.45
IsArrayMethod · 0.45
IsFloatValueMethod · 0.45
IsIntValueMethod · 0.45
DataMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected