use thread safe events for file picker

This commit is contained in:
Turanszki Janos
2020-07-22 21:04:27 +01:00
parent 5d6edf7cd5
commit 2f659443ba
11 changed files with 163 additions and 120 deletions
+6 -4
View File
@@ -132,10 +132,12 @@ WeatherWindow::WeatherWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
params.description = "Cubemap texture";
params.extensions.push_back("dds");
wiHelper::FileDialog(params, [=](std::string fileName) {
auto& weather = GetWeather();
weather.skyMapName = fileName;
weather.skyMap = wiResourceManager::Load(fileName);
skyButton->SetText(fileName);
wiEvent::Subscribe_Once(SYSTEM_EVENT_THREAD_SAFE_POINT, [=](uint64_t userdata) {
auto& weather = GetWeather();
weather.skyMapName = fileName;
weather.skyMap = wiResourceManager::Load(fileName);
skyButton->SetText(fileName);
});
});
}
else