It is currently Wed Jun 26, 2024 5:57 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: How to find a list of enums?
PostPosted: Sun May 24, 2020 10:34 am  (#1) 
Offline
New Member

Joined: May 24, 2020
Posts: 3
Hello everybody,
I am new to GIMP and to GIMP scripting and am trying to write a Scheme script for changing the mode of all visible layers at once to a particular value (LAYER-MODE-LIGHTEN-ONLY), because I want to combine a series of 200 full moon images with a foreground taken at dawn (the moon alone in black night is boring). Unfortunately, GIMP does not offer that functionalty by itself.
I am stuck at the stage where I want to register my new function with one of the parameters being an SF-ENUM offering all the available layer modes with a default of LAYER-MODE-LIGHTEN-ONLY. My parameter declaration in script-fu-register so far is
SF-ENUM "The Layer Mode" '("LayerMode" "LAYER-MODE-LIGHTEN-ONLY")
This is syntactically accepted but not executed with respect to the default. The default remains at the entry with the lowest value. I could live with it but I'd like to have it pretty.
The documentation says "This has to be the name of a registered enum, without the 'Gimp' prefix. The second parameter speficies the default value, using the enum value's nick".
Wonderful! How about a link to a list of those enums with the corresponding nicks?
Has anbody a hint for me where I can look-up the available enum declarations? I even found such a declaration in developer gimp org (I newbie am not allowed to post weblinks), but that's outdated.
Do I really need to study the source code of GIMP? Hm... Is GIMP open source at all...? :puzzled


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: How to find a list of enums?
PostPosted: Sun May 24, 2020 12:22 pm  (#2) 
Offline
GimpChat Member

Joined: Mar 04, 2011
Posts: 2435
Certainly been done before.
For script-fu there is an old one, so just legacy layer modes, ra-mode-settings.scm from http://www.silent9.com/incoming/scripts/
For python one of ofnuts plugins ofn-layer-modes.py from http://sourceforge.net/projects/gimp-to ... s/scripts/

Should be something in the code to give you a hint for writing your script.

_________________
Image


Top
 Post subject: Re: How to find a list of enums?
PostPosted: Sun May 24, 2020 3:08 pm  (#3) 
Offline
New Member

Joined: May 24, 2020
Posts: 3
rich2005 wrote:
For script-fu there is an old one, so just legacy layer modes, ra-mode-settings.scm from http www silent9 com incoming scripts

Excellent! :coolthup
While it does not point me to the enum list, it even solves my original problem! :bigthup The legacy modes will do so far. Main thing I can merge my moon images with the dawn foreground.
Thank you very much! :cheers

(The enum list would be appreciated anyway, just for information or for future projects, in case anybody knows...) (The python list seems not to apply to script-fu)


Top
 Post subject: Re: How to find a list of enums?
PostPosted: Sun May 24, 2020 9:26 pm  (#4) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
berater wrote:
rich2005 wrote:
For script-fu there is an old one, so just legacy layer modes, ra-mode-settings.scm from http www silent9 com incoming scripts

Excellent! :coolthup
While it does not point me to the enum list, it even solves my original problem! :bigthup The legacy modes will do so far. Main thing I can merge my moon images with the dawn foreground.
Thank you very much! :cheers

(The enum list would be appreciated anyway, just for information or for future projects, in case anybody knows...) (The python list seems not to apply to script-fu)



I wonder if this is the list you're looking for?
Go to the link and go down about half of the way.
https://developer.gimp.org/api/2.0/app/ ... enums.html

_________________
https://www.deviantart.com/pocholo17
Image


Top
 Post subject: Re: How to find a list of enums?
PostPosted: Mon May 25, 2020 3:23 am  (#5) 
Offline
New Member

Joined: May 24, 2020
Posts: 3
Pocholo wrote:
I wonder if this is the list you're looking for?
Go to the link and go down about half of the way.
https developer gimp org api 2.0 app app-base-enums html

Thank you very much! Obviously, I missed this one scarcely. What I found was
https developer gimp org api 2.0 libgimpbase libgimpbase-gimpbaseenums html which seems outdated to me.


Top
 Post subject: Re: How to find a list of enums?
PostPosted: Mon May 25, 2020 5:24 am  (#6) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4750
Otherwise, see my ofn-layer-modes script.

Using the enums is quite touchy if you want to support 2.8 and 2.10, because the names don't change but their values do (so that LAYER_MODE_NORMAL is the new NORMAL mode in 2.10 (28) and not the legacy LAYER_MODE_NORMAL mode (0), which in 2.10 is LAYER_MODE_NORMAL_LEGACY.

So the Right Thing to do is to use enums instead of hardcoded values, but at the same time new layer modes can appear with new releases, but using them blindly makes the script unusable even with recent versions. In my script above used Python introspection to enable choices only if the running Gimp release allows it.

_________________
Image


Top
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) where to find ...

5

No new posts I can't find G'MIC FOR windows 32

2

No new posts Attachment(s) WHERE TO FIND???? NEED GMIC 32 BIT

1

No new posts Attachment(s) Help in find Gimp 2.10.28 AppImage

2

No new posts Attachment(s) Where can I find a user manual

9



* Login  



Powered by phpBB3 © phpBB Group