Navigation
API > API/Runtime > API/Runtime/UMG
Expensive to create wrapper for binary and enumerated widget states that supports FName-based interaction and dynamic states populated in an IWidgetStateNameMapper May be used to represent either a target widget state combination, or an actual widgets state
All this does is cache the integer results of dynamic FName state lookup from an IWidgetStateNameMapper So it's prefertable to create these once and reuse. In particular, if broadcasting current state determine the correct bitfield to modify the existing state ahead of time. Save that bitfield and use it when performing state-modifications. Likewise when performing state tests, try to construct the relevant bitfield ahead of time & store that to later be compared against
| Name | FWidgetStateBitfield |
| Type | struct |
| Header File | /Engine/Source/Runtime/UMG/Public/Binding/States/WidgetStateBitfield.h |
| Include Path | #include "Binding/States/WidgetStateBitfield.h" |
Syntax
USTRUCT ()
struct FWidgetStateBitfield
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| Default, will convert to false as a bool | Binding/States/WidgetStateBitfield.h | ||
FWidgetStateBitfield
(
const FName InStateName |
Interprets name as binary state on | Binding/States/WidgetStateBitfield.h | |
FWidgetStateBitfield
(
const FName InStateName, |
Interprets name value pair as enum state | Binding/States/WidgetStateBitfield.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| BinaryStates | uint64 | Binary states captured by this state field | Binding/States/WidgetStateBitfield.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void ClearEnumState
(
const FWidgetStateBitfield& EnumStateBitfield |
Clear all existing values for given states & mark the states unused | Binding/States/WidgetStateBitfield.h | |
void ClearEnumState
(
FName EnumStateName |
Clear all existing values for given state & mark the state unused, slow version w/ map lookup | Binding/States/WidgetStateBitfield.h | |
void ClearEnumState
(
uint8 EnumStateIndex |
Clear all existing values for given state & mark the state unused | Binding/States/WidgetStateBitfield.h | |
bool HasAllBinaryFlags
(
const FWidgetStateBitfield& InBitfield |
True if all binary state flags are met | Binding/States/WidgetStateBitfield.h | |
bool HasAllEnumFlags
(
const FWidgetStateBitfield& InBitfield |
True if all enum state flags are met | Binding/States/WidgetStateBitfield.h | |
bool HasAllFlags
(
const FWidgetStateBitfield& InBitfield |
True if all state flags are met | Binding/States/WidgetStateBitfield.h | |
bool HasAnyBinaryFlags
(
const FWidgetStateBitfield& InBitfield |
True if any binary state flag is met | Binding/States/WidgetStateBitfield.h | |
bool HasAnyEnumFlags
(
const FWidgetStateBitfield& InBitfield |
True if any enum state flag is met | Binding/States/WidgetStateBitfield.h | |
bool HasAnyFlags
(
const FWidgetStateBitfield& InBitfield |
Note: No need for HasNoFlags. Simply call !HasAnyFlags. True if any state flag is met | Binding/States/WidgetStateBitfield.h | |
bool HasBinaryStates() |
True if any binary state is set | Binding/States/WidgetStateBitfield.h | |
bool HasEmptyUsedEnumStates() |
True if any enum used enum states are empty, usually indicating a failed '&' test | Binding/States/WidgetStateBitfield.h | |
bool HasEnumStates () |
True if any enum state is used, does not indicate if state is actually set. | Binding/States/WidgetStateBitfield.h | |
FWidgetStateBitfield Intersect
(
const FWidgetStateBitfield& Rhs |
Intersection of binary and enum states, with union on enum state usage so enum state mismatches can fail Intersections will remove not allowed enum states, allowing for failure on bool conversion due to empty used states. | Binding/States/WidgetStateBitfield.h | |
void NegateBinaryStates() |
Negate only binary states | Binding/States/WidgetStateBitfield.h | |
void NegateEnumStates() |
Negate only enum states, does not change usage, but marks existing values as not allowed | Binding/States/WidgetStateBitfield.h | |
void NegateStates() |
Negate both binary and enum states | Binding/States/WidgetStateBitfield.h | |
void SetBinaryState
(
uint8 BinaryStateIndex, |
Set binary state to given value | Binding/States/WidgetStateBitfield.h | |
void SetBinaryState
(
const FWidgetStateBitfield& BinaryStateBitfield, |
Set Binary state to given value, using a bitfield to indicate states that should be changed | Binding/States/WidgetStateBitfield.h | |
void SetBinaryStateSlow
(
FName BinaryStateName, |
Set Binary state to given value, slow version w/ FName map lookup | Binding/States/WidgetStateBitfield.h | |
void SetEnumState
(
const FWidgetStateBitfield& EnumStateBitfield |
Set enum state to given value, clearing all existing values for states in use | Binding/States/WidgetStateBitfield.h | |
void SetEnumState
(
uint8 EnumStateIndex, |
Set enum state to given value, clearing all existing values for that state | Binding/States/WidgetStateBitfield.h | |
void SetEnumStateSlow
(
FName EnumStateName, |
Set enum state to given value, clearing all existing values for that state, slow version w/ FName map lookup | Binding/States/WidgetStateBitfield.h | |
void SetState
(
const FWidgetStateBitfield& InBitfield |
Set state to given value, just calls assignment operator for you | Binding/States/WidgetStateBitfield.h | |
FWidgetStateBitfield Union
(
const FWidgetStateBitfield& Rhs |
Union of binary and enum states, allows for a single enum state to have multiple values in a bitfield. | Binding/States/WidgetStateBitfield.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
operator bool() |
True if any binary or enum state is set, and no empty used enum states exist | Binding/States/WidgetStateBitfield.h | |
FWidgetStateBitfield operator~() |
Negation of binary and enum states, maintains enum state usage, but marks states as not allowed. | Binding/States/WidgetStateBitfield.h |