You are here

Bug with sliders in Gimp 2.8.2!

Hello,

I don't see in the list of open bugs on this site (http://developer.gimp.org/bugs.html) if the bug I found is known by developers.
I wrote a little script-fu to make it easier to understand and to show how the bug is annoying. I don't think it comes from my script or maybe it's because I repeat the same mistake. If this is the case, the problem exists between keyboard and chair XD

If you change a value with the sliders (step_inc), the value displayed is not the one that will be used in the script.
e.g. 10 + 10 will be 10.31390135 + 9.865470852 = 20.1793722
e.g. 10 * 22 will be 9.865470852 x 21.52466368 = 212.3509421
This even if you choose no digit after the point.
Fortunately, there is no problem with the arrows or with page key (page_inc) or by entering the value directly.
I hope the developers will fix the bug because scripts-fu do not work properly.

If there is an error in my script, thank you for the report.
I have the same problem on a real script that does something other than simple addition.
Without saying too much, this is not the topic, I take this tutorial http://www.youtube.com/watch?v=C7t5hsbtwrM
but better with more options. But this f%&# "bug" prevents me to finalize it because it causes inconsistencies.

- My OS = Windows XP SP3 (x86 Family)
- Parameter type in question = SF-ADJUSTMENT
with:
Widget argument = step_inc Increment/decrement value (= 1 in my script)
Widget argument = SF-SLIDER or 0

Best regards

Loïc

AttachmentSize
Script-fu : bug-with-sliders.scm3.78 KB

Have you asked about this on the developers' list already?

I guess that the fix will be an update of the docs for SF-ADJUSTMENT to clarify that it will always return float numbers.

Your script can be called non-interactively from other scripts with arbitrary values anyway, so you should make sure to convert the input parameters to integer values.

I sent an email to report the bug to the developers.
Yes, I had to convert the value into an integer for this to work. But it is a backup solution...

I discovered this back in 2009 for a script I wrote.

My solution was just to reassign the value in the let*

reference "inDivs":


(define (thatch img inLayer inInvert inThatchPattern inThatchDirection inCompensateAngle inDivs inBlend inFlatsize inWaterlevel inBump inAngle inSoftlight inMerge inNewImage)
(let*
(
...snip...
(inDivs (trunc inDivs))
...snip...
)

Not exactly, round is better in my example.

> (trunc 10.01)
10
> (truncate 10.01)
10.0
> (round 10.01)
10.0

> (trunc 10.49)
10
> (truncate 10.49)
10.0
> (round 10.49)
10.0

> (trunc 10.51)
10
> (truncate 10.51)
10.0
> (round 10.51)
11.0

> (trunc 10.99)
10
> (truncate 10.99)
10.0
> (round 10.99)
11.0

And without the ".0"

> (inexact->exact (round 10.99))
11

In my script, this function works and allows you to retrieve the value modified by the slider.
> (define (debug x) (inexact->exact (round x)))
debug
> (debug 10.934643646)
11

In my other script in progress, because sometimes I want to keep the digits after the point:

> (define (debug x y) (if (= y 0) (inexact->exact (round x)) (/ (round (* x (pow 10 y))) (pow 10 y))))
debug

> (debug 10.934643646 0)
11
> (debug 10.934643646 1)
10.9
> (debug 10.934643646 2)
10.93
> (debug 10.934643646 3)
10.935
> (debug 10.934643646 4)
10.9346
> (debug 10.934643646 5)
10.93464

> (let* ((input1 45.519954)) (set! input1 (debug input1 0)))
46
> (let* ((input1 45.519954)) (set! input1 (debug input1 1)))
45.5
> (let* ((input1 45.519954)) (set! input1 (debug input1 2)))
45.52
> (let* ((input1 45.519954)) (set! input1 (debug input1 3)))
45.52
> (let* ((input1 45.519954)) (set! input1 (debug input1 4)))
45.52
> (let* ((input1 45.519954)) (set! input1 (debug input1 5)))
45.51995
> (let* ((input1 45.519954)) (set! input1 (debug input1 6)))
45.519954

For the moment, I don't know how to get an argument of a parameter in the register.
y would be the argument "digits" of the parameter SF-ADJUSTMENT

Subscribe to Comments for "Bug with sliders in Gimp 2.8.2!"