2
$\begingroup$

I've seen several posts suggesting that it's better to write functions that manipulate bpy.data directly, instead of using the bpy.ops operators. I can understand the argument about how operators such as bpy.ops.mesh.separate() are meant for the user interface, requiring context such as the active object or the mode (object vs. edit), usually given by the user.

But the operators are convenient because they embody so much of Blender's functionality already, and I don't want to have to re-code that from scratch... So where I can find this functionality in Blender's API, apart from the bpy.ops operators ? Is it in bmesh ?

Here's a specific example : if I want to code the equivalent of "separate", I need (among other things) to identify, in the set of vertices that I want to separate, which ones are on the 'borders', so I can duplicate them. This would probably involve navigating around the mesh data, iterating over each vertex's neighbors, and checking whether they're inside my set. Not trivial for a newbie. So is there a function for this ?

$\endgroup$

1 Answer 1

1
$\begingroup$

No, currently the only method for splitting objects uses bpy.ops, there aren't always API equivalents for each blender operator.

$\endgroup$
2
  • $\begingroup$ Isn't bmesh module able of re-creating the functionality? It will probably be slower than the operator, it should be possible to implement however. $\endgroup$
    – CodeManX
    Commented May 9, 2014 at 9:57
  • $\begingroup$ Its possible to write in bmesh, and fairly fast since bmesh has connectivity data, but functionality doesn't exist out-of-the-box. $\endgroup$
    – ideasman42
    Commented May 9, 2014 at 10:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .