bpy.context
bpy.contextbpy.context.areabpy.context.asset_file_handlebpy.context.blend_databpy.context.collectiobpy.context.enginebpy.context.gizmo_groupbpy.context.layer_collectionbpy.context.modebpy.context.preferencesbpy.context.regionbpy.context.region_databpy.context.scenebpy.context.screenbpy.context.space_databpy.context.tool_settingsbpy.context.view_layerbpy.context.windowbpy.context.window_managerbpy.context.workspacebpy.context.texture_slotbpy.context.scenebpy.context.worldbpy.context.objectbpy.context.meshbpy.context.armaturebpy.context.latticebpy.context.curvebpy.context.meta_ballbpy.context.lightbpy.context.speakerbpy.context.lightprobebpy.context.camerabpy.context.materialbpy.context.material_slotbpy.context.texturebpy.context.texture_userbpy.context.texture_user_propertybpy.context.bonebpy.context.edit_bonebpy.context.pose_bonebpy.context.particle_systembpy.context.particle_system_editablebpy.context.particle_settingsbpy.context.clothbpy.context.soft_bodybpy.context.fluidbpy.context.collisionbpy.context.brushbpy.context.dynamic_paintbpy.context.line_stylebpy.context.collectionbpy.context.gpencilbpy.context.curvesbpy.context.volumebpy.context.edit_movieclipbpy.context.edit_maskbpy.context.active_filebpy.context.selected_filesbpy.context.asset_library_refbpy.context.selected_asset_filesbpy.context.idbpy.context.edit_imagebpy.context.edit_maskbpy.context.selected_nodesbpy.context.active_nodebpy.context.lightbpy.context.materialbpy.context.worldbpy.context.scenebpy.context.view_layerbpy.context.visible_objectsbpy.context.selectable_objectsbpy.context.selected_objectsbpy.context.editable_objectsbpy.context.selected_editable_objectsbpy.context.objects_in_modebpy.context.objects_in_mode_unique_databpy.context.visible_bonesbpy.context.editable_bonesbpy.context.selected_bonesbpy.context.selected_editable_bonesbpy.context.visible_pose_bonesbpy.context.selected_pose_bonesbpy.context.selected_pose_bones_from_active_objectbpy.context.active_bonebpy.context.active_pose_bonebpy.context.active_objectbpy.context.objectbpy.context.edit_objectbpy.context.sculpt_objectbpy.context.vertex_paint_objectbpy.context.weight_paint_objectbpy.context.image_paint_objectbpy.context.particle_edit_objectbpy.context.pose_objectbpy.context.active_sequence_stripbpy.context.sequencesbpy.context.selected_sequencesbpy.context.selected_editable_sequencesbpy.context.active_nla_trackbpy.context.active_nla_stripbpy.context.selected_nla_stripsbpy.context.selected_movieclip_tracksbpy.context.gpencil_databpy.context.gpencil_data_ownerbpy.context.annotation_databpy.context.annotation_data_ownerbpy.context.visible_gpencil_layersbpy.context.editable_gpencil_layersbpy.context.editable_gpencil_strokesbpy.context.active_gpencil_layerbpy.context.active_gpencil_framebpy.context.active_annotation_layerbpy.context.active_operatorbpy.context.active_actionbpy.context.selected_visible_actionsbpy.context.selected_editable_actionsbpy.context.visible_fcurvesbpy.context.editable_fcurvesbpy.context.selected_visible_fcurvesbpy.context.selected_editable_fcurvesbpy.context.active_editable_fcurvebpy.context.selected_editable_keyframesbpy.context.ui_listbpy.context.asset_library_refbpy.context.edit_maskbpy.context.edit_textbpy.context.active_objectbpy.context.selected_ids
bpy.data
bpy.msgbus
bpy.ops
bpy.ops.actions
bpy.ops.anim
bpy.ops.anim.change_framebpy.ops.anim.channel_select_keysbpy.ops.anim.channels_clean_emptybpy.ops.anim.channels_clickbpy.ops.anim.channels_collapsebpy.ops.anim.channels_deletebpy.ops.anim.channels_editable_togglebpy.ops.anim.channels_expandbpy.ops.anim.channels_fcurves_enablebpy.ops.anim.channels_groupbpy.ops.anim.channels_movebpy.ops.anim.channels_renamebpy.ops.anim.channels_select_allbpy.ops.anim.channels_select_boxbpy.ops.anim.channels_select_filterbpy.ops.anim.channels_setting_disablebpy.ops.anim.channels_setting_enablebpy.ops.anim.channels_setting_togglebpy.ops.anim.channels_ungroupbpy.ops.anim.clear_useless_actionsbpy.ops.anim.copy_driver_buttonbpy.ops.anim.driver_button_addbpy.ops.anim.driver_button_editbpy.ops.anim.driver_button_removebpy.ops.anim.end_frame_setbpy.ops.anim.keyframe_clear_buttonbpy.ops.anim.keyframe_clear_v3dbpy.ops.anim.keyframe_deletebpy.ops.anim.keyframe_delete_buttonbpy.ops.anim.keyframe_delete_by_namebpy.ops.anim.keyframe_delete_v3dbpy.ops.anim.keyframe_insertbpy.ops.anim.keyframe_insert_buttonbpy.ops.anim.keyframe_insert_by_namebpy.ops.anim.keyframe_insert_menubpy.ops.anim.keying_set_active_setbpy.ops.anim.keying_set_addbpy.ops.anim.keying_set_exportbpy.ops.anim.keying_set_path_addbpy.ops.anim.keying_set_path_removebpy.ops.anim.keying_set_removebpy.ops.anim.keyingset_button_addbpy.ops.anim.keyingset_button_removebpy.ops.anim.paste_driver_buttonbpy.ops.anim.previewrange_clearbpy.ops.anim.previewrange_setbpy.ops.anim.start_frame_setbpy.ops.anim.update_animated_transform_constraintsbpy.ops.anim.snapbpy.ops.anim.stashbpy.ops.anim.stash_and_createbpy.ops.anim.unlinkbpy.ops.anim.view_allbpy.ops.anim.view_framebpy.ops.anim.view_selected
bpy.opts.armature
bpy.ops.asset
bpy.ops.boid
bpy.ops.brush
bpy.ops.buttons
bpy.ops.cachefile
bpy.ops.camera
bpy.ops.clip
bpy.ops.clip.add_markerbpy.ops.clip.add_marker_at_clickbpy.ops.clip.add_marker_movebpy.ops.clip.add_marker_slidebpy.ops.clip.apply_solution_scalebpy.ops.clip.average_tracksbpy.ops.clip.bundles_to_meshbpy.ops.clip.camera_preset_addbpy.ops.clip.change_framebpy.ops.clip.clean_tracksbpy.ops.clip.clear_solutionbpy.ops.clip.clear_track_pathbpy.ops.clip.constraint_to_fcurvebpy.ops.clip.copy_tracksbpy.ops.clip.create_plane_trackbpy.ops.clip.cursor_setbpy.ops.clip.delete_markerbpy.ops.clip.delete_proxybpy.ops.clip.delete_trackbpy.ops.clip.detect_featuresbpy.ops.clip.disable_markersbpy.ops.clip.dopesheet_select_channelbpy.ops.clip.dopesheet_view_allbpy.ops.clip.filter_tracksbpy.ops.clip.frame_jumpbpy.ops.clip.graph_center_current_framebpy.ops.clip.graph_delete_curvebpy.ops.clip.graph_delete_knotbpy.ops.clip.graph_disable_markersbpy.ops.clip.graph_selectbpy.ops.clip.graph_select_all_markersbpy.ops.clip.graph_select_boxbpy.ops.clip.graph_view_allbpy.ops.clip.hide_tracksbpy.ops.clip.hide_tracks_clearbpy.ops.clip.join_tracksbpy.ops.clip.keyframe_deletebpy.ops.clip.keyframe_insertbpy.ops.clip.lock_selection_togglebpy.ops.clip.lock_tracksbpy.ops.clip.mode_setbpy.ops.clip.new_image_from_plane_markerbpy.ops.clip.openbpy.ops.clip.paste_tracksbpy.ops.clip.prefetchbpy.ops.clip.rebuild_proxybpy.ops.clip.refine_markersbpy.ops.clip.reloadbpy.ops.clip.selectbpy.ops.clip.select_allbpy.ops.clip.select_boxbpy.ops.clip.select_circlebpy.ops.clip.select_groupedbpy.ops.clip.select_lassobpy.ops.clip.set_active_clipbpy.ops.clip.set_axisbpy.ops.clip.set_center_principalbpy.ops.clip.set_originbpy.ops.clip.set_planebpy.ops.clip.set_scalebpy.ops.clip.set_scene_framebpy.ops.clip.set_solution_scalebpy.ops.clip.set_solver_keyframebpy.ops.clip.set_viewport_backgroundbpy.ops.clip.setup_tracking_scenebpy.ops.clip.slide_markerbpy.ops.clip.slide_plane_markerbpy.ops.clip.solve_camerabpy.ops.clip.stabilize_2d_addbpy.ops.clip.stabilize_2d_removebpy.ops.clip.stabilize_2d_rotation_addbpy.ops.clip.bilize_2d_rotation_removebpy.ops.clip.stabilize_2d_rotation_selectbpy.ops.clip.stabilize_2d_selectbpy.ops.clip.track_color_preset_addbpy.ops.clip.track_copy_colorbpy.ops.clip.track_markersbpy.ops.clip.track_settings_as_defaultbpy.ops.clip.track_settings_to_trackbpy.ops.clip.track_to_emptybpy.ops.clip.tracking_object_newbpy.ops.clip.tracking_object_removebpy.ops.clip.tracking_settings_preset_addbpy.ops.clip.update_image_from_plane_markerbpy.ops.clip.view_allbpy.ops.clip.view_center_cursorbpy.ops.clip.view_ndofbpy.ops.clip.view_panbpy.ops.clip.view_selectedbpy.ops.clip.view_zoombpy.ops.clip.view_zoom_inbpy.ops.clip.view_zoom_outbpy.ops.clip.view_zoom_ratio
bpy.ops.cloth
bpy.ops.collection
bpy.ops.console
bpy.ops.constraint
bpy.ops.curve
bpy.ops.curves
bpy.ops.cycles
bpy.ops.dpaint
bpy.ops.ed
bpy.ops.export_
bpy.ops.file
bpy.ops.fluid
bpy.ops.font
bpy.ops.geometry
bpy.ops.gizmogroup
bpy.ops.gpencil
bpy.ops.gpencil.active_frame_deletebpy.ops.gpencil.active_frames_delete_allbpy.ops.gpencil.annotatebpy.ops.gpencil.annotation_active_frame_deletebpy.ops.gpencil.annotation_addbpy.ops.gpencil.bake_grease_pencil_animationbpy.ops.gpencil.bake_mesh_animationbpy.ops.gpencil.blank_frame_addbpy.ops.gpencil.brush_resetbpy.ops.gpencil.brush_reset_allbpy.ops.gpencil.convertbpy.ops.gpencil.convert_old_filesbpy.ops.gpencil.copybpy.ops.gpencil.data_unlinkbpy.ops.gpencil.deletebpy.ops.gpencil.dissolvebpy.ops.gpencil.drawbpy.ops.gpencil.duplicatebpy.ops.gpencil.duplicate_movebpy.ops.gpencil.editmode_togglebpy.ops.gpencil.extract_palette_vertexbpy.ops.gpencil.extrudebpy.ops.gpencil.extrude_movebpy.ops.gpencil.fillbpy.ops.gpencil.frame_clean_duplicatebpy.ops.gpencil.frame_clean_fillbpy.ops.gpencil.frame_clean_loosebpy.ops.gpencil.frame_duplicatebpy.ops.gpencil.generate_weightsbpy.ops.gpencil.guide_rotatebpy.ops.gpencil.hidebpy.ops.gpencil.image_to_grease_pencilbpy.ops.gpencil.interpolatebpy.ops.gpencil.interpolate_reversebpy.ops.gpencil.interpolate_sequencebpy.ops.gpencil.layer_activebpy.ops.gpencil.layer_addbpy.ops.gpencil.layer_annotation_addbpy.ops.gpencil.layer_annotation_movebpy.ops.gpencil.layer_annotation_removebpy.ops.gpencil.layer_changebpy.ops.gpencil.layer_duplicatebpy.ops.gpencil.layer_duplicate_objectbpy.ops.gpencil.layer_isolatebpy.ops.gpencil.layer_mask_addbpy.ops.gpencil.layer_mask_movebpy.ops.gpencil.layer_mask_removebpy.ops.gpencil.layer_mergebpy.ops.gpencil.layer_movebpy.ops.gpencil.layer_removebpy.ops.gpencil.lock_allbpy.ops.gpencil.lock_layerbpy.ops.gpencil.material_hidebpy.ops.gpencil.material_isolatebpy.ops.gpencil.material_lock_allbpy.ops.gpencil.material_lock_unusedbpy.ops.gpencil.material_revealbpy.ops.gpencil.material_selectbpy.ops.gpencil.material_setbpy.ops.gpencil.material_to_vertex_colorbpy.ops.gpencil.material_unlock_allbpy.ops.gpencil.materials_copy_to_objectbpy.ops.gpencil.move_to_layerbpy.ops.gpencil.paintmode_togglebpy.ops.gpencil.pastebpy.ops.gpencil.primitive_boxbpy.ops.gpencil.primitive_circlebpy.ops.gpencil.primitive_curvebpy.ops.gpencil.primitive_linebpy.ops.gpencil.primitive_polylinebpy.ops.gpencil.recalc_geometrybpy.ops.gpencil.reprojectbpy.ops.gpencil.reset_transform_fillbpy.ops.gpencil.revealbpy.ops.gpencil.sculpt_paintbpy.ops.gpencil.sculptmode_togglebpy.ops.gpencil.segment_addbpy.ops.gpencil.segment_movebpy.ops.gpencil.segment_removebpy.ops.gpencil.selectbpy.ops.gpencil.select_allbpy.ops.gpencil.select_alternatebpy.ops.gpencil.select_boxbpy.ops.gpencil.select_circlebpy.ops.gpencil.select_firstbpy.ops.gpencil.select_groupedbpy.ops.gpencil.select_lassobpy.ops.gpencil.select_lastbpy.ops.gpencil.select_lessbpy.ops.gpencil.select_linkedbpy.ops.gpencil.select_morebpy.ops.gpencil.select_randombpy.ops.gpencil.select_vertex_colorbpy.ops.gpencil.selection_opacity_togglebpy.ops.gpencil.selectmode_togglebpy.ops.gpencil.set_active_materialbpy.ops.gpencil.snap_cursor_to_selectedbpy.ops.gpencil.snap_to_cursorbpy.ops.gpencil.snap_to_gridbpy.ops.gpencil.stroke_apply_thicknessbpy.ops.gpencil.stroke_arrangebpy.ops.gpencil.stroke_caps_setbpy.ops.gpencil.stroke_change_colorbpy.ops.gpencil.stroke_cutterbpy.ops.gpencil.stroke_cyclical_setbpy.ops.gpencil.stroke_editcurve_set_handle_typebpy.ops.gpencil.stroke_enter_editcurve_modebpy.ops.gpencil.stroke_flipbpy.ops.gpencil.stroke_joinbpy.ops.gpencil.stroke_mergebpy.ops.gpencil.stroke_merge_by_distancebpy.ops.gpencil.stroke_merge_materialbpy.ops.gpencil.stroke_normalizebpy.ops.gpencil.stroke_outlinebpy.ops.gpencil.stroke_reset_vertex_colorbpy.ops.gpencil.stroke_samplebpy.ops.gpencil.stroke_separatebpy.ops.gpencil.stroke_simplifybpy.ops.gpencil.stroke_simplify_fixedbpy.ops.gpencil.stroke_smoothbpy.ops.gpencil.stroke_splitbpy.ops.gpencil.stroke_start_setbpy.ops.gpencil.stroke_subdividebpy.ops.gpencil.stroke_trimbpy.ops.gpencil.time_segment_addbpy.ops.gpencil.time_segment_movebpy.ops.gpencil.time_segment_removebpy.ops.gpencil.tint_flipbpy.ops.gpencil.trace_imagebpy.ops.gpencil.transform_fillbpy.ops.gpencil.unlock_allbpy.ops.gpencil.vertex_color_brightness_contrastbpy.ops.gpencil.vertex_color_hsvbpy.ops.gpencil.vertex_color_invertbpy.ops.gpencil.vertex_color_levelsbpy.ops.gpencil.vertex_color_setbpy.ops.gpencil.vertex_group_assignbpy.ops.gpencil.vertex_group_deselectbpy.ops.gpencil.vertex_group_invertbpy.ops.gpencil.vertex_group_normalizebpy.ops.gpencil.vertex_group_normalize_allbpy.ops.gpencil.vertex_group_remove_frombpy.ops.gpencil.vertex_group_selectbpy.ops.gpencil.vertex_group_smoothbpy.ops.gpencil.vertex_paintbpy.ops.gpencil.vertexmode_togglebpy.ops.gpencil.weight_paintbpy.ops.gpencil.weightmode_toggle

