add file picking for osx and ios and implement equirectangular import

This commit is contained in:
2017-12-09 09:07:42 +00:00
parent d18b1103bb
commit f4cd7fdc62
20 changed files with 218 additions and 8 deletions

View File

@@ -26,6 +26,29 @@
{
CGLFlushDrawable([glctx CGLContextObj]);
}
- (std::string)pick_file
{
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setCanChooseFiles:YES];
[panel setCanChooseDirectories:NO];
[panel setAllowsMultipleSelection:NO]; // yes if more than one dir is allowed
NSArray* fileTypes = [NSArray arrayWithObjects:@"png", @"PNG", @"jpg", @"JPG", @"jpeg", nil];
[panel setAllowedFileTypes:fileTypes];
NSInteger clicked = [panel runModal];
std::string ret;
if (clicked == NSFileHandlingPanelOKButton)
{
for (NSURL *url in [panel URLs])
{
LOG("selected file: %s", [[url path] cStringUsingEncoding:NSUTF8StringEncoding]);
ret = [[url path] cStringUsingEncoding:NSUTF8StringEncoding];
}
}
return ret;
}
- (instancetype)initWithFrame:(NSRect)frameRect
{
gl_ready = false;

View File

@@ -14,4 +14,5 @@
- (void)async_lock;
- (void)async_unlock;
- (void)async_swap;
- (std::string)pick_file;
@end