Files
UnrealEngineUWP/Engine/Source/Runtime/TimeManagement/Public/TimeManagementBlueprintLibrary.h
ben zeigler 6c301cae85 #jira UE-2848 Blueprint function category and display name cleanup pass:
Add spaces to overridden display names, it doesn't add them automatically
Move some functions out of Utilities into their own categories like Transformation, this improves the UX for the node picker and Utilities is for Core functionality
Simplify and combine some redundant categories
Clean up functions like IsValid to specify the type and attempt to unify case for math functions
#rb ben.hoffman

[CL 16355176 by ben zeigler in ue5-main branch]
2021-05-17 13:26:33 -04:00

89 lines
5.9 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "Misc/FrameRate.h"
#include "Misc/QualifiedFrameTime.h"
#include "Misc/Timecode.h"
#include "TimeManagementBlueprintLibrary.generated.h"
/**
*
*/
UCLASS(meta = (BlueprintThreadSafe, ScriptName = "TimeManagementLibrary"))
class TIMEMANAGEMENT_API UTimeManagementBlueprintLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
/** Converts an FrameRate to a float ie: 1/30 returns 0.0333333 */
UFUNCTION(BlueprintPure, meta = (DisplayName = "FrameRate To Seconds", BlueprintAutocast), Category = "Utilities|Time Management")
static float Conv_FrameRateToSeconds(const FFrameRate& InFrameRate);
/** Converts an QualifiedFrameTime to seconds. */
UFUNCTION(BlueprintPure, meta = (DisplayName = "QualifiedFrameTime To Seconds", BlueprintAutocast), Category = "Utilities|Time Management")
static float Conv_QualifiedFrameTimeToSeconds(const FQualifiedFrameTime& InFrameTime);
/** Multiplies a value in seconds against a FrameRate to get a new FrameTime. */
UFUNCTION(BlueprintPure, meta = (DisplayName = "Seconds * FrameRate", CompactNodeTitle = "*"), Category = "Utilities|Time Management")
static FFrameTime Multiply_SecondsFrameRate(float TimeInSeconds, const FFrameRate& FrameRate);
/** Converts an Timecode to a string (hh:mm:ss:ff). If bForceSignDisplay then the number sign will always be prepended instead of just when expressing a negative time. */
UFUNCTION(BlueprintPure, meta = (DisplayName = "Timecode To String", BlueprintAutocast), Category = "Utilities|Time Management")
static FString Conv_TimecodeToString(const FTimecode& InTimecode, bool bForceSignDisplay = false);
/** Verifies that this is a valid framerate with a non-zero denominator. */
UFUNCTION(BlueprintPure, meta = (DisplayName = "Is Valid Frame Rate"), Category = "Utilities|Time Management")
static bool IsValid_Framerate(const FFrameRate& InFrameRate);
/** Checks if this framerate is an even multiple of another framerate, ie: 60 is a multiple of 30, but 59.94 is not. */
UFUNCTION(BlueprintPure, meta = (DisplayName = "Is Multiple Of"), Category = "Utilities|Time Management")
static bool IsValid_MultipleOf(const FFrameRate& InFrameRate, const FFrameRate& OtherFramerate);
/** Converts the specified time from one framerate to another framerate. This is useful for converting between tick resolution and display rate. */
UFUNCTION(BlueprintPure, meta = (DisplayName = "Transform Frame Time"), Category = "Utilities|Time Management")
static FFrameTime TransformTime(const FFrameTime& SourceTime, const FFrameRate& SourceRate, const FFrameRate& DestinationRate);
/** Snaps the given SourceTime to the nearest frame in the specified Destination Framerate. Useful for determining the nearest frame for another resolution. Returns the frame time in the destination frame rate. */
UFUNCTION(BlueprintPure, meta = (DisplayName = "Snap Frame Time"), Category = "Utilities|Time Management")
static FFrameTime SnapFrameTimeToRate(const FFrameTime& SourceTime, const FFrameRate& SourceRate, const FFrameRate& SnapToRate);
/** Addition (FrameNumber A + FrameNumber B) */
UFUNCTION(BlueprintPure, meta = (DisplayName = "FrameNumber + FrameNumber", CompactNodeTitle = "+", Keywords = "+ add plus", CommutativeAssociativeBinaryOperator = "true", ScriptMethod, ScriptMethodSelfReturn, ScriptOperator = "+;+="), Category = "Utilities|Time Management")
static FFrameNumber Add_FrameNumberFrameNumber(FFrameNumber A, FFrameNumber B);
/** Subtraction (FrameNumber A - FrameNumber B) */
UFUNCTION(BlueprintPure, meta = (DisplayName = "FrameNumber - FrameNumber", CompactNodeTitle = "-", Keywords = "- subtract minus", ScriptMethod, ScriptMethodSelfReturn, ScriptOperator = "-;-="), Category = "Utilities|Time Management")
static FFrameNumber Subtract_FrameNumberFrameNumber(FFrameNumber A, FFrameNumber B);
/** Addition (FrameNumber A + int B) */
UFUNCTION(BlueprintPure, meta = (DisplayName = "FrameNumber + Int", CompactNodeTitle = "+", Keywords = "+ add plus", ScriptMethod, ScriptMethodSelfReturn, ScriptOperator = "+;+="), Category = "Utilities|Time Management")
static FFrameNumber Add_FrameNumberInteger(FFrameNumber A, int32 B);
/** Subtraction (FrameNumber A - int B) */
UFUNCTION(BlueprintPure, meta = (DisplayName = "FrameNumber - Int", CompactNodeTitle = "-", Keywords = "- subtract minus", ScriptMethod, ScriptMethodSelfReturn, ScriptOperator = "-;-="), Category = "Utilities|Time Management")
static FFrameNumber Subtract_FrameNumberInteger(FFrameNumber A, int32 B);
/** Multiply (FrameNumber A * B) */
UFUNCTION(BlueprintPure, meta = (DisplayName = "FrameNumber * Int", CompactNodeTitle = "*", Keywords = "* multiply", ScriptMethod, ScriptMethodSelfReturn, ScriptOperator = "*;*="), Category = "Utilities|Time Management")
static FFrameNumber Multiply_FrameNumberInteger(FFrameNumber A, int32 B);
/** Divide (FrameNumber A / B) */
UFUNCTION(BlueprintPure, meta = (DisplayName = "FrameNumber / FrameNumber", CompactNodeTitle = "/", Keywords = "/ divide", ScriptMethod, ScriptMethodSelfReturn, ScriptOperator = "/;/="), Category = "Utilities|Time Management")
static FFrameNumber Divide_FrameNumberInteger(FFrameNumber A, int32 B);
/** Converts a FrameNumber to an int32 for use in functions that take int32 frame counts for convenience. */
UFUNCTION(BlueprintPure, meta = (DisplayName = "FrameNumber to Integer", ScriptName="FrameNumberToInteger", BlueprintAutocast), Category = "Utilities|Time Management")
static int32 Conv_FrameNumberToInteger(const FFrameNumber& InFrameNumber);
public:
/** Get the current timecode of the engine. */
UFUNCTION(BlueprintPure, Category = "Utilities|Time Management")
static FTimecode GetTimecode();
/** Gets the current timecode frame rate. */
UFUNCTION(BlueprintPure, Category = "Utilities|Time Management")
static FFrameRate GetTimecodeFrameRate();
};