I was playing with topix yesterday and made some improvements, mostly on the user interface side, although I did enable a few topix features that the original python module didn’t allow.
There’s gobs of explanation of what I did in the .blend file, too much probably, :). But to save those people on slow connections from downloading something they don’t want, I’ll outline the status of this here.
I exposed all topix cloth parameters to the python API now, enabled the TAGGED/pinned feature of topix, added better support for collision spheres animated via their parents, added a floor (min Z coord cloth can’t go below), put a python UI in front of everything, fixed some memory problems in topixmodule.c, put some Py_DECREFs in that I believe should have been in there, generally hacked on the code, changed the process of the simulation more or less completely and spent way too much time today putting the .blend file and these .avis together. While I was doing this, I was teaching myself the python C API, python in general and blender’s python interface. Some of these later things I expect are reflected in the code I produced, :).
I definitely didn’t make topix a completely different animal, so don’t get your hopes up that we now have a “real” cloth solution for blender. Basically all of the old limitations still exist. Only collision detection with spheres is supported, you can only apply the simulation against Grid meshes and it consumes enormous amounts of memory and still will (until the design changes) even when the memory leaks are gone. Oh, did I forget to mention those ?
One of the things I changed in the process was switching from updating the mesh via a framechanged script link to having python make absolute vertex keys for each frame. This resolved the problem of subsurfaced meshes disappearing when you changed the frame and allowed you to run the simulation once, save it in your .blend file and play it back. However, I just noticed putting the examples together that I ran into a limit of 100 frames of animation this way, so 2 steps forward, one step backward.
At this point, I believe this has some use in certain situations, although the 100 frame limit is pretty tough for many purposes. I’m not sure where I want to go with this at this moment. I making it available in case it sparks some interest and is useful to someone. I plan on rewriting the C code to clean it up and look at solving some of the interactions between it and blender that are the biggest limiting factors. However, when I actually get around to working on it again is another question, so rather than let this sit collecting dust for months before I touch it again, I’m making it available as is.
Here’s the user interface I put in front of it:
EDIT: removed temporary links from when stephern2002’s server was down.
Example1.avi shows a cloth falling on a sphere.
Example2.avi is a flag waving.
Example3.avi shows pinned cloth unpinning and then falling on some moving spheres.
THE .ZIP BELOW CONTAINS A COMPILED MODULE FOR LINUX i386 AND MY EXAMPLE BLEND FILE. IF YOU NEED IT FOR A DIFFERENT CPU OR OS, YOU’LL HAVE TO COMPILE YOURSELF OR GET FROM ANOTHER PARTY. ALL SOURCE CODE AND MY MAKEFILE ARE IN THE .blend FILE. Sorry, I only have development tools under linux. You can play back and render the example animations though as they are stored in the file as vertex keys. You just won’t be able to run the simulator if you don’t have a compiled module for your computer.
Cloth2.zip is available here and contains the .blend file and topixmodule.so (compiled for linux p4). My python code (cloth2.py), C code (topixmodule.c) and Makefile are text files in the .blend file.
EDIT: Changed topixmodule.so in the .zip to i386 from p4, edited note above to reflect that.