update() deletes armature bones

In Blender 2.49b, when I use the update() on an armature, every bone in the armature is deleted. However, if I don’t use update(), the changes my script made to the armature are not made in Blender. I tested it by doing nothing more in the interactive console than just getting the armature and calling update() on the armature, and it still deleted all the bones in the armature. The armature object still exists, but all the bones are gone.

I think it depends what exactly your code does… You may need pose.update() rather than arma.update(), provided your armatura object is called “arma”. Frankly, I think (and I use this) it is better (not very fair in theory though) to go in and get out of EDIT mode (or vice-versa depending of the window state - OBJECT/EDIT mode). This ALWAYS causes redraw and update of the object(s). I know it is no good to advise you so but the trick works at me with no further complications. Furthermore, in most cases you would need redraw anyway. :wink:

You’d need to check your code too… If it deletes the bones of your armature then at any kind of update you will have your bones deleted! :stuck_out_tongue:

Regards,

Actually, I tried running the script, commenting out the update(). The bones were not deleted but the armature was not modified. Here is the code of the program:


import Blender
from Blender import *
source_armature = "Armature"
size = 0.5
ao = Blender.Object.Get(source_armature)
a = ao.getData()
for b in a.bones.keys():
 bb = a.bones[b]
 h = [ bb.head['ARMATURESPACE'][0] , bb.head['ARMATURESPACE'][1] , bb.head['ARMATURESPACE'][2] ]
 t = [ bb.tail['ARMATURESPACE'][0] , bb.tail['ARMATURESPACE'][1] , bb.tail['ARMATURESPACE'][2] ]
 bb.head['ARMATURESPACE'] = Blender.Mathutils.Vector(size*h[0] , size*h[1] , size*h[2])
 bb.tail['ARMATURESPACE'] = Blender.Mathutils.Vector(size*t[0] , size*t[1] , size*t[2])
# a.update()
Blender.Redraw()

The code basically resizes an armature without changing the size values for the armature or the bones. I tried the following script (which does pretty much nothing except update() ) and it still deleted the bones:


import Blender
from Blender import *
source_armature = "Armature"
ao = Blender.Object.Get(source_armature)
a = ao.getData()
a.update()