From: ousttrue Date: Mon, 4 Oct 2010 16:44:57 +0000 (+0900) Subject: fix for Blender2.54. X-Git-Url: http://git.osdn.jp/view?a=commitdiff_plain;h=0b73759763d57e7f8bde75b301502f5bc9ae6f22;p=meshio%2Fmeshio.git fix for Blender2.54. --- diff --git a/swig/blender/bl25.py b/swig/blender/bl25.py index e002437..0754796 100755 --- a/swig/blender/bl25.py +++ b/swig/blender/bl25.py @@ -299,11 +299,9 @@ class shapekey: 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) @@ -340,14 +338,11 @@ class material: 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 @@ -420,7 +415,7 @@ class mesh: 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 @@ -433,7 +428,7 @@ class mesh: @staticmethod def addUV(mesh): - mesh.add_uv_texture() + mesh.uv_textures.new() @staticmethod def hasFaceUV(mesh, i, face): @@ -459,7 +454,7 @@ class mesh: 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): @@ -476,8 +471,8 @@ class mesh: @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): @@ -493,7 +488,7 @@ class mesh: @staticmethod def addMaterial(m, material): - m.add_material(material) + m.materials.append(material) @staticmethod def getMaterial(m, index): @@ -551,7 +546,7 @@ class face: @staticmethod def setSmooth(face, isSmooth): - face.smooth=True if isSmooth else False + face.use_smooth=True if isSmooth else False class armature: diff --git a/swig/blender/mqo_import.py b/swig/blender/mqo_import.py index 6e4c487..2b1ecdd 100644 --- a/swig/blender/mqo_import.py +++ b/swig/blender/mqo_import.py @@ -140,6 +140,7 @@ def __createMaterials(mqo, directory): # relative path = os.path.join(directory, texture_name) # texture + path=path.replace("\\", "/") if os.path.exists(path): print("create texture:", path) texture, image=bl.texture.create(path)