New Metaballs API in CVS

Hi, Not sure how many people use existing metaballs API, but when I tried to recreate the bone > metaballs script as an example for the docs I stumbeled accross quite a few problems and decieded it needed to be updated to be inline with the quality of the rest of Blenders python API’s.

If anyone wants a hand in making there scripts compatible with the next release of blender, you can post your scripts here.

EpyDocs are here.


This looks fantastic. Much cleaner…


If theres anything missing or could be added- let me know.
Possible variable access- matrix, inverseMatrix, bounds

When Im less buisy Ill test this API more with a povray/blob exporter,

As I gather, now one would be able to create “creature” body meshes from armatures ? Will it be possible to “Alt-C” - i.e. convert metaball to mesh from script so the process could be fully automated?

I must admit, I am not quite sure, what it does - but I never worked with Metaballs in Blender before :eek:

If I may though, I would like to propose curve-metaballs as well and I would
love it, if I could influence the extension of the metaballs by each subsection of the curve :stuck_out_tongue: (not sure how, since they do not implement vertex-painting or such :confused:

Anyway - thank you very much for constantly improving blender (of course like so many others out there :rolleyes:


Quaternions seem to be broken with the new Metaballs API:

import Blender
from Blender import Mathutils
ob =  Blender.Object.New("Mball","mb")
mb = Blender.Metaball.New()
quat = Mathutils.Quaternion()
sc = Blender.Scene.GetCurrent()

gives a “TypeError:expected quat argument”

Am I missing something obvious?


Thanks for the report. fixed in the cvs.

Alt+C can be done from Python - if you make a metaball object you can get it as a mesh.

me= Mesh.New()

Hrmmm…I’m still getting the same error - does the fix take a while to get into CVS?


Are you compiling your own build, or downloading a build from somewhere?


if you want to get quick updates its worth doing your own builds. I have a script that I run daily that updates and compiles blender on windows and linux.
CVS Builds are quite stable, in general. unless your using features that have just been added (like this one)

>>> Alt+C can be done from Python - if you make a metaball object you can get it as a mesh.

me= Mesh.New()

ouch. this one was completely under my radar.

I’m compiling it from the source in bf-blender-2006-9-18.tgz…I’ll try it again - maybe I did something stupid, like re-compiling the last download:rolleyes:

Hmmm…the source I have doesn’t have the changes yet - I’ll try downloading from CVS tonight - just have to figure out when midnight in Amsterdam is…:smiley:


Well I’d love to build my own, and muck about with the source :slight_smile:

I had a MinqW build environment working until something drastically changed around the release of 2.42a, (I think it was the external libraries were included), since then my build environment has been broken and I’ve started a couple of times to try to fix it, but it’s like looking at Mt. Everest :), so I’ve been just using JMS’s window’s builds which he updates almost every day.

btw, I just submitted a bug report #5008, it appears that something drastic was changed with the armature system / mesh parenting in the past couple of weeks or even days, as parenting a mesh to an armature with “create vertexes from closest bones” is now crashing CVS builds from the last few weeks. I hadn’t tried that parenting up until today when I was trying it for some other reason.


Are you downloading an archive, or using a CVS client to connect directly? (The second should give you whatever is in the commit logs … I think :smiley:


Mike_S: I’ve looked into your bug, and the easiest fix would just be for the code to check that there actually is the variable in question. However, looks like there may be something wrong earlier down the track.


All is well - works like a charm! The change hadn’t made it into CVS yet. Its all starting to make sense now…


This will certainly be useful. Doing things with the old method is very ungainly.

Here’s an quick example that I was just about to post:

It has the interesting behavior of not updating the metaobject until you enter editmode for that object. It’s possible to do a:


to force an update in the script, but that is NOT recommended if you have scripts like the one in the file set to run on redraw.

I’ve made other versions with properly named individual metaobjects such that updates are live, but it’s not nearly as clean as using metaelements, and it seems more computationally intensive.

As a related issue, maybe someone has a fix for the following problem.

Open up that .blend file I posted and make the armature and the metaball members of a group. Then make a new empty and make it a dupligroup for the group you just made. On my system this works fine, and it will update nicely until you enter editmode on the source metaobject.

To get around this, I’ve had to avoid using metaballs for duplicated systems, but it’s a pity considering how nicely they work for my applications.

JonathanK, thanks for the report, Ill look into a way of updating metaballs, as for metaballs not working in a dupligroup (crashed in my case), thats a bug in Blender - not anything to do with the python API, Could you file a bug report on the tracker?

  • Cam