Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AI Gimp Plugins
#15
(11-04-2024, 02:48 AM)nchen Wrote:
(11-03-2024, 11:58 PM)inkdolls Wrote: Looking at your files, you're using identical functions in many files. I don't know if you're aware that you can declare more than one plugin in one file calling register() repeatedly with different parameters for all the dialogs and a different function each time, so the basic code exists just once, making maintenance easier.

After more than a decade writing plugins, I learned that only quite recently.

Thank you, that is very good to know! So essentially I just create one python file containing all of the plugins in a bundle?
I had tried creating classes for the plugins but it became too convoluted, so I'll definitely have to give this a shot. I just manually copied and pasted all of the functions in alphabetical order, for each plugin...
Hopefully things get a bit easier with GIMP 3 as well.

You can indeed register several plugins in a single Python file, but since 2.10 you can also do something else: put all your "common" code in a separate module


plug-ins
├── bar
│   ├── bar.py
│   └── libmodule.py
├── baz
│   ├── baz.py
│   └── libmodule.py
└── foo
   ├── foo.py
   └── libmodule.py

  • Each plugin in its own directory, together with all necessary files
  • In such directories, Gimp only tries to register the executable that bears the same name as the directory, the other executables are ignored
  • You of course distribute a copy of libmodule.py with each script, but given the size of python files the disk waste is minimal and you gain some upgrade independence
Reply


Messages In This Thread
AI Gimp Plugins - by nchen - 10-10-2024, 05:44 PM
RE: AI Gimp Plugins - by inkdolls - 10-25-2024, 11:39 PM
RE: AI Gimp Plugins - by nchen - 10-26-2024, 11:13 AM
RE: AI Gimp Plugins - by inkdolls - 10-28-2024, 03:16 AM
RE: AI Gimp Plugins - by nchen - 10-29-2024, 07:41 PM
RE: AI Gimp Plugins - by inkdolls - 10-30-2024, 12:51 AM
RE: AI Gimp Plugins - by nchen - 10-30-2024, 03:25 AM
RE: AI Gimp Plugins - by inkdolls - 10-30-2024, 05:27 AM
RE: AI Gimp Plugins - by nchen - 10-30-2024, 06:14 PM
RE: AI Gimp Plugins - by inkdolls - 11-01-2024, 02:53 AM
RE: AI Gimp Plugins - by inkdolls - 11-01-2024, 12:33 AM
RE: AI Gimp Plugins - by nchen - 11-01-2024, 07:59 PM
RE: AI Gimp Plugins - by inkdolls - 11-03-2024, 11:58 PM
RE: AI Gimp Plugins - by nchen - 11-04-2024, 02:48 AM
RE: AI Gimp Plugins - by Ofnuts - 11-04-2024, 08:09 AM
RE: AI Gimp Plugins - by nchen - 11-04-2024, 08:13 PM
RE: AI Gimp Plugins - by Ofnuts - 11-05-2024, 10:34 AM
RE: AI Gimp Plugins - by inkdolls - 11-05-2024, 02:34 AM
RE: AI Gimp Plugins - by nchen - 11-05-2024, 08:43 AM

Forum Jump: