X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=swig%2Fblender%2Fpmd_import.py;h=8b0463f763c9ef114dd4327c0cca40bd785611d3;hb=e3663cdfa9eba5b3809390cbc46516f50cb244bc;hp=408e84bdad6d8ba8ec86cc80a3beb5cc254b439c;hpb=692ea38238c7d5f4199734b3941a2fcc7bd19f57;p=meshio%2Fmeshio.git diff --git a/swig/blender/pmd_import.py b/swig/blender/pmd_import.py index 408e84b..8b0463f 100644 --- a/swig/blender/pmd_import.py +++ b/swig/blender/pmd_import.py @@ -184,7 +184,7 @@ def __importShape(obj, l, vertex_map): for index, offset in zip(s.indices, s.pos_list): try: - vertex_index=base.indices[index] + vertex_index=vertex_map[base.indices[index]] bl.shapeKeyAssign(new_shape_key, vertex_index, mesh.verts[vertex_index].co+ bl.createVector(*convert_coord(offset))) @@ -206,7 +206,7 @@ def __importShape(obj, l, vertex_map): def __build(armature, b, p, parent): name=englishmap.getEnglishBoneName(b.getName()) if not name: - name=b.getName().encode(bl.INTERNAL_ENCODING) + name=b.getName() bone=bl.createArmatureBone(armature, name) @@ -257,6 +257,8 @@ def __importArmature(scene, l): for ik in l.ik_list: target=l.bones[ik.target] name = englishmap.getEnglishBoneName(target.getName()) + if not name: + name=target.getName() p_bone = pose.bones[name] if not p_bone: print('not found', name) @@ -302,9 +304,6 @@ def __import16MaerialAndMesh(meshObject, l, material=bl.createPmdMaterial(m) texture_name=m.getTexture() - #tex_file=re.compile('\*.*.spa$').sub('', m.getTexture()) - #tex_path = os.path.join(tex_dir, tex_file).encode( - # bl.INTERNAL_ENCODING) if texture_name!='': if texture_name in textureMap: texture=textureMap[texture_name] @@ -547,13 +546,13 @@ def __importMesh(scene, io, tex_dir): face_map, tex_dir) # enter Edit Mode - bl.enterEditMode() + #bl.enterEditMode() # crete shape key __importShape(meshObject, io, vertex_map) # exit Edit Mode - bl.exitEditMode() + #bl.exitEditMode() mesh.update() material_offset+=16 @@ -575,8 +574,10 @@ def __execute(filename, scene): progress_set('loaded %s' % filename, 0.1) # create root object - root=bl.createEmptyObject(scene, - io.english_name if len(io.english_name)>0 else io.getName().encode(bl.INTERNAL_ENCODING)) + model_name=io.getEnglishName() + if len(model_name)==0: + model_name=io.getName() + root=bl.createEmptyObject(scene, model_name) # import mesh mesh_objects=__importMesh(scene, io, os.path.dirname(filename))