I'm trying to hook an object - namely a cube, which is a Mesh - to a specified control point of a Bezier curve - which is a Curve - by scripting. So I do the following and it doesn't work:
bpy.data.objects['Cube'].select = True # it has to be selected
bpy.data.objects['BezierCircle'].select = True # it has to be selected too
# and it has to be the active one as well
bpy.context.scene.objects.active = bpy.data.objects['BezierCircle'].splines[0].bezier_points[0]
It says that it doesn't find the 'splines' attribute. OK, so if I change it to a curve, like this:
bpy.data.objects['Cube'].select = True
bpy.data.objects['BezierCircle'].select = True
bpy.context.scene.objects.active = bpy.data.curves['BezierCircle'].splines[0].bezier_points[0]
then it says that it is expecting an Object, and not a BezierSplinePoint.
If it would be accepted, the following command should do the hooking:
bpy.ops.object.hook_add_selob(use_bone = False)
So that the Cube would be hooked to the control point I'm indexing.
Now what do you suggest I should do?