Create a Sketchfab Popcorn Maker plugin to include 3D models in projects

VERIFIED FIXED

Status

Webmaker
Popcorn Maker
VERIFIED FIXED
5 years ago
5 years ago

People

(Reporter: secretrobotron, Assigned: secretrobotron)

Tracking

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

5 years ago
Sketchfab has an iframe API (detailed here: https://sketchfab.com/api) which can be wrapped relatively easily to achieve integration of a popular 3D model service within Popcorn Maker.
(Assignee)

Comment 2

5 years ago
Created attachment 792265 [details]
Pull request on github for sketchfab work
Attachment #792265 - Flags: review?(schranz.m)
Comment on attachment 792265 [details]
Pull request on github for sketchfab work

Adding Scott as well.

Can you guys help Bobby get this in?
Attachment #792265 - Flags: review?(scott)
Can I first ask why we need this in?
(Assignee)

Comment 5

5 years ago
As a part of the DoE program that Ben put together, we needed a 3D modeling Popcorn plugin and Popcorn Maker integration that people could use to display models or scenes they created as part of the program (generally, learning about math, physics, science, 3D, cool stuff). This method was the most minimally disruptive way to make that happen, since we're just dealing with an iframe from an external service.

Note that the `sketchfab-iframe.js` file comes from Sketchfab.com as a library. Everything else I scripted.
(Assignee)

Comment 6

5 years ago
Additionally, it's one of the few things left that are blocking us from finishing up the program.
Comment on attachment 792265 [details]
Pull request on github for sketchfab work

Code wise there isn't much I can complain about at this point, but with stock config settings and a fresh repo the Sketchfab plugin crashes the app for me in Chrome (29) on OSX 10.8.4.

Uncaught TypeError: Cannot call method 'get' of undefined  editorhelper.js:152
Attachment #792265 - Flags: review?(schranz.m) → review-
(Assignee)

Comment 8

5 years ago
I added some proper iframe API teardown here: https://github.com/mozilla/butter/pull/1683/files#L4R16 Hopefully, that addresses the error you got somehow. If it doesn't, do you mind dropping the backtrace here for me? I couldn't replicate what you saw.
(Assignee)

Comment 9

5 years ago
Comment on attachment 792265 [details]
Pull request on github for sketchfab work

[t906746] corrections from mjschranz
[t906746] newlines
[t906746] cleanup and error protection in setupIframe
Attachment #792265 - Flags: review?(schranz.m)
Comment on attachment 792265 [details]
Pull request on github for sketchfab work

Still the same error unfortunately. Sorry, should have given something more detailed before for the error.

https://dl.dropboxusercontent.com/u/8586348/sketchfab.png

This is happening immediately after I add the event.
Attachment #792265 - Flags: review?(schranz.m) → review-
(Assignee)

Comment 11

5 years ago
Created attachment 795803 [details]
new pull request for sketchfab work, based on p.m.o repo instead of butter
Attachment #792265 - Attachment is obsolete: true
Attachment #792265 - Flags: review?(scott)
Attachment #795803 - Flags: review?(schranz.m)
Comment on attachment 795803 [details]
new pull request for sketchfab work, based on p.m.o repo instead of butter

Lint errors:

public/templates/assets/plugins/sketchfab/popcorn.sketchfab.js: line 28, col 15, 'src' is already defined.
public/templates/assets/plugins/sketchfab/popcorn.sketchfab.js: line 37, col 1, Trailing whitespace.

Add your plugin's less file to this https://github.com/mozilla/popcorn.webmaker.org/blob/master/make.js#L99-L108 so it can be linted.


After double clicking on the container and then clicking the tiny box in the top right, this happened:
Uncaught TypeError: Cannot read property 'resolve' of undefined
http://localhost:8888/templates/assets/plugins/sketchfab/sketchfab-iframe.js:82

RequireJS build fails (You need to set OPTIMIZE_JS to true in either your custom local.json config or change it in lib/default-config.js)
compilation failed for /var/folders/rl/xr0_kz8x17x8m5w56nk_69cr0000gp/T/mozilla.butter/src/butter.js:
Error: Error: ENOENT, no such file or directory '/Users/matt/Sites/repos/popcorn.webmaker.org/public/src/vendors/q/q.min.js'
In module tree:
    butter
      popcorn
        sketchfab-iframe

    at Object.fs.openSync (fs.js:427:18)

compilation failed for /var/folders/rl/xr0_kz8x17x8m5w56nk_69cr0000gp/T/mozilla.butter/src/embed.js:
Error: Error: ENOENT, no such file or directory '/Users/matt/Sites/repos/popcorn.webmaker.org/public/src/vendors/q/q.min.js'
In module tree:
    embed
      popcorn
        sketchfab-iframe

    at Object.fs.openSync (fs.js:427:18)


Plus a few comments in the PR.
Attachment #795803 - Flags: review?(schranz.m) → review-
(Assignee)

Comment 13

5 years ago
Comment on attachment 795803 [details]
new pull request for sketchfab work, based on p.m.o repo instead of butter

Fixes you mentioned. Make sure you `npm install` because of an update to requirejs-middleware to fix those requirejs compile issues.
Attachment #795803 - Flags: review- → review?(schranz.m)
Comment on attachment 795803 [details]
new pull request for sketchfab work, based on p.m.o repo instead of butter

So, this works although I have minor nit's in the code itself.

The big thing is though I can still trigger a crash in editor by clicking the little "close" button in the top right https://dl-web.dropbox.com/spa/qxpeeqhhsjhcqcf/65mkwujd.png. Note: You have to double click on the container first for that icon to be clickable.

I'm wondering if there's an option in the API that can turn that off. I'm not experienced with the use case of the plugin but it feels like it isn't useful because of the fact that it means you can't interact with the model anymore.
Attachment #795803 - Flags: review?(schranz.m) → review-
(Assignee)

Comment 15

5 years ago
Comment on attachment 795803 [details]
new pull request for sketchfab work, based on p.m.o repo instead of butter

Thanks for catching that problem. Consequently, I've found two separate bugs about which I've notified Sketchfab. For now, there's a patch in the external `sketchfab-iframe` file which should prevent an exception from occurring.

Nits are cleaned up.
Attachment #795803 - Flags: review- → review?(schranz.m)
Comment on attachment 795803 [details]
new pull request for sketchfab work, based on p.m.o repo instead of butter

R+ with merge conflicts sorted.
Attachment #795803 - Flags: review?(schranz.m) → review+

Comment 17

5 years ago
Very cool—what's the next step? Does this get staged? (We have Mike McCarthy doing starter makes to show this off, would be great if he could start playing around).

Thanks guys!
@Bobby

Once it's landed, ping me and I'll do the work to get it up on the interwebs.
Landed as https://github.com/mozilla/popcorn.webmaker.org/commit/041ba2fd217b0c871ee24a422cc0eb5d0375d7b9

Needs verification.
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Flags: needinfo?(schranz.m)
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
Flags: needinfo?(schranz.m)
You need to log in before you can comment on or make changes to this bug.