Navigation
API > API/Editor > API/Editor/CurveEditor
Flattens the tangents of a single key per curve whose tangent mode is user-specified (RCTM_User or RCTM_Break). The degree of flattening is proportional to how close the key moves toward a neighboring key vertically: reaching the neighbor results in fully flat (zero) tangents and passing the neighbor causes it to flip.
=== Algorithm for a center key k ===
AddTangents (call once to initialize):
Find the left and right neighbors of k.
Pick an anchor neighbor: prefer left, fall back to right.
Record initial_distance = |k.Y - anchor.Y|. (No-ops if k has no neighbors, or if k and anchor share the same Y value.)
ComputeMirroringParallel (call each time k moves to recompute tangents):
Compute a blend height; a value that shrinks toward 0 as k approaches either neighbor:
- Moving toward anchor: blend = |k.Y - anchor.Y|
- Moving toward opposite: blend = initial_distance * (1 - |current_distance_to_anchor - initial_distance| / |k_initial.Y - opposite.Y|)
If k has crossed past the target neighbor, flip the tangent direction.
Scale the tangents linearly by blend via RecomputeMirroringParallel.
| Name | FTangentSingleKeyFlattener |
| Type | class |
| Header File | /Engine/Source/Editor/CurveEditor/Public/Misc/Mirror/TangentSingleKeyFlattener.h |
| Include Path | #include "Misc/Mirror/TangentSingleKeyFlattener.h" |
Syntax
class FTangentSingleKeyFlattener
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FTangentSingleKeyFlattener() |
Misc/Mirror/TangentSingleKeyFlattener.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| CachedCurveData | TMap< FCurveModelID, FSingleKeyMirrorData > | Misc/Mirror/TangentSingleKeyFlattener.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool AddTangents
(
const FCurveEditor& InCurveEditor, |
Searches the range for exactly 1 key that has user specified tangents and adds the key as blend info. | Misc/Mirror/TangentSingleKeyFlattener.h | |
void ComputeMirroringParallel
(
const FCurveEditor& InCurveEditor, |
Recomputes the keys's tangents based on where on their vertical distance to the specified neighboring keys. | Misc/Mirror/TangentSingleKeyFlattener.h | |
bool ResetFromSelection
(
const FCurveEditor& InCurveEditor |
Inits the tangent data from the curve editor's selection. | Misc/Mirror/TangentSingleKeyFlattener.h |
See Also
- FTangentSelectionFlattener For flattening consecutive keys.