UI: length now scales proportionally w/ multi-but
authorCampbell Barton <ideasman42@gmail.com>
Sat, 5 Jan 2019 09:09:25 +0000 (20:09 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 5 Jan 2019 09:09:25 +0000 (20:09 +1100)
Use for object dimensions.

source/blender/editors/interface/interface_handlers.c
source/blender/editors/space_view3d/view3d_buttons.c

index 1d8e452ba45f7f26ad2c5612d8732e483c7c89a4..91b9ba03fa216c1cd42378886125f3a62f10dd78 100644 (file)
@@ -1141,11 +1141,14 @@ static void ui_multibut_states_create(uiBut *but_active, uiHandleButtonData *dat
        /* edit buttons proportionally to eachother
         * note: if we mix buttons which are proportional and others which are not,
         * this may work a bit strangely */
-       if (but_active->rnaprop) {
-               if ((data->origvalue != 0.0) && (RNA_property_flag(but_active->rnaprop) & PROP_PROPORTIONAL)) {
+       if ((but_active->rnaprop && (RNA_property_flag(but_active->rnaprop) & PROP_PROPORTIONAL)) ||
+           ELEM(but->unit_type, PROP_UNIT_LENGTH))
+       {
+               if (data->origvalue != 0.0) {
                        data->multi_data.is_proportional = true;
                }
        }
+
 }
 
 static void ui_multibut_states_apply(bContext *C, uiHandleButtonData *data, uiBlock *block)
index d68ef5c3fbdb23b6c1674863e684aaaf3801a56d..87bbb347bd074bb3688b0a5a06344436bc35673c 100644 (file)
@@ -793,9 +793,12 @@ static void v3d_object_dimension_buts(bContext *C, uiLayout *layout, View3D *v3d
                UI_block_align_begin(block);
                const float lim = 10000;
                for (int i = 0; i < 3; i++) {
+                       uiBut *but;
                        char text[3] = {'X' + i, ':', '\0'};
-                       uiDefButF(block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_DIMS, text, 0, yi -= buth, butw, buth,
-                                 &(tfp->ob_dims[i]), 0.0f, lim, 10, 3, "");
+                       but = uiDefButF(
+                               block, UI_BTYPE_NUM, B_TRANSFORM_PANEL_DIMS, text, 0, yi -= buth, butw, buth,
+                               &(tfp->ob_dims[i]), 0.0f, lim, 10, 3, "");
+                       UI_but_unit_type_set(but, PROP_UNIT_LENGTH);
                }
                UI_block_align_end(block);
        }