Skip to content

Commit

Permalink
fix vrm bones mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonnji committed Oct 17, 2021
1 parent 7c82a80 commit 36a1c1b
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 9 deletions.
21 changes: 21 additions & 0 deletions addon_install.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python3

import os
import shutil


confpath = os.path.join(os.path.expanduser('~'), '.config', 'blender')
versions = []
for i in os.listdir(confpath):
versions.append((i, map(int, i.split('.'))))
versions.sort(key=lambda x: x[1])

print('using version {}'.format(versions[0][0]))
addonpath = os.path.join(confpath, versions[0][0], 'scripts', 'addons', 'kitsunetsuki')

if os.path.exists(addonpath):
print('removing existing installation in {}'.format(addonpath))
shutil.rmtree(addonpath)

print('installing to {}'.format(addonpath))
shutil.copytree('kitsunetsuki', addonpath)
4 changes: 0 additions & 4 deletions addon_install.sh

This file was deleted.

2 changes: 1 addition & 1 deletion kitsunetsuki/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
bl_info = {
'name': 'KITSUNETSUKI Asset Tools',
'author': 'kitsune.ONE team',
'version': (0, 6, 4),
'version': (0, 6, 5),
'blender': (2, 92, 0),
'location': 'File > Import-Export',
'description': 'Exports: glTF, VRM',
Expand Down
17 changes: 13 additions & 4 deletions kitsunetsuki/exporter/vrm/armature.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,18 @@ def _make_vrm_bone(self, gltf_node_id, bone):
def is_hips(bone):
return is_bone_matches(bone, ('hips',))

def is_upper_leg(bone):
return is_bone_matches(bone, ('upperleg', 'upleg', 'thigh'))
def is_upper_leg(bone, strict=True):
names = ['thigh']
if not strict:
names.append('leg')
is_upper = is_bone_matches(bone, names)
is_child = is_hips(get_parent(bone))
return is_upper or is_child

def is_lower_leg(bone):
is_lower = is_bone_matches(bone, ('calf', 'shin', 'knee'))
is_child = is_upper_leg(get_parent(bone), strict=False)
return is_lower or is_child

def is_hand(bone):
return is_bone_matches(bone, ('hand', 'wrist'))
Expand Down Expand Up @@ -70,8 +80,7 @@ def is_hand(bone):
elif is_bone_matches(bone, ('eye',)):
vrm_bone['bone'] = '{}Eye'.format(side)

elif (is_bone_matches(bone, ('lowerleg', 'calf', 'shin', 'knee')) or
is_upper_leg(get_parent(bone))):
elif is_lower_leg(bone):
vrm_bone['bone'] = '{}LowerLeg'.format(side)

elif is_upper_leg(bone):
Expand Down

0 comments on commit 36a1c1b

Please sign in to comment.