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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-08-25 08:31:51 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-08-25 08:34:42 +0400
commit93d40aef05318cdc1f5ff0dac3e229cba2cc9527 (patch)
tree3b6ecf6357e2079ec270646eed3f0188394c4551 /source
parentbf5361591dd6f44f3e275615425bbe8838f976c6 (diff)
Fix Color DnD setting alpha to an undefined value
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/interface/interface_ops.c10
1 files changed, 9 insertions, 1 deletions
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);