Updating curve handles by location of other objects I'd like to use blender to animate motion of nodes in a graph (~50000 nodes) that I've exported from gephi (different layouts of the same graph). Let's call them spheres to avoid confusing them with Blender's material/compositing nodes. Similarly, instead of graph edges, let's call them connections.

I'm pretty sure the best way to handle the spheres is with duplivert, but I'm having trouble with the connections.

I'm trying things out on a small graph before I scale up. Here I have bezier curves set up for the connections, getting the appropriate curvature by scaling the handles. Looks fine for a static image, but will quickly break down when the spheres start moving.



The first thing to do is hook the curve ends to the spheres. This way, the curves move around when the spheres do. The problem now is getting the handles rotated and scaled based on the new sphere positions:



Is there a way to get the connections' curve handles to be pointed in the right direction, and scaled to give appropriate curvature, based on the position of the speheres?
Assumption: If your graph has approx 50k junctions, I will assume you will import/generate such graph with python in blender.

If I were you, I would do all the animating also with python. If you do that, you also don't need to set all the hooks with python (yay!).


When you'll be building the graph, store junctions and connections into some list. You should use some nice classes for them and remember inside them what belongs to what and also remember data paths to each connection ends and handles vertices.
Then you create a function that will receive such list via a global variable and that will edit all junction positions and connections vertices and handles according to current frame. The function only takes 1 parameter - the scene.

def update_fce(scene):
    # get data
    global list

    # get frame
    frame = scene.frame_current

    # here move stuff to where it is supposed to be at frame
    return

The last step is to add this function into frame change callback list so it is called everytime the frame is changed:

bpy.app.handlers.frame_change_pre.append(update_fce)