[Bf-blender-cvs] [3693e1d8e80] master: Revert commits to increase button flag bitfield size

Julian Eisel noreply at git.blender.org
Thu May 12 16:56:20 CEST 2022


Commit: 3693e1d8e80501c6efcb8f732107742f80acf773
Author: Julian Eisel
Date:   Thu May 12 15:53:12 2022 +0200
Branches: master
https://developer.blender.org/rB3693e1d8e80501c6efcb8f732107742f80acf773

Revert commits to increase button flag bitfield size

This reverts the commits 8d9d5da13706b668b9bd0d631e00c9b00b73f3ea,
59cd616534b46ab85b4324a0886bd9eb8876a48b and
98a04ed4524234b1840dc039c2f356db5ac57f26.

The commits are causing issues with MSVC, see D14926. I'm working on a
different solution, but that will need some work.

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

M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface.cc
M	source/blender/editors/interface/interface_anim.c
M	source/blender/editors/interface/interface_intern.h
M	source/blender/editors/interface/interface_layout.c
M	source/blender/editors/interface/interface_query.cc
M	source/blender/editors/interface/interface_region_search.cc
M	source/blender/editors/interface/interface_template_search_menu.cc
M	source/blender/editors/interface/interface_utils.cc
M	source/blender/editors/interface/interface_widgets.c
M	source/blender/editors/interface/view2d.cc

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

diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index a996d1e0e76..301171a284d 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -184,50 +184,50 @@ enum {
 
 /** #uiBut.flag general state flags. */
 enum {
-  /* WARNING: the first 10 flags are internal (see #UI_SELECT definition). */
-  UI_BUT_ICON_SUBMENU = 1 << 10,
-  UI_BUT_ICON_PREVIEW = 1 << 11,
+  /* WARNING: the first 7 flags are internal (see #UI_SELECT definition). */
+  UI_BUT_ICON_SUBMENU = 1 << 7,
+  UI_BUT_ICON_PREVIEW = 1 << 8,
 
-  UI_BUT_NODE_LINK = 1 << 12,
-  UI_BUT_NODE_ACTIVE = 1 << 13,
-  UI_BUT_DRAG_LOCK = 1 << 14,
+  UI_BUT_NODE_LINK = 1 << 9,
+  UI_BUT_NODE_ACTIVE = 1 << 10,
+  UI_BUT_DRAG_LOCK = 1 << 11,
   /** Grayed out and un-editable. */
-  UI_BUT_DISABLED = 1 << 15,
+  UI_BUT_DISABLED = 1 << 12,
 
-  UI_BUT_ANIMATED = 1 << 16,
-  UI_BUT_ANIMATED_KEY = 1 << 17,
-  UI_BUT_DRIVEN = 1 << 18,
-  UI_BUT_REDALERT = 1 << 19,
+  UI_BUT_ANIMATED = 1 << 13,
+  UI_BUT_ANIMATED_KEY = 1 << 14,
+  UI_BUT_DRIVEN = 1 << 15,
+  UI_BUT_REDALERT = 1 << 16,
   /** Grayed out but still editable. */
-  UI_BUT_INACTIVE = 1 << 20,
-  UI_BUT_LAST_ACTIVE = 1 << 21,
-  UI_BUT_UNDO = 1 << 22,
-  UI_BUT_IMMEDIATE = 1 << 23,
-  UI_BUT_NO_UTF8 = 1 << 24,
+  UI_BUT_INACTIVE = 1 << 17,
+  UI_BUT_LAST_ACTIVE = 1 << 18,
+  UI_BUT_UNDO = 1 << 19,
+  UI_BUT_IMMEDIATE = 1 << 20,
+  UI_BUT_NO_UTF8 = 1 << 21,
 
   /** For popups, pressing return activates this button, overriding the highlighted button.
    * For non-popups this is just used as a display hint for the user to let them
    * know the action which is activated when pressing return (file selector for eg). */
-  UI_BUT_ACTIVE_DEFAULT = 1 << 25,
+  UI_BUT_ACTIVE_DEFAULT = 1 << 23,
 
   /** This but is "inside" a list item (currently used to change theme colors). */
-  UI_BUT_LIST_ITEM = 1 << 26,
+  UI_BUT_LIST_ITEM = 1 << 24,
   /** edit this button as well as the active button (not just dragging) */
-  UI_BUT_DRAG_MULTI = 1 << 27,
+  UI_BUT_DRAG_MULTI = 1 << 25,
   /** Use for popups to start editing the button on initialization. */
-  UI_BUT_ACTIVATE_ON_INIT = 1 << 28,
+  UI_BUT_ACTIVATE_ON_INIT = 1 << 26,
 
   /** #uiBut.str contains #UI_SEP_CHAR, used for key shortcuts */
-  UI_BUT_HAS_SEP_CHAR = 1 << 29,
+  UI_BUT_HAS_SEP_CHAR = 1 << 27,
   /** Don't run updates while dragging (needed in rare cases). */
-  UI_BUT_UPDATE_DELAY = 1u << 30,
+  UI_BUT_UPDATE_DELAY = 1 << 28,
   /** When widget is in text-edit mode, update value on each char stroke. */
-  UI_BUT_TEXTEDIT_UPDATE = 1ul << 31,
+  UI_BUT_TEXTEDIT_UPDATE = 1 << 29,
   /** Show 'x' icon to clear/unlink value of text or search button. */
-  UI_BUT_VALUE_CLEAR = 1ul << 32,
+  UI_BUT_VALUE_CLEAR = 1 << 30,
 
   /** RNA property of the button is overridden from linked reference data. */
-  UI_BUT_OVERRIDDEN = 1ul << 33,
+  UI_BUT_OVERRIDDEN = 1u << 31u,
 };
 
 /* Default font size for normal text. */
@@ -462,7 +462,7 @@ enum {
 void UI_draw_widget_scroll(struct uiWidgetColors *wcol,
                            const struct rcti *rect,
                            const struct rcti *slider,
-                           uint64_t state);
+                           int state);
 
 /**
  * Shortening string helper.
@@ -887,9 +887,9 @@ uiBut *UI_but_active_drop_name_button(const struct bContext *C);
 bool UI_but_active_drop_name(const struct bContext *C);
 bool UI_but_active_drop_color(struct bContext *C);
 
-void UI_but_flag_enable(uiBut *but, uint64_t flag);
-void UI_but_flag_disable(uiBut *but, uint64_t flag);
-bool UI_but_flag_is_set(uiBut *but, uint64_t flag);
+void UI_but_flag_enable(uiBut *but, int flag);
+void UI_but_flag_disable(uiBut *but, int flag);
+bool UI_but_flag_is_set(uiBut *but, int flag);
 
 void UI_but_drawflag_enable(uiBut *but, int flag);
 void UI_but_drawflag_disable(uiBut *but, int flag);
@@ -1682,7 +1682,7 @@ bool UI_search_item_add(uiSearchItems *items,
                         const char *name,
                         void *poin,
                         int iconid,
-                        uint64_t state,
+                        int state,
                         uint8_t name_prefix_offset);
 
 /**
diff --git a/source/blender/editors/interface/interface.cc b/source/blender/editors/interface/interface.cc
index effd3a64fcd..b7098c26bcd 100644
--- a/source/blender/editors/interface/interface.cc
+++ b/source/blender/editors/interface/interface.cc
@@ -848,7 +848,7 @@ static void ui_but_update_old_active_from_new(uiBut *oldbut, uiBut *but)
   BLI_assert(oldbut->active);
 
   /* flags from the buttons we want to refresh, may want to add more here... */
-  const uint64_t flag_copy = UI_BUT_REDALERT | UI_HAS_ICON | UI_SELECT_DRAW;
+  const int flag_copy = UI_BUT_REDALERT | UI_HAS_ICON | UI_SELECT_DRAW;
   const int drawflag_copy = 0; /* None currently. */
 
   /* still stuff needs to be copied */
@@ -991,7 +991,7 @@ static bool ui_but_update_from_old_block(const bContext *C,
     found_active = true;
   }
   else {
-    uint64_t flag_copy = UI_BUT_DRAG_MULTI;
+    int flag_copy = UI_BUT_DRAG_MULTI;
 
     /* Stupid special case: The active button may be inside (as in, overlapped on top) a tree-row
      * button which we also want to keep highlighted then. */
@@ -4219,7 +4219,7 @@ static uiBut *ui_def_but(uiBlock *block,
   return but;
 }
 
-void ui_def_but_icon(uiBut *but, const int icon, const uint64_t flag)
+void ui_def_but_icon(uiBut *but, const int icon, const int flag)
 {
   if (icon) {
     ui_icon_ensure_deferred(static_cast<const bContext *>(but->block->evil_C),
@@ -5806,17 +5806,17 @@ void UI_block_flag_disable(uiBlock *block, int flag)
   block->flag &= ~flag;
 }
 
-void UI_but_flag_enable(uiBut *but, uint64_t flag)
+void UI_but_flag_enable(uiBut *but, int flag)
 {
   but->flag |= flag;
 }
 
-void UI_but_flag_disable(uiBut *but, uint64_t flag)
+void UI_but_flag_disable(uiBut *but, int flag)
 {
   but->flag &= ~flag;
 }
 
-bool UI_but_flag_is_set(uiBut *but, uint64_t flag)
+bool UI_but_flag_is_set(uiBut *but, int flag)
 {
   return (but->flag & flag) != 0;
 }
diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c
index b77d48552c7..e838ce37d8e 100644
--- a/source/blender/editors/interface/interface_anim.c
+++ b/source/blender/editors/interface/interface_anim.c
@@ -144,7 +144,7 @@ void ui_but_anim_decorate_update_from_flag(uiButDecorator *decorator_but)
     return;
   }
 
-  const uint64_t flag = but_anim->flag;
+  const int flag = but_anim->flag;
 
   if (flag & UI_BUT_DRIVEN) {
     but->icon = ICON_DECORATE_DRIVER;
@@ -162,7 +162,7 @@ void ui_but_anim_decorate_update_from_flag(uiButDecorator *decorator_but)
     but->icon = ICON_DECORATE;
   }
 
-  const uint64_t flag_copy = (UI_BUT_DISABLED | UI_BUT_INACTIVE);
+  const int flag_copy = (UI_BUT_DISABLED | UI_BUT_INACTIVE);
   but->flag = (but->flag & ~flag_copy) | (flag & flag_copy);
 }
 
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index e8c5f2bb322..c09ff68bbca 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -74,8 +74,7 @@ enum {
   UI_SELECT_DRAW = (1 << 5),
   /** Property search filter is active and the button does not match. */
   UI_SEARCH_FILTER_NO_MATCH = (1 << 6),
-
-  /* WARNING: rest of #uiBut.flag in UI_interface.h (starting at `1 << 10`). */
+  /* WARNING: rest of #uiBut.flag in UI_interface.h */
 };
 
 /** #uiBut.dragflag */
@@ -148,8 +147,7 @@ struct uiBut {
 
   /** Pointer back to the layout item holding this button. */
   uiLayout *layout;
-  uint64_t flag;
-  int drawflag;
+  int flag, drawflag;
   eButType type;
   eButPointerType pointype;
   short bit, bitnr, retval, strwidth, alignnr;
@@ -711,7 +709,7 @@ extern void ui_but_active_string_clear_and_exit(struct bContext *C, uiBut *but)
 extern void ui_but_set_string_interactive(struct bContext *C, uiBut *but, const char *value);
 extern uiBut *ui_but_drag_multi_edit_get(uiBut *but);
 
-void ui_def_but_icon(uiBut *but, int icon, uint64_t flag);
+void ui_def_but_icon(uiBut *but, int icon, int flag);
 /**
  * Avoid using this where possible since it's better not to ask for an icon in the first place.
  */
@@ -1218,14 +1216,14 @@ void ui_draw_menu_item(const struct uiFontStyle *fstyle,
                        rcti *rect,
                        const char *name,
                        int iconid,
-                       uint64_t state,
+                       int state,
                        uiMenuItemSeparatorType separator_type,
                        int *r_xmax);
 void ui_draw_preview_item(const struct uiFontStyle *fstyle,
                           rcti *rect,
                           const char *name,
                           int iconid,
-                          uint64_t state,
+                          int state,
                           eFontStyle_Align text_align);
 /**
  * Version of #ui_draw_preview_item() that does not draw the menu background and item text based on
@@ -1426,8 +1424,8 @@ uiBlock *ui_block_find_mouse_over(const struct ARegion *region,
                                   bool only_clip);
 
 uiBut *ui_region_find_first_but_test_flag(struct ARegion *region,
-                                          uint64_t flag_include,
-                                          uint64_t flag_exclude);
+                                          int flag_include,
+                                          int flag_exclude);
 uiBut *ui_region_find_active_but(struct ARegion *region) ATTR_WARN_UNUSED_RESULT;
 bool ui_region_contains_point_px(const struct ARegion *region, const int xy[2])
     ATTR_NONNULL(1, 2) ATTR_WARN_UNUSED_RESULT;
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 198195f1d9a..c1bb2ed6d18 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -5316,7 +5316,7 @@ static void ui_item_align(uiLayout *litem, short nr)
   }
 }
 
-static void 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list