Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
small plugin code help
#18
(03-03-2024, 01:42 AM)gimpygirl Wrote:
(03-03-2024, 12:35 AM)Ofnuts Wrote: This is because you used dashes (gimp-drawable-edit-clear) instead of underscores: (gimp_drawable_edit_clear). For Python you are therefore trying to subtract a variable called drawable from pdb.gimp. The Python doc is auto-generated and since the same text is used for script-fu and python-fu, there are things to adapt:
  • all dashes become underscores
  • object IDs in script-fu are plain objects in Python (so you get a gimp.Image object, not an integer)
  • when there is no object instead of using the -1 ID you use None
Also, don't use image.active_layer. If you script registration is correct, your script is passed a layer as the second argument and this is the layer you should work with. Using image.active_layer doesn't do you any good because if the active drawable isn't a layer (because it is a mask/channel), then image.active_layer returns None.

You really give great answers.

What parameters the method used in 'register' must have? First image, second drawable or are there more options?
How do you know what parameters you must use?

What layer is passed to the drawable parameter by gimp?
Suppouse I open an image with 4 layers. Which one is it? Always the first? And is the first the lowest or highest in the GUI?

This is still very unclear for me: what parameters in the 'register' method you need and what is passed by gimp to them?
  • Typically, the first two parameters are Image and layer/drawable (if the script is supposed to modify a drawable/layer). When your registration starts with these two, Gimp prefills them with the active image and active drawable in the image. 
  • Other parameters depend on functionality: if you want to use your script on another image, what will change? The size of the tiles? The position of the top left corner? The width/height of some space between tiles that should be skipped? The output directory? Anything that you think could change between two uses of the script is a possible parameter. After that you have to stroke a balance between a script that covers most cases and a script that as so many parameters that the dialog doesn't fit on a screen...
   

   
Reply


Messages In This Thread
small plugin code help - by gimpygirl - 02-29-2024, 07:21 PM
RE: small plugin code help - by Ofnuts - 02-29-2024, 11:54 PM
RE: small plugin code help - by gimpygirl - 03-01-2024, 12:25 AM
RE: small plugin code help - by Ofnuts - 03-01-2024, 08:02 AM
RE: small plugin code help - by gimpygirl - 03-01-2024, 08:31 PM
RE: small plugin code help - by Ofnuts - 03-01-2024, 09:48 PM
RE: small plugin code help - by gimpygirl - 03-01-2024, 11:18 PM
RE: small plugin code help - by Ofnuts - 03-02-2024, 01:41 AM
RE: small plugin code help - by gimpygirl - 03-02-2024, 03:35 AM
RE: small plugin code help - by Ofnuts - 03-02-2024, 09:10 AM
RE: small plugin code help - by gimpygirl - 03-02-2024, 06:56 PM
RE: small plugin code help - by Ofnuts - 03-01-2024, 09:41 PM
RE: small plugin code help - by MrsP-from-C - 03-02-2024, 07:56 PM
RE: small plugin code help - by Ofnuts - 03-02-2024, 08:58 PM
RE: small plugin code help - by gimpygirl - 03-02-2024, 11:05 PM
RE: small plugin code help - by Ofnuts - 03-03-2024, 12:35 AM
RE: small plugin code help - by gimpygirl - 03-03-2024, 01:42 AM
RE: small plugin code help - by Ofnuts - 03-03-2024, 05:09 PM

Forum Jump: