ousttrue / pymeshio

3d model reader/writer for python
http://pypi.python.org/pypi/pymeshio/
92 stars 26 forks source link

PMX shape key export needs bone group '表情' #28

Open Hogarth-MMD opened 9 years ago

Hogarth-MMD commented 9 years ago

Pymeshio does not automatically create the essential bone group '表情' when exporting a .pmx model. Therefore there is no display panel for morphs and MMD will crash when you import the model. Googleが翻訳します: Pymeshioは自動的に必須の骨のグループを作成していない「表情」.pmxモデルをエクスポートするとき。そのため、モデルをインポートすると、モーフとMMDには、表示パネルがクラッシュしませんがあります。

import bpy

# adds an empty bone group named '表情' if this bone group does not already exist. An essential bug fix for exporting shape keys.
for m in active.modifiers:
    if m.type == 'ARMATURE':
        if '表情' not in m.object.pose.bone_groups.keys():
            m.object.pose.bone_groups.new('表情')