To Whom It May Concern,
I discovered this by unintentionally reproducing [Content removed]
This affects an extraordinary number of UENUMs in the engine that specify both of these, but not Flags.
What is the expected usage? I’m having trouble finding good documentation anywhere for UENUM(Flags). I’ve been looking at https://dev.epicgames.com/documentation/unreal\-engine/unreal\-engine\-uproperties?application\_version\=5\.7 and https://unreal-garden.com/docs/uenum-umeta/. Is this equivalent to UENUM(meta=(BitFlags, UseEnumValuesAsMaskValuesInEditor = “true”))? Is the former not recommended usage?
I encountered this when I was trying to emit a json struct that contained enums with UENUM(meta=(BitFlags, UseEnumValuesAsMaskValuesInEditor = “true”)) and if the value didn’t match an existing one, I was getting the <enum name>_MAX value. I then altered JsonObjectConverter.cpp locally to GetValueOrBitfieldAsAuthoredNameString and it’s counterpart GetValueOrBitfieldFromString instead of GetAuthoredNameStringByValue and GetValueByName, respectively, but I was still getting the undesired output (using .
It wasn’t until I changed it to UENUM(Flags), along with my changes, that I got the desired output.
The questions that come to mind are:
* Can the enum export and import for JsonObjectConverter.cpp be changed to support bitfields?
* Could the meta with Bitflags and UseEnumValuesAsMaskValuesInEditor = true apply EEnumFlags::Flags?
* Could there be more documentation for the Flags property for UENUM?
It would be good to know if UENUM(Flags) is sufficient and instead of doing (as an example):
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = “Tracking Settings”, meta=(Bitmask, BitmaskEnum = “EMovementTrackingFlags”))
uint8 movementTrackingFlags;
We could just use:
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = “Tracking Settings”)
EMovementTrackingFlags movementTrackingFlags;
Thank you,
Brent
[Attachment Removed]