0
$\begingroup$

I'm failing to set the active control point of a nurbs curve using bpy.

For context, I'm trying to add a hook to a selected pose bone. The following snippet demonstrates the idea. A pose bone is already selected:

ob = bpy.context.active_object
curve = ob.data.splines[0]
scene = bpy.context.scene

ob.select = True
scene.objects.active = ob  

bpy.ops.object.mode_set(mode = 'EDIT')
bpy.ops.curve.select_all(action='DESELECT')
curve.points[0].select = True
bpy.ops.object.hook_add_selob(use_bone=True)

This returns the following error:

RuntimeError: Error: Requires selected vertices or active vertex group
$\endgroup$
3
  • $\begingroup$ Related blender.stackexchange.com/questions/81395/… $\endgroup$ Commented Jul 11, 2018 at 12:23
  • $\begingroup$ Thanks for this. There's no equivalent 'active' property on the collection of spline points. bmesh isn't applicable because the curve is not a mesh. $\endgroup$
    – MattA
    Commented Jul 13, 2018 at 15:16
  • $\begingroup$ Also, there's no applicable operator under bpy.ops.curve. $\endgroup$
    – MattA
    Commented Jul 13, 2018 at 15:17

0

You must log in to answer this question.

Browse other questions tagged .