It is currently Thu Jul 04, 2024 8:37 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Commands to make scripts fwd & bwd compatible
PostPosted: Fri Sep 11, 2020 10:11 pm  (#1) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
(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 ?

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Commands to make scripts fwd & bwd compatible
PostPosted: Fri Sep 11, 2020 10:27 pm  (#2) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4050
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).

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: Commands to make scripts fwd & bwd compatible
PostPosted: Fri Sep 11, 2020 11:15 pm  (#3) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
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)))

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Commands to make scripts fwd & bwd compatible
PostPosted: Fri Sep 11, 2020 11:31 pm  (#4) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4050
Nice!

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: Commands to make scripts fwd & bwd compatible
PostPosted: Fri Sep 11, 2020 11:56 pm  (#5) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
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

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Commands to make scripts fwd & bwd compatible
PostPosted: Sat Sep 12, 2020 1:24 am  (#6) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2260
Location: Poland
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

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: Commands to make scripts fwd & bwd compatible
PostPosted: Sat Sep 12, 2020 1:51 am  (#7) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
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

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Commands to make scripts fwd & bwd compatible
PostPosted: Sat Sep 12, 2020 2:17 am  (#8) 
Offline
GimpChat Member

Joined: Mar 04, 2011
Posts: 2438
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.

_________________
Image


Top
 Post subject: Re: Commands to make scripts fwd & bwd compatible
PostPosted: Sun Sep 13, 2020 12:06 am  (#9) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
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

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Commands to make scripts fwd & bwd compatible
PostPosted: Sun Sep 13, 2020 3:08 am  (#10) 
Offline
GimpChat Member

Joined: Mar 04, 2011
Posts: 2438
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 3696 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 3696 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 3696 times ]


As MareroQ wrote above, nothing is future proof.

_________________
Image


Top
 Post subject: Re: Commands to make scripts fwd & bwd compatible
PostPosted: Sun Sep 13, 2020 10:20 pm  (#11) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
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

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Is it possible to make a plugin that runs bash scripts on a clipboard

1

No new posts Attachment(s) Make a brush - Make a mandala

317

No new posts Attachment(s) very old scripts

11

No new posts Attachment(s) Elsamuko scripts

16

No new posts HELP: looking for page with old scripts

2



* Login  



Powered by phpBB3 © phpBB Group