diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-08-30 21:55:21 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-08-30 21:55:21 +0400 |
commit | fd22a5603ab11cc2c332a98220e98081964a9eeb (patch) | |
tree | 982947022e4d2e8b1ae87e1210fd7acc911cf1b4 /source | |
parent | 4e13a659bb40b66c19d4b15a885705fc23294454 (diff) |
Fix #32418: color copy/paste between gamma and linear color buttons gave wrong
results, now it does the conversion.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index ca52daa8cd2..31bc40326c2 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1187,12 +1187,20 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, else if (mode == 'c') { ui_get_but_vectorf(but, rgb); + /* convert to linear color to do compatible copy between gamma and non-gamma */ + if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) + srgb_to_linearrgb_v3_v3(rgb, rgb); + BLI_snprintf(buf, sizeof(buf), "[%f, %f, %f]", rgb[0], rgb[1], rgb[2]); WM_clipboard_text_set(buf, 0); } else { if (sscanf(buf, "[%f, %f, %f]", &rgb[0], &rgb[1], &rgb[2]) == 3) { + /* assume linear colors in buffer */ + if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) + linearrgb_to_srgb_v3_v3(rgb, rgb); + button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); ui_set_but_vectorf(but, rgb); button_activate_state(C, but, BUTTON_STATE_EXIT); |