bpy.ops.constraint.followpath_path_animate

描述

将路径约束应用于对象,并通过其路径动画它。

语法

bpy.ops.constraint.followpath_path_animate(
    constraint='FOLLOW_PATH',
    owner='OBJECT',
    frame_start=0,
    length=100,
    follow='PATH',
    use_timing_curves=True,
    use_fixed_location=True,
    use_fixed_rotation=True,
    use_offset=True,
    use_curve_follow=True,
    use_curve_radius=True,
    use_curve_stretch=True,
    use_bbone_shape=True,
    use_custom_shape=False,
    use_follow_path=True,
    use_follow_curve=False,
    use_follow_offset=False,
    use_use_curve_follow=False,
    use_use_path=False,
    curve_mapping_min=0.0,
    curve_mapping_max=1.0,
    curve_mapping_time=0.0,
    curve_mapping_rotation='AUTO',
    curve_mapping_follow='AUTO',
    curve_mapping_vertical='AUTO',
    curve_bend_axis='X',
    follow_axis='FORWARD',
    forward_axis='X',
    up_axis='Z',
    track_axis='X',
    bank_scale=1.0,
    flexible=True,
    inverse_kinematics=True,
    start_delay=0,
    cyclings=1,
    evaluation_time=None,
    animation_offset=0,
    animation_step=1,
    forward_kinematics=True,
    lock_camera=False,
    lock_curve=False,
    lock_rog=False,
    lock_segment=False,
    timeaffect='LOCATION'
)

