class texture:
@staticmethod
def create(path):
- texture=bpy.data.textures.new(os.path.basename(path))
- texture.type='IMAGE'
- texture=texture.recast_type()
- texture.mipmap=True
- texture.interpolation=True
+ texture=bpy.data.textures.new(os.path.basename(path), 'IMAGE')
+ texture.use_mipmap=True
+ texture.use_interpolation=True
texture.use_alpha=True
try:
image=bpy.data.images.load(path)
if index==None:
return
- if enable:
- material.add_texture(texture, "UV", "COLOR")
- slot=material.texture_slots[index]
- slot.blend_type='MULTIPLY'
- slot.map_alpha=True
- else:
- material.add_texture(texture)
- material.use_textures[index]=False
+ #material.add_texture(texture, "UV", "COLOR")
+ slot=material.texture_slots.create(index)
+ slot.blend_type='MULTIPLY'
+ slot.use_map_alpha=True
+ slot.use=enable
return index
@staticmethod
unpackedFaces.extend(face)
mesh.faces.foreach_set("verts_raw", unpackedFaces)
"""
- assert(len(vertices)==len(mesh.verts))
+ assert(len(vertices)==len(mesh.vertices))
assert(len(faces)==len(mesh.faces))
@staticmethod
@staticmethod
def addUV(mesh):
- mesh.add_uv_texture()
+ mesh.uv_textures.new()
@staticmethod
def hasFaceUV(mesh, i, face):
uv_face.uv=uv_array
if image:
uv_face.image=image
- uv_face.tex=True
+ uv_face.use_image=True
@staticmethod
def vertsDelete(m, remove_vertices):
@staticmethod
def setSmooth(m, smoothing):
- m.autosmooth_angle=int(smoothing)
- m.autosmooth=True
+ m.auto_smooth_angle=int(smoothing)
+ m.use_auto_smooth=True
@staticmethod
def recalcNormals(mesh_object):
@staticmethod
def addMaterial(m, material):
- m.add_material(material)
+ m.materials.append(material)
@staticmethod
def getMaterial(m, index):
@staticmethod
def setSmooth(face, isSmooth):
- face.smooth=True if isSmooth else False
+ face.use_smooth=True if isSmooth else False
class armature: