declension / elm-obj-loader

An elm library for importing wavefront .obj files into your WebGL application.

Home Page:http://package.elm-lang.org/packages/declension/elm-obj-loader/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Loading Obj from local file system on windows throws error.

Muzz opened this issue · comments

Ok so another bizarre issue that doesn't seem to be a parsing issue this time.

My model loads find if i am running elm-live, but with identical code, compiling to a js file and loading it in a custom html file however breaks it. This is an issue because photoshop(chromium) uses the local filesystem to run it and throws an identical error to chrome. I'm unsure if this is a windows only issue, but i can test on a osx system.

The same error exists with both provided objs and my own obj.

My Html just looks like this:
https://hastebin.com/iniruhehaf.xml

The error: (linebreaks added for readability)
https://hastebin.com/inaratudas.tex

If you are able to help that would be amazing!

I saw the discussion on slack, but I currently don't have any time to investigate. I'm travalling abroad, without a laptop and I only sparingly have any internet.

From the quick look I took, it might be a security issue. As far as I remember, browsers do not allow opening local files with an ajax request.

I think your best bet is to use a port to open the file with the file api from js and then send the content over to elm.

Thanks! i'll give that a shot and see what i can come up with!

@Muzz Hi, I'm back from travelling.
Did you manage to get it working?

If so, it would be cool if you could create a small example on ellie if possible.
Other people will probably run into this as well, so it would be nice to have a working example linked in the docs.
Thanks!

@Muzz did you ever get this working? Will close if not. Thanks