Remove non-bmesh case from test

This commit is contained in:
Campbell Barton 2017-03-29 20:10:46 +11:00
parent dd662c74ae
commit c2d3bb7090
1 changed files with 24 additions and 51 deletions

View File

@ -31,7 +31,6 @@
import math
USE_QUICK_RENDER = False
IS_BMESH = hasattr(__import__("bpy").types, "LoopColors")
# -----------------------------------------------------------------------------
# utility functions
@ -203,13 +202,8 @@ def defaults_object(obj):
mesh.show_normal_vertex = True
# lame!
if IS_BMESH:
for poly in mesh.polygons:
poly.use_smooth = True
else:
for face in mesh.faces:
face.use_smooth = True
for poly in mesh.polygons:
poly.use_smooth = True
def defaults_modifier(mod):
@ -220,16 +214,14 @@ def defaults_modifier(mod):
# -----------------------------------------------------------------------------
# models (utils)
def mesh_bmesh_poly_elems(poly, elems):
vert_start = poly.loop_start
vert_total = poly.loop_total
return elems[vert_start:vert_start + vert_total]
if IS_BMESH:
def mesh_bmesh_poly_elems(poly, elems):
vert_start = poly.loop_start
vert_total = poly.loop_total
return elems[vert_start:vert_start + vert_total]
def mesh_bmesh_poly_vertices(poly):
return [loop.vertex_index
for loop in mesh_bmesh_poly_elems(poly, poly.id_data.loops)]
def mesh_bmesh_poly_vertices(poly):
return [loop.vertex_index
for loop in mesh_bmesh_poly_elems(poly, poly.id_data.loops)]
def mesh_bounds(mesh):
@ -258,21 +250,14 @@ def mesh_uv_add(obj):
uv_lay = obj.data.uv_textures.new()
if IS_BMESH:
# XXX, odd that we need to do this. until UV's and texface
# are separated we will need to keep it
uv_loops = obj.data.uv_layers[-1]
uv_list = uv_loops.data[:]
for poly in obj.data.polygons:
poly_uvs = mesh_bmesh_poly_elems(poly, uv_list)
for i, c in enumerate(poly_uvs):
c.uv = uvs[i % 4]
else:
for uv in uv_lay.data:
uv.uv1 = uvs[0]
uv.uv2 = uvs[1]
uv.uv3 = uvs[2]
uv.uv4 = uvs[3]
# XXX, odd that we need to do this. until UV's and texface
# are separated we will need to keep it
uv_loops = obj.data.uv_layers[-1]
uv_list = uv_loops.data[:]
for poly in obj.data.polygons:
poly_uvs = mesh_bmesh_poly_elems(poly, uv_list)
for i, c in enumerate(poly_uvs):
c.uv = uvs[i % 4]
return uv_lay
@ -296,21 +281,12 @@ def mesh_vcol_add(obj, mode=0):
mesh = obj.data
if IS_BMESH:
col_list = vcol_lay.data[:]
for poly in mesh.polygons:
face_verts = mesh_bmesh_poly_vertices(poly)
poly_cols = mesh_bmesh_poly_elems(poly, col_list)
for i, c in enumerate(poly_cols):
c.color = colors_get(face_verts[i])
else:
for i, col in enumerate(vcol_lay.data):
face_verts = mesh.faces[i].vertices
col.color1 = colors_get(face_verts[0])
col.color2 = colors_get(face_verts[1])
col.color3 = colors_get(face_verts[2])
if len(face_verts) == 4:
col.color4 = colors_get(face_verts[3])
col_list = vcol_lay.data[:]
for poly in mesh.polygons:
face_verts = mesh_bmesh_poly_vertices(poly)
poly_cols = mesh_bmesh_poly_elems(poly, col_list)
for i, c in enumerate(poly_cols):
c.color = colors_get(face_verts[i])
return vcol_lay
@ -470,10 +446,7 @@ def modifier_build_add(scene, obj):
defaults_modifier(mod)
# ensure we display some faces
if IS_BMESH:
totface = len(obj.data.polygons)
else:
totface = len(obj.data.faces)
totface = len(obj.data.polygons)
mod.frame_start = totface // 2
mod.frame_duration = totface