Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-10-17 03:42:44 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-10-17 03:42:44 +0400
commit69d66f98a8a3d9b40d9bcb1c6bbfb641b6b1b9b4 (patch)
treeefe042340eb77665c47b097fa96b46a2f9965ad4 /source
parent234626f9e185294e910e371f0d8b551f4ce6fe50 (diff)
patch [#37114] copypaste for NORMAL buttons (BUT_NORMAL)
from Philipp Oeser (lichtwerk)
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/interface/interface_handlers.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 296db88dce8..ad36958f6f8 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -1376,6 +1376,32 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
}
}
+ /* NORMAL button */
+ else if (but->type == BUT_NORMAL) {
+ float xyz[3];
+
+ if (but->poin == NULL && but->rnapoin.data == NULL) {
+ /* pass */
+ }
+ else if (mode == 'c') {
+ ui_get_but_vectorf(but, xyz);
+ BLI_snprintf(buf, sizeof(buf), "[%f, %f, %f]", xyz[0], xyz[1], xyz[2]);
+ WM_clipboard_text_set(buf, 0);
+ }
+ else {
+ if (sscanf(buf, "[%f, %f, %f]", &xyz[0], &xyz[1], &xyz[2]) == 3) {
+ if (normalize_v3(xyz) == 0.0f) {
+ /* better set Z up then have a zero vector */
+ xyz[2] = 1.0;
+ }
+ button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
+ ui_set_but_vectorf(but, xyz);
+ button_activate_state(C, but, BUTTON_STATE_EXIT);
+ }
+ }
+ }
+
+
/* RGB triple */
else if (but->type == COLOR) {
float rgba[4];