OSDN Git Service

add pymeshio.
[meshio/meshio.git] / swig / blender / bl25.py
index d0138b3..e002437 100755 (executable)
@@ -18,6 +18,12 @@ if os.path.exists(os.path.dirname(sys.argv[0])+"/utf8"):
 else:
     INTERNAL_ENCODING=FS_ENCODING
 
+def register():
+    pass
+
+def unregister():
+    pass
+
 SCENE=None
 def initialize(name, scene):
     global SCENE
@@ -29,7 +35,7 @@ def finalize():
     progress_finish()
 
 def message(msg):
-    pass
+    print(msg)
 
 def enterEditMode():
     bpy.ops.object.mode_set(mode='EDIT', toggle=False)
@@ -122,6 +128,11 @@ class object:
         return empty
 
     @staticmethod
+    def each():
+        for o in SCENE.objects:
+            yield o
+
+    @staticmethod
     def makeParent(parent, child):
         child.parent=parent
 
@@ -129,7 +140,7 @@ class object:
     def duplicate(o):
         global SCENE
         bpy.ops.object.select_all(action='DESELECT')
-        o.selected=True
+        o.select=True
         SCENE.objects.active=o
         bpy.ops.object.duplicate()
         dumy=SCENE.objects.active
@@ -149,12 +160,12 @@ class object:
 
     @staticmethod
     def select(o):
-        o.selected=True
+        o.select=True
 
     @staticmethod
     def activate(o):
         global SCENE
-        o.selected=True 
+        o.select=True 
         SCENE.objects.active=o
 
     @staticmethod
@@ -178,7 +189,7 @@ class object:
 
     @staticmethod
     def isVisible(o):
-        return o.restrict_view
+        return False if o.hide else True
 
     @staticmethod
     def getShapeKeys(o):
@@ -291,11 +302,14 @@ class texture:
         texture=bpy.data.textures.new(os.path.basename(path))
         texture.type='IMAGE'
         texture=texture.recast_type()
-        image=bpy.data.images.load(path)
-        texture.image=image
         texture.mipmap=True
         texture.interpolation=True
         texture.use_alpha=True
+        try:
+            image=bpy.data.images.load(path)
+        except SystemError:
+            image=bpy.data.images.new('Image')
+        texture.image=image
         return texture, image
 
     @staticmethod
@@ -303,7 +317,7 @@ class texture:
         if  t.type=="IMAGE":
             image=t.image
             if image:
-                return image.filename
+                return image.filepath
 
 
 class material:
@@ -357,7 +371,7 @@ class material:
                     image=texture.image
                     if not image:
                         continue
-                    yield image.filename
+                    yield image.filepath
 
     @staticmethod
     def eachEnalbeTexturePath(m):
@@ -368,7 +382,7 @@ class material:
                     image=texture.image
                     if not image:
                         continue
-                    yield image.filename
+                    yield image.filepath
 
 
 class mesh:
@@ -454,7 +468,7 @@ class mesh:
         enterObjectMode()
 
         for i in remove_vertices:
-            m.verts[i].selected=True
+            m.verts[i].select=True
 
         enterEditMode()
         bpy.ops.mesh.delete(type='VERT')
@@ -636,4 +650,3 @@ class constraint:
     def isIKSolver(c):
         return c.type=='IK'
 
-