python modifier (or python parametric mesh)

Hi all, I’m brand new to blender, but relatively seasoned generative graphics coder. I’m now trying out blender. Loving it so far.

i’m wondering if it 's possible to create a python modifier. I.e. i want to write a script, that runs on an attached object every frame, taking time as a parameter, and any custom parameters the object might have (ideally the script would expose custom parameters).

i have a number of applications in mind:

  • to act as a parametric mesh deformer. i.e. act on every vertex of the mesh, and move to a new position, f(x, y, z, time). E.g. like a very bespoke ‘warp’ modifier.

  • take the object it’s attached to, and duplicate it around the scene, with custom transformations, animating over time (kind of like the mograph plugin for C4D).

It’s very hard to google this because all search results for any combinations of the words “python modifier blender” always return “how to add a modifier in python in blender” which is not what I’m after.

is this possible? Do I need to write a plugin for this kind of behaviour? Or do I use the game engine? Ultimately I’m not bothered about this running realtime. I want to render it through blender, not opengl.

Just to be clear, you can’t write a modifier for the modifier stack in Python. None of that stuff is exposed in the Python API.

But you can emulate what a modifier does on a frame change. That is the premise behind the Parametric Beam AddOn. Because the code generates the mesh every frame, it act like a modifier at the bottom of the stack. So you can still put other modifiers on top of the object. You just can’t move the code further up the stack.

So there are limitations but it is as close as you can get to making an modifier in python. Beyond that you have to dig into the Blender Source Code.