#include <ComposableCameraEvaluationTree.h>
Inherits:
UObject
Evaluation tree for composable cameras. Manages the blending tree of active cameras and transitions.
The tree is structured as follows:
-
Leaf nodes wrap a single active camera.
-
Inner nodes wrap a transition that blends between a source (left child) and target (right child) subtree.
When a new camera is activated:
-
With a transition: the current tree becomes the left (source) subtree, the new camera becomes a new right (target) leaf, and an inner node wrapping the transition becomes the new root.
-
Without a transition (camera cut): the tree is replaced with a single leaf node for the new camera.
When a transition finishes, the tree is collapsed: the inner node is replaced by its right (target) subtree.
You should be very careful about transient cameras, because they may break the camera chain you'd expect.
Public Methods¶
| Return | Name | Description |
|---|---|---|
UComposableCameraEvaluationTree |
||
FComposableCameraPose |
Evaluate |
Evaluate the full tree for this frame and return the final blended camera pose. |
void |
OnActivateNewCamera |
Called when a new camera is activated, optionally with a transition from the current state. |
void |
OnActivateNewCameraWithReferenceSource |
Activate a new camera with a reference to another context's Director as the transition source. Used for inter-context transitions: the reference leaf evaluates the source context live (not frozen), producing smooth blending between contexts. |
bool |
HasActiveCamera const |
Returns true if the tree has at least one active camera. |
AComposableCameraCameraBase * |
GetRunningCamera const inline |
Get the current running camera (set when a camera is activated, updated on tree rebuild). |
void |
DestroyAll |
Destroy all cameras in the tree and reset to empty. |
void |
BuildDebugString const |
Build a debug string representation of the evaluation tree structure. |
UComposableCameraEvaluationTree¶
UComposableCameraEvaluationTree(const FObjectInitializer & ObjectInitializer)
Evaluate¶
FComposableCameraPose Evaluate(float DeltaTime)
Evaluate the full tree for this frame and return the final blended camera pose.
OnActivateNewCamera¶
void OnActivateNewCamera(AComposableCameraCameraBase * NewCamera, UComposableCameraTransitionBase * Transition, bool bFreezeSourceCamera)
Called when a new camera is activated, optionally with a transition from the current state.
OnActivateNewCameraWithReferenceSource¶
void OnActivateNewCameraWithReferenceSource(AComposableCameraCameraBase * NewCamera, UComposableCameraTransitionBase * Transition, UComposableCameraDirector * SourceDirector, bool bFreezeSourceCamera)
Activate a new camera with a reference to another context's Director as the transition source. Used for inter-context transitions: the reference leaf evaluates the source context live (not frozen), producing smooth blending between contexts.
Parameters
-
NewCameraThe new camera to activate in this context. -
TransitionThe transition to blend from the referenced Director's output to NewCamera. -
SourceDirectorThe Director from the source context to reference as the left (source) side.
HasActiveCamera¶
const
bool HasActiveCamera() const
Returns true if the tree has at least one active camera.
GetRunningCamera¶
const inline
inline AComposableCameraCameraBase * GetRunningCamera() const
Get the current running camera (set when a camera is activated, updated on tree rebuild).
DestroyAll¶
void DestroyAll()
Destroy all cameras in the tree and reset to empty.
BuildDebugString¶
const
void BuildDebugString(TStringBuilder< 1024 > & OutString, int32 IndentLevel) const
Build a debug string representation of the evaluation tree structure.
Public Static Methods¶
| Return | Name | Description |
|---|---|---|
void |
AddReferencedObjects static |
AddReferencedObjects¶
static
static void AddReferencedObjects(UObject * InThis, FReferenceCollector & Collector)
Private Attributes¶
| Return | Name | Description |
|---|---|---|
TSharedPtr< FComposableCameraEvaluationTreeNode > |
RootNode |
Root of the evaluation tree. Null if no camera has been activated yet. |
TObjectPtr< AComposableCameraCameraBase > |
RunningCamera |
Currently running (target) camera. |
RootNode¶
TSharedPtr< FComposableCameraEvaluationTreeNode > RootNode
Root of the evaluation tree. Null if no camera has been activated yet.
RunningCamera¶
TObjectPtr< AComposableCameraCameraBase > RunningCamera
Currently running (target) camera.
Private Methods¶
| Return | Name | Description |
|---|---|---|
TSharedPtr< FComposableCameraEvaluationTreeNode > |
CollapseFinishedTransitions |
Collapse finished transitions in the tree. |
void |
DestroySubtreeCameras |
Recursively destroy all camera actors referenced by a subtree. |
CollapseFinishedTransitions¶
TSharedPtr< FComposableCameraEvaluationTreeNode > CollapseFinishedTransitions(const TSharedPtr< FComposableCameraEvaluationTreeNode > & Node)
Collapse finished transitions in the tree.
When an inner node's transition is finished (or its source is destroyed), the node is replaced by its right (target) subtree and the left (source) subtree's cameras are destroyed.
Transient cameras are not managed here — they live in separate contexts and their lifecycle is handled by the context stack's auto-pop mechanism.
Returns
The node that should replace the input node in the tree.
DestroySubtreeCameras¶
void DestroySubtreeCameras(const TSharedPtr< FComposableCameraEvaluationTreeNode > & Node)
Recursively destroy all camera actors referenced by a subtree.
Private Static Methods¶
| Return | Name | Description |
|---|---|---|
void |
FreezeSubtree static |
Recursively set bFrozen on all leaf and reference-leaf nodes in a subtree. Used when bFreezeSourceCamera is set on activation — the entire outgoing blend tree holds its last pose during the transition. |
void |
BuildNodeDebugString static |
Recursively build a debug string for a subtree. |
void |
AddTreeReferencedObjects static |
Recursively register UObject references in the tree for garbage collection. |
FreezeSubtree¶
static
static void FreezeSubtree(const TSharedPtr< FComposableCameraEvaluationTreeNode > & Node, bool bFrozen)
Recursively set bFrozen on all leaf and reference-leaf nodes in a subtree. Used when bFreezeSourceCamera is set on activation — the entire outgoing blend tree holds its last pose during the transition.
BuildNodeDebugString¶
static
static void BuildNodeDebugString(const TSharedPtr< FComposableCameraEvaluationTreeNode > & Node, TStringBuilder< 1024 > & OutString, int32 IndentLevel)
Recursively build a debug string for a subtree.
AddTreeReferencedObjects¶
static
static void AddTreeReferencedObjects(const TSharedPtr< FComposableCameraEvaluationTreeNode > & Node, FReferenceCollector & Collector)
Recursively register UObject references in the tree for garbage collection.