UKismetMathLibrary::BreakFrameRate
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Decomposes an FFrameRate into its numerator and denominator integers. Use when you need to display, serialize, or transmit frame rate information as individual integers.
Caveats & Gotchas
- • FFrameRate does not auto-reduce fractions: a rate constructed as 24/1 and one as 48/2 are not equal by Numerator/Denominator comparison even though they represent the same rate. Use FFrameRate::IsValid() and FFrameRate equality operators for comparisons.
- • Denominator is always at least 1 for valid FFrameRate values, but if you receive an FFrameRate from untrusted data (network, assets created with old code), validate Denominator != 0 before performing any arithmetic division with the raw integers.
Signature
static ENGINE_API void BreakFrameRate(const FFrameRate& InFrameRate, int32& Numerator, int32& Denominator); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InFrameRate | const FFrameRate& | The frame rate to decompose. | — |
| Numerator | int32& | Receives the numerator of the frame rate. | — |
| Denominator | int32& | Receives the denominator of the frame rate. | — |
Return Type
void Example
Display frame rate as a string C++
FFrameRate Rate = Sequencer->GetFocusedTickResolution();
int32 Num, Den;
UKismetMathLibrary::BreakFrameRate(Rate, Num, Den);
FString Display = (Den == 1)
? FString::Printf(TEXT("%d fps"), Num)
: FString::Printf(TEXT("%d/%d fps"), Num, Den); Tags
Version History
Introduced in: 4.23
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?