UI: length now scales proportionally w/ multi-but

Use for object dimensions.
This commit is contained in:
Campbell Barton 2019-01-05 20:09:25 +11:00
parent 16f49f81dd
commit 95736683a9
Notes: blender-bot 2023-02-14 04:11:22 +01:00
Referenced by issue #60370, Keyframes on Cut-ted strips
Referenced by issue #60194, Sequencer cut loses animation data for the right strip
2 changed files with 10 additions and 4 deletions

View 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)

View 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);
}