diff --git a/herosaver.js b/herosaver.js index 8f26e65..df9c081 100644 --- a/herosaver.js +++ b/herosaver.js @@ -200,7 +200,7 @@ function init() { stl.click(function(e) { e.preventDefault(); var exporter = new RK.STLExporter(); - var objs = CK.character.threeObj.children; + var objs = CK.character.children; var character = objs[0]; var figure = []; var max_objs = 0; @@ -219,7 +219,7 @@ function init() { console.log(character); figure.push(character); } - if(CK.character.characterData.parts.mount !== undefined) { + if(CK.data.parts.mount !== undefined) { console.log("Exporting Mount"); var mount = undefined; for(i in objs) { // find mount @@ -237,15 +237,15 @@ function init() { } console.log(figure); var stlString = exporter.parse(figure) - var name = CK.character.name + var name = CK.data.meta.character_name name = name === "" ? "unnamed" : name download(stlString, name + '.stl', 'application/sla'); }); stl_base.click(function(e) { e.preventDefault(); var exporter = new RK.STLExporter(); - var stlString = exporter.parse([CK.character.threeObj]) - var name = CK.character.name + var stlString = exporter.parse([CK.character]) + var name = CK.data.meta.character_name name = name === "" ? "unnamed" : name download(stlString, name + '_base.stl', 'application/sla'); }); @@ -253,8 +253,8 @@ function init() { sjson.click(function(e) { e.preventDefault(); - var char_json = JSON.stringify(CK.character.characterData); - var name = CK.character.name + var char_json = JSON.stringify(CK.data); + var name = CK.data.meta.character_name name = name === "" ? "unnamed" : name download(char_json, name + ".json", "text/plain"); }); diff --git a/herosaver.min.js b/herosaver.min.js index 541a531..aad56c3 100644 --- a/herosaver.min.js +++ b/herosaver.min.js @@ -1 +1 @@ -function init(){!function(){var e,t;RK.STLExporter=function(){},RK.STLExporter.prototype={constructor:THREE.STLExporter,parse:(e=new THREE.Vector3,t=new THREE.Matrix3,function(r){console.log(r);var n="";for(var o in n+="solid exported\n",r)r[o].traverse(function(r){if(r instanceof RK.Mesh){if(0==r.visible)return;var o=r.geometry,a=r.matrixWorld,i=r.skeleton,s=r;if(o instanceof RK.BufferGeometry){var c=o.clone();o=(new RK.Geometry).fromBufferGeometry(o);for(var l=c.getAttribute("skinIndex"),d=c.getAttribute("skinWeight"),p=c.getAttribute("morphTarget0"),f=0;void 0!==p;)f++,p=c.getAttribute("morphTarget"+f);if(void 0!==l){o.skinIndices=[],o.skinWeights=[],o.morphTargets=[];for(var u=0;u").css({"margin-left":"20px","font-size":"1.4em",color:"rgba(255, 255, 255, 0.8)",cursor:"pointer"}).text("Export Figure"),o=jQuery("").css({"margin-left":"20px","font-size":"1.4em",color:"rgba(255, 255, 255, 0.8)",cursor:"pointer"}).text("Export Figure + Base"),a=jQuery("").css({"margin-left":"20px","font-size":"1.4em",color:"rgba(255, 255, 255, 0.8)",cursor:"pointer"}).text("Save JSON"),i=jQuery("").attr({type:"file",id:"ljson"}).css({display:"none"}).text("Load JSON"),s=jQuery("").css({"margin-left":"20px","font-size":"1.4em",color:"rgba(255, 255, 255, 0.8)",cursor:"pointer"}).text("Export Figure + Base"),a=jQuery("").css({"margin-left":"20px","font-size":"1.4em",color:"rgba(255, 255, 255, 0.8)",cursor:"pointer"}).text("Save JSON"),i=jQuery("").attr({type:"file",id:"ljson"}).css({display:"none"}).text("Load JSON"),s=jQuery("