GIMP Chat
http://gimpchat.com/

Commands to make scripts fwd & bwd compatible
http://gimpchat.com/viewtopic.php?f=9&t=18777
Page 1 of 1

Author:  Graechan [ Fri Sep 11, 2020 10:11 pm ]
Post subject:  Commands to make scripts fwd & bwd compatible

(gimp-edit-fill drawable FILL-FOREGROUND) is OK 2-10 but fails in 2-8 bwds
Whereas
(gimp-edit-fill drawable FOREGROUND-FILL) is OK 2-10 & 2-8
Should our scripts be only for 2-10 or 2-8 as well ?

Author:  mahvin [ Fri Sep 11, 2020 10:27 pm ]
Post subject:  Re: Commands to make scripts fwd & bwd compatible

If you're asking everybody, it's a good question. If you're asking me in regards to gimpscripts.net, we are only dealing with 2.10 - simply because our workload would triple with the site, and no one's getting paid (well, maybe brownie points for the 2.10 diehards out there).

Author:  Graechan [ Fri Sep 11, 2020 11:15 pm ]
Post subject:  Re: Commands to make scripts fwd & bwd compatible

Mahvin my only interest is that scripts can be compatable with 2-6,2-8 & 2-10, shown below is an example of 'gimp-edt-fill'
Add this before your script starts with (define (script-fu-'blurb' and it will cover your script and answ (gimp-version-meets? check)

;
;Helper function to check the gimp version
(define (gimp-version-meets? check)
  (let ((c (map string->number (strbreakup check ".")))
        (v (map string->number (strbreakup (car (gimp-version)) "."))))
  (if (> (car v) (car c)) #t
  (if (< (car c) (car v)) #f
   (if (> (cadr v) (cadr c)) #t
   (if (< (cadr v) (cadr c)) #f
     (if (>= (caddr v) (caddr c)) #t #f)))))))
;

then replace 'gimp-edit-fill' with

(gimp-edit-fill  drawable (cond ((gimp-version-meets? "2.10.0") FILL-FOREGROUND ) (else FOREGROUND-FILL)))

Author:  mahvin [ Fri Sep 11, 2020 11:31 pm ]
Post subject:  Re: Commands to make scripts fwd & bwd compatible

Nice!

Author:  Graechan [ Fri Sep 11, 2020 11:56 pm ]
Post subject:  Re: Commands to make scripts fwd & bwd compatible

Thanks Mahvin That and other minor changes make it possible for me to run scripts across all 3 gimp platforms although no one should be using 2-6

Author:  MareroQ [ Sat Sep 12, 2020 1:24 am ]
Post subject:  Re: Commands to make scripts fwd & bwd compatible

Hi Graechan.

You are absolutely right that plugins should be universal - however, the behavior of Gimp developers is a bit strange:
1. Due to the removal of around 35 plugins in 2.10 (compared to 2.8) many plugins stopped working - what was done: removed the scripts.
2. When the time comes for Gimp-3.0, those based on Python2 will stop working (not much left).
3. Most of the plugins for Gimp-2.8 have already been tweaked and I expect backwards compatibility will be bypassed someday so I'm focusing on adjusting them only to 2.10 (because for 2.8 they are original or already reworked). There is not enough time and people willing to enter your code into many plugins. :gaah

Author:  Graechan [ Sat Sep 12, 2020 1:51 am ]
Post subject:  Re: Commands to make scripts fwd & bwd compatible

MareroQ I'm not concerned with deleted plugins as such, but with plugins that have changed parameters it's strange that in 'gimp-edit-fill' FOREGROUND-FILL works in gimps 2.8 and 2.10

even though the 2.10 'procedure browser' shows FILL-FOREGROUND. Gimp doesn't tell us the full story

Author:  rich2005 [ Sat Sep 12, 2020 2:17 am ]
Post subject:  Re: Commands to make scripts fwd & bwd compatible

You can not be backward and forward compatible in a script unless you insert some sort of trapping to use applicable blocks of code.

These 'old' scripts are only complatible because of the Gimp developers use of backward compatibility. Run Gimp 2.10.x with the switch --pdb-compat-mode=off and see how compatible the script really is.

In normal use, and the various releases. Before Gimp 2.10.12, GEGL had not replaced fixed compatibility of some plugins, example bump-map (I know, bad example from me). Then Gimp 2.10.14 is not very compatible at all. The developers implementation of the pdb links to GEGL I find has improved with 2.10.20. The only certain way to run an old script is use an 'old' Gimp.

Author:  Graechan [ Sun Sep 13, 2020 12:06 am ]
Post subject:  Re: Commands to make scripts fwd & bwd compatible

Rich2005 that there is snake language (python). I downloaded and installed my 2-10-20 from gimp, instead of playing with parameters to enter an 'alpha' answer simply enter the numeric value
(gimp-edit-fill drawable 0),this will succeed in past and present gimps the same applies to layer-modes

Author:  rich2005 [ Sun Sep 13, 2020 3:08 am ]
Post subject:  Re: Commands to make scripts fwd & bwd compatible

Quote:
....(gimp-edit-fill drawable 0),this will succeed in past and present gimps the same applies to layer-modes...


Indeed it does and I have done that myself in the past. I believe this is generally considered bad practice.
While Gimp 2.10.20 is the best so far for backward compatibility, taking gimp-edit-fill as the example.

Gimp 2 is usually (but not always) compiled with --pdb-compat-mode=on as default
Procedure browser shows it is deprecated, new plugins/scripts should not use it but we are talking old plugins/scripts here.

Attachment:
mode-on.jpg
mode-on.jpg [ 152.24 KiB | Viewed 3705 times ]


This procedure gimp-edit-fill does not actually exist, run Gimp with --pdb-compat-mode=off and see what you get.

Attachment:
mode-off.jpg
mode-off.jpg [ 55.17 KiB | Viewed 3705 times ]


Even then not quite the same as Gimp 2.8 although where you might use 'NO-FILL(5)' I do not know ;)

Attachment:
mode-28.jpg
mode-28.jpg [ 124.48 KiB | Viewed 3705 times ]


As MareroQ wrote above, nothing is future proof.

Author:  Graechan [ Sun Sep 13, 2020 10:20 pm ]
Post subject:  Re: Commands to make scripts fwd & bwd compatible

While nothing can be done to future proof Gimp it can be backward compatible and still use the commands applicable to the current version
((cond ((gimp-version-meets? "2.10.0") gimp-drawable-edit-fill) (else gimp-edit-fill)) drawable 0)

Most of my scripts run in 2.8 and 2.6 so to allow for the nuiences of 2.10 is no problem

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/