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

Instead:

ao = ob.find_armature()
a2 = ao.data.copy()
a2.transform(conversionMatrix)


This copies the armature datablock instead of the object datablock.