Просмотр исходного кода

Merge pull request #18106 from Mugen87/dev29

Editor: Add PLYExporter.
Mr.doob 5 лет назад
Родитель
Сommit
d1375d695b
4 измененных файлов с 42 добавлено и 0 удалено
  1. 1 0
      editor/index.html
  2. 36 0
      editor/js/Menubar.File.js
  3. 4 0
      editor/js/Strings.js
  4. 1 0
      editor/sw.js

+ 1 - 0
editor/index.html

@@ -39,6 +39,7 @@
 		<script src="../examples/js/exporters/ColladaExporter.js"></script>
 		<script src="../examples/js/exporters/GLTFExporter.js"></script>
 		<script src="../examples/js/exporters/OBJExporter.js"></script>
+		<script src="../examples/js/exporters/PLYExporter.js"></script>
 		<script src="../examples/js/exporters/STLExporter.js"></script>
 
 		<script src="../examples/js/renderers/Projector.js"></script>

+ 36 - 0
editor/js/Menubar.File.js

@@ -266,6 +266,42 @@ Menubar.File = function ( editor ) {
 	} );
 	options.add( option );
 
+	// Export PLY (ASCII)
+
+	var option = new UI.Row();
+	option.setClass( 'option' );
+	option.setTextContent( strings.getKey( 'menubar/file/export/ply' ) );
+	option.onClick( function () {
+
+		var exporter = new THREE.PLYExporter();
+
+		exporter.parse( editor.scene, function ( result ) {
+
+			saveArrayBuffer( result, 'model.ply' );
+
+		} );
+
+	} );
+	options.add( option );
+
+	// Export PLY (Binary)
+
+	var option = new UI.Row();
+	option.setClass( 'option' );
+	option.setTextContent( strings.getKey( 'menubar/file/export/ply_binary' ) );
+	option.onClick( function () {
+
+		var exporter = new THREE.PLYExporter();
+
+		exporter.parse( editor.scene, function ( result ) {
+
+			saveArrayBuffer( result, 'model-binary.ply' );
+
+		}, { binary: true } );
+
+	} );
+	options.add( option );
+
 	// Export STL (ASCII)
 
 	var option = new UI.Row();

+ 4 - 0
editor/js/Strings.js

@@ -20,6 +20,8 @@ var Strings = function ( config ) {
 			'menubar/file/export/glb': 'Export GLB',
 			'menubar/file/export/gltf': 'Export GLTF',
 			'menubar/file/export/obj': 'Export OBJ',
+			'menubar/file/export/ply': 'Export PLY',
+			'menubar/file/export/ply_binary': 'Export PLY (Binary)',
 			'menubar/file/export/stl': 'Export STL',
 			'menubar/file/export/stl_binary': 'Export STL (Binary)',
 			'menubar/file/publish': 'Publish',
@@ -325,6 +327,8 @@ var Strings = function ( config ) {
 			'menubar/file/export/glb': '导出GLB',
 			'menubar/file/export/gltf': '导出GLTF',
 			'menubar/file/export/obj': '导出OBJ',
+			'menubar/file/export/ply': '导出PLY',
+			'menubar/file/export/ply_binary': '导出PLY(二进制)',
 			'menubar/file/export/stl': '导出STL',
 			'menubar/file/export/stl_binary': '导出STL(二进制)',
 			'menubar/file/publish': '发布',

+ 1 - 0
editor/sw.js

@@ -36,6 +36,7 @@ const assets = [
 	'../examples/js/exporters/ColladaExporter.js',
 	'../examples/js/exporters/GLTFExporter.js',
 	'../examples/js/exporters/OBJExporter.js',
+	'../examples/js/exporters/PLYExporter.js',
 	'../examples/js/exporters/STLExporter.js',
 
 	'../examples/js/renderers/Projector.js',