RSS/Atom feed Twitter
Site is read-only, email is disabled

Question about Script-Fu functions

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

5 of 6 messages available
Toggle history

Please log in to manage your subscriptions.

Question about Script-Fu functions Kevin Cozens 28 Jan 08:45
  Question about Script-Fu functions Michael Natterer 28 Jan 11:59
   Question about Script-Fu functions Sven Neumann 28 Jan 13:06
    Question about Script-Fu functions Kevin Cozens 29 Jan 20:15
1075435595.3087.2.camel@thoth 07 Oct 20:22
  Question about Script-Fu functions Kevin Cozens 30 Jan 17:39
Kevin Cozens
2004-01-28 08:45:53 UTC (about 20 years ago)

Question about Script-Fu functions

Greetings, all.

I am doing a number of things in the GIMP related to Script-Fu scripts. One of the things I noticed is that in libgimp/gimpcompat.h it appears that the 'img' argument has not been dropped for a couple of Script-Fu scripts that also take a layer argument. For 1.2, many of the functions requiring 'img layer' as part of their argument list had the 'img' argument dropped as no longer needed.

The functions in question are gimp-layer-add-mask, and gimp-layer-remove-mask.

Is there some reason these two functions still require both img and layer arguments?

Michael Natterer
2004-01-28 11:59:41 UTC (about 20 years ago)

Question about Script-Fu functions

Kevin Cozens writes:

Greetings, all.

I am doing a number of things in the GIMP related to Script-Fu scripts. One of the things I noticed is that in libgimp/gimpcompat.h it appears that the 'img' argument has not been dropped for a couple of Script-Fu scripts that also take a layer argument. For 1.2, many of the functions requiring 'img layer' as part of their argument list had the 'img' argument dropped as no longer needed.

The functions in question are gimp-layer-add-mask, and gimp-layer-remove-mask.

Is there some reason these two functions still require both img and layer arguments?

Hm, gimp-layer-[add,remove]-mask do not take an image parameter.

This was changed recently and the old API went into gimpcompat.h Of course the compat macros still take the image parameter.

(note that everything in gimpcompat.h is deprecated)

ciao, --mitch

Sven Neumann
2004-01-28 13:06:43 UTC (about 20 years ago)

Question about Script-Fu functions

Hi,

Michael Natterer writes:

This was changed recently and the old API went into gimpcompat.h Of course the compat macros still take the image parameter.

(note that everything in gimpcompat.h is deprecated)

Let me try to clarify this even more....

gimpcompat.h is not included from libgimp/gimp.h and it is not meant to be used at all. It serves two purposes: First, it documents the changes that were made to the libgimp API. Second, it helps when porting a plug-in to the 2.0 API.

When porting a plug-in to the GIMP 2.0 API, first of all, the build environment needs to be adjusted so it uses the gimp2.0 headers and libraries. Then, the plug-in can include libgimp/gimpcompat.h and an attempt can be made to compile it. Most probably a few occurances of drawable->id will have to be changed to drawable->drawable_id and if there's a GUI, the call to gimp_dialog_new() will have to be redone (these changes cannot be covered by gimpcompat.h).

At this point the plug-in should compile and work already but we aren't done yet. The next step is to remove the inclusion of gimpcompat.h again and change the code until it compiles and works again. Then, you should consider to define G_DISABLE_DEPRECATED, GTK_DISABLED_DEPRECATED, GDK_DISABLE_DEPRECATED at the top of you C files or as a compiler command-line option. As soon as any warnings caused by this change are fixed, your plug-in should be ready for 2.0.

Sven

Kevin Cozens
2004-01-29 20:15:59 UTC (about 20 years ago)

Question about Script-Fu functions

Thank you, Sven and Michael.

Oops, my mistake. It was late and I looked up the deprecated functions to see they still need 'img'. I thought I had looked up their replacements before I commented. You are both right of course, that the replacement functions don't take the extra argument.

I was looking at the source (and gimpcompat.h) in order to build a list of deprecated functions for my Perl script that updates Script-Fu's written from the 1.2 GIMP to the 2.0 GIMP.

Thank you, Sven, for the comments about porting a plug-in to the 2.0 API. I haven't done a port of a C-based plug-in yet, but I want to try doing this with the Guash plug-in. The sample plug-in and your comments should help. Now all I need is the time in which to do the port. :-)

Cheers!

Kevin. (http://www.interlog.com/~kcozens/)

Owner of Elecraft K2 #2172 |"What are we going to do today, Borg?" E-mail:kcozens at interlog dot com|"Same thing we always do, Pinkutus: Packet:ve3syb@ve3yra.#con.on.ca.na| Try to assimilate the world!" #include | -Pinkutus & the Borg

Kevin Cozens
2004-01-30 17:39:11 UTC (about 20 years ago)

Question about Script-Fu functions

At 11:06 PM 01/29/2004, Jeff wrote:

Before you put too much more work into a script converter - take a look at this one which I just got working this afternoon. I based it on Marc Lehmann's old scm2scm script, but tweaked it to (a) convert the deprecated functions and (b) add some additional parameters to things like gimp-edit-blend and plug-in-edge.

I didn't notice the change to plug-in-edge. I had already finished my script before I saw your message. I have gone back in and modified my script to deal with plug-in-edge. My script is simpler than scm2scm in that it reads from stdin and writes to stdout, and it won't generate a diff. I have one other minor change to make to it to make it safe to run a 2.0 script through it so it won't alter a call to plug-in-edge which already has the right parameter count. My script will be an aid (for me at least) in porting scripts to 2.0 which I may do from time to time on an as needed basis.

I would like to see your script. It didn't make it through to the mailing list so perhaps you could e-mail it to me off list or post a URL where I can obtain it.

Which reminds me, I haven't yet adjusted the functions that no longer take the image parameter, but you should be able to figure out where that code should go.

My script also takes care of converting the deprecated constants (see the comment in siod-wrapper.c if you don't believe there are constants already considered deprecated).

Cheers!

Kevin. (http://www.interlog.com/~kcozens/)

Owner of Elecraft K2 #2172 |"What are we going to do today, Borg?" E-mail:kcozens at interlog dot com|"Same thing we always do, Pinkutus: Packet:ve3syb@ve3yra.#con.on.ca.na| Try to assimilate the world!" #include | -Pinkutus & the Borg