import sys
import struct
import warnings
-import pymeshio.common
+from .. import common
class Vertex(object):
self.type=type
self.parent_index=0xFFFF
self.tail_index=0
- self.tail=pymeshio.common.Vector3(0, 0, 0)
+ self.tail=common.Vector3(0, 0, 0)
self.parent=None
self.ik_index=0xFFFF
- self.pos=pymeshio.common.Vector3(0, 0, 0)
+ self.pos=common.Vector3(0, 0, 0)
self.children=[]
self.english_name=''
def append(self, index, x, y, z):
self.indices.append(index)
- self.pos_list.append(Vector3(x, y, z))
+ self.pos_list.append(common.Vector3(x, y, z))
def __str__(self):
return '<Skin name: "%s", type: %d, vertex: %d>' % (
class BoneGroup(object):
- __slots__=['_name', '_english_name']
- def __init__(self, name='group'): self._name=name; self._english_name='center'
+ __slots__=['name', 'english_name']
+ def __init__(self, name=b'group', english_name=b'center'):
+ self.name=name
+ self.english_name=english_name
SHAPE_SPHERE=0
bone_index,
collision_group,
no_collision_group,
- shape_type,
- shape_size,
- shape_position,
- shape_rotation,
mass,
linear_damping,
angular_damping,
restitution,
friction,
- mode
+ mode,
+ shape_type=0,
+ shape_size=common.Vector3(),
+ shape_position=common.Vector3(),
+ shape_rotation=common.Vector3()
):
self.name=name
self.bone_index=bone_index
)
-class ToonTextures(object):
- __slots__=['_toon_textures']
- def __init__(self):
- self._toon_textures=[]
- for i in range(10):
- self._toon_textures.append('toon%02d.bmp' % (i+1))
-
- def __getitem__(self, key):
- return from_str(self._toon_textures[key])
-
- def __setitem__(self, key, value):
- self._toon_textures[key]=to_str(value)
-
- def __iter__(self):
- for toon_texture in self._toon_textures:
- yield from_str(toon_texture)
-
-
class Model(object):
"""pmd loader class.
'vertices', 'indices', 'materials', 'bones',
'ik_list', 'morphs',
'morph_indices', 'bone_group_list', 'bone_display_list',
- 'bone_group_english_list',
'toon_textures',
'rigidbodies', 'joints',
self.bone_group_list=[]
self.bone_display_list=[]
# extend
- self.bone_group_english_list=[]
- self.toon_textures=ToonTextures()
+ self.toon_textures=[b'']*10
self.rigidbodies=[]
self.joints=[]
# innner use
def getUV(self, i): return self.vertices[i].uv
def __str__(self):
- return '<PMDLoader version: %g, model: "%s", vertex: %d, face: %d, material: %d, bone: %d ik: %d, skin: %d>' % (
+ return '<pmd-%g, "%s" vertex: %d, face: %d, material: %d, bone: %d ik: %d, skin: %d>' % (
self.version, self.name, len(self.vertices), len(self.indices),
len(self.materials), len(self.bones), len(self.ik_list), len(self.morph_list))
and self.morph_indices==rhs.morph_indices
and self.bone_group_list==rhs.bone_group_list
and self.bone_display_list==rhs.bone_display_list
- and self.bone_group_english_list==rhs.bone_group_english_list
and self.toon_textures==rhs.toon_textures
and self.rigidbodies==rhs.rigidbodies
and self.joints==rhs.joints
)
-class IO(object):
- def __init__(self):
- pass
-
- def read(self, path):
- warnings.warn("'pymeshio.mqo.IO.read' will be replaced by 'pymeshio.mqo.loader.load'")
- model=pymeshio.pmd.loader.load_from_file(path)
- if model:
- return True
-