OSDN Git Service

fix mqo_import smoothing, mirroring.
[meshio/meshio.git] / swig / blender / bl25.py
index 9c5a573..ca79e58 100644 (file)
@@ -91,8 +91,6 @@ def createMqoMaterial(m):
     material.diffuse_color=[m.color.r, m.color.g, m.color.b]
     material.alpha=m.color.a
     material.diffuse_intensity=m.diffuse
-    # temporary
-    material.emit=1.0
     return material
 
 def createPmdMaterial(m):
@@ -105,8 +103,6 @@ def createPmdMaterial(m):
     material.specular_color=([m.specular.r, m.specular.g, m.specular.b])
     material.mirror_color=([m.ambient.r, m.ambient.g, m.ambient.b])
     material.subsurface_scattering.enabled=True if m.flag==1 else False
-    # temporary
-    material.emit=1.0
     return material
 
 def createTexture(path):
@@ -140,6 +136,8 @@ def createMesh(scene, name):
 def objectMakeParent(parent, child):
     child.parent=parent
 
+def objectAddMirrorModifier(mesh_object):
+    return mesh_object.modifiers.new("Modifier", "MIRROR")
 
 def meshAddMqoGeometry(mesh_object, o, materials, imageMap, scale):
     mesh=mesh_object.data
@@ -516,3 +514,8 @@ def shapeKeys(b):
 def VtoV(v):
     return mathutils.Vector([v.x, v.y, v.z])
 
+def meshSetSmooth(mesh, smoothing):
+    mesh.autosmooth_angle=int(smoothing)
+    mesh.autosmooth=True
+    mesh.calc_normals()
+