OSDN Git Service

fix for Blender2.54.
authorousttrue <ousttrue@gmail.com>
Mon, 4 Oct 2010 16:44:57 +0000 (01:44 +0900)
committerousttrue <ousttrue@gmail.com>
Mon, 4 Oct 2010 16:44:57 +0000 (01:44 +0900)
swig/blender/bl25.py
swig/blender/mqo_import.py

index e002437..0754796 100755 (executable)
@@ -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:
index 6e4c487..2b1ecdd 100644 (file)
@@ -140,6 +140,7 @@ def __createMaterials(mqo, directory):
                         # relative\r
                         path = os.path.join(directory, texture_name)\r
                     # texture\r
+                    path=path.replace("\\", "/")\r
                     if os.path.exists(path):\r
                         print("create texture:", path)\r
                         texture, image=bl.texture.create(path)\r