[Bf-blender-cvs] [34853c7e06c] master: Fix T67483: Cannot paste on unit-vector uibut
Jacques Lucke
noreply at git.blender.org
Wed Jan 29 11:15:08 CET 2020
Commit: 34853c7e06c98fb26c2a5969317f340b6551005a
Author: Jacques Lucke
Date: Wed Jan 29 11:12:34 2020 +0100
Branches: master
https://developer.blender.org/rB34853c7e06c98fb26c2a5969317f340b6551005a
Fix T67483: Cannot paste on unit-vector uibut
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D6701
===================================================================
M source/blender/editors/interface/interface_handlers.c
===================================================================
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index ad245353479..cdaa5b26b8a 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -2239,7 +2239,13 @@ static void ui_but_set_float_array(
RNA_property_float_set_index(&but->rnapoin, but->rnaprop, i, values[i]);
}
if (data) {
- data->value = values[but->rnaindex];
+ if (but->type == UI_BTYPE_UNITVEC) {
+ BLI_assert(array_length == 3);
+ copy_v3_v3(data->vec, values);
+ }
+ else {
+ data->value = values[but->rnaindex];
+ }
}
button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -2348,7 +2354,10 @@ static void ui_but_paste_numeric_value(bContext *C,
}
}
-static void ui_but_paste_normalized_vector(bContext *C, uiBut *but, char *buf_paste)
+static void ui_but_paste_normalized_vector(bContext *C,
+ uiBut *but,
+ uiHandleButtonData *data,
+ char *buf_paste)
{
float xyz[3];
if (parse_float_array(buf_paste, xyz, 3)) {
@@ -2356,7 +2365,7 @@ static void ui_but_paste_normalized_vector(bContext *C, uiBut *but, char *buf_pa
/* better set Z up then have a zero vector */
xyz[2] = 1.0;
}
- ui_but_set_float_array(C, but, NULL, xyz, 3);
+ ui_but_set_float_array(C, but, data, xyz, 3);
}
else {
WM_report(RPT_ERROR, "Paste expected 3 numbers, formatted: '[n, n, n]'");
@@ -2644,7 +2653,7 @@ static void ui_but_paste(bContext *C, uiBut *but, uiHandleButtonData *data, cons
if (!has_required_data) {
break;
}
- ui_but_paste_normalized_vector(C, but, buf_paste);
+ ui_but_paste_normalized_vector(C, but, data, buf_paste);
break;
case UI_BTYPE_COLOR:
More information about the Bf-blender-cvs
mailing list