IPO curve manipulation via Python


I’m currently working on some research on how to make a procedural dance script, and am almost finished. I set each pose with insertKey(…) and am attempting to make the dance look less robotic by manipulating the IPO location and rotation curves with the bezierPoints attribute. I’ve gotten the points to move to where I want them, but once I run the animation once, and then stop the animation, the bezier points are back to their original positions (before I manually changed them). What would be doing this?


Hi there.

In fact, I am currently working on the same problem - manipulating IPO curves by a Python script as a part of making some dancing via a bigger Python script. I have some achievements and - of course - I am still missing something as I am NOT finished the script yet.

Here’s a list of problems and conclusions that I have based on my experience on the metter (as I had similar problems with the same issues like you at earlier stage):

I am not clear if you are totally doing EVERYTHING with your script or just a part + some manual manipulation. If the latter is your case - may be you’re missing something in your script. It could be that:

  1. you have made your poses, keyframes, etc., then when you manually manipulate IPO-curves this fact is not recognised by the script or it is NOT included into your poses/frames sequence, i.e. the effect of insertKey(…) is missing

  2. if you “read” you manual actions some how by your script, may be IpoCurve.recalc() is missing --> it does the “update”

In my case, I had the first situation so I needed to rework my script to reflect changes in the IPOs as well by posebone.insertKey method for the respective bones in the respective frame (keyframe). Perhaps you’re doing the same or similar. Now I cope with the problem of decreasing the number of unwanted keys (nodes) in IPOs as many of them do not carry any specific info about the body movement.

I’d be happy if I helped you…


I am doing everything via python, nothing “by hand” or by mouse. I don’t want to have to set any more keyframes unless I have to, shouldn’t just setting the IPOs work? It looks right after I run the script once! Animating it once is fine… but the moment I stop the animation it’s back to what the curves would look like as if I hadn’t changed the IPOs at all.

On a side note, I’d love to hear more about your project. I’m currently researching how to make an interpreter for a dance language, but first I have to make dance procedurally.


If I’ve got your idea correctly, you’re doing everything by a script. Including the animation, I mean. In my case it is not included into the script control. In general, my idea is to produce a script to help my work on setting up poses in frames for any projected animation of a human or human-like body in Blender. Everyone lnows that it is a very time-consuming process. The idea was inspired by a wish to interpret (copy) in Blender a clip of a dancing girl which I saw in YouTube. So it’s a principle issue - to control the poses easily when projecting what you need for the resulting clip. Human movements are very complex and that’s why many artifacially made clips look like some kind of movements of a robot, machine, etc. and it is extremely difficult to produce clips that are naturally nice, i.e. while looking them the viewer to NOT develop the impression that the person/figure/body is mashine-like, artificial, etc. Now we have the Makehuman software which produces relatively nice meshes for bodies that can be used in such a clip I am talking about. Makehuman has its deficiences though (see another Blender forum topic where I have wrote something on the matter: http://forum.nystic.com/viewtopic.php?f=9&t=4813). MH-produced meshes need a lot of further editing if you like this to resemble a particular human, for example, an actor/actress, dancer, your relative, etc. This type of re-work would be a subject of another script that I will produce later on. :slight_smile: These meshes are very hard to control by any CORRECTLY set-up armature as this is a matter of computing power. But before reaching this stage, one needs to solve the natural movements issue as this is really the key issue because no matter what your human (man, woman, girl, child, monkey, humanoid) looks like it needs to move nicely and without ANY (visible) distortions. To testing how to control this (movement control) I prepared a conceptual model which carries information of ALL important human characteristics - size, proportions, form - and in the same time is rather simplified. In comparison with the MH-meshes my conceptual model has 10 to 20 times less number of vertices which makes the model more operable. My idea is when everything is OK with controling the conceptual model, then apply the same approach (the same script, armature, etc.) to more complicated MH-mesh or modification of MH-mesh as there may be such a need. I havent tried it but as soon as size, proportions are correct in the conceptual model it should work… :wink: I think you are getting the main ideas of what I plan to do… Although it is possible, I dont plan to do animation by a script as animations have a lot of settings but in the same time it is fairly easy to make them manually. So far I have a rather complicated script consisting of 2,000 program rows that already do control poses, introduction of new movements, editing “old” poses (i.e. making doubles as in the film industry with the difference that my script does NOT record “old” poses or frame/movement set-up. I would say - so far it doesnt do this… At this stage, the control board of the script (in a state to showing arms preset buttons + some testing buttons for IPOs) is here: http://www.geocities.com/elonsie/Blender/Robo/Script_control_board.jpg. Last week I made a simple boxer. You can see more about this here: http://forum.nystic.com/viewtopic.php?f=9&t=5302

The model has 54 bones. I know that the real human body has more bones but for the purposes described above those 54 bones are completely sufficient. For a real model there may be a need for some more bones to control the face, but for the conceptual model it is NOT an issue. Therefore, my script is to control ALL movements of ALL bones of the model. Speaking of armature bones, movement control means control over rotation of bones. Movement of the whole body itself is made by moving around a base control point of the body. So control of the bones/armature/poses is implemented in two phases or in two ways if you wish. My script has controls for fine setting up (tunning) of bones rotations on X,Y and Z. Script also has several sets of “speed” buttons which set up directly specific poses of group bones, for example - the the arm extended upwards, with palms facing front and fingers wide spread… :slight_smile: This is possible to be achieved by fine-tunning controls but will take you about 3 to 5 minutes if you are quick & have excelent 3D orientation & you’re NOT mistaken in the setting-ip process. That’s why the speed-up buttons are very helpful for raw set-up as in general you need more complicated poses and you would need a compination with fine-tune buttons to achieve the pose you’re aiming to. Fine tuning is NOT extremely fine cause it sets up rotation angles with presision of 1 degree (no less, no fractions of the degree) which is sufficient as it is extremely difficult for any viewer to practically see the difference of 1 degree or less in a pose that appear in the animation in less than 0.05 sec. Therefore, for practice, working with whole degrees (integer value or values rounded to integer) is absolutely sufficient. This simplifies the designer work and script work, too! Interpolation between keyframes (which is done by Blender itself) do use fractions of degrees of rotation and I (my script) does not mess with it as it should be exactly like this. :slight_smile: For setting up poses, the script manipulates the IPO-objects assigned to each bone and - of course - each IPO-curve for their rotations. For practical resons (again!), I assume LINEAR interpolation mode of all IPO-curves. In future, this could be changed to BEZIER type but so far I have to develop a procedure to control how to exclude (delete) keys from IPO-curves that are really NOT need to be there. This is exactly the place where I am in my work on the scripting tool. After I wrote an answer yesterday to your posting, I issued a new thread on that issue but so far I dont see it published here. I only got a “normal” forum’s message that the moderator(s) should first approve the content. I waited for 1 hour and it wasnt published (or at least I cant see it here). It is strange why I can send you responses without any problem but when I issue a new thread with NEW questions on the matter (which is not identical to your here), this doesnt appear here… Any way, the issue of my interes was to learn what is the relation of values of QuatX,Y,Z,W IPO-curves and the angle of rotation of the respective bone. You realise that it is important while a script is trying to control keys of IPO-curves. Another question is: What QuatW IPO-curve stands for? I havent found anything on both issues so far… Nevertheless, I was able to produce yesterday a procedure that judges which keys of an IPO-curve are really needed for the resulting animation. It is important to NOT include unwanted keys in IPO-curves while seting-up your poses or (alternatively) purge the IPO-curves from time to time eliminating (deleting) some keys that practically do NOT have effect on the resulting animation. I stick to the second option as the first option would require much more complicated calculations plus the fact that these calculations should be made each time you touch a bone thus dramatically decrease the work speed of the script. It may be reasonable to do this cleaning when exiting the script or manually by clicking of a button from time to time. I havent decided on the issue so far, may be both will be implemented as the animation production itself will stay out of script and will be done manually (see above).

Phew… :slight_smile:

That’s for now from me. I’d be happy to exchange views/ideas on the matter and/or may be work together in future. I dont know about you, but so far I am doing everything in my free time in a form of a hobby. I’d waiting for an answer on the two questions related to IPO-curves (see above) if you’re more deep in this matter. Please also share info on your project. So far I suspect that we are doing the same independently. Parhaps it is implemented in two different ways. Should you be interested (or someone else) I’d be able to provide more info on my development and conclusions related to the theme we are discussing here.


Hey, I sent you a response 2 hours ago but it is NOT published yet. I dont know why :eek:

Perhaps because it contained external links to pics, clips that I made…??? But is it NOT allowed to post external links here?

I hope that this message will reach you as our discussion is positive and fruitful :wink:


It doesn’t look like your other response will go through at all. You could try sending the links to me via private message?

Ok, I’d be able to do that tomorrow morning as I dont have a copy here of what I have written to you earlier today. It is now 20.34 hrs here, i.e.GMT+2…

Oh well, I see that now my missing post is published and I dont need to rewrite it. :wink: