[B2.5] Wanted: Python animation tutorial

Blender 2.5 python tutorials are easy to find, now. However, I am still looking for an introduction tutorial on how to use python for animation.

How can I programmatically change some properties at each frame?
Also, I am trying to add a stamp with the property and its value on the top of each frame.

I’m studying the code from the following threads:
Hopefully, I’ll figure out enough to get me started…

Probably just need to learn about pydrivers.

…though the driver system in 2.5x doesn’t make a whole lot of sense until you understand how it works.

…and I don’t even think bpy.app.driver_namespace (where you toss your functions/classes that the drivers can call) is documented anywhere.

I posted this on the other thread but thought it might do more good here.
This is a hacky way to animate via python I picked up somewhere around here…
can’t take any credit except that I tried it out and it worked.

  1. create Empty
  2. add single keyframe to rotZ (frame 1) to Empty
  • leave default expanded poly generator on it
  1. add single driver to locY (frame1)
  • in Drivers> choose - Scripted sxpression
  • enter this in the expression line:

".join([l.body for l in bpy.data.texts["RUN"].lines]))==None)

  1. then save script in the text editor and name it ‘RUN’ - it should execute every time the frame changes
  • rotZ of Empty drives expression which (i think) grabs the text datablock of the script and runs it

here’s a test. set up the empty as above…
then make a cube (has to be named ‘Cube’) subdivide it a lot,
copy this to text editor and name it “RUN”
then alt-a

     import bpy
import random
ob = bpy.data.objects['Cube']
verts = ob.data.vertices
for v in verts:
    rxnum = round(random.uniform(-0.01 ,0.01), 4)
    rynum = round(random.uniform(-0.01 ,0.01), 4)
    rznum = round(random.uniform(-0.01 ,0.01), 4)    
    v.co[0] = v.co[0] + rxnum
    v.co[1] = v.co[1] + rynum
    v.co[2] = v.co[2] + rznum    
scene = bpy.context.scene 

hope this helps

if it does - you can return the favor helping me get rid of objects that are already unlinked but hang around in a .blend file for some reason… with or without python - they’re driving me crazy…
also - how do you call bpy.ops commands from a script that runs in the properties panel? actually I just want to subdivide a mesh but I can’t figure out how except with ops…

Thank you Uncle Entity and teldredge.
I’m going to test this, and since apparently a formal tutorial does not exist, I’ll use your feedback to create one myself.

teldredge: I’ll keep your problem in mind. If I find something that can help, I’ll remember to share it with you, in your thread. But remember that I am a complete newbie, so don’t hold your breath…

To answer my own question, any interested python newbie should first go through the official documentation and tutorial: