[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50284] trunk/blender/source/blender/ editors/interface/interface_handlers.c: Fix #32418: color copy/ paste between gamma and linear color buttons gave wrong

Brecht Van Lommel brechtvanlommel at pandora.be
Thu Aug 30 19:55:21 CEST 2012


Revision: 50284
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50284
Author:   blendix
Date:     2012-08-30 17:55:21 +0000 (Thu, 30 Aug 2012)
Log Message:
-----------
Fix #32418: color copy/paste between gamma and linear color buttons gave wrong
results, now it does the conversion.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/interface_handlers.c

Modified: trunk/blender/source/blender/editors/interface/interface_handlers.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_handlers.c	2012-08-30 17:42:08 UTC (rev 50283)
+++ trunk/blender/source/blender/editors/interface/interface_handlers.c	2012-08-30 17:55:21 UTC (rev 50284)
@@ -1187,12 +1187,20 @@
 		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);




More information about the Bf-blender-cvs mailing list