diff options
author | julianeisel <julian_eisel@web.de> | 2015-01-05 23:05:17 +0300 |
---|---|---|
committer | julianeisel <julian_eisel@web.de> | 2015-01-05 23:05:17 +0300 |
commit | e7a9bf88d2243bead0ed1b5f9db1f21aef7ea397 (patch) | |
tree | 5a0144eff0dfed981c9c12bdf45d79802336edad /source/blender/editors/interface | |
parent | 22ce525bcd4fe38fcc82c5ec2e07cacc89f26c12 (diff) |
Fix T43111: Node Editor (Slider) Draw Glitch
* don't allow Node Editor input max value to be less then min value
* avoid the num slider drawing glitch if softmin equals softmax
* assert if softmax/hardmax is smaller than softmin/hardmin
With this, we sort of allow softmin/hardmin and softmax/hardmax being the same.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface.c | 4 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 38e331e6a1e..e730182ae37 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -2603,6 +2603,10 @@ void ui_but_update(uiBut *but) } } + /* max must never be smaller than min! Both being equal is allowed though */ + BLI_assert(but->softmin <= but->softmax && + but->hardmin <= but->hardmax); + /* test for min and max, icon sliders, etc */ switch (but->type) { case UI_BTYPE_NUM: diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 645637d5130..04a886ba2a8 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -2874,7 +2874,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s uiWidgetBase wtb, wtb1; rcti rect1; double value; - float offs, toffs, fac; + float offs, toffs, fac = 0; char outline[3]; widget_init(&wtb); @@ -2905,7 +2905,9 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s rect1 = *rect; value = ui_but_value_get(but); - fac = ((float)value - but->softmin) * (BLI_rcti_size_x(&rect1) - offs) / (but->softmax - but->softmin); + if ((but->softmax - but->softmin) > 0) { + fac = ((float)value - but->softmin) * (BLI_rcti_size_x(&rect1) - offs) / (but->softmax - but->softmin); + } /* left part of slider, always rounded */ rect1.xmax = rect1.xmin + ceil(offs + U.pixelsize); |