X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=pymeshio%2Fpmx%2F__init__.py;h=e367e46973bdbb9d20c0c25d545b0627a653641a;hb=924bae1667aea0f57dd3de11b1248c12bc9a95d1;hp=f98032c7cc17fc57bbcde48e6d09c87b4ddfeb3f;hpb=a7744035815a6ad1c446abc5fcc94c74fc8484e0;p=meshio%2Fpymeshio.git diff --git a/pymeshio/pmx/__init__.py b/pymeshio/pmx/__init__.py index f98032c..e367e46 100644 --- a/pymeshio/pmx/__init__.py +++ b/pymeshio/pmx/__init__.py @@ -74,11 +74,11 @@ class Ik(Diff): 'limit_radian', 'link', ] - def __init__(self, target_index, loop, limit_radian, link=[]): + def __init__(self, target_index, loop, limit_radian, link=None): self.target_index=target_index self.loop=loop self.limit_radian=limit_radian - self.link=link + self.link=link or [] def __eq__(self, rhs): return ( @@ -104,11 +104,11 @@ class IkLink(Diff): 'limit_min', 'limit_max', ] - def __init__(self, bone_index, limit_angle, limit_min=common.Vector3(), limit_max=common.Vector3()): + def __init__(self, bone_index, limit_angle, limit_min=None, limit_max=None): self.bone_index=bone_index self.limit_angle=limit_angle - self.limit_min=limit_min - self.limit_max=limit_max + self.limit_min=limit_min or common.Vector3() + self.limit_max=limit_max or common.Vector3() def __eq__(self, rhs): return ( @@ -155,13 +155,13 @@ class Bone(Diff): parent_index, layer, flag, - tail_position=common.Vector3(), + tail_position=None, tail_index=-1, effect_index=-1, effect_factor=0.0, - fixed_axis=common.Vector3(), - local_x_vector=common.Vector3(), - local_z_vector=common.Vector3(), + fixed_axis=None, + local_x_vector=None, + local_z_vector=None, external_key=-1, ik=None ): @@ -171,13 +171,13 @@ class Bone(Diff): self.parent_index=parent_index self.layer=layer self.flag=flag - self.tail_position=tail_position + self.tail_position=tail_position or common.Vector3() self.tail_index=tail_index self.effect_index=effect_index self.effect_factor=effect_factor - self.fixed_axis=fixed_axis - self.local_x_vector=local_x_vector - self.local_z_vector=local_z_vector + self.fixed_axis=fixed_axis or common.Vector3() + self.local_x_vector=local_x_vector or common.Vector3() + self.local_z_vector=local_z_vector or common.Vector3() self.external_key=external_key self.ik=ik @@ -470,12 +470,12 @@ class Morph(Diff): 'morph_type', 'offsets', ] - def __init__(self, name, english_name, panel, morph_type, offsets=[]): + def __init__(self, name, english_name, panel, morph_type, offsets=None): self.name=name self.english_name=english_name self.panel=panel self.morph_type=morph_type - self.offsets=offsets + self.offsets=offsets or [] def __eq__(self, rhs): return ( @@ -497,7 +497,7 @@ class Morph(Diff): self._diff_array(rhs, 'offsets') -class VerexMorphOffset(Diff): +class VertexMorphOffset(Diff): """pmx vertex morph offset Attributes: @@ -533,26 +533,29 @@ class DisplaySlot(Diff): name: english_name: special_flag: - refrences: list of (ref_type, ref_index) + references: list of (ref_type, ref_index) """ __slots__=[ 'name', 'english_name', 'special_flag', - 'refrences', + 'references', ] - def __init__(self, name, english_name, special_flag, refrences=[]): + def __init__(self, name, english_name, special_flag, references=None): self.name=name self.english_name=english_name self.special_flag=special_flag - self.refrences=refrences + self.references=references or [] + + def __str__(self): + return "" % (self.name, len(self.references)) def __eq__(self, rhs): return ( self.name==rhs.name and self.english_name==rhs.english_name and self.special_flag==rhs.special_flag - and self.refrences==rhs.refrences + and self.references==rhs.references ) def __ne__(self, rhs): @@ -562,7 +565,7 @@ class DisplaySlot(Diff): self._diff(rhs, 'name') self._diff(rhs, 'english_name') self._diff(rhs, 'special_flag') - #self._diff_array(rhs, 'refrences') + #self._diff_array(rhs, 'references') class RigidBodyParam(Diff): @@ -691,7 +694,7 @@ class RigidBody(Diff): self._diff(rhs, 'no_collision_group') self._diff(rhs, 'shape_type') self._diff(rhs, 'shape_size') - #self._diff(rhs, 'shape_position') + self._diff(rhs, 'shape_position') self._diff(rhs, 'shape_rotation') self._diff(rhs, 'param') self._diff(rhs, 'mode')