diff options
Diffstat (limited to 'source/blender/editors/interface/interface_handlers.c')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 3a19bb2a90c..311f0f87b50 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1115,8 +1115,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, { static ColorBand but_copypaste_coba = {0}; char buf[UI_MAX_DRAW_STR+1]= {0}; - double val; - + if(mode=='v' && but->lock) return; @@ -1140,17 +1139,16 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, if(but->poin==NULL && but->rnapoin.data==NULL); else if(mode=='c') { - if(ui_is_but_float(but)) - BLI_snprintf(buf, sizeof(buf), "%f", ui_get_but_val(but)); - else - BLI_snprintf(buf, sizeof(buf), "%d", (int)ui_get_but_val(but)); - + ui_get_but_string(but, buf, sizeof(buf)); WM_clipboard_text_set(buf, 0); } else { - if (sscanf(buf, " %lf ", &val) == 1) { + double val; + + if (ui_set_but_string_eval_num(C, but, buf, &val)) { button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); data->value= val; + ui_set_but_string(C, but, buf); button_activate_state(C, but, BUTTON_STATE_EXIT); } } @@ -1703,8 +1701,9 @@ static int ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, int paste changed= 1; } - if(pbuf) + if (pbuf) { MEM_freeN(pbuf); + } } /* cut & copy */ else if (copy || cut) { |