[Solved]Problem with bpy.ops.mesh.rip()

I need to rip edges with bpy.ops.mesh.rip(), but I can’t get it to work from my script. Check my blend file

  • at first run the script called “Rip1” by pressing “Run Script”
  • press “Space” and type “Rip1” and run the operator
  • nothing will happen -> no edges get ripped and if you check the system console(Window -> Toogle System Console) there’s message " wm_operator_invoke: invalid operator call ‘MESH_OT_rip’ "
  • if you now again press “Space” but type “Rip”(Blender’s internal operator) and run the one without shorcut “V” assigned, ripping works fine(if you press “G” and move your mouse you can see the selected edge was ripped)
  • also if you check top “Info” window you can see that the same function(bpy.ops.mesh.rip()) I use in my script was called

What am I missing or it’s just a bug???

The execution context is EXEC_DEFAULT when you try to call it, but it only supports INVOKE_DEFAULT.

Why? Because there is no deterministic solution, as the operator relies on the view and mouse location to determine what to rip. These kinds of operators need to be invoked, e.g.


But still, the results depend on the 3D View, so you should use a different way to rip things (unless you don’t care what piece of geometry is disconnected from another).

It appears that bmesh.utils.vert_separate() is an equivalent bmesh module operation if you pass it a vertex and all linked edges but one.

oh snap… thank you CoDEmaX, bpy.ops.mesh.rip(‘INVOKE_DEFAULT’) actually solves my issue, because I run my operator from 3D view and it doesn’t need mouse location, because rip function uses selected edges to know what to rip.
Btw. where did you get this info from, I mean where I can get the execution context for specific operator? It’s not mentioned in Online python reference.

You need to see the original code (whether it defines invoke or execute), or try the default context and see if you get an error like you reported above