use thread safe events for file picker
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user