参数

  • constraint (string, (可选)) – 约束类型 ("FOLLOW_PATH" 其中之一)
  • owner (string, (可选)) – 运用于约束的对象类型 ("OBJECT" 其中之一)
  • frame_start (int) – 动画开始帧号
  • length (int) – 动画帧数
  • follow (string, (可选)) – 跟随类型 ("PATH" 其中之一)
  • use_timing_curves (boolean, (可选)) – 启用Timing曲线
  • use_fixed_location (boolean, (可选)) – 启用FIXED LOCATION
  • use_fixed_rotation (boolean, (可选)) – 启用FIXED ROTATION
  • use_offset (boolean, (可选)) – 启用OFFSET
  • use_curve_follow (boolean, (可选)) – 开启CURVE FOLLOW
  • use_curve_radius (boolean, (可选)) – 开启CURVE RADIUS
  • use_curve_stretch (boolean, (可选)) – 开启CURVE STRETCH
  • use_bbone_shape (boolean, (可选)) – 启用BONE形状
  • use_custom_shape (boolean, (可选)) – 启用CUSTOM形状
  • use_follow_path (boolean, (可选)) – 启用路径跟随
  • use_follow_curve (boolean, (可选)) – 启用曲线跟随
  • use_follow_offset (boolean, (可选)) – 启用跟随偏移
  • use_use_curve_follow (boolean, (可选)) – 启用CURVE FOLLOW
  • use_use_path (boolean, (可选)) – 启用PATH跟随
  • curve_mapping_min (float in [0, 1], (可选)) – 最小曲线映射范围
  • curve_mapping_max (float in [0, 1], (可选)) – 最大曲线映射范围
  • curve_mapping_time (float in [0, 1], (可选)) – 曲线映射时间
  • curve_mapping_rotation (string, (可选)) – 曲线映射旋转 (‘AUTO’, ‘VECTOR_X’, ‘VECTOR_Y’, ‘VECTOR_Z’, ‘KEYED’ 如果是)"AUTO"之一。
  • curve_mapping_follow (string, (可选)) – 曲线行驶方向 (‘AUTO’, ‘CURVATURE’, ‘FIXED_LOCATION’, ‘FIXED_ROTATION’ 如果是)"AUTO"之一。
  • curve_mapping_vertical (string, (可选)) – 曲线垂直 (‘AUTO’, ‘FIXED_LOCATION’, ‘FIXED_ROTATION’, ‘TANGENT’, ‘NORMAL’ 如果是)"AUTO"之一。
  • curve_bend_axis (string, (可选)) – 曲线弯曲轴向 ( ‘X’, ‘Y’, ‘Z’ 如果是)"X"之一。
  • follow_axis (string, (可选)) – 跟随运动方向 (‘FORWARD’, ‘BACKWARD’) 如果是)"FORWARD"之一。
  • forward_axis (string, (可选)) – 正向方向 (‘X’, ‘Y’, ‘Z’) 如果是)"X"之一。
  • up_axis (string, (可选)) – 上方向 (‘X’, ‘Y’, ‘Z’) 如果是)"Z"之一。
  • track_axis (string, (可选)) – 追踪方向 (‘X’, ‘Y’, ‘Z’) 如果是)"X"之一。
  • bank_scale (float in [0, ∞], (可选)) – BANK SCALE
  • flexible (boolean, (可选)) – FLEXIBLE
  • inverse_kinematics (boolean, (可选)) – 反向动力学
  • start_delay (int in [-inf, inf], (可选)) – 延迟开始
  • cyclings (int in [-inf, inf], (可选)) – 循环
  • evaluation_time (float in [0, inf], (可选)) – 评估时间
  • animation_offset (int in [-inf, inf], (可选)) – 动画偏移
  • animation_step (int in [1, inf], (可选)) – 动画步骤
  • forward_kinematics (boolean, (可选)) – 前向运动学
  • lock_camera (boolean, (可选)) – 锁定摄像机
  • lock_curve (boolean, (可选)) – 锁定曲线
  • lock_rog (boolean, (可选)) – 锁定ROG
  • lock_segment (boolean, (可选)) – 锁定段
  • timeaffect (string, (可选)) – 影响时间 (‘LOCATION’, ‘ROTATION’, ‘BOTH’, ‘NONE’ 如果是)"LOCATION"之一。

