Remove non-bmesh case from test
This commit is contained in:
@@ -31,7 +31,6 @@
|
|||||||
import math
|
import math
|
||||||
|
|
||||||
USE_QUICK_RENDER = False
|
USE_QUICK_RENDER = False
|
||||||
IS_BMESH = hasattr(__import__("bpy").types, "LoopColors")
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# utility functions
|
# utility functions
|
||||||
@@ -203,13 +202,8 @@ def defaults_object(obj):
|
|||||||
|
|
||||||
mesh.show_normal_vertex = True
|
mesh.show_normal_vertex = True
|
||||||
|
|
||||||
# lame!
|
|
||||||
if IS_BMESH:
|
|
||||||
for poly in mesh.polygons:
|
for poly in mesh.polygons:
|
||||||
poly.use_smooth = True
|
poly.use_smooth = True
|
||||||
else:
|
|
||||||
for face in mesh.faces:
|
|
||||||
face.use_smooth = True
|
|
||||||
|
|
||||||
|
|
||||||
def defaults_modifier(mod):
|
def defaults_modifier(mod):
|
||||||
@@ -220,14 +214,12 @@ def defaults_modifier(mod):
|
|||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# models (utils)
|
# models (utils)
|
||||||
|
|
||||||
|
def mesh_bmesh_poly_elems(poly, elems):
|
||||||
if IS_BMESH:
|
|
||||||
def mesh_bmesh_poly_elems(poly, elems):
|
|
||||||
vert_start = poly.loop_start
|
vert_start = poly.loop_start
|
||||||
vert_total = poly.loop_total
|
vert_total = poly.loop_total
|
||||||
return elems[vert_start:vert_start + vert_total]
|
return elems[vert_start:vert_start + vert_total]
|
||||||
|
|
||||||
def mesh_bmesh_poly_vertices(poly):
|
def mesh_bmesh_poly_vertices(poly):
|
||||||
return [loop.vertex_index
|
return [loop.vertex_index
|
||||||
for loop in mesh_bmesh_poly_elems(poly, poly.id_data.loops)]
|
for loop in mesh_bmesh_poly_elems(poly, poly.id_data.loops)]
|
||||||
|
|
||||||
@@ -258,7 +250,6 @@ def mesh_uv_add(obj):
|
|||||||
|
|
||||||
uv_lay = obj.data.uv_textures.new()
|
uv_lay = obj.data.uv_textures.new()
|
||||||
|
|
||||||
if IS_BMESH:
|
|
||||||
# XXX, odd that we need to do this. until UV's and texface
|
# XXX, odd that we need to do this. until UV's and texface
|
||||||
# are separated we will need to keep it
|
# are separated we will need to keep it
|
||||||
uv_loops = obj.data.uv_layers[-1]
|
uv_loops = obj.data.uv_layers[-1]
|
||||||
@@ -267,12 +258,6 @@ def mesh_uv_add(obj):
|
|||||||
poly_uvs = mesh_bmesh_poly_elems(poly, uv_list)
|
poly_uvs = mesh_bmesh_poly_elems(poly, uv_list)
|
||||||
for i, c in enumerate(poly_uvs):
|
for i, c in enumerate(poly_uvs):
|
||||||
c.uv = uvs[i % 4]
|
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]
|
|
||||||
|
|
||||||
return uv_lay
|
return uv_lay
|
||||||
|
|
||||||
@@ -296,21 +281,12 @@ def mesh_vcol_add(obj, mode=0):
|
|||||||
|
|
||||||
mesh = obj.data
|
mesh = obj.data
|
||||||
|
|
||||||
if IS_BMESH:
|
|
||||||
col_list = vcol_lay.data[:]
|
col_list = vcol_lay.data[:]
|
||||||
for poly in mesh.polygons:
|
for poly in mesh.polygons:
|
||||||
face_verts = mesh_bmesh_poly_vertices(poly)
|
face_verts = mesh_bmesh_poly_vertices(poly)
|
||||||
poly_cols = mesh_bmesh_poly_elems(poly, col_list)
|
poly_cols = mesh_bmesh_poly_elems(poly, col_list)
|
||||||
for i, c in enumerate(poly_cols):
|
for i, c in enumerate(poly_cols):
|
||||||
c.color = colors_get(face_verts[i])
|
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])
|
|
||||||
|
|
||||||
return vcol_lay
|
return vcol_lay
|
||||||
|
|
||||||
@@ -470,10 +446,7 @@ def modifier_build_add(scene, obj):
|
|||||||
defaults_modifier(mod)
|
defaults_modifier(mod)
|
||||||
|
|
||||||
# ensure we display some faces
|
# ensure we display some faces
|
||||||
if IS_BMESH:
|
|
||||||
totface = len(obj.data.polygons)
|
totface = len(obj.data.polygons)
|
||||||
else:
|
|
||||||
totface = len(obj.data.faces)
|
|
||||||
|
|
||||||
mod.frame_start = totface // 2
|
mod.frame_start = totface // 2
|
||||||
mod.frame_duration = totface
|
mod.frame_duration = totface
|
||||||
|
Reference in New Issue
Block a user