[Bf-blender-cvs] [5aed8a03eb6] greasepencil-object: GPencil: Replace Palette sort buttons by Menu
Antonio Vazquez
noreply at git.blender.org
Wed Feb 19 11:53:54 CET 2020
Commit: 5aed8a03eb6d9db63da3ca51d16ce8cd8b8c5129
Author: Antonio Vazquez
Date: Wed Feb 19 11:53:47 2020 +0100
Branches: greasepencil-object
https://developer.blender.org/rB5aed8a03eb6d9db63da3ca51d16ce8cd8b8c5129
GPencil: Replace Palette sort buttons by Menu
===================================================================
M source/blender/editors/interface/interface_templates.c
===================================================================
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 977689c04a0..a2617ded399 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -5385,6 +5385,27 @@ void uiTemplateColorPicker(uiLayout *layout,
}
}
+static void ui_template_palette_menu(bContext *C, uiLayout *layout, void *but_p)
+{
+ uiLayout *row;
+
+ uiItemL(layout, IFACE_("Sort"), ICON_NONE);
+ row = uiLayoutRow(layout, false);
+ uiItemEnumO_value(row,
+ IFACE_("Sort Colors by Hue, Saturation, Value"),
+ ICON_NONE,
+ "PALETTE_OT_sort",
+ "type",
+ 1);
+ row = uiLayoutRow(layout, false);
+ uiItemEnumO_value(row,
+ IFACE_("Sort Colors by Saturation, Value, Hue"),
+ ICON_NONE,
+ "PALETTE_OT_sort",
+ "type",
+ -1);
+}
+
void uiTemplatePalette(uiLayout *layout,
PointerRNA *ptr,
const char *propname,
@@ -5466,31 +5487,9 @@ void uiTemplatePalette(uiLayout *layout,
UI_but_operator_ptr_get(but);
RNA_enum_set(but->opptr, "type", 1);
- but = uiDefIconButO(block,
- UI_BTYPE_BUT,
- "PALETTE_OT_sort",
- WM_OP_INVOKE_DEFAULT,
- ICON_SORTSIZE,
- 0,
- 0,
- UI_UNIT_X,
- UI_UNIT_Y,
- NULL);
- UI_but_operator_ptr_get(but);
- RNA_enum_set(but->opptr, "type", -1);
-
- but = uiDefIconButO(block,
- UI_BTYPE_BUT,
- "PALETTE_OT_sort",
- WM_OP_INVOKE_DEFAULT,
- ICON_SORT_DESC,
- 0,
- 0,
- UI_UNIT_X,
- UI_UNIT_Y,
- NULL);
- UI_but_operator_ptr_get(but);
- RNA_enum_set(but->opptr, "type", 1);
+ /* Menu. */
+ uiDefIconMenuBut(
+ block, ui_template_palette_menu, NULL, ICON_SORTSIZE, 0, 0, UI_UNIT_X, UI_UNIT_Y, "");
}
col = uiLayoutColumn(layout, true);
More information about the Bf-blender-cvs
mailing list