# Copying Armature through Python API

I'm writing an exporter, and I want to transform an armature to Y-Up coordinates without actually saving it back to the blend file.

So, here's my transformation matrix:

conversionMatrix = axis_conversion(from_forward='Y', from_up='Z', to_forward='Z', to_up='Y').to_4x4()


I get the armature, copy it, and transform it for exporting:

armature = ob.find_armature().copy()
armature.data.transform(conversionMatrix)
# Export...


However, the actual armature in blender is transformed, 90 degrees, which would ruin the model if I were to save the file.

It seems like the armature isn't actually copied. Is there something wrong with what I'm doing?

Blender 2.72b

You copied the armature OBJECT, not the armature data. The copied object referred to the same datablock (armature.data). If you look at the properties panel in the armature tab (as opposed to the object or materials tab) you will see a [2] next to the name of the armature datablock

ao = ob.find_armature()

• Awesome, thank you so much. Do I need to explicitly delete a2 so that the duplicate data block doesn't get saved back into the blend file? – winduptoy Nov 8 '14 at 6:50