[Bf-blender-cvs] [8c9e50889ed] asset-browser-poselib: Fix compile error when using UIList template flags in C++

Julian Eisel noreply at git.blender.org
Tue Apr 13 19:01:07 CEST 2021


Commit: 8c9e50889ed8bf4dde934344665aab59bf53e4ab
Author: Julian Eisel
Date:   Tue Apr 13 18:49:10 2021 +0200
Branches: asset-browser-poselib
https://developer.blender.org/rB8c9e50889ed8bf4dde934344665aab59bf53e4ab

Fix compile error when using UIList template flags in C++

C++ has strongly typed enums (which is great!), so a bitwise OR on two
enum values will result in a compiler error. Use our `ENUM_OPERATORS()`
utility to overload the bitwise operations to be valid for this strong
enum type.

===================================================================

M	source/blender/editors/include/UI_interface.h

===================================================================

diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 247a8bdc5ad..06b7a9b013d 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -25,6 +25,7 @@
 
 #include "BLI_compiler_attrs.h"
 #include "BLI_sys_types.h" /* size_t */
+#include "BLI_utildefines.h"
 #include "UI_interface_icons.h"
 
 #ifdef __cplusplus
@@ -2156,7 +2157,11 @@ enum uiTemplateListFlags {
   UI_TEMPLATE_LIST_SORT_LOCK = (1 << 1),
   /* Don't allow resizing the list, i.e. don't add the grip button. */
   UI_TEMPLATE_LIST_NO_GRIP = (1 << 2),
+
+  UI_TEMPLATE_LIST_FLAGS_LAST
 };
+ENUM_OPERATORS(enum uiTemplateListFlags, UI_TEMPLATE_LIST_FLAGS_LAST);
+
 void uiTemplateList(uiLayout *layout,
                     struct bContext *C,
                     const char *listtype_name,
@@ -2186,6 +2191,7 @@ struct uiList *uiTemplateList_ex(uiLayout *layout,
                                  int columns,
                                  enum uiTemplateListFlags flags,
                                  void *customdata);
+
 void uiTemplateNodeLink(uiLayout *layout,
                         struct bContext *C,
                         struct bNodeTree *ntree,



More information about the Bf-blender-cvs mailing list