OSDN Git Service

fix bone connection.
[meshio/meshio.git] / swig / blender / pmd_export.py
index d473d7a..8e9b4bd 100644 (file)
@@ -87,6 +87,10 @@ if isBlender24():
         # flag
         material.flag=1 if m.enableSSS else 0
 
+    def toCP932(s):
+        return s
+
+
 else:
     # for 2.5
     import bpy
@@ -116,6 +120,10 @@ else:
         # flag
         material.flag=1 if m.subsurface_scattering.enabled else 0
 
+    def toCP932(s):
+        return s.encode('cp932')
+
+
 class Node(object):
     __slots__=['o', 'children']
     def __init__(self, o):
@@ -847,8 +855,10 @@ class PmdExporter(object):
 
             material.vertex_count=len(indices)
             material.toon_index=0
-            # ToDo
-            material.texture=""
+            textures=[os.path.basename(path) 
+                for path in bl.material.eachTexturePath(m)]
+            if len(textures)>0:
+                material.setTexture(toCP932('*'.join(textures)))
             # 面
             for i in indices:
                 assert(i<vertexCount)