返回

  • {'FINISHED'}

抛出

  • TypeError – 规范化参数失败
  • ValueError – 无法约束对象或未知的路径或曲线
  • RuntimeError – 执行以下之一:
  1. 执行约束时调用此操作时出错

  2. 系统有多于一个约束跟随路径

  3. 对象始终超出路径或曲线

  4. path_duration为零或负

  5. cyclings为零或负

  6. 路径或曲线未经填充

  7. 前向和反向动力学尚未实现

  8. _animation_offset + (_animation_step * frame)小于零

    1. _frame_start(用于Re-Ob评估)小于零

    2. b'Constraint is not set up for indirect evaluation' (* 表示值在运行时具有不同的描述)

提醒

  • 如果当且仅当 FOLLOW_PATH 约束被初始化,锁定Y轴旋转被打开(默认状态开启)

  • 当 FOLLOW_PATH 约束是选中的,Location为Fixed但 Rotation部分为路径指导时,它会根据路径修改对象的方向

  • 跟随路径中的“Max”默认始终为100,而“Min”的默认值始终为0。这意味着路径动画将路径上的对象移动100代(或从200到300)。将长度设置为50将使对象在路径的0到50的长度中移动,并返回该位置。

  • 进行按标准步骤执行的路径动画,使用了整数数字步骤,并忽略筛选的曲线范围。这是为了在动画编辑器中提供一致的结果,并且不应使用作为规范化的任何数据。

  • 以下属性将被修改,尽管只在对象选择时才能更改:

    • ['rotation_mode']
    • ['rotation_euler']
    • ['rotation_quaternion']
    • ['rotation_axis_angle']
    • ['rotation_matrix']
    • ['location']
    • ['rotation_axis_angle']
    • ['rotation_quaternion']
    • ['rotation_euler']
    • ['rotation_matrix']
    • ['rotation_quaternion']
    • ['rotation_euler']
    • ['lock_location'][0]
    • ['lock_rotation'][0]
    • ['constraint']

示例

将一个立方体放入场景中和一个曲线(形状扭曲):

import bpy, mathutils
# add a curve and a cube to the scene
bpy.ops.curve.primitive_bezier_curve_add()
cu = bpy.context.active_object
bpy.ops.mesh.primitive_cube_add(radius=2)
ob = bpy.context.active_object
# set the cube to follow the curve
cu.select = True
bpy.ops.object.constraint_add(type='FOLLOW_PATH')
# bpy.ops.constraint.followpath_path_animate is called when 'Apply Path Animation' is activated in GUI