Mesh Deform Bind to multiple objects

Hi everyone,
I’m having troubles with a little script I typed from informations I got around the net, I’d need to Bind 720 objects to a ‘cage’ using the Mesh Deform modifier.

Using the Copy attributes menu addon, I copied the Mesh Deform modifier from an object that was already binded to the ‘cage’ into all the objects, but they just got the modifier without being binded.

I’d like to select all the 720 objects that now have the Mesh Deform modifier, and bind all of them to the ‘cage’ with a script, instead of click bind for all the objects…

After searching around, I came up with this little code:

import bpy
for obj in bpy.data.objects:
     bpy.ops.object.meshdeform_bind(modifier="mesh_deform")

but when I run it, I just get hundreds of ‘CANCELLED’ in the console …
can someone help me?

thanks in advance

bpy.ops.object.meshdeform_bind() acts on the active object, you need to change that in your loop


import bpy
sce = bpy.context.scene
for obj in bpy.data.objects:
     sce.objects.active = obj
     bpy.ops.object.meshdeform_bind(modifier="mesh_deform")

Not sure what else it requires, or if there’s a low-level replacement for the operator call (I don’t think so).

Are all of your objects identical? Because it would be much fast if you created one objects and duplicated that.

Thanks for the reply :slight_smile:

My scene is a complete track circuit for a racing game, as you can imagine I have track, grass, fences, kerbs, etc …

I did everything like it was a flat track, while it isn’t … so I’d like to add the bumps now, and with the Mesh Deform I can succesfully increase and decrease the level of the surface in the parts I need.

But well, I can’t move only the track and leave everything else flat, so I just thought I could include everything else in the Mesh Deform, but I can’t really stay there and Bind every object one by one, would take too much time …

I just tried your code, but it acts the same way, still all those ‘CANCELLED’ …

Might be because the modifier is already there? do you think I can try to add the modifier, set the ‘cage’ to follow and then bind directly from the script?

or there might be another way to do those bumps involving all the objects?

Thanks for your support :smiley: