[Bf-blender-cvs] [0a0e88b6455] master: Cleanup: Use short for properties editor tab list

Hans Goudey noreply at git.blender.org
Mon Oct 5 16:31:38 CEST 2020


Commit: 0a0e88b6455e9c46167dcd17afaa0527ddedd3f8
Author: Hans Goudey
Date:   Mon Oct 5 09:31:32 2020 -0500
Branches: master
https://developer.blender.org/rB0a0e88b6455e9c46167dcd17afaa0527ddedd3f8

Cleanup: Use short for properties editor tab list

Because the active context is stored as a short in DNA it's better
to use short in the code surrounding it. Also adjusted a comment
that reflected an incorrect assumption.

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

M	source/blender/editors/include/ED_buttons.h
M	source/blender/editors/space_buttons/space_buttons.c
M	source/blender/makesrna/intern/rna_space.c

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

diff --git a/source/blender/editors/include/ED_buttons.h b/source/blender/editors/include/ED_buttons.h
index ccef62eb8d2..a4cd2525af3 100644
--- a/source/blender/editors/include/ED_buttons.h
+++ b/source/blender/editors/include/ED_buttons.h
@@ -28,7 +28,7 @@ extern "C" {
 
 struct SpaceProperties;
 
-int ED_buttons_tabs_list(struct SpaceProperties *sbuts, int *context_tabs_array);
+int ED_buttons_tabs_list(struct SpaceProperties *sbuts, short *context_tabs_array);
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index a4eddd460b0..8c1030f6fc4 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -156,7 +156,7 @@ static void buttons_main_region_init(wmWindowManager *wm, ARegion *region)
  *
  * \return The total number of items in the array returned.
  */
-int ED_buttons_tabs_list(SpaceProperties *sbuts, int *context_tabs_array)
+int ED_buttons_tabs_list(SpaceProperties *sbuts, short *context_tabs_array)
 {
   int length = 0;
   if (sbuts->pathflag & (1 << BCONTEXT_TOOL)) {
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index d26662e9a43..6e30e279ddc 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -1777,11 +1777,9 @@ static const EnumPropertyItem *rna_SpaceProperties_context_itemf(bContext *UNUSE
   SpaceProperties *sbuts = (SpaceProperties *)(ptr->data);
   EnumPropertyItem *item = NULL;
 
-  /* We use 32 tabs maximum here so a flag for each can fit into a 32 bit integer flag.
-   * A theoretical maximum would be BCONTEXT_TOT * 2, with every tab displayed and a spacer
-   * in every other item. But this size is currently limited by the size of integer
-   * supported by RNA enums. */
-  int context_tabs_array[32];
+  /* Although it would never reach this amount, a theoretical maximum number of tabs
+   * is BCONTEXT_TOT * 2, with every tab displayed and a spacer in every other item. */
+  short context_tabs_array[BCONTEXT_TOT * 2];
   int totitem = ED_buttons_tabs_list(sbuts, context_tabs_array);
   BLI_assert(totitem <= ARRAY_SIZE(context_tabs_array));



More information about the Bf-blender-cvs mailing list