The following code separates unconnected splines into individual curve objects just fine (as far as I can tell).
curve = bpy.context.object if len(curve.data.splines) > 1: bpy.ops.object.mode_set(mode='EDIT') bpy.ops.curve.select_all(action='DESELECT') while len(curve.data.splines) > 1: for point in curve.data.splines.bezier_points: point.select_control_point = True bpy.ops.curve.separate() bpy.ops.object.mode_set(mode='OBJECT')
This code snippet is part of a much larger addon and I make a habit of avoiding bpy.ops so I don't have to worry about context or changing the active object.
Is there a relatively simple way of doing the same thing without bpy.ops or should I just stick to
bpy.ops.curve.separate() for it's simplicity?