Skip to content

Commit

Permalink
Fix AttributeError when no parent bone
Browse files Browse the repository at this point in the history
  • Loading branch information
UuuNyaa committed Aug 4, 2023
1 parent bf192d3 commit b55b2c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mmd_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
bl_info = {
"name": "mmd_tools",
"author": "sugiany",
"version": (2, 9, 0),
"version": (2, 9, 1),
"blender": (2, 93, 0),
"location": "View3D > Sidebar > MMD Tools Panel",
"description": "Utility tools for MMD model editing. (UuuNyaa's forked version)",
Expand Down
9 changes: 5 additions & 4 deletions mmd_tools/core/pmx/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,17 +383,18 @@ def __to_pmx_axis(axis, pose_bone):
r[bone.name] = len(pmx_bones) - 1

if (
(
pmx_bone.parent is not None
and (
bone.use_connect
or (
not pmx_bone.isMovable
and math.isclose(0.0, (bone.head - bone.parent.tail).length)
and math.isclose(0.0, (bone.head - pmx_bone.parent.tail).length)
)
)
and p_bone.parent.mmd_bone.is_tip
):
logging.debug(' * fix location of bone %s, parent %s is tip', bone.name, bone.parent.name)
pmx_bone.location = boneMap[bone.parent].location
logging.debug(' * fix location of bone %s, parent %s is tip', bone.name, pmx_bone.parent.name)
pmx_bone.location = boneMap[pmx_bone.parent].location

# a connected child bone is preferred
pmx_bone.displayConnection = None
Expand Down

0 comments on commit b55b2c1

Please sign in to comment.