mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:37:34 +00:00
3DFileViewer: Do not abort model loading when texture is missing
This commit is contained in:
parent
265dd9b445
commit
086fcd4e44
1 changed files with 7 additions and 9 deletions
|
@ -299,14 +299,13 @@ bool GLContextWidget::load_file(Core::File& file)
|
||||||
texture_image = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
|
texture_image = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
|
||||||
} else {
|
} else {
|
||||||
auto response = FileSystemAccessClient::Client::the().try_request_file(window(), builder.string_view(), Core::OpenMode::ReadOnly);
|
auto response = FileSystemAccessClient::Client::the().try_request_file(window(), builder.string_view(), Core::OpenMode::ReadOnly);
|
||||||
if (response.is_error())
|
if (!response.is_error()) {
|
||||||
return false;
|
|
||||||
|
|
||||||
auto texture_file = response.value();
|
auto texture_file = response.value();
|
||||||
auto bitmap_or_error = Gfx::Bitmap::try_load_from_fd_and_close(texture_file->leak_fd(), texture_file->filename());
|
auto bitmap_or_error = Gfx::Bitmap::try_load_from_fd_and_close(texture_file->leak_fd(), texture_file->filename());
|
||||||
if (!bitmap_or_error.is_error())
|
if (!bitmap_or_error.is_error())
|
||||||
texture_image = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
|
texture_image = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GLuint tex;
|
GLuint tex;
|
||||||
glGenTextures(1, &tex);
|
glGenTextures(1, &tex);
|
||||||
|
@ -331,8 +330,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
TRY(Core::System::pledge("stdio thread recvfd sendfd rpath unix"));
|
TRY(Core::System::pledge("stdio thread recvfd sendfd rpath unix"));
|
||||||
|
|
||||||
TRY(Core::System::unveil("/tmp/portal/filesystemaccess", "rw"));
|
TRY(Core::System::unveil("/tmp/portal/filesystemaccess", "rw"));
|
||||||
TRY(Core::System::unveil("/home/anon/Documents/3D Models/teapot.obj", "r"));
|
TRY(Core::System::unveil("/home/anon/Documents/3D Models", "r"));
|
||||||
TRY(Core::System::unveil("/home/anon/Documents/3D Models/teapot.bmp", "r"));
|
|
||||||
TRY(Core::System::unveil("/res", "r"));
|
TRY(Core::System::unveil("/res", "r"));
|
||||||
TRY(Core::System::unveil(nullptr, nullptr));
|
TRY(Core::System::unveil(nullptr, nullptr));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue