From 93d40aef05318cdc1f5ff0dac3e229cba2cc9527 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 25 Aug 2014 14:31:51 +1000 Subject: Fix Color DnD setting alpha to an undefined value --- source/blender/editors/interface/interface_ops.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 458aca444cb..817445cc14e 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -869,7 +869,7 @@ static int drop_color_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED( { ARegion *ar = CTX_wm_region(C); uiBut *but = NULL; - float color[3]; + float color[4]; bool gamma; RNA_float_get_array(op->ptr, "color", color); @@ -880,6 +880,14 @@ static int drop_color_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED( but = ui_but_find_activated(ar); if (but && but->type == COLOR && but->rnaprop) { + const int color_len = RNA_property_array_length(&but->rnapoin, but->rnaprop); + BLI_assert(color_len <= 4); + + /* keep alpha channel as-is */ + if (color_len == 4) { + color[3] = RNA_property_float_get_index(&but->rnapoin, but->rnaprop, 3); + } + if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) { if (!gamma) ui_block_to_display_space_v3(but->block, color); -- cgit v1.2.3