I have an armature with a few bones. There are empties that are parented to the bones. I am trying to get the location of the parent bones
import Blender
# get all objects
objects = Blender.Object.Get()
# go through all the bojects
for bObject in objects:
# work only with empties
if (bObject.getType() == "Empty"):
# get position of the empty
location=bObject.getLocation()
# check if empty has a parent
if bObject.getParent():
# we assume that the parent is a bone
parentBoneName=bObject.getParentBoneName()
# get bone object
parentBoneObj=bObject.getParent().data.bones[parentBoneName]
# get location of the parent bone
parentBone=parentBoneObj.getLoc()
The last line causes the error:
Traceback (most recent call last):
File "<string>", line 35, in ?
AttributeError: 'Bone' object has no attribute 'getLoc'
What am I doing wrong there? Thx.