Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check wether an index group actually has existing bones #18

Merged
merged 3 commits into from
Jan 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions wmb/exporter/boneSet/boneSet.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def __init__(self):
boneID = getBoneIndexByName("WMB", group.name)
if boneID not in boneMap:
#print("Adding ID to boneMap: " + str(boneID))
boneMap.append(boneID)
if boneID:
boneMap.append(boneID)

# Set boneMap to armature
boneMap = sorted(boneMap)
Expand All @@ -71,12 +72,14 @@ def __init__(self):
if obj['boneSetIndex'] != -1:
for group in obj.vertex_groups:
boneID = getBoneIndexByName("WMB", group.name)
boneMapIndex = boneMap.index(boneID)
vertex_group_bones.append(boneMapIndex)
if boneID:
boneMapIndex = boneMap.index(boneID)
vertex_group_bones.append(boneMapIndex)

if vertex_group_bones not in b_boneSets:
b_boneSets.append(vertex_group_bones)
obj["boneSetIndex"] = len(b_boneSets)-1
else:
obj["boneSetIndex"] = b_boneSets.index(vertex_group_bones)

amt.data['boneSetArray'] = b_boneSets
amt.data['boneSetArray'] = b_boneSets
5 changes: 3 additions & 2 deletions wmb/exporter/meshes/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ def get_bones(self, obj):
for vertexGroup in mesh.vertex_groups:
boneName = getBoneIndexByName("WMB", vertexGroup.name)
if boneName not in bones:
bones.append(boneName)
numBones += 1
if boneName:
bones.append(boneName)
numBones += 1
if len(bones) == 0:
bones.append(0)

Expand Down