AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Clion unreal engine9/26/2023 ECB_Green corresponds to bit 1 (adding 2 to ColorFlags), and ECB_BlueĬorresponds to bit 2 (adding 4 to ColorFlags). Is value 0, meaning it will activate bit 0 (adding 1 to ColorFlags) when checked. UPROPERTY(EditAnywhere, Meta = (Bitmask, BitmaskEnum = "EColorBits"))įollowing this change, the bitflags listed in the drop-down box will take on the names and values of the enumerated class entries. *~ This property lists flags matching the names of values from EColorBits. UENUM(Meta = (Bitflags, UseEnumValuesAsMaskValuesInEditor = "true"))Īfter creating this UENUM, we can reference it with the "BitmaskEnum" meta tag, like this: The equivalent enumerated type, made using this method, would look like this: The key difference is that this method uses the mask values directly, instead of the bit numbers. In order to use the flag selector in the editor, we must also add the meta field UseEnumValuesAsMaskValuesInEditor and set it to true. In the example above, bit 0 is ECB_Red, bit 1 is ECB_Green, and bit 2 is ECB_Blue.Īs an alternate declaration style, you can use the ENUM_CLASS_FLAGS to turn your enumerated type into a bitmask after defining it. This corresponds to the bits (starting at bit 0) of a 32-bit integer variable. The supported value range for a bitmask enumerated type is 0 to 31, inclusive. In order to customize the bitflags' names, we must first create a UENUM with the "bitflags" meta tag: Void MyFunction(UPARAM(meta=(Bitmask)) int32 BasicBitsParam) *~ You can set MyFunction using a generic list of flags instead of typing in an integer value. You can also make integer parameters to Blueprint-callable functions behave as bitmasks, by adding the Bitmask meta tag (no value necessary) to a UPARAM Specifier for the parameter. UPROPERTY(EditAnywhere, Meta = (Bitmask))Īdding this meta tag will cause the integer to be editable as a drop-down list of generically-named flags ("Flag 1", "Flag 2", "Flag 3", etc.) that can be *~ BasicBits appears as a list of generic flags in the editor, instead of an integer field. To mark an integer property as a bitmask, just add "bitmask" to the meta section, as follows: Integer properties can now be exposed to the Editor as bitmasks. The convention for integral data types is "int" or "uint" followed by the size in bits. Type VariableName Core Data Types Integers Properties are declared using standard C++ variable syntax, preceded by the UPROPERTY macro which defines property metadata and variable specifiers.
0 Comments
Read More
Leave a Reply. |