Skip to content

Commit

Permalink
Add export to ply button. Close stephomi#14
Browse files Browse the repository at this point in the history
  • Loading branch information
disjukr committed Aug 10, 2013
1 parent 29f0272 commit f5df599
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions gui/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Gui.prototype = {
foldFiles.add(main, 'resetSphere_').name('Reset sphere');
foldFiles.add(main, 'open_').name('Import (obj, stl)');
foldFiles.add(main, 'save_').name('Export (obj)');
foldFiles.add(main, 'savePLY_').name('Export (ply)');
foldFiles.open();

//Verold fold
Expand Down
14 changes: 14 additions & 0 deletions sculptgl.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function SculptGL()
this.resetSphere_ = this.resetSphere; //load sphere
this.open_ = this.openFile; //open file button (trigger hidden html input...)
this.save_ = this.saveFile; //save file function
this.savePLY_ = this.saveFileAsPLY;
this.undo_ = this.onUndo; //undo last action
this.redo_ = this.onRedo; //redo last action

Expand Down Expand Up @@ -597,6 +598,19 @@ SculptGL.prototype = {
saveAs(blob, 'yourMesh.obj');
},

/** Save file */
saveFileAsPLY: function ()
{
if (!this.mesh_)
return;
var data = [Files.exportPLY(this.mesh_)];
var blob = new Blob(data,
{
type: 'text/plain;charset=utf-8'
});
saveAs(blob, 'yourMesh.ply');
},

/** Export to Verold */
exportVerold: function ()
{
Expand Down

0 comments on commit f5df599

Please sign in to comment.