/** * FBX animation curve model and evaluator. * * Keys carry cubic Bezier tangents expressed the way the FBX SDK stores them: a left and right tangent with a time * extent (dx, as a fraction of the segment scaled by the tangent weight) and a value extent (dy). Linear and constant * segments are represented the same way so that a single evaluator handles every case, including the weighted * tangents Maya and MotionBuilder write, TCB keys, and the pre/post extrapolation modes. */ /** FBX time units: 46186158000 ticks per second */ export declare const FBX_TIME_UNIT = 46186158000; export type FBXInterpolationType = "constant" | "linear" | "cubic"; export type FBXExtrapolationMode = "constant" | "repeat" | "mirror" | "slope" | "repeatRelative"; export interface FBXExtrapolation { mode: FBXExtrapolationMode; /** Number of repetitions, or -1 for infinite */ repeatCount: number; } /** A single keyframe */ export interface FBXKeyframe { /** Time in seconds */ time: number; /** Value at this keyframe */ value: number; /** Interpolation used from this key to the next key */ interpolation: FBXInterpolationType; /** Constant interpolation variant */ constantMode?: "standard" | "next"; /** Left (incoming) tangent: time extent in seconds and value extent */ leftDx: number; leftDy: number; /** Right (outgoing) tangent: time extent in seconds and value extent */ rightDx: number; rightDy: number; /** Cubic outgoing slope in value units per second (derived, kept for consumers that export hermite keys) */ rightSlope?: number; /** Cubic incoming slope for the next key, in value units per second (derived) */ nextLeftSlope?: number; } /** An animation curve (one axis of one property) */ export interface FBXCurveData { /** Channel: "d|X", "d|Y", "d|Z" */ channel: string; /** Keyframes */ keys: FBXKeyframe[]; /** True for baked sample curves that should be connected as linear samples */ isSampled?: boolean; preExtrapolation?: FBXExtrapolation; postExtrapolation?: FBXExtrapolation; } /** Raw key attribute data for one key, after run-length decoding. */ export interface FBXKeyAttributes { flags: number; data: [number, number, number, number]; } /** * Builds keyframes from parallel time/value arrays and their (run-length encoded) attributes, resolving every * tangent mode the FBX SDK writes: user, broken, auto (with clamp / progressive clamp / time-independent flags and * auto bias), TCB, weighted, linear and constant. */ export declare function buildKeyframes(times: ArrayLike, values: ArrayLike, attributes: (index: number) => FBXKeyAttributes): FBXKeyframe[]; /** Auto tangent as the FBX SDK computes it, including clamping and auto bias. */ export declare function solveAutoTangent(prevTime: number, time: number, nextTime: number, prevValue: number, value: number, nextValue: number, weightLeft: number, weightRight: number, autoBias: number, flags: number): number; /** Builds a keyframe list from explicit per-key slopes (legacy Takes and synthetic curves). */ export declare function keyframesFromSlopes(times: number[], values: number[], interpolation: FBXInterpolationType[], constantNext: boolean[], leftSlope: number[], rightSlope: number[], leftWeight?: number[], rightWeight?: number[]): FBXKeyframe[]; /** Reads a `Pre-Extrapolation` / `Post-Extrapolation` block: `Type` is a character code, `Repetition` a count. */ export declare function parseExtrapolation(typeValue: unknown, repetitionValue: unknown): FBXExtrapolation; export declare function evaluateCurve(curve: FBXCurveData | undefined, time: number, defaultValue: number, noExtrapolation?: boolean): number; export type Vec3 = [number, number, number]; export type Quat = [number, number, number, number]; /** Euler angles in degrees with an FBX rotation order (0=XYZ ... 5=ZYX; spheric falls back to XYZ) to a quaternion. */ export declare function eulerToQuat(v: Vec3, order: number): Quat; /** Quaternion to Euler angles in degrees for an FBX rotation order (inverse of eulerToQuat). */ export declare function quatToEuler(q: Quat, order: number): Vec3; /** Blend semantics of an animation layer, derived from its BlendMode and accumulation modes. */ export interface FBXLayerBlend { /** Layer participates in blending (BlendMode Additive or Override Passthrough) */ blended: boolean; /** Layer adds onto the result instead of replacing it (BlendMode Additive) */ additive: boolean; /** Rotations compose as quaternions (RotationAccumulationMode ByLayer) */ composeRotation: boolean; /** Scales compose multiplicatively (ScaleAccumulationMode Multiply) */ composeScale: boolean; /** Layer weight in [0, 1] */ weight: number; } /** * Combines one animation layer's value into the running result, exactly as the FBX SDK evaluator does. * `kind` selects the accumulation rule: "R" rotations (degrees, rotation order given), "S" scales, anything else linear. */ export declare function combineLayerValue(result: Vec3, value: Vec3, layer: FBXLayerBlend, kind: "T" | "R" | "S" | "other", rotationOrder: number): Vec3;