Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

fix blender exporter to work with 2.63 #1845

Merged
merged 1 commit into from

2 participants

@ghost

mesh.faces was renamed to mesh.tessfaces.

@mrdoob mrdoob merged commit 525dd71 into mrdoob:master
@mrdoob
Owner

Thanks! :)

I guess import_threejs.py also needs to be updated?

@ghost

probably... i'll poke at it.

@alteredq alteredq referenced this pull request
Closed

Blender 2.63 exporter #1866

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 1, 2012
  1. @timb
This page is out of date. Refresh to see the latest.
View
16 utils/exporters/blender/2.62/scripts/addons/io_mesh_threejs/export_threejs.py
@@ -192,7 +192,7 @@
TEMPLATE_LIGHT_DIRECTIONAL = """\
%(light_id)s: {
- "type" : "directional",
+ "type" : "directional",
"direction" : %(direction)s,
"color" : %(color)d,
"intensity" : %(intensity).2f
@@ -276,6 +276,12 @@ def veckey3d(v):
def veckey2d(v):
return round(v[0], 6), round(v[1], 6)
+def get_faces(obj):
+ if hasattr(obj, "tessfaces"):
+ return obj.tessfaces
+ else:
+ return obj.faces
+
def get_normal_indices(v, normals, mesh):
n = []
mv = mesh.vertices
@@ -481,7 +487,7 @@ def generate_faces(normals, uvs, colors, meshes, option_normals, option_colors,
if not active_col_layer:
mesh_extract_colors = False
- for i, f in enumerate(mesh.faces):
+ for i, f in enumerate(get_faces(mesh)):
face = generate_face(f, i, normals, uvs, colors, mesh, option_normals, mesh_colors, mesh_uvs, option_materials, vertex_offset, material_offset)
chunks.append(face)
@@ -574,7 +580,7 @@ def generate_face(f, faceIndex, normals, uvs, colors, mesh, option_normals, opti
# #####################################################
def extract_vertex_normals(mesh, normals, count):
- for f in mesh.faces:
+ for f in get_faces(mesh):
for v in f.vertices:
normal = mesh.vertices[v].normal
@@ -603,7 +609,7 @@ def generate_normals(normals, option_normals):
def extract_vertex_colors(mesh, colors, count):
color_layer = mesh.vertex_colors.active.data
- for face_index, face in enumerate(mesh.faces):
+ for face_index, face in enumerate(get_faces(mesh)):
face_colors = color_layer[face_index]
face_colors = face_colors.color1, face_colors.color2, face_colors.color3, face_colors.color4
@@ -633,7 +639,7 @@ def generate_vertex_colors(colors, option_colors):
def extract_uvs(mesh, uvs, count):
uv_layer = mesh.uv_textures.active.data
- for face_index, face in enumerate(mesh.faces):
+ for face_index, face in enumerate(get_faces(mesh)):
for uv_index, uv in enumerate(uv_layer[face_index].uv):
Something went wrong with that request. Please try again.