if b.ik_index>0:
b.ik_index=sortMap[b.ik_index]
+ def fix(self):
+ """
+ 調整
+ """
+ for b in self.bones:
+ # parent index
+ if b.parent_index==None:
+ b.parent_index=0xFFFF
+ else:
+ if b.type==6 or b.type==7:
+ # fix tail bone
+ parent=self.bones[b.parent_index]
+ parent.tail_index=b.index
+
+ for b in self.bones:
+ if b.tail_index==None:
+ b.tail_index=0
+ elif b.type==9:
+ b.tail_index==0
+
def getIndex(self, bone):
for i, b in enumerate(self.bones):
if b==bone:
self.builder.ik_list.sort(lambda l, r: getIndex(l)-getIndex(r))
else:
self.builder.ik_list.sort(key=getIndex)
+ self.builder.fix()
def __createOneSkinMesh(self, node):
############################################################
else:
bone.type=b.type
- # parent index
- bone.parent_index=b.parent_index if b.parent_index!=None else 0xFFFF
-
- # tail index
- if b.tail_index!=None:
- if bone.type==9:
- bone.tail_index=0
- else:
- bone.tail_index=b.tail_index
- else:
- bone.tail_index=0
-
+ bone.parent_index=b.parent_index
+ bone.tail_index=b.tail_index
bone.ik_index=b.ik_index
# convert right-handed z-up to left-handed y-up
bone=bl.createArmatureBone(armature, name)
if b.tail_index==0:
- # 先端
- assert(b.type==6 or b.type==7)
+ # 先端ボーン
+ assert(b.type==6 or b.type==7 or b.type==9)
bone.head = bl.createVector(*convert_coord(b.pos))
bone.tail=bone.head+bl.createVector(0, 1, 0)
assert(parent)
# armature layer 2
bl.boneLayerMask(bone, [0, 1])
else:
+ # 通常ボーン
bone.head = bl.createVector(*convert_coord(b.pos))
bone.tail = bl.createVector(*convert_coord(b.tail))
if parent: