Exporting bones from Armature

Hi all,

Just a quick question about the best practices for exporting bones from an armature.

I’ve looked through the Python documentation for 2.6 and came across the FCurve, and its associated data_path (FCurve.data_path). From this, it is possible to derive a target property which is affected by the animation, and an evaluated value for a particular frame. This is fine, and it would be possible to build up a transformation matrix for a particular frame from this information, but is it possible to extract the RNA information for the data_path into something more meaningful? For example, the target which is affected consisting of the name of the object, and a property? The data_path just seems to be a text representation of a member within a class, which makes it kind of difficult.

Thanks,
Paul

e.g.
bpy.context.object.pose.bones[‘Bone’].id_data

gives you the object:
bpy.data.objects[‘Armature’]

Or you can get the data path like:

>>> bpy.context.active_pose_bone.path_from_id("location")
'pose.bones["Bone"].location'

Or resolve the path:

>>> bpy.context.active_pose_bone.path_resolve("location")
Vector((0.0, 0.0, 0.0))

>>> bpy.context.active_pose_bone.path_resolve("location", coerce=False)
bpy.data.objects['Armature'].pose.bones["Bone"].location

Hi, thanks for the reply.

So I’m assuming the best way to export the armature is by building up a set of metadata for each PoseBone, ie with the complete path as string values for each parameter (bpy.data.objects[‘Armature’].pose.bones[“Bone”].location), and simply looking this metadata up while resolving the data_path member from the animation data?

Thanks,
Paul