OSDN Git Service
(root)
/
meshio
/
pymeshio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
f4ab30f
)
implement clean up.
author
ousttrue
<ousttrue@gmail.com>
Fri, 14 Oct 2011 14:32:31 +0000
(23:32 +0900)
committer
ousttrue
<ousttrue@gmail.com>
Fri, 14 Oct 2011 14:32:31 +0000
(23:32 +0900)
blender26-meshio/import_pmx.py
patch
|
blob
|
history
diff --git
a/blender26-meshio/import_pmx.py
b/blender26-meshio/import_pmx.py
index
e29f3a0
..
3641050
100644
(file)
--- a/
blender26-meshio/import_pmx.py
+++ b/
blender26-meshio/import_pmx.py
@@
-178,9
+178,14
@@
def _execute(filepath):
print("%s(%d)" % (name, letter_count))
return name
for i, m in enumerate(model.materials):
print("%s(%d)" % (name, letter_count))
return name
for i, m in enumerate(model.materials):
- #print(m.name)
- # material作成
+ ####################
+ # material
+ ####################
material=__create_a_material(m, m.name, textures_and_images)
material=__create_a_material(m, m.name, textures_and_images)
+
+ ####################
+ # mesh object
+ ####################
# object名はutf-8で21byteまで
mesh, mesh_object=bl.mesh.create(get_object_name(i, m.name))
bl.mesh.addMaterial(mesh, material)
# object名はutf-8で21byteまで
mesh, mesh_object=bl.mesh.create(get_object_name(i, m.name))
bl.mesh.addMaterial(mesh, material)
@@
-188,9
+193,13
@@
def _execute(filepath):
bl.object.deselectAll()
bl.object.activate(mesh_object)
bl.object.makeParent(root_object, mesh_object)
bl.object.deselectAll()
bl.object.activate(mesh_object)
bl.object.makeParent(root_object, mesh_object)
+
+ ####################
# vertices & faces
# vertices & faces
+ ####################
indices=[next(index_generator)
for _ in range(m.vertex_count)]
indices=[next(index_generator)
for _ in range(m.vertex_count)]
+ used_indices=set(indices)
bl.mesh.addGeometry(mesh, vertices,
[(indices[i], indices[i+1], indices[i+2])
for i in range(0, len(indices), 3)])
bl.mesh.addGeometry(mesh, vertices,
[(indices[i], indices[i+1], indices[i+2])
for i in range(0, len(indices), 3)])
@@
-217,6
+226,9
@@
def _execute(filepath):
],
image)
],
image)
+ ####################
+ # armature
+ ####################
if armature_object:
# armature modifirer
bl.modifier.addArmature(mesh_object, armature_object)
if armature_object:
# armature modifirer
bl.modifier.addArmature(mesh_object, armature_object)
@@
-235,6
+247,9
@@
def _execute(filepath):
else:
raise Exception("unknown deform: %s" % v.deform)
else:
raise Exception("unknown deform: %s" % v.deform)
+ ####################
+ # shape keys
+ ####################
# set shape_key pin
bl.object.pinShape(mesh_object, True)
# create base key
# set shape_key pin
bl.object.pinShape(mesh_object, True)
# create base key
@@
-253,5
+268,12
@@
def _execute(filepath):
# select base shape
bl.object.setActivateShapeKey(mesh_object, 0)
# select base shape
bl.object.setActivateShapeKey(mesh_object, 0)
+ #############################
+ # clean up not used vertices
+ # in the material.
+ #############################
+ bl.mesh.vertsDelete(mesh, [i for i in range(len(mesh.vertices))
+ if i not in used_indices])
+
return {'FINISHED'}
return {'FINISHED'}