[Bf-blender-cvs] [93d40ae] master: Fix Color DnD setting alpha to an undefined value
Campbell Barton
noreply at git.blender.org
Mon Aug 25 06:35:03 CEST 2014
Commit: 93d40aef05318cdc1f5ff0dac3e229cba2cc9527
Author: Campbell Barton
Date: Mon Aug 25 14:31:51 2014 +1000
Branches: master
https://developer.blender.org/rB93d40aef05318cdc1f5ff0dac3e229cba2cc9527
Fix Color DnD setting alpha to an undefined value
===================================================================
M source/blender/editors/interface/interface_ops.c
===================================================================
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 458aca4..817445c 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);
More information about the Bf-blender-cvs
mailing list