[Bf-blender-cvs] [7d3bf5166d6] blender-v2.83-release: Fix color picker being used for non-color buttons such as rotation

Campbell Barton noreply at git.blender.org
Wed May 20 14:08:24 CEST 2020


Commit: 7d3bf5166d6782b0e6cde48c1a998414d83aba9d
Author: Campbell Barton
Date:   Wed May 20 22:04:51 2020 +1000
Branches: blender-v2.83-release
https://developer.blender.org/rB7d3bf5166d6782b0e6cde48c1a998414d83aba9d

Fix color picker being used for non-color buttons such as rotation

Issue raised in T76794

===================================================================

M	source/blender/editors/interface/interface_eyedropper_color.c

===================================================================

diff --git a/source/blender/editors/interface/interface_eyedropper_color.c b/source/blender/editors/interface/interface_eyedropper_color.c
index 7527a1e0662..3c06e9c6070 100644
--- a/source/blender/editors/interface/interface_eyedropper_color.c
+++ b/source/blender/editors/interface/interface_eyedropper_color.c
@@ -82,11 +82,13 @@ static bool eyedropper_init(bContext *C, wmOperator *op)
   eye->use_accum = RNA_boolean_get(op->ptr, "use_accumulate");
 
   uiBut *but = UI_context_active_but_prop_get(C, &eye->ptr, &eye->prop, &eye->index);
+  const enum PropertySubType prop_subtype = eye->prop ? RNA_property_subtype(eye->prop) : 0;
 
   if ((eye->ptr.data == NULL) || (eye->prop == NULL) ||
       (RNA_property_editable(&eye->ptr, eye->prop) == false) ||
       (RNA_property_array_length(&eye->ptr, eye->prop) < 3) ||
-      (RNA_property_type(eye->prop) != PROP_FLOAT)) {
+      (RNA_property_type(eye->prop) != PROP_FLOAT) ||
+      (ELEM(prop_subtype, PROP_COLOR, PROP_COLOR_GAMMA) == 0)) {
     MEM_freeN(eye);
     return false;
   }
@@ -96,7 +98,7 @@ static bool eyedropper_init(bContext *C, wmOperator *op)
 
   float col[4];
   RNA_property_float_get_array(&eye->ptr, eye->prop, col);
-  if (RNA_property_subtype(eye->prop) != PROP_COLOR) {
+  if (prop_subtype != PROP_COLOR) {
     Scene *scene = CTX_data_scene(C);
     const char *display_device;



More information about the Bf-blender-cvs mailing list