Skip to content

Commit

Permalink
Merge pull request #19107 from Mugen87/dev43
Browse files Browse the repository at this point in the history
Editor: Support loading of 3MF files.
  • Loading branch information
mrdoob authored Apr 11, 2020
2 parents 332760a + 6365c6f commit 1f2e69c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions editor/js/Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import * as THREE from '../../build/three.module.js';

import { ThreeMFLoader } from '../../examples/jsm/loaders/3MFLoader.js';
import { AMFLoader } from '../../examples/jsm/loaders/AMFLoader.js';
import { ColladaLoader } from '../../examples/jsm/loaders/ColladaLoader.js';
import { DRACOLoader } from '../../examples/jsm/loaders/DRACOLoader.js';
Expand Down Expand Up @@ -105,6 +106,20 @@ var Loader = function ( editor ) {

break;

case '3mf':

reader.addEventListener( 'load', function ( event ) {

var loader = new ThreeMFLoader();
var object = loader.parse( event.target.result );

editor.execute( new AddObjectCommand( editor, object ) );

}, false );
reader.readAsArrayBuffer( file );

break;

case 'amf':

reader.addEventListener( 'load', function ( event ) {
Expand Down
1 change: 1 addition & 0 deletions editor/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const assets = [
'../examples/js/libs/draco/draco_encoder.js',
'../examples/js/libs/draco/draco_wasm_wrapper.js',

'../examples/jsm/loaders/3MFLoader.js',
'../examples/jsm/loaders/AMFLoader.js',
'../examples/jsm/loaders/ColladaLoader.js',
'../examples/jsm/loaders/DRACOLoader.js',
Expand Down

0 comments on commit 1f2e69c

Please sign in to comment.