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

Issue raised in T76794
This commit is contained in:
Campbell Barton 2020-05-20 22:04:51 +10:00
parent 3360db83c4
commit 7d3bf5166d
1 changed files with 4 additions and 2 deletions

View File

@ -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;