/ by Toni
After seeing promising animation tests by Lee (video, blend) with curves in Blender last week, I started experimenting with them in BPython. The challenge is to create large amounts of them in a controlled manner, and have them well manipulable and animatable after creation, too. Now I have a first version put together for all you to see and comment, and hopefully start developing further too! It is not really useful yet, and the current visual output is nowhere near Orange standards, but the code proves the basic concept and brought up issues that had to be fixed (in the API code).
Here’s how it works: when started, a so-called ‘guiding curve’ must be assigned first. It should be a Bezier curve, and its shape is then used as the base for the newly created curves. After assigning a selected curve to be the guiding curve with the GUI button, a slider can be used to set the amount of generated curves around the ‘guide’. In this first test the generation is fixed to proceed along the z-axis (which is up/down in the front view), but the idea is to use another shape (called ‘target’) to define the area to be filled / shape to be generated. That’s the first major todo point for version 0.2, animation features coming as second.
The cool thing is that the generated curves can not only be generated, by also deleted by the script. And not only during the run, but also after restarts. This is different from otherwise similar scripts, like the L-System generator and Beast (I must still look more into makehuman, which probably handles this well too). Also, the generated curves can be e.g. deleted in the normal Blender UI, and the script/manipulator notes it. This is a central challenge: to allow both automated and manual editing of the same things, so that things keep in sync and tools can be as powerful as ever. I’m currently using parenting to get the info in the script about which curves are to be manipulated, so if a modeller wants to make sure that some generated and perhaps afterwards modified, curve can’t be deleted by this tool, that can be ensured by clearing parenting. But then the script can’t control that curve for animation anymore.. so there sure are interesting challenged down this road still!
Yet a bit deeper into technical details and issues encountered there: we are using Bezier curves, because like the way they are controlled with the handles. So on the scripting side, I had to learn about the unpublished and partly unfinished BezTriple BPython module. In fact, most of the time in this work so far has gone into figuring out the ways to use that part of the API, and fixing bugs in it. There’s a memory leak and some inconveniences in the latest release version 2.37a, but I’m happy to report that the current cvs works without problems now. Thanks a lot to the Python Team guys for the great support in sorting those problems out! For future developments, I already added a way to add the tapering curve to the API, and will probably need to look into manipulating the modifier stack too. So am afraid that the development of the actual script, and the visual quality of it’s output, will not develope as quickly as it could with having perfect tools ready at hand, but of course it’s great to get to enhance the API and work with Blender itself — it’s the idea of the project, after all.
Finally, I’d like to invite anyone interested to suggest ideas, and the fellow scriptwriters to take a look at the approach. Nothing about this is set in stone — it’s just a first test and an example of one possibility. Especially I’m hoping to get views on how existing tools, like Beast, relate to this. Perhaps these features (curve support, deleting / regenerating / manipulating after restarts, animation, ..) could be even merged there, or we could have some new joint project that takes elements from both (and perhaps e.g. from the lsystem generator too). I’d be ready to take this further in a public CVS that we can set-up on the Blender projects website if there’s interest. And of course can use the Blenderdev wiki to form ideas etc. Also, I just created an irc channel called #blenderpython on freenode as a place to coordinate tool development and will hang out there.
Oh and to try this yourself, the source is curvepulator_01.py and a test blend is there too. It should work to some extent on 2.37a (try removing the __future__ import as it does not seem to work there), but requires the extra ScriptUI module with my modifications, as discussed on the ScriptUI Elysiun thread. To get the new fixes in the BezTriple module, and coming animation features using tapering etc., a current version from CVS is needed at this point (we’ll see if ScriptUI ends up there or not).