Gimp-Forum.net
Gimp.ParamSpec.int() default value triggers “invalid or out of range” warning - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP)
+--- Thread: Gimp.ParamSpec.int() default value triggers “invalid or out of range” warning (/Thread-Gimp-ParamSpec-int-default-value-triggers-%E2%80%9Cinvalid-or-out-of-range%E2%80%9D-warning)



Gimp.ParamSpec.int() default value triggers “invalid or out of range” warning - owierda - 07-07-2025

Hi folks — I'm working on a plugin for GIMP 3.0 and running into a strange behavior with Gimp.ParamSpec.int.

When I define a property like seed with:

python
proc.add_argument(
    Gimp.ParamSpec.int(
        "seed",
        "Seed",
        "Seed value",
        0,       # min
        9999,    # max
        9999,    # default
        Gimp.ParamFlags.READWRITE
    )
)


I get this warning at plugin registration:


Warning: value "9999" of type 'gint' is invalid or out of range for property 'seed' of type 'gint'

min <= max => default 

The default is clearly within the defined min/max bounds, and all three values (min, max, default) are legitimate. Strangely, the only setup that suppresses this warning is when all three values are **exactly the same** (we call it the triple x same bug), like:

python

0, 0, 0

or


1024, 1024, 1024

Even common combinations like:

python

0, 9999, 0


512, 2048, 1024

or:
python
0, 9999, 5000


cause the warning to appear and as a result, the plug-in is not registered. I’ve searched around but haven’t found an explanation. Is this a known quirk in GIMP’s plugin API? Are there hidden constraints on gint properties that aren’t documented?

Any ideas or workarounds would be appreciated!

Thanks ?

Olaf


RE: Gimp.ParamSpec.int() default value triggers “invalid or out of range” warning - Ofnuts - 07-07-2025

Use add_int_argument() instead (in fact I don' t see any documented add_argument() method).


RE: Gimp.ParamSpec.int() default value triggers “invalid or out of range” warning - owierda - 07-07-2025

(07-07-2025, 05:15 PM)Ofnuts Wrote: Use add_int_argument() instead (in fact I don' t see any documented add_argument() method).

Hi, my bad, I am using add_int_argument() (it was late)

Thanks for your time

Olaf

PS I'll update my post