[Bf-committers] [Bf-blender-cvs] [6c4bab2] pie-menus: add ui_radial_dir_to_num lookup to avoid long switch ()
Johnny Matthews
johnny.matthews at gmail.com
Wed Jul 30 15:31:37 CEST 2014
This is a question not a complaint, because I LOVE the new pie menus. I am
no UI expert, so this was just my initial impression of the numbering. When
you have a number pad, the numbering makes complete sense and I think it
works well, but when you do not (like on a laptop) the numbering doesn’t
translate as well it seems. Perhaps a user pref for the numbers 1 -> 8
clockwise or Radial. Just a thought and it might be a terrible idea :)
Johnny Matthews
johnny.matthews at gmail.com
On Wed, Jul 30, 2014 at 7:41 AM, Campbell Barton <noreply at git.blender.org>
wrote:
> Commit: 6c4bab22db32e86d52be7c2b00210237ffd6b8fb
> Author: Campbell Barton
> Date: Wed Jul 30 22:40:36 2014 +1000
> Branches: pie-menus
> https://developer.blender.org/rB6c4bab22db32e86d52be7c2b00210237ffd6b8fb
>
> add ui_radial_dir_to_num lookup to avoid long switch ()
>
> ===================================================================
>
> M source/blender/editors/interface/interface.c
> M source/blender/editors/interface/interface_intern.h
>
> ===================================================================
>
> diff --git a/source/blender/editors/interface/interface.c
> b/source/blender/editors/interface/interface.c
> index 726aef1..1e68de0 100644
> --- a/source/blender/editors/interface/interface.c
> +++ b/source/blender/editors/interface/interface.c
> @@ -1076,34 +1076,12 @@ static bool
> ui_but_event_property_operator_string(const bContext *C, uiBut *but,
> return found;
> }
>
> +const char ui_radial_dir_to_num[8] = {8, 9, 6, 3, 2, 1, 4, 7};
> +
> static void ui_pie_direction_string(uiBut *but, char *buf, int size)
> {
> - switch(but->pie_dir) {
> - case UI_RADIAL_N:
> - BLI_strncpy(buf, "8", size);
> - break;
> - case UI_RADIAL_NE:
> - BLI_strncpy(buf, "9", size);
> - break;
> - case UI_RADIAL_E:
> - BLI_strncpy(buf, "6", size);
> - break;
> - case UI_RADIAL_SE:
> - BLI_strncpy(buf, "3", size);
> - break;
> - case UI_RADIAL_S:
> - BLI_strncpy(buf, "2", size);
> - break;
> - case UI_RADIAL_SW:
> - BLI_strncpy(buf, "1", size);
> - break;
> - case UI_RADIAL_W:
> - BLI_strncpy(buf, "4", size);
> - break;
> - case UI_RADIAL_NW:
> - BLI_strncpy(buf, "7", size);
> - break;
> - }
> + BLI_assert((unsigned int)(but->pie_dir - 1) <
> ARRAY_SIZE(ui_radial_dir_to_num));
> + BLI_snprintf(buf, size, "%d", ui_radial_dir_to_num[but->pie_dir -
> 1]);
> }
>
> static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
> diff --git a/source/blender/editors/interface/interface_intern.h
> b/source/blender/editors/interface/interface_intern.h
> index f6c2e60..4197589 100644
> --- a/source/blender/editors/interface/interface_intern.h
> +++ b/source/blender/editors/interface/interface_intern.h
> @@ -135,6 +135,8 @@ typedef enum RadialDirection {
> UI_RADIAL_NW = 8
> } RadialDirection;
>
> +extern const char ui_radial_dir_to_pad[8];
> +
> /* internal panel drawing defines */
> #define PNL_GRID (UI_UNIT_Y / 5) /* 4 default */
> #define PNL_HEADER (UI_UNIT_Y + 4) /* 24 default */
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>
More information about the Bf-committers
mailing list