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
+2 -6
View File
@@ -73,16 +73,12 @@ SoundWindow::SoundWindow(EditorComponent* editor) : GUI(&editor->GetGUI())
params.description = "Sound";
params.extensions.push_back("wav");
wiHelper::FileDialog(params, [=](std::string fileName) {
editor->main->loader->addLoadingFunction([=](wiJobArgs args) {
wiEvent::Subscribe_Once(SYSTEM_EVENT_THREAD_SAFE_POINT, [=](uint64_t userdata) {
Entity entity = GetScene().Entity_CreateSound("editorSound", fileName);
editor->ClearSelected();
editor->AddSelected(entity);
SetEntity(entity);
});
editor->main->loader->onFinished([=] {
editor->main->ActivatePath(editor, 0.2f, wiColor::Black());
});
editor->main->ActivatePath(editor->main->loader.get(), 0.2f, wiColor::Black());
});
});
});
soundWindow->AddWidget(addButton);