# How can I access, edit, add and remove Metaballs in Edit Mode with Animation Nodes?

I'm working on a rather complex animation where I plan to use Metaballs to shape a certain geometry in combination with Animation Nodes. I have managed to get what I want by using the Object Instancer node, and the result looks just fine. But the Viewport becomes unbearable slow because of the high amount of Objects in the scene. The Polycount thanks to Metaball merging would not be an issue though.

To improve that interaction performance, I'd like to place, add and edit my metaballs in Edit Mode instead. Is this possible? Merging the Object Instances into one new target mesh would by the way also work for me, I just couldn't find a node that does this.

You can use a simple script as follows, you access the required metaball data block by name, clear its balls, and add new metaballs and edit their attributes like location and radius:

mball = bpy.data.metaballs[name]
mball.elements.clear()
for v, r in zip(locations, radii):
ele = mball.elements.new()
ele.co = v

• Fantastic answer as always. I've improved it slightly by adding a target socket and filling the metaball data with mball = Target.data, so I can interactively set it. The speedup is enormous, funnily also concerning generation of a solution in general. Nov 16 '18 at 11:44