2
0
Эх сурвалжийг харах

Removed edges handling from asset pipeline (Blender exporter, OBJ converter, JSONLoader).

alteredq 14 жил өмнө
parent
commit
a60595b3f7

+ 2 - 2
build/Three.js

@@ -608,8 +608,8 @@ THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,
 t[p++]*c,x.position.z=t[p++]*c,f.vertices.push(x);p=0;for(v=J.length;p<v;){c=J[p++];t=c&1;u=c&2;e=c&4;h=c&8;w=c&16;x=c&32;z=c&64;c&=128;t?(C=new THREE.Face4,C.a=J[p++],C.b=J[p++],C.c=J[p++],C.d=J[p++],t=4):(C=new THREE.Face3,C.a=J[p++],C.b=J[p++],C.c=J[p++],t=3);if(u)u=J[p++],C.materials=f.materials[u];u=f.faces.length;if(e)for(e=0;e<I;e++)A=b.uvs[e],y=J[p++],D=A[y*2],y=A[y*2+1],f.faceUvs[e][u]=new THREE.UV(D,y);if(h)for(e=0;e<I;e++){A=b.uvs[e];F=[];for(h=0;h<t;h++)y=J[p++],D=A[y*2],y=A[y*2+1],F[h]=
 new THREE.UV(D,y);f.faceVertexUvs[e][u]=F}if(w)w=J[p++]*3,h=new THREE.Vector3,h.x=P[w++],h.y=P[w++],h.z=P[w],C.normal=h;if(x)for(e=0;e<t;e++)w=J[p++]*3,h=new THREE.Vector3,h.x=P[w++],h.y=P[w++],h.z=P[w],C.vertexNormals.push(h);if(z)x=J[p++],x=new THREE.Color(S[x]),C.color=x;if(c)for(e=0;e<t;e++)x=J[p++],x=new THREE.Color(S[x]),C.vertexColors.push(x);f.faces.push(C)}}})(h);(function(){var c,e,h,u;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)h=b.skinWeights[c],u=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(h,
 u,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)h=b.skinIndices[c],u=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(h,u,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,h,u,p,v,t,x,w,y;e=0;for(h=b.morphTargets.length;e<h;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];w=f.morphTargets[e].vertices;y=b.morphTargets[e].vertices;u=0;for(p=y.length;u<p;u+=3)v=y[u]*c,t=y[u+1]*
-c,x=y[u+2]*c,w.push(new THREE.Vertex(new THREE.Vector3(v,t,x)))}}if(b.morphColors!==void 0){e=0;for(h=b.morphColors.length;e<h;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];p=f.morphColors[e].colors;v=b.morphColors[e].colors;c=0;for(u=v.length;c<u;c+=3)t=new THREE.Color(16755200),t.setRGB(v[c],v[c+1],v[c+2]),p.push(t)}}})(h);(function(){if(b.edges!==void 0){var c,e,h;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],h=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
-f.vertices[h],e,h))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
+c,x=y[u+2]*c,w.push(new THREE.Vertex(new THREE.Vector3(v,t,x)))}}if(b.morphColors!==void 0){e=0;for(h=b.morphColors.length;e<h;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];p=f.morphColors[e].colors;v=b.morphColors[e].colors;c=0;for(u=v.length;c<u;c+=3)t=new THREE.Color(16755200),t.setRGB(v[c],v[c+1],v[c+2]),p.push(t)}}})(h);f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};
+THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
 THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:h+"/"+b}function n(){for(w in Q.objects)if(!V.objects[w])if(F=Q.objects[w],F.geometry!==void 0){if(S=V.geometries[F.geometry]){var b=!1;Y=[];for(aa=0;aa<F.materials.length;aa++)Y[aa]=V.materials[F.materials[aa]],b=Y[aa]instanceof THREE.ShaderMaterial;b&&S.computeTangents();D=F.position;r=F.rotation;
 q=F.quaternion;s=F.scale;q=0;Y.length==0&&(Y[0]=new THREE.MeshFaceMaterial);Y.length>1&&(Y=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(S,Y);object.name=w;object.position.set(D[0],D[1],D[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=F.visible;V.scene.add(object);V.objects[w]=object;F.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),V.scene.collisions.colliders.push(b));
 if(F.castsShadow)b=new THREE.ShadowVolume(S),V.scene.add(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},V.triggers[object.name]=b)}}else D=F.position,r=F.rotation,q=F.quaternion,s=F.scale,q=0,object=new THREE.Object3D,object.name=w,object.position.set(D[0],D[1],D[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],

+ 2 - 2
build/custom/ThreeExtras.js

@@ -264,8 +264,8 @@ THREE.JSONLoader.prototype.createModel=function(a,b,c){var e=new THREE.Geometry,
 o[m++]*c,t.position.z=o[m++]*c,e.vertices.push(t);m=0;for(n=A.length;m<n;){c=A[m++];o=c&1;l=c&2;b=c&4;g=c&8;p=c&16;t=c&32;v=c&64;c&=128;o?(u=new THREE.Face4,u.a=A[m++],u.b=A[m++],u.c=A[m++],u.d=A[m++],o=4):(u=new THREE.Face3,u.a=A[m++],u.b=A[m++],u.c=A[m++],o=3);if(l)l=A[m++],u.materials=e.materials[l];l=e.faces.length;if(b)for(b=0;b<E;b++)z=a.uvs[b],x=A[m++],w=z[x*2],x=z[x*2+1],e.faceUvs[b][l]=new THREE.UV(w,x);if(g)for(b=0;b<E;b++){z=a.uvs[b];y=[];for(g=0;g<o;g++)x=A[m++],w=z[x*2],x=z[x*2+1],y[g]=
 new THREE.UV(w,x);e.faceVertexUvs[b][l]=y}if(p)p=A[m++]*3,g=new THREE.Vector3,g.x=C[p++],g.y=C[p++],g.z=C[p],u.normal=g;if(t)for(b=0;b<o;b++)p=A[m++]*3,g=new THREE.Vector3,g.x=C[p++],g.y=C[p++],g.z=C[p],u.vertexNormals.push(g);if(v)t=A[m++],t=new THREE.Color(G[t]),u.color=t;if(c)for(b=0;b<o;b++)t=A[m++],t=new THREE.Color(G[t]),u.vertexColors.push(t);e.faces.push(u)}}})(g);(function(){var c,b,g,l;if(a.skinWeights){c=0;for(b=a.skinWeights.length;c<b;c+=2)g=a.skinWeights[c],l=a.skinWeights[c+1],e.skinWeights.push(new THREE.Vector4(g,
 l,0,0))}if(a.skinIndices){c=0;for(b=a.skinIndices.length;c<b;c+=2)g=a.skinIndices[c],l=a.skinIndices[c+1],e.skinIndices.push(new THREE.Vector4(g,l,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(c){if(a.morphTargets!==void 0){var b,g,l,m,n,o,t,p,x;b=0;for(g=a.morphTargets.length;b<g;b++){e.morphTargets[b]={};e.morphTargets[b].name=a.morphTargets[b].name;e.morphTargets[b].vertices=[];p=e.morphTargets[b].vertices;x=a.morphTargets[b].vertices;l=0;for(m=x.length;l<m;l+=3)n=x[l]*c,o=x[l+1]*
-c,t=x[l+2]*c,p.push(new THREE.Vertex(new THREE.Vector3(n,o,t)))}}if(a.morphColors!==void 0){b=0;for(g=a.morphColors.length;b<g;b++){e.morphColors[b]={};e.morphColors[b].name=a.morphColors[b].name;e.morphColors[b].colors=[];m=e.morphColors[b].colors;n=a.morphColors[b].colors;c=0;for(l=n.length;c<l;c+=3)o=new THREE.Color(16755200),o.setRGB(n[c],n[c+1],n[c+2]),m.push(o)}}})(g);(function(){if(a.edges!==void 0){var c,b,g;for(c=0;c<a.edges.length;c+=2)b=a.edges[c],g=a.edges[c+1],e.edges.push(new THREE.Edge(e.vertices[b],
-e.vertices[g],b,g))}})();e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();b(e)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
+c,t=x[l+2]*c,p.push(new THREE.Vertex(new THREE.Vector3(n,o,t)))}}if(a.morphColors!==void 0){b=0;for(g=a.morphColors.length;b<g;b++){e.morphColors[b]={};e.morphColors[b].name=a.morphColors[b].name;e.morphColors[b].colors=[];m=e.morphColors[b].colors;n=a.morphColors[b].colors;c=0;for(l=n.length;c<l;c+=3)o=new THREE.Color(16755200),o.setRGB(n[c],n[c+1],n[c+2]),m.push(o)}}})(g);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();b(e)};
+THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
 THREE.SceneLoader.prototype={load:function(a,b){var c=this,e=new Worker(a);e.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,c){return c=="relativeToHTML"?a:g+"/"+a}function k(){for(p in D.objects)if(!F.objects[p])if(y=D.objects[p],y.geometry!==void 0){if(G=F.geometries[y.geometry]){var a=!1;M=[];for(O=0;O<y.materials.length;O++)M[O]=F.materials[y.materials[O]],a=M[O]instanceof THREE.ShaderMaterial;a&&G.computeTangents();w=y.position;r=y.rotation;
 q=y.quaternion;s=y.scale;q=0;M.length==0&&(M[0]=new THREE.MeshFaceMaterial);M.length>1&&(M=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(G,M);object.name=p;object.position.set(w[0],w[1],w[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=y.visible;F.scene.add(object);F.objects[p]=object;y.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),F.scene.collisions.colliders.push(a));
 if(y.castsShadow)a=new THREE.ShadowVolume(G),F.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},F.triggers[object.name]=a)}}else w=y.position,r=y.rotation,q=y.quaternion,s=y.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(w[0],w[1],w[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 1
examples/models/animated/horse.js


+ 8 - 7
examples/obj/cubecolors/cube_fvc.js

@@ -1,5 +1,5 @@
 /*
- * File generated with Blender 2.56 Exporter
+ * File generated with Blender 2.59 Exporter
  * https://github.com/mrdoob/three.js/tree/master/utils/exporters/blender/
  *
  * vertices: 8
@@ -8,16 +8,16 @@
  * uvs: 0
  * colors: 22
  * materials: 1
- * edges: 0
+ * morphTargets: 0
  *
  */
 
 var model = {
 
     "version" : 2,
-    
+
     "scale" : 1.000000,
-    
+
     "materials": [	{
 	"DbgColor" : 15658734,
 	"DbgIndex" : 0,
@@ -25,12 +25,13 @@ var model = {
 	"colorAmbient" : [0.0, 0.0, 0.0],
 	"colorDiffuse" : [0.800000011920929, 0.800000011920929, 0.800000011920929],
 	"colorSpecular" : [0.5, 0.5, 0.5],
+	"shading" : "Lambert",
 	"specularCoef" : 50,
 	"transparency" : 1.0,
 	"vertexColors" : true
 	}],
 
-    "vertices": [1.000000,-1.000000,-1.000000,1.000000,-1.000000,1.000000,-1.000000,-1.000000,1.000000,-1.000000,-1.000000,-1.000000,1.000000,1.000000,-1.000000,0.999999,1.000000,1.000001,-1.000000,1.000000,1.000000,-1.000000,1.000000,-1.000000],
+    "vertices": [1.000000,-1.000000,-1.000000,1.000000,-1.000000,1.000000,-1.000000,-1.000000,1.000000,-1.000000,-1.000000,-1.000000,1.000000,1.000000,-1.000000,0.999999,1.000000,1.000000,-1.000000,1.000000,0.999999,-1.000000,1.000000,-1.000000],
 
     "morphTargets": [],
 
@@ -40,9 +41,9 @@ var model = {
 
     "uvs": [[]],
 
-    "faces": [131,0,1,2,3,0,0,1,2,3,131,4,7,6,5,0,4,5,6,7,131,0,4,5,1,0,0,8,9,10,131,1,5,6,2,0,0,11,12,13,131,2,6,7,3,0,14,15,16,17,131,4,0,3,7,0,18,19,20,21],
+    "faces": [131,0,1,2,3,0,0,1,2,3,131,4,7,6,5,0,4,5,6,7,131,0,4,5,1,0,0,8,9,10,131,1,5,6,2,0,0,11,12,13,131,2,6,7,3,0,14,15,16,17,131,4,0,3,7,0,18,19,20,21]
+
 
-    "edges" : []
 
 };
 

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 5 - 4
examples/obj/cubecolors/cubecolors.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 13 - 14
examples/obj/female02/Female02_slim.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 1 - 2
examples/obj/lucy/Lucy100k_slim.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 11 - 12
examples/obj/male02/Male02_slim.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 2 - 3
examples/obj/walt/WaltHead_slim.js


+ 0 - 21
src/extras/loaders/JSONLoader.js

@@ -54,14 +54,12 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 
 	parseSkin();
 	parseMorphing( scale );
-	parseEdges();
 
 	geometry.computeCentroids();
 	geometry.computeFaceNormals();
 
 	if ( this.hasNormals( geometry ) ) geometry.computeTangents();
 
-	// geometry.computeEdgeFaces();
 
 	function parseModel( scale ) {
 
@@ -384,25 +382,6 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 
 	};
 
-	function parseEdges() {
-
-		if( json.edges !== undefined ) {
-
-			var i, il, v1, v2;
-
-			for ( i = 0; i < json.edges.length; i+= 2 ) {
-
-				v1 = json.edges[ i ];
-				v2 = json.edges[ i + 1 ];
-
-				geometry.edges.push( new THREE.Edge( geometry.vertices[ v1 ], geometry.vertices[ v2 ], v1, v2 ) );
-
-			}
-
-		}
-
-	};
-
 	callback( geometry );
 
 };

+ 0 - 7
utils/exporters/blender/2.59/scripts/addons/io_mesh_threejs/__init__.py

@@ -193,7 +193,6 @@ def save_settings_export(properties):
     "option_normals"         : properties.option_normals,
     "option_colors"          : properties.option_colors,
     "option_uv_coords"       : properties.option_uv_coords,
-    "option_edges"           : properties.option_edges,
     "option_faces"           : properties.option_faces,
     "option_vertices"        : properties.option_vertices,
 
@@ -220,7 +219,6 @@ def restore_settings_export(properties):
     properties.option_vertices_truncate = settings.get("option_vertices_truncate", False)
     properties.option_faces = settings.get("option_faces", True)
     properties.option_normals = settings.get("option_normals", True)
-    properties.option_edges = settings.get("option_edges", False)
 
     properties.option_colors = settings.get("option_colors", True)
     properties.option_uv_coords = settings.get("option_uv_coords", True)
@@ -263,7 +261,6 @@ class ExportTHREEJS(bpy.types.Operator, ExportHelper):
     option_faces_deltas = BoolProperty(name = "Deltas", description = "Delta faces", default = False)
 
     option_normals = BoolProperty(name = "Normals", description = "Export normals", default = True)
-    option_edges = BoolProperty(name = "Edges", description = "Export edges", default = False)
 
     option_colors = BoolProperty(name = "Colors", description = "Export vertex colors", default = True)
     option_uv_coords = BoolProperty(name = "UVs", description = "Export texture coordinates", default = True)
@@ -333,10 +330,6 @@ class ExportTHREEJS(bpy.types.Operator, ExportHelper):
         row.prop(self.properties, "option_normals")
         layout.separator()
 
-        row = layout.row()
-        row.prop(self.properties, "option_edges")
-        layout.separator()
-
         row = layout.row()
         row.label(text="Materials:")
 

+ 2 - 35
utils/exporters/blender/2.59/scripts/addons/io_mesh_threejs/export_threejs.py

@@ -222,7 +222,7 @@ TEMPLATE_HEX = "0x%06x"
 
 TEMPLATE_FILE_ASCII = """\
 /*
- * File generated with Blender 2.58 Exporter
+ * File generated with Blender 2.59 Exporter
  * https://github.com/mrdoob/three.js/tree/master/utils/exporters/blender/
  *
  * vertices: %(nvertex)d
@@ -231,7 +231,6 @@ TEMPLATE_FILE_ASCII = """\
  * uvs: %(nuv)d
  * colors: %(ncolor)d
  * materials: %(nmaterial)d
- * edges: %(nedges)d
  * morphTargets: %(nmorphTarget)d
  *
  */
@@ -263,9 +262,8 @@ TEMPLATE_MODEL_ASCII = """\
 
     "uvs": [[%(uvs)s]],
 
-    "faces": [%(faces)s],
+    "faces": [%(faces)s]
 
-    "edges" : [%(edges)s]
 """
 
 TEMPLATE_VERTEX = "%f,%f,%f"
@@ -274,7 +272,6 @@ TEMPLATE_VERTEX_TRUNCATE = "%d,%d,%d"
 TEMPLATE_N = "%f,%f,%f"
 TEMPLATE_UV = "%f,%f"
 TEMPLATE_C = "%d"
-TEMPLATE_EDGE = "%d,%d"
 
 # #####################################################
 # Utils
@@ -454,9 +451,6 @@ def generate_vertex_color(c):
 def generate_uv(uv):
     return TEMPLATE_UV % (uv[0], 1.0 - uv[1])
 
-def generate_edge(e, offset):
-    return TEMPLATE_EDGE % (e.vertices[0] + offset, e.vertices[1] + offset)
-
 # #####################################################
 # Model exporter - faces
 # #####################################################
@@ -868,7 +862,6 @@ def generate_ascii_model(meshes, morphs,
                          option_vertices_truncate,
                          option_faces,
                          option_normals,
-                         option_edges,
                          option_uv_coords,
                          option_materials,
                          option_colors,
@@ -885,8 +878,6 @@ def generate_ascii_model(meshes, morphs,
     vertex_offset = 0
     vertex_offsets = []
 
-    edges = []
-
     nnormal = 0
     normals = {}
 
@@ -923,8 +914,6 @@ def generate_ascii_model(meshes, morphs,
 
         vertices.extend(mesh.vertices[:])
 
-        edges.append(mesh.edges[:])
-
         if option_normals:
             nnormal = extract_vertex_normals(mesh, normals, nnormal)
 
@@ -951,17 +940,6 @@ def generate_ascii_model(meshes, morphs,
         morphTargets_string = ",\n\t".join(chunks)
         nmorphTarget = len(morphs)
 
-    edges_string = ""
-    nedges = 0
-
-    if option_edges:
-        chunks = []
-        for edges_mesh, offset in zip(edges, vertex_offsets):
-            for edge in edges_mesh:
-                chunks.append(generate_edge(edge, offset))
-        nedges = len(chunks)
-        edges_string  = ",".join(chunks)
-
     if align_model == 1:
         center(vertices)
     elif align_model == 2:
@@ -986,8 +964,6 @@ def generate_ascii_model(meshes, morphs,
 
     "faces"    : faces_string,
 
-    "edges"    : edges_string,
-
     "morphTargets" : morphTargets_string
     }
 
@@ -998,7 +974,6 @@ def generate_ascii_model(meshes, morphs,
     "nnormal"   : nnormal,
     "ncolor"    : ncolor,
     "nmaterial" : nmaterial,
-    "nedges"    : nedges,
     "nmorphTarget": nmorphTarget,
 
     "model"     : model_string
@@ -1045,7 +1020,6 @@ def generate_mesh_string(objects, scene,
                 option_vertices_truncate,
                 option_faces,
                 option_normals,
-                option_edges,
                 option_uv_coords,
                 option_materials,
                 option_colors,
@@ -1095,7 +1069,6 @@ def generate_mesh_string(objects, scene,
                                 option_vertices_truncate,
                                 option_faces,
                                 option_normals,
-                                option_edges,
                                 option_uv_coords,
                                 option_materials,
                                 option_colors,
@@ -1120,7 +1093,6 @@ def export_mesh(objects,
                 option_vertices_truncate,
                 option_faces,
                 option_normals,
-                option_edges,
                 option_uv_coords,
                 option_materials,
                 option_colors,
@@ -1140,7 +1112,6 @@ def export_mesh(objects,
                 option_vertices_truncate,
                 option_faces,
                 option_normals,
-                option_edges,
                 option_uv_coords,
                 option_materials,
                 option_colors,
@@ -1807,7 +1778,6 @@ def save(operator, context, filepath = "",
          option_vertices_truncate = False,
          option_faces = True,
          option_normals = True,
-         option_edges = False,
          option_uv_coords = True,
          option_materials = True,
          option_colors = True,
@@ -1865,7 +1835,6 @@ def save(operator, context, filepath = "",
                                                         option_vertices_truncate,
                                                         option_faces,
                                                         option_normals,
-                                                        option_edges,
                                                         option_uv_coords,
                                                         option_materials,
                                                         option_colors,
@@ -1889,7 +1858,6 @@ def save(operator, context, filepath = "",
                                     option_vertices_truncate,
                                     option_faces,
                                     option_normals,
-                                    option_edges,
                                     option_uv_coords,
                                     option_materials,
                                     option_colors,
@@ -1920,7 +1888,6 @@ def save(operator, context, filepath = "",
                     option_vertices_truncate,
                     option_faces,
                     option_normals,
-                    option_edges,
                     option_uv_coords,
                     option_materials,
                     option_colors,

+ 2 - 97
utils/exporters/convert_obj_three.py

@@ -17,7 +17,6 @@ Notes:
         -t ascii|binary			export ascii or binary format (ascii has more features, binary just supports vertices, faces, normals, uvs and materials)
         -d invert|normal		invert transparency
         -b						bake material colors into face colors
-        -e						export edges
         -x 10.0                 scale and truncate
         -f 2                    morph frame sampling step
 
@@ -26,7 +25,6 @@ Notes:
         will be in ASCII format
         original model is assumed to use non-inverted transparency / dissolve (0.0 fully transparent, 1.0 fully opaque)
         no face colors baking
-        no edges export
         no scale and truncate
         morph frame step = 1 (all files will be processed)
 
@@ -106,7 +104,6 @@ How to get proper OBJ + MTL files with Blender
             UVs
             Normals
             Materials
-            Edges
 
         - select empty folder
         - give your exported file name with "obj" extension
@@ -154,7 +151,6 @@ SCALE = 1.0
 FRAMESTEP = 1
 
 BAKE_COLORS = False
-EXPORT_EDGES = False
 
 # default colors for debugging (each material gets one distinct color):
 # white, red, green, blue, yellow, cyan, magenta
@@ -171,7 +167,6 @@ TEMPLATE_FILE_ASCII = u"""\
 //  colors: %(ncolor)d
 //  uvs: %(nuv)d
 //  materials: %(nmaterial)d
-//  edges: %(nedge)d
 //
 //  Generated with OBJ -> Three.js converter
 //  http://github.com/alteredq/three.js/blob/master/utils/exporters/convert_obj_three.py
@@ -197,9 +192,7 @@ var model = {
 
     "uvs": [[%(uvs)s]],
 
-    "faces": [%(faces)s],
-
-    "edges" : [%(edges)s]
+    "faces": [%(faces)s]
 
 };
 
@@ -238,7 +231,6 @@ TEMPLATE_N = "%.5g,%.5g,%.5g"
 TEMPLATE_UV = "%.5g,%.5g"
 TEMPLATE_COLOR = "%.3g,%.3g,%.3g"
 TEMPLATE_COLOR_DEC = "%d"
-TEMPLATE_EDGE = "%d,%d"
 
 TEMPLATE_MORPH_VERTICES = '\t{ "name": "%s", "vertices": [%s] }'
 TEMPLATE_MORPH_COLORS   = '\t{ "name": "%s", "colors": [%s] }'
@@ -707,9 +699,6 @@ def generate_color_rgb(c):
 def generate_color_decimal(c):
     return TEMPLATE_COLOR_DEC % hexcolor(c)
 
-def generate_edge(e):
-    return TEMPLATE_EDGE % (e[0], e[1])
-
 # #####################################################
 # Morphs
 # #####################################################
@@ -849,74 +838,6 @@ def generate_morph_colors(colorfiles, n_vertices, n_faces):
 
     return morphColors, colorFaces, materialColors
 
-# #####################################################
-# Edges
-# #####################################################
-def edge_hash(a, b):
-    return "%d_%d" % (min(a, b), max(a, b))
-
-def add_unique_edge(a, b, edge_set, edges):
-    h = edge_hash(a[0], b[0])
-    if h not in edge_set:
-        x = min(a[1], b[1])
-        y = max(a[1], b[1])
-        edges.append([x, y])
-        edge_set.add(h)
-
-def compute_edges(faces, vertices):
-    edges = []
-
-    # compute unique vertices
-
-    unique_vertices = {}
-    vertex_count = 0
-
-    for i, v in enumerate(vertices):
-        key = veckey3(v)
-        if key not in unique_vertices:
-            unique_vertices[key] = [vertex_count, i]
-            vertex_count += 1
-
-    # find edges between unique vertices
-
-    edge_set = set()
-
-    for f in faces:
-        vertex_indices = f["vertex"]
-        unique_indices = []
-
-        for vi in vertex_indices:
-            v = vertices[vi - 1]
-            key = veckey3(v)
-            unique_indices.append(unique_vertices[key])
-
-        if len(unique_indices) == 3:
-            a = unique_indices[0]
-            b = unique_indices[1]
-            c = unique_indices[2]
-
-            add_unique_edge(a, b, edge_set, edges)
-            add_unique_edge(b, c, edge_set, edges)
-            add_unique_edge(a, c, edge_set, edges)
-
-        elif len(unique_indices) == 4:
-            a = unique_indices[0]
-            b = unique_indices[1]
-            c = unique_indices[2]
-            d = unique_indices[3]
-
-            # this should be inside edge of quad, should it go in?
-            # add_unique_edge(b, d, edge_set, edges)
-
-            add_unique_edge(a, b, edge_set, edges)
-            add_unique_edge(a, d, edge_set, edges)
-            add_unique_edge(b, c, edge_set, edges)
-            add_unique_edge(c, d, edge_set, edges)
-
-    edges.sort()
-
-    return edges
-
 # #####################################################
 # Materials
 # #####################################################
@@ -1151,16 +1072,6 @@ def convert_ascii(infile, morphfiles, colorfiles, outfile):
         colors_string = ",".join(generate_color_decimal(c) for c in materialColors)
         ncolor = len(materialColors)
 
-    # generate edges string
-
-    nedge = 0
-    edges_string = ""
-
-    if EXPORT_EDGES:
-        edges = compute_edges(faces, vertices)
-        nedge = len(edges)
-        edges_string  = ",".join(generate_edge(e) for e in edges)
-
     # generate ascii model string
 
     text = TEMPLATE_FILE_ASCII % {
@@ -1172,7 +1083,6 @@ def convert_ascii(infile, morphfiles, colorfiles, outfile):
     "nnormal"   : nnormal,
     "ncolor"    : ncolor,
     "nmaterial" : len(materials),
-    "nedge"     : nedge,
 
     "materials" : generate_materials_string(materials, mtllib, infile),
 
@@ -1186,8 +1096,6 @@ def convert_ascii(infile, morphfiles, colorfiles, outfile):
 
     "faces"     : ",".join(generate_face(f, fc) for f, fc in zip(faces, colorFaces)),
 
-    "edges"    : edges_string,
-
     "scale"    : SCALE
     }
 
@@ -1523,7 +1431,7 @@ if __name__ == "__main__":
 
     # get parameters from the command line
     try:
-        opts, args = getopt.getopt(sys.argv[1:], "hbei:m:c:b:o:a:s:t:d:x:f:", ["help", "bakecolors", "edges", "input=", "morphs=", "colors=", "output=", "align=", "shading=", "type=", "dissolve=", "truncatescale=", "framestep="])
+        opts, args = getopt.getopt(sys.argv[1:], "hbi:m:c:b:o:a:s:t:d:x:f:", ["help", "bakecolors", "input=", "morphs=", "colors=", "output=", "align=", "shading=", "type=", "dissolve=", "truncatescale=", "framestep="])
 
     except getopt.GetoptError:
         usage()
@@ -1569,9 +1477,6 @@ if __name__ == "__main__":
         elif o in ("-b", "--bakecolors"):
             BAKE_COLORS = True
 
-        elif o in ("-e", "--edges"):
-            EXPORT_EDGES = True
-
         elif o in ("-x", "--truncatescale"):
             TRUNCATE = True
             SCALE = float(a)

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно