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