Skip to content

Commit

Permalink
[#D3D-2363] Fixes exception if parent_bone but no parent
Browse files Browse the repository at this point in the history
  • Loading branch information
AurL committed Aug 25, 2016
1 parent 9388fed commit a556e39
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions exporter/osg/osgbake.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def objFrameInfo(blender_object, do_visual_keying):
# TODO, pass data rather then grabbing from the context!
scene = bpy.context.scene
frame_back = scene.frame_current
if blender_object.parent_bone:
if blender_object.parent_bone and blender_object.parent:
bone_height = blender_object.parent.data.bones[blender_object.parent_bone].tail_local.z \
- blender_object.parent.data.bones[blender_object.parent_bone].head_local.z
bone_correction = Vector((0, bone_height, 0))
Expand Down Expand Up @@ -325,7 +325,7 @@ def objFrameInfo(blender_object, do_visual_keying):
# visual keying is enabled so set parent to identity
if do_visual_keying:
blender_object.matrix_parent_inverse.identity()
if blender_object.parent_bone:
if blender_object.parent_bone and blender_object.parent:
# Blender considers bone's tail instead of bone's head for parenting
# so we need to take to take bone's length into account
blender_object.location = blender_object.location + bone_correction
Expand Down

0 comments on commit a556e39

Please sign in to comment.