From a556e39ba48a43834cc6067cf7de4c43afe7ebcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Chatelain?= Date: Thu, 25 Aug 2016 17:54:38 +0200 Subject: [PATCH] [#D3D-2363] Fixes exception if parent_bone but no parent --- exporter/osg/osgbake.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exporter/osg/osgbake.py b/exporter/osg/osgbake.py index fefabe9..385724f 100644 --- a/exporter/osg/osgbake.py +++ b/exporter/osg/osgbake.py @@ -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)) @@ -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