From 2d68b0ab21b557470659a933fcc8c2d069cb5232 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Sun, 18 Sep 2011 23:08:29 +0900 Subject: [PATCH] update for blender2.59 --- README.txt | 15 ++++- blender25-meshio/__init__.py | 13 +++-- blender25-meshio/bl25.py | 27 +++++++++ blender25-meshio/export_mqo.py | 2 +- blender25-meshio/export_pmd.py | 130 ++++++++++++++++------------------------- blender25-meshio/import_mqo.py | 4 +- blender25-meshio/import_pmd.py | 90 ++++++++++------------------ setup.py | 2 +- 8 files changed, 133 insertions(+), 150 deletions(-) mode change 100644 => 100755 README.txt diff --git a/README.txt b/README.txt old mode 100644 new mode 100755 index f7d1a2d..1840805 --- a/README.txt +++ b/README.txt @@ -5,6 +5,10 @@ http://meshio.sourceforge.jp/ pmdとmqoの読み書きライブラリと、それを使ったblender2.57b向けaddonです。 +package方法 +=========== +$ python setup.py sdist + blender-2.57addonのインストール =============================== アーカイブを解凍すると中にblender25-meshioというディレクトリができます。 @@ -14,10 +18,19 @@ blender-2.57addonのインストール 次にblenderを起動して、(File)-(User Preferences)をオープン。 (Add-Ons)タブを選択。 + +[Install Add-On...]をクリック +{blender2.57bのインストールディレクトリ}/2.57/scripts/addons/pymeshio/__init__.pyを選択 + Import-Exportの中から"meshio. (.pmd)(.mqo)"を探して右のチェックボックスを有効にします。これでaddonが有効になり、(File)メニューの(Import)と(Export)それぞれにpmdとmqoが現れます。 更新履歴 ======== +20110918 1.9.0 +-------------- +blender2.59に対応(from . importがよろしくない) +剛体修正 + 20110607 1.8.6 -------------- pmd exportの法線を修正。 @@ -28,7 +41,7 @@ cubeなどの単純形状をエクスポートできるように修正。 20110523 1.8.4 -------------- -2.57bより新しくしてしまったのを修正。 +blender2.57bより新しくしてしまったのを修正。 20110523 1.8.3 -------------- diff --git a/blender25-meshio/__init__.py b/blender25-meshio/__init__.py index 9f7d747..a27accc 100644 --- a/blender25-meshio/__init__.py +++ b/blender25-meshio/__init__.py @@ -1,7 +1,8 @@ bl_info = { "name": "meshio. (.pmd)(.mqo)", + "version": (1, 9), "author": "ousttrue", - "blender": (2, 5, 7), + "blender": (2, 5, 9), "api": 35622, "location": "File > Import-Export", "description": "Import-Export PMD/MQO meshes", @@ -27,7 +28,7 @@ try: from io_utils import ImportHelper, ExportHelper except: from bpy_extras.io_utils import ImportHelper, ExportHelper -from . import bl25 as bl +import bl25 as bl ''' @@ -42,7 +43,7 @@ class ImportPmd(bpy.types.Operator, ImportHelper): filter_glob = StringProperty(default="*.pmd", options={'HIDDEN'}) def execute(self, context): - from . import import_pmd + import import_pmd bl.initialize('pmd_import', context.scene) import_pmd._execute(**self.as_keywords( ignore=("filter_glob",))) @@ -70,7 +71,7 @@ class ExportPMD(bpy.types.Operator, ExportHelper): use_selection = BoolProperty(name="Selection Only", description="Export selected objects only", default=False) def execute(self, context): - from . import export_pmd + import export_pmd bl.initialize('pmd_export', context.scene) export_pmd._execute(**self.as_keywords( ignore=("check_existing", "filter_glob", "use_selection"))) @@ -104,7 +105,7 @@ class ImportMQO(bpy.types.Operator, ImportHelper): soft_min=0.001, soft_max=100.0, default=0.1) def execute(self, context): - from . import import_mqo + import import_mqo bl.initialize('mqo_import', context.scene) import_mqo._execute(**self.as_keywords( ignore=("filter_glob",))) @@ -144,7 +145,7 @@ class ExportMQO(bpy.types.Operator, ExportHelper): default=False) def execute(self, context): - from . import export_mqo + import export_mqo export_mqo._execute(**self.as_keywords( ignore=("check_existing", "filter_glob", "use_selection"))) return {'FINISHED'} diff --git a/blender25-meshio/bl25.py b/blender25-meshio/bl25.py index 188fcd2..d3f52f9 100644 --- a/blender25-meshio/bl25.py +++ b/blender25-meshio/bl25.py @@ -662,3 +662,30 @@ class constraint: def isIKSolver(c): return c.type=='IK' +MMD_SHAPE_GROUP_NAME='_MMD_SHAPE' +MMD_MB_NAME='mb_name' +MMD_MB_COMMENT='mb_comment' +MMD_COMMENT='comment' +BASE_SHAPE_NAME='Basis' +RIGID_NAME='rigid_name' +RIGID_SHAPE_TYPE='rigid_shape_type' +RIGID_PROCESS_TYPE='rigid_process_type' +RIGID_BONE_NAME='rigid_bone_name' +RIGID_GROUP='ribid_group' +RIGID_INTERSECTION_GROUP='rigid_intersection_group' +RIGID_WEIGHT='rigid_weight' +RIGID_LINEAR_DAMPING='rigid_linear_damping' +RIGID_ANGULAR_DAMPING='rigid_angular_damping' +RIGID_RESTITUTION='rigid_restitution' +RIGID_FRICTION='rigid_friction' +CONSTRAINT_NAME='const_name' +CONSTRAINT_A='const_a' +CONSTRAINT_B='const_b' +CONSTRAINT_POS_MIN='const_pos_min' +CONSTRAINT_POS_MAX='const_pos_max' +CONSTRAINT_ROT_MIN='const_rot_min' +CONSTRAINT_ROT_MAX='const_rot_max' +CONSTRAINT_SPRING_POS='const_spring_pos' +CONSTRAINT_SPRING_ROT='const_spring_rot' +TOON_TEXTURE_OBJECT='ToonTextures' + diff --git a/blender25-meshio/export_mqo.py b/blender25-meshio/export_mqo.py index 45ef006..cd400b8 100644 --- a/blender25-meshio/export_mqo.py +++ b/blender25-meshio/export_mqo.py @@ -72,7 +72,7 @@ class MQOMaterial(object): import bpy # wrapper -from . import bl25 as bl +import bl25 as bl def materialToMqo(m): material=MQOMaterial(m.name, 3) diff --git a/blender25-meshio/export_pmd.py b/blender25-meshio/export_pmd.py index 6d31f67..c61a915 100644 --- a/blender25-meshio/export_pmd.py +++ b/blender25-meshio/export_pmd.py @@ -45,34 +45,6 @@ bl_addon_info = { 'tracker_url': 'http://sourceforge.jp/ticket/newticket.php?group_id=5081', } -MMD_SHAPE_GROUP_NAME='_MMD_SHAPE' -MMD_MB_NAME='mb_name' -MMD_MB_COMMENT='mb_comment' -MMD_COMMENT='comment' -BASE_SHAPE_NAME='Basis' -RIGID_NAME='rigid_name' -RIGID_SHAPE_TYPE='rigid_shape_type' -RIGID_PROCESS_TYPE='rigid_process_type' -RIGID_BONE_NAME='rigid_bone_name' -#RIGID_LOCATION='rigid_loation' -RIGID_GROUP='ribid_group' -RIGID_INTERSECTION_GROUP='rigid_intersection_group' -RIGID_WEIGHT='rigid_weight' -RIGID_LINEAR_DAMPING='rigid_linear_damping' -RIGID_ANGULAR_DAMPING='rigid_angular_damping' -RIGID_RESTITUTION='rigid_restitution' -RIGID_FRICTION='rigid_friction' -CONSTRAINT_NAME='constraint_name' -CONSTRAINT_A='const_a' -CONSTRAINT_B='const_b' -CONSTRAINT_POS_MIN='const_pos_min' -CONSTRAINT_POS_MAX='const_pos_max' -CONSTRAINT_ROT_MIN='const_rot_min' -CONSTRAINT_ROT_MAX='const_rot_max' -CONSTRAINT_SPRING_POS='const_spring_pos' -CONSTRAINT_SPRING_ROT='const_spring_rot' -TOON_TEXTURE_OBJECT='ToonTextures' - ############################################################################### # import @@ -86,8 +58,8 @@ try: print('use meshio C module') except ImportError: # full python - from .pymeshio import englishmap - from .pymeshio import pmd + from pymeshio import englishmap + from pymeshio import pmd # for 2.5 @@ -95,7 +67,7 @@ import bpy import mathutils # wrapper -from . import bl25 as bl +import bl25 as bl xrange=range @@ -492,9 +464,9 @@ class OneSkinMesh(object): ) def __mesh(self, obj): - if RIGID_SHAPE_TYPE in obj: + if bl.RIGID_SHAPE_TYPE in obj: return - if CONSTRAINT_A in obj: + if bl.CONSTRAINT_A in obj: return bl.message("export: %s" % obj.name) @@ -550,12 +522,12 @@ class OneSkinMesh(object): baseMorph=None # shape keys - vg=bl.object.getVertexGroup(obj, MMD_SHAPE_GROUP_NAME) + vg=bl.object.getVertexGroup(obj, bl.MMD_SHAPE_GROUP_NAME) # base used=set() for b in bl.object.getShapeKeys(obj): - if b.name==BASE_SHAPE_NAME: + if b.name==bl.BASE_SHAPE_NAME: baseMorph=self.__getOrCreateMorph('base', 0) basis=b @@ -583,7 +555,7 @@ class OneSkinMesh(object): # shape keys for b in bl.object.getShapeKeys(obj): - if b.name==BASE_SHAPE_NAME: + if b.name==bl.BASE_SHAPE_NAME: continue #print(b.name) @@ -616,12 +588,12 @@ class OneSkinMesh(object): self.morphList.sort(key=getIndex) def __rigidbody(self, obj): - if not RIGID_SHAPE_TYPE in obj: + if not bl.RIGID_SHAPE_TYPE in obj: return self.rigidbodies.append(obj) def __constraint(self, obj): - if not CONSTRAINT_A in obj: + if not bl.CONSTRAINT_A in obj: return self.constraints.append(obj) @@ -887,9 +859,9 @@ class PmdExporter(object): root=object_node_map[bl.object.getActive()] o=root.o self.englishName=o.name - self.englishComment=o[MMD_COMMENT] if MMD_COMMENT in o else 'blender export\n' - self.name=o[MMD_MB_NAME] if MMD_MB_NAME in o else 'Blenderエクスポート' - self.comment=o[MMD_MB_COMMENT] if MMD_MB_COMMENT in o else 'Blnderエクスポート\n' + self.englishComment=o[bl.MMD_COMMENT] if bl.MMD_COMMENT in o else 'blender export\n' + self.name=o[bl.MMD_MB_NAME] if bl.MMD_MB_NAME in o else 'Blenderエクスポート' + self.comment=o[bl.MMD_MB_COMMENT] if bl.MMD_MB_COMMENT in o else 'Blnderエクスポート\n' # ワンスキンメッシュを作る self.oneSkinMesh=OneSkinMesh() @@ -1094,7 +1066,7 @@ class PmdExporter(object): toonMeshObject=None for o in bl.object.each(): try: - if o.name.startswith(TOON_TEXTURE_OBJECT): + if o.name.startswith(bl.TOON_TEXTURE_OBJECT): toonMeshObject=o except: p(o.name) @@ -1115,45 +1087,42 @@ class PmdExporter(object): # rigid body rigidNameMap={} for i, obj in enumerate(self.oneSkinMesh.rigidbodies): - name=obj[RIGID_NAME] if RIGID_NAME in obj else obj.name - #print(name) + name=obj[bl.RIGID_NAME] if bl.RIGID_NAME in obj else obj.name + print(name) rigidBody=pmd.RigidBody(name) rigidNameMap[name]=i - boneIndex=boneNameMap[obj[RIGID_BONE_NAME]] + boneIndex=boneNameMap[obj[bl.RIGID_BONE_NAME]] if boneIndex==0: boneIndex=0xFFFF bone=self.skeleton.bones[0] else: bone=self.skeleton.bones[boneIndex] rigidBody.boneIndex=boneIndex - #rigidBody.position.x=obj[RIGID_LOCATION][0] - #rigidBody.position.y=obj[RIGID_LOCATION][1] - #rigidBody.position.z=obj[RIGID_LOCATION][2] rigidBody.position.x=obj.location.x-bone.pos[0] rigidBody.position.y=obj.location.z-bone.pos[2] rigidBody.position.z=obj.location.y-bone.pos[1] rigidBody.rotation.x=-obj.rotation_euler[0] rigidBody.rotation.y=-obj.rotation_euler[2] rigidBody.rotation.z=-obj.rotation_euler[1] - rigidBody.processType=obj[RIGID_PROCESS_TYPE] - rigidBody.group=obj[RIGID_GROUP] - rigidBody.target=obj[RIGID_INTERSECTION_GROUP] - rigidBody.weight=obj[RIGID_WEIGHT] - rigidBody.linearDamping=obj[RIGID_LINEAR_DAMPING] - rigidBody.angularDamping=obj[RIGID_ANGULAR_DAMPING] - rigidBody.restitution=obj[RIGID_RESTITUTION] - rigidBody.friction=obj[RIGID_FRICTION] - if obj[RIGID_SHAPE_TYPE]==0: + rigidBody.processType=obj[bl.RIGID_PROCESS_TYPE] + rigidBody.group=obj[bl.RIGID_GROUP] + rigidBody.target=obj[bl.RIGID_INTERSECTION_GROUP] + rigidBody.weight=obj[bl.RIGID_WEIGHT] + rigidBody.linearDamping=obj[bl.RIGID_LINEAR_DAMPING] + rigidBody.angularDamping=obj[bl.RIGID_ANGULAR_DAMPING] + rigidBody.restitution=obj[bl.RIGID_RESTITUTION] + rigidBody.friction=obj[bl.RIGID_FRICTION] + if obj[bl.RIGID_SHAPE_TYPE]==0: rigidBody.shapeType=pmd.SHAPE_SPHERE rigidBody.w=obj.scale[0] rigidBody.d=0 rigidBody.h=0 - elif obj[RIGID_SHAPE_TYPE]==1: + elif obj[bl.RIGID_SHAPE_TYPE]==1: rigidBody.shapeType=pmd.SHAPE_BOX rigidBody.w=obj.scale[0] rigidBody.d=obj.scale[1] rigidBody.h=obj.scale[2] - elif obj[RIGID_SHAPE_TYPE]==2: + elif obj[bl.RIGID_SHAPE_TYPE]==2: rigidBody.shapeType=pmd.SHAPE_CAPSULE rigidBody.w=obj.scale[0] rigidBody.h=obj.scale[2] @@ -1162,33 +1131,34 @@ class PmdExporter(object): # constraint for obj in self.oneSkinMesh.constraints: - constraint=pmd.Constraint(obj[CONSTRAINT_NAME]) - constraint.rigidA=rigidNameMap[obj[CONSTRAINT_A]] - constraint.rigidB=rigidNameMap[obj[CONSTRAINT_B]] + print(obj) + constraint=pmd.Constraint(obj[bl.CONSTRAINT_NAME]) + constraint.rigidA=rigidNameMap[obj[bl.CONSTRAINT_A]] + constraint.rigidB=rigidNameMap[obj[bl.CONSTRAINT_B]] constraint.pos.x=obj.location[0] constraint.pos.y=obj.location[2] constraint.pos.z=obj.location[1] constraint.rot.x=-obj.rotation_euler[0] constraint.rot.y=-obj.rotation_euler[2] constraint.rot.z=-obj.rotation_euler[1] - constraint.constraintPosMin.x=obj[CONSTRAINT_POS_MIN][0] - constraint.constraintPosMin.y=obj[CONSTRAINT_POS_MIN][1] - constraint.constraintPosMin.z=obj[CONSTRAINT_POS_MIN][2] - constraint.constraintPosMax.x=obj[CONSTRAINT_POS_MAX][0] - constraint.constraintPosMax.y=obj[CONSTRAINT_POS_MAX][1] - constraint.constraintPosMax.z=obj[CONSTRAINT_POS_MAX][2] - constraint.constraintRotMin.x=obj[CONSTRAINT_ROT_MIN][0] - constraint.constraintRotMin.y=obj[CONSTRAINT_ROT_MIN][1] - constraint.constraintRotMin.z=obj[CONSTRAINT_ROT_MIN][2] - constraint.constraintRotMax.x=obj[CONSTRAINT_ROT_MAX][0] - constraint.constraintRotMax.y=obj[CONSTRAINT_ROT_MAX][1] - constraint.constraintRotMax.z=obj[CONSTRAINT_ROT_MAX][2] - constraint.springPos.x=obj[CONSTRAINT_SPRING_POS][0] - constraint.springPos.y=obj[CONSTRAINT_SPRING_POS][1] - constraint.springPos.z=obj[CONSTRAINT_SPRING_POS][2] - constraint.springRot.x=obj[CONSTRAINT_SPRING_ROT][0] - constraint.springRot.y=obj[CONSTRAINT_SPRING_ROT][1] - constraint.springRot.z=obj[CONSTRAINT_SPRING_ROT][2] + constraint.constraintPosMin.x=obj[bl.CONSTRAINT_POS_MIN][0] + constraint.constraintPosMin.y=obj[bl.CONSTRAINT_POS_MIN][1] + constraint.constraintPosMin.z=obj[bl.CONSTRAINT_POS_MIN][2] + constraint.constraintPosMax.x=obj[bl.CONSTRAINT_POS_MAX][0] + constraint.constraintPosMax.y=obj[bl.CONSTRAINT_POS_MAX][1] + constraint.constraintPosMax.z=obj[bl.CONSTRAINT_POS_MAX][2] + constraint.constraintRotMin.x=obj[bl.CONSTRAINT_ROT_MIN][0] + constraint.constraintRotMin.y=obj[bl.CONSTRAINT_ROT_MIN][1] + constraint.constraintRotMin.z=obj[bl.CONSTRAINT_ROT_MIN][2] + constraint.constraintRotMax.x=obj[bl.CONSTRAINT_ROT_MAX][0] + constraint.constraintRotMax.y=obj[bl.CONSTRAINT_ROT_MAX][1] + constraint.constraintRotMax.z=obj[bl.CONSTRAINT_ROT_MAX][2] + constraint.springPos.x=obj[bl.CONSTRAINT_SPRING_POS][0] + constraint.springPos.y=obj[bl.CONSTRAINT_SPRING_POS][1] + constraint.springPos.z=obj[bl.CONSTRAINT_SPRING_POS][2] + constraint.springRot.x=obj[bl.CONSTRAINT_SPRING_ROT][0] + constraint.springRot.y=obj[bl.CONSTRAINT_SPRING_ROT][1] + constraint.springRot.z=obj[bl.CONSTRAINT_SPRING_ROT][2] io.constraints.append(constraint) # 書き込み diff --git a/blender25-meshio/import_mqo.py b/blender25-meshio/import_mqo.py index d8bf131..9896d3a 100644 --- a/blender25-meshio/import_mqo.py +++ b/blender25-meshio/import_mqo.py @@ -52,13 +52,13 @@ try: print('use meshio C module') except ImportError: # full python - from .pymeshio import mqo + from pymeshio import mqo # for 2.5 import bpy # wrapper -from . import bl25 as bl +import bl25 as bl def createMqoMaterial(m): material = bpy.data.materials.new(m.getName()) diff --git a/blender25-meshio/import_pmd.py b/blender25-meshio/import_pmd.py index ea634c4..d3cb03b 100644 --- a/blender25-meshio/import_pmd.py +++ b/blender25-meshio/import_pmd.py @@ -52,34 +52,6 @@ bl_addon_info = { 'tracker_url': 'http://sourceforge.jp/ticket/newticket.php?group_id=5081', } -MMD_SHAPE_GROUP_NAME='_MMD_SHAPE' -MMD_MB_NAME='mb_name' -MMD_MB_COMMENT='mb_comment' -MMD_COMMENT='comment' -BASE_SHAPE_NAME='Basis' -RIGID_NAME='rigid_name' -RIGID_SHAPE_TYPE='rigid_shape_type' -RIGID_PROCESS_TYPE='rigid_process_type' -RIGID_BONE_NAME='rigid_bone_name' -#RIGID_LOCATION='rigid_loation' -RIGID_GROUP='ribid_group' -RIGID_INTERSECTION_GROUP='rigid_intersection_group' -RIGID_WEIGHT='rigid_weight' -RIGID_LINEAR_DAMPING='rigid_linear_damping' -RIGID_ANGULAR_DAMPING='rigid_angular_damping' -RIGID_RESTITUTION='rigid_restitution' -RIGID_FRICTION='rigid_friction' -CONSTRAINT_NAME='const_name' -CONSTRAINT_A='const_a' -CONSTRAINT_B='const_b' -CONSTRAINT_POS_MIN='const_pos_min' -CONSTRAINT_POS_MAX='const_pos_max' -CONSTRAINT_ROT_MIN='const_rot_min' -CONSTRAINT_ROT_MAX='const_rot_max' -CONSTRAINT_SPRING_POS='const_spring_pos' -CONSTRAINT_SPRING_ROT='const_spring_rot' -TOON_TEXTURE_OBJECT='ToonTextures' - ############################################################################### # import @@ -94,17 +66,17 @@ try: print('use meshio C module') except ImportError: # full python - from .pymeshio import englishmap + from pymeshio import englishmap #from .pymeshio import mmd as pmd #pmd.IO=pmd.PMDLoader - from .pymeshio import pmd + from pymeshio import pmd # for 2.5 import bpy import mathutils # wrapper -from . import bl25 as bl +import bl25 as bl xrange=range @@ -187,8 +159,8 @@ def get_group_name(g): def __importToonTextures(io, tex_dir): - mesh, meshObject=bl.mesh.create(TOON_TEXTURE_OBJECT) - material=bl.material.create(TOON_TEXTURE_OBJECT) + mesh, meshObject=bl.mesh.create(bl.TOON_TEXTURE_OBJECT) + material=bl.material.create(bl.TOON_TEXTURE_OBJECT) bl.mesh.addMaterial(mesh, material) for toon in (io.toon_textures._toon_textures[i] for i in range(10)): path=os.path.join(tex_dir, toon) @@ -211,19 +183,19 @@ def __importShape(obj, l, vertex_map): base=s # create vertex group - bl.object.addVertexGroup(obj, MMD_SHAPE_GROUP_NAME) + bl.object.addVertexGroup(obj, bl.MMD_SHAPE_GROUP_NAME) hasShape=False for i in s.indices: if i in vertex_map: hasShape=True bl.object.assignVertexGroup( - obj, MMD_SHAPE_GROUP_NAME, vertex_map[i], 0) + obj, bl.MMD_SHAPE_GROUP_NAME, vertex_map[i], 0) if not hasShape: return assert(base) # create base key - baseShapeBlock=bl.object.addShapeKey(obj, BASE_SHAPE_NAME) + baseShapeBlock=bl.object.addShapeKey(obj, bl.BASE_SHAPE_NAME) # mesh mesh=bl.object.getData(obj) mesh.update() @@ -645,15 +617,15 @@ def __importConstraints(io): rot=c.rot meshObject.rotation_euler=(-rot.x, -rot.z, -rot.y) - meshObject[CONSTRAINT_NAME]=c._name - meshObject[CONSTRAINT_A]=io.rigidbodies[c.rigidA]._name - meshObject[CONSTRAINT_B]=io.rigidbodies[c.rigidB]._name - meshObject[CONSTRAINT_POS_MIN]=VtoV(c.constraintPosMin) - meshObject[CONSTRAINT_POS_MAX]=VtoV(c.constraintPosMax) - meshObject[CONSTRAINT_ROT_MIN]=VtoV(c.constraintRotMin) - meshObject[CONSTRAINT_ROT_MAX]=VtoV(c.constraintRotMax) - meshObject[CONSTRAINT_SPRING_POS]=VtoV(c.springPos) - meshObject[CONSTRAINT_SPRING_ROT]=VtoV(c.springRot) + meshObject[bl.CONSTRAINT_NAME]=c._name + meshObject[bl.CONSTRAINT_A]=io.rigidbodies[c.rigidA]._name + meshObject[bl.CONSTRAINT_B]=io.rigidbodies[c.rigidB]._name + meshObject[bl.CONSTRAINT_POS_MIN]=VtoV(c.constraintPosMin) + meshObject[bl.CONSTRAINT_POS_MAX]=VtoV(c.constraintPosMax) + meshObject[bl.CONSTRAINT_ROT_MIN]=VtoV(c.constraintRotMin) + meshObject[bl.CONSTRAINT_ROT_MAX]=VtoV(c.constraintRotMax) + meshObject[bl.CONSTRAINT_SPRING_POS]=VtoV(c.springPos) + meshObject[bl.CONSTRAINT_SPRING_ROT]=VtoV(c.springRot) for meshObject in reversed(constraintMeshes): bl.object.makeParent(container, meshObject) @@ -708,7 +680,7 @@ def __importRigidBodies(io): rigidMeshes.append(meshObject) bl.mesh.addMaterial(mesh, material) meshObject.name='r_%03d' % i - meshObject[RIGID_NAME]=rigid._name + meshObject[bl.RIGID_NAME]=rigid._name #meshObject.draw_transparent=True #meshObject.draw_wire=True meshObject.draw_type='WIRE' @@ -716,21 +688,21 @@ def __importRigidBodies(io): meshObject.rotation_euler=(-rot.x, -rot.z, -rot.y) # custom properties - meshObject[RIGID_SHAPE_TYPE]=rigid.shapeType - meshObject[RIGID_PROCESS_TYPE]=rigid.processType + meshObject[bl.RIGID_SHAPE_TYPE]=rigid.shapeType + meshObject[bl.RIGID_PROCESS_TYPE]=rigid.processType bone_name = englishmap.getEnglishBoneName(bone._name) if not bone_name: bone_name=bone._name - meshObject[RIGID_BONE_NAME]=bone_name + meshObject[bl.RIGID_BONE_NAME]=bone_name - meshObject[RIGID_GROUP]=rigid.group - meshObject[RIGID_INTERSECTION_GROUP]=rigid.target - meshObject[RIGID_WEIGHT]=rigid.weight - meshObject[RIGID_LINEAR_DAMPING]=rigid.linearDamping - meshObject[RIGID_ANGULAR_DAMPING]=rigid.angularDamping - meshObject[RIGID_RESTITUTION]=rigid.restitution - meshObject[RIGID_FRICTION]=rigid.friction + meshObject[bl.RIGID_GROUP]=rigid.group + meshObject[bl.RIGID_INTERSECTION_GROUP]=rigid.target + meshObject[bl.RIGID_WEIGHT]=rigid.weight + meshObject[bl.RIGID_LINEAR_DAMPING]=rigid.linearDamping + meshObject[bl.RIGID_ANGULAR_DAMPING]=rigid.angularDamping + meshObject[bl.RIGID_RESTITUTION]=rigid.restitution + meshObject[bl.RIGID_FRICTION]=rigid.friction for meshObject in reversed(rigidMeshes): bl.object.makeParent(container, meshObject) @@ -757,9 +729,9 @@ def _execute(filepath=""): if len(model_name)==0: model_name=io._name root=bl.object.createEmpty(model_name) - root[MMD_MB_NAME]=io._name - root[MMD_MB_COMMENT]=io._comment - root[MMD_COMMENT]=io._english_comment + root[bl.MMD_MB_NAME]=io._name + root[bl.MMD_MB_COMMENT]=io._comment + root[bl.MMD_COMMENT]=io._english_comment # toon textures tex_dir=os.path.dirname(filepath) diff --git a/setup.py b/setup.py index 5ee81ca..dfc9a31 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import setup setup( name='pymeshio', - version='1.8.6', + version='1.9.0', description='pure python 3d model io library', keywords=[], author='ousttrue', -- 2.11.0