Changing Bone Names in a Script

Hey, this is just a quick hack because I hate renaming a large number of bones with the mouse for some reason . . . .

It looks like it should work. It runs through the selected bones and lets you type in new names. But then nothing changes. Help?

Note - searching bone.name didn’t turn up anything useful and searching for “bone name” on these forums drops the “name” keyword because it’s considered ‘too common’ somehow.

#!BPY
"""
Name: 'Z Type In Names'
Blender: 245
Group: 'Object'
Tooltip: 'Rename all selected objects consecutavely'
"""
__author__ = "Star Weaver"
__url__ = ("blender", "elysiun")
__version__ = "0.0"

__bpydoc__ = """\
Stuff goes in here
"""

from Blender import *
import bpy


def main():

    print Window.EditMode()

    if Window.EditMode():
        aobj = Scene.GetCurrent().getActiveObject()
        if aobj and aobj.type == "Armature":
            print aobj

            arma = aobj.data
            selbones = []

            Window.EditMode(0)
            arma.makeEditable()
            
            for bone in arma.bones.values():
                print bone, bone.options
                if Armature.BONE_SELECTED in bone.options:
                    selbones.append(bone)


            for bone in selbones:
                name = Draw.PupStrInput("Rename " + bone.name + " >>", bone.name, 21)
                bone.name = name

            arma.update()
                



if __name__=='__main__':
    main()

Dude, now I see that it’s renaming the things, and creating a whole nother bone hierarchy in the armature with the new names. WTH?