fix wrong anim target

master
Pullusb 2022-04-11 19:56:38 +02:00
parent 57aae8af75
commit cf8fdc0f71
1 changed files with 16 additions and 13 deletions

View File

@ -200,6 +200,8 @@ class UAC_OT_bake_cycle_and_step(bpy.types.Operator):
if err[0] == 'ERROR': if err[0] == 'ERROR':
return {"CANCELLED"} return {"CANCELLED"}
## all followup is not needed when animating on one
if not context.scene.anim_cycle_settings.linear: if not context.scene.anim_cycle_settings.linear:
# CHAINED ACTION : step the path of the curve path # CHAINED ACTION : step the path of the curve path
err = step_path() err = step_path()
@ -209,19 +211,20 @@ class UAC_OT_bake_cycle_and_step(bpy.types.Operator):
return {"CANCELLED"} return {"CANCELLED"}
else: else:
# Delete points in curve action between first and last and go LINEAR # Delete points in curve action between first and last and go LINEAR
curve = context.scene.anim_cycle_settings.path_to_follow # curve = context.scene.anim_cycle_settings.path_to_follow
if curve: # if curve:
act = fn.get_obj_action(curve.data) # act = fn.get_obj_action(curve.data)
if act: act = fn.get_obj_action(context.object)
timef = next((fc for fc in act.fcurves if fc.data_path.endswith('.offset') and 'constraint' in fc.data_path), None) if act:
if timef: timef = next((fc for fc in act.fcurves if fc.data_path.endswith('.offset') and 'constraint' in fc.data_path), None)
keys_ct = len(timef.keyframe_points) if timef:
if keys_ct > 2: keys_ct = len(timef.keyframe_points)
for k in reversed(timef.keyframe_points[1:-2]): if keys_ct > 2:
timef.keyframe_points.remove(k) for k in reversed(timef.keyframe_points[1:-2]):
for k in timef.keyframe_points: timef.keyframe_points.remove(k)
k.interpolation = 'LINEAR' for k in timef.keyframe_points:
print(f'Anim path to linear : Deleted all keys ({keys_ct - 2}) on anim path except first and last') k.interpolation = 'LINEAR'
print(f'Anim path to linear : Deleted all keys ({keys_ct - 2}) on anim path except first and last')
# CHAINED ACTION pin feet ?? : Step the path of the curve path # CHAINED ACTION pin feet ?? : Step the path of the curve path