@@ -248,19 +248,29 @@ def __exportBones(self):
248248
249249 if p_bone .mmd_bone .is_tip :
250250 pmx_bone .displayConnection = - 1
251+ elif p_bone .mmd_bone .use_tail_location :
252+ tail_loc = world_mat * mathutils .Vector (bone .tail ) * self .__scale * self .TO_PMX_MATRIX
253+ pmx_bone .displayConnection = tail_loc - pmx_bone .location
251254 else :
252255 for child in bone .children :
253256 if child .use_connect :
254257 pmx_bone .displayConnection = child
255258 break
256- if not pmx_bone .displayConnection :
257- pmx_bone .displayConnection = bone .tail - bone .head
259+ # if not pmx_bone.displayConnection: #I think this wasn't working properly
260+ # pmx_bone.displayConnection = bone.tail - bone.head
258261
262+ #add fixed and local axes
263+ if mmd_bone .enabled_fixed_axis :
264+ pmx_bone .axis = mmd_bone .fixed_axis
259265
260- for i in pmx_bones :
266+ if mmd_bone .enabled_local_axes :
267+ pmx_bone .localCoordinate = pmx .Coordinate (
268+ mmd_bone .local_axis_x , mmd_bone .local_axis_z )
269+
270+ for idx , i in enumerate (pmx_bones ):
261271 if i .parent is not None :
262272 i .parent = pmx_bones .index (boneMap [i .parent ])
263- logging .debug ('the parent of %s: %s' , i .name , i .parent )
273+ logging .debug ('the parent of %s:%s: %s' , idx , i .name , i .parent )
264274 if isinstance (i .displayConnection , pmx .Bone ):
265275 i .displayConnection = pmx_bones .index (i .displayConnection )
266276 elif isinstance (i .displayConnection , bpy .types .EditBone ):
0 commit comments