Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-03-18 09:41:37 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-03-18 09:50:18 +0300
commitb749e43cd3e2a76a58f3fb7b47959b684061ea9b (patch)
treea76ade362ffaa3bbb2342ed3c0fa31761363fb32 /source/blender/editors/interface/interface_templates.c
parent8f5ba8e1a1df2e496bbf24573a68cffe564e24db (diff)
Fix color ramp eyedropper menu item
This couldn't be accessed because the poll function was checking the active button. Add a "color_ramp" context pointer which is set by the menu. Alternative fix to D3984
Diffstat (limited to 'source/blender/editors/interface/interface_templates.c')
-rw-r--r--source/blender/editors/interface/interface_templates.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 7bbf4d1307e..cc28d712ffa 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -2378,15 +2378,26 @@ static void colorband_tools_dofunc(bContext *C, void *coba_v, int event)
static uiBlock *colorband_tools_func(
bContext *C, ARegion *ar, void *coba_v)
{
+ uiStyle *style = UI_style_get_dpi();
ColorBand *coba = coba_v;
uiBlock *block;
short yco = 0, menuwidth = 10 * UI_UNIT_X;
- block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
+ block = UI_block_begin(C, ar, __func__, UI_EMBOSS_PULLDOWN);
UI_block_func_butmenu_set(block, colorband_tools_dofunc, coba);
+ uiLayout *layout = UI_block_layout(
+ block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, UI_MENU_WIDTH_MIN, 0, UI_MENU_PADDING, style);
+ UI_block_layout_set_current(block, layout);
+ {
+ PointerRNA coba_ptr;
+ RNA_pointer_create(NULL, &RNA_ColorRamp, coba, &coba_ptr);
+ uiLayoutSetContextPointer(layout, "color_ramp", &coba_ptr);
+ }
+
+ /* We could move these to operators,
+ * although this isn't important unless we want to assign key shortcuts to them. */
{
- uiBut *but;
uiDefIconTextBut(
block, UI_BTYPE_BUT_MENU, 1, ICON_BLANK1,
IFACE_("Flip Color Ramp"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y,
@@ -2399,11 +2410,9 @@ static uiBlock *colorband_tools_func(
block, UI_BTYPE_BUT_MENU, 1, ICON_BLANK1,
IFACE_("Distribute Stops Evenly"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y,
NULL, 0.0, 0.0, 0, CB_FUNC_DISTRIBUTE_EVENLY, "");
- but = uiDefIconTextButO(
- block, UI_BTYPE_BUT_MENU, "UI_OT_eyedropper_colorband", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER,
- IFACE_("Eyedropper"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y,
- "");
- but->custom_data = coba;
+
+ uiItemO(layout, IFACE_("Eyedropper"), ICON_EYEDROPPER, "UI_OT_eyedropper_colorband");
+
uiDefIconTextBut(
block, UI_BTYPE_BUT_MENU, 1, ICON_BLANK1, IFACE_("Reset Color Ramp"),
0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, CB_FUNC_RESET, "");