else:
INTERNAL_ENCODING=FS_ENCODING
+def register():
+ pass
+
+def unregister():
+ pass
+
SCENE=None
def initialize(name, scene):
global SCENE
progress_finish()
def message(msg):
- pass
+ print(msg)
def enterEditMode():
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
return empty
@staticmethod
+ def each():
+ for o in SCENE.objects:
+ yield o
+
+ @staticmethod
def makeParent(parent, child):
child.parent=parent
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
@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
@staticmethod
def isVisible(o):
- return o.restrict_view
+ return False if o.hide else True
@staticmethod
def getShapeKeys(o):
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
+ def getPath(t):
+ if t.type=="IMAGE":
+ image=t.image
+ if image:
+ return image.filepath
+
class material:
@staticmethod
return index
@staticmethod
- def getTexture(material, index):
- return material.texture_slots[index].texture
+ def getTexture(m, index):
+ return m.texture_slots[index].texture
@staticmethod
- def hasTexture(material):
- return material.texture_slots[0]
+ def hasTexture(m):
+ return m.texture_slots[0]
@staticmethod
- def setUseTexture(material, index, enable):
- material.use_textures[index]=enable
+ def setUseTexture(m, index, enable):
+ m.use_textures[index]=enable
@staticmethod
def eachTexturePath(m):
image=texture.image
if not image:
continue
- yield image.filename
+ yield image.filepath
+
+ @staticmethod
+ def eachEnalbeTexturePath(m):
+ for i, slot in enumerate(m.texture_slots):
+ if m.use_textures[i] and slot and slot.texture:
+ texture=slot.texture
+ if texture.type=="IMAGE":
+ image=texture.image
+ if not image:
+ continue
+ yield image.filepath
+
class mesh:
@staticmethod
return ((0, 0), (0, 0), (0, 0), (0, 0))
@staticmethod
- def setFaceUV(mesh, i, face, uv_array, image):
- uv_face=mesh.uv_textures[0].data[i]
+ def setFaceUV(m, i, face, uv_array, image):
+ uv_face=m.uv_textures[0].data[i]
uv_face.uv=uv_array
if image:
uv_face.image=image
uv_face.tex=True
@staticmethod
- def vertsDelete(mesh, remove_vertices):
+ def vertsDelete(m, remove_vertices):
enterEditMode()
bpy.ops.mesh.select_all(action='DESELECT')
enterObjectMode()
for i in remove_vertices:
- mesh.verts[i].selected=True
+ m.verts[i].select=True
enterEditMode()
bpy.ops.mesh.delete(type='VERT')
enterObjectMode()
@staticmethod
- def setSmooth(mesh, smoothing):
- mesh.autosmooth_angle=int(smoothing)
- mesh.autosmooth=True
+ def setSmooth(m, smoothing):
+ m.autosmooth_angle=int(smoothing)
+ m.autosmooth=True
@staticmethod
def recalcNormals(mesh_object):
enterObjectMode()
@staticmethod
- def flipNormals(mesh):
- mesh.flipNormals()
+ def flipNormals(m):
+ m.flipNormals()
+
+ @staticmethod
+ def addMaterial(m, material):
+ m.add_material(material)
@staticmethod
- def addMaterial(mesh, material):
- mesh.add_material(material)
+ def getMaterial(m, index):
+ return m.materials[index]
class vertex:
@staticmethod
- def setNormal(mvert, normal):
- mvert.normal=mathutils.Vector(normal)
+ def setNormal(v, normal):
+ v.normal=mathutils.Vector(normal)
@staticmethod
- def setUv(mvert, uv):
+ def getNormal(v):
+ return v.normal
+
+ @staticmethod
+ def setUv(v, uv):
+ # sticky ?
pass
def isIKSolver(c):
return c.type=='IK'
-