I'm writing an importer for a file format with skeletal data, so I'd like to generate an armature with bones to represent it. I can put the object into edit mode and create EditBones without any trouble, but the bones then vanish as soon as I exit edit mode.
As far as I can tell, exiting Edit mode is supposed to convert EditBones to actual Bones, but that's not happening. Instead, when I exit Edit mode, the armature is reset back to the state it was in before I entered Edit mode.
Here's a test case that can be run line-by-line in Blender's Python console.
# Create a new armature, make it active, and put it into edit mode.
bpy.ops.object.armature_add( enter_editmode=True )
# Add a new bone named "test"
C.object.data.edit_bones.new( "test" )
# At this point, you can see the armature object with two bones ("Bone" and "test") in the Outliner
# Exit Edit mode by switching back to Object mode.
bpy.ops.object.mode_set( mode='OBJECT' )
# Result: the "test" bone vanishes without a trace.
I've tried a bunch of variations, all with the same end result. It feels like I'm missing a step; perhaps something to explicitly apply the edits.
I'm using Blender 2.68a and Blender 2.69.