diff --git a/render-worker/scripts/cinematic_render.py b/render-worker/scripts/cinematic_render.py index 11c2be4..f9e558b 100644 --- a/render-worker/scripts/cinematic_render.py +++ b/render-worker/scripts/cinematic_render.py @@ -380,20 +380,30 @@ def _setup_cinematic_camera(parts, bbox_center, bsphere_radius, total_frames): cam_obj.data.dof.keyframe_insert(data_path="aperture_fstop", frame=frame) # Set all keyframes to LINEAR interpolation (no bezier smoothing) - if cam_obj.animation_data and cam_obj.animation_data.action: - for fcurve in cam_obj.animation_data.action.fcurves: - for kp in fcurve.keyframe_points: - kp.interpolation = 'LINEAR' - if cam_obj.data.animation_data and cam_obj.data.animation_data.action: - for fcurve in cam_obj.data.animation_data.action.fcurves: - for kp in fcurve.keyframe_points: - kp.interpolation = 'LINEAR' - if cam_obj.data.dof.animation_data and cam_obj.data.dof.animation_data.action: - for fcurve in cam_obj.data.dof.animation_data.action.fcurves: - for kp in fcurve.keyframe_points: - kp.interpolation = 'LINEAR' + def _set_linear(anim_data): + if not anim_data or not anim_data.action: + return + action = anim_data.action + # Blender 5.0+: action.fcurves may be action.channels or similar + curves = None + if hasattr(action, 'fcurves'): + curves = action.fcurves + elif hasattr(action, 'channels'): + curves = action.channels + if curves: + for fc in curves: + for kp in fc.keyframe_points: + kp.interpolation = 'LINEAR' - print(f"[cinematic_render] camera keyframed: {total_frames} frames across {len(SEGMENTS)} segments (LINEAR interpolation)", flush=True) + try: + _set_linear(cam_obj.animation_data) + _set_linear(cam_obj.data.animation_data) + if hasattr(cam_obj.data, 'dof') and cam_obj.data.dof: + _set_linear(getattr(cam_obj.data.dof, 'animation_data', None)) + except Exception as e: + print(f"[cinematic_render] WARNING: could not set LINEAR interpolation: {e}", flush=True) + + print(f"[cinematic_render] camera keyframed: {total_frames} frames across {len(SEGMENTS)} segments", flush=True) return cam_obj