How much of the software is exposed through Python?

I haven’t done much with python programming but I have seen that you can extend the interface and rearrange things (for example, adding a button that would import a fully rigged human mesh or putting ambient occlusion in the Physics tab if some odd reason compelled you to).

Note that this isn’t a feature request. It’s something I plan on adding myself but I need to know which route I need to take. Is it possible to add constraints via python? I have an idea for an improved floor constraint. The current one seems to have a global effect. If you add it to an object and set a 2 x 2 BU cube as the target it still takes effect if the object with the constraint is 1,000 BU away.

It would be more useful, to me at least, if you could specify an area of effect. For example, if it’s within a radius of 2 BU of the target’s origin it locks the object but if it’s 3 BU away it can move on the axis set in the constraint without constraint. The only way I can think of at the moment is adding drivers to the influence value but if an object has constraints for several other objects in the scene that could take a while and get a bit messy (I’m also aware that adding the function would take longer than setting up the drivers in a scene, but as often as I’d use it I’d save time in the long run).

Is this something I can do through Python or do I need to download the source and hard code the constraint in?

Nope, py-constraints aren’t possible in 2.6x.

You could emulate a constraint by running your code in a frame change handler or a scripted function that a driver calls (assign the driver to an Empty that constantly spins). Only operations upon bpy.data itself are typically valid when programming in this style. This is similar to emulating a modifier as well.

Wow. Sounds like the constraint system is a real problem. Not only doesn’t it work as expected, the code isn’t documented, the guy who wrote it is long gone, and it can’t be ripped out and replaced without jeopardizing the rest of Blender. That’s a hell of a pickle to be in; I don’t envy the devs.

Nah, it wouldn’t be too hard for some motivated individual to get py-constraints working, I started on it myself but don’t really feel like going through 237 rounds of code review and having it sit on the patch tracker for a couple years like the last time I worked on code that touches the animation system.

Bitter? …perhaps.

That brings up another question. If add this constraint do I have to release the changes or can I just keep it for “in house” use? To be honest I’m not sure how to go about submitting anything.

contribution wiki:
http://wiki.blender.org/index.php/Dev:Doc/New_Committer_Info
http://wiki.blender.org/index.php/Dev:Doc/Process/Patches

If you’re going to go through all the trouble of implementing it you may as well try to get it into trunk…