small plugin code help - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP) +---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions) +---- Thread: small plugin code help (/Thread-small-plugin-code-help) Pages:
1
2
|
RE: small plugin code help - Ofnuts - 03-02-2024 (03-02-2024, 03:35 AM)gimpygirl Wrote: But this function is tje same as "select by color" tool in gimp, right? Yes... RE: small plugin code help - gimpygirl - 03-02-2024 I don't understand how the selection is "passed" to the clear function So I select all black pixels Code: pdb.gimp_image_select_color(image, CHANNEL_OP_REPLACE, image.active_layer, (0, 0, 0)) Code: pdb.gimp-drawable-edit-clear(???) what parameter to insert there? The selection is made in the previous line but where is it now? RE: small plugin code help - MrsP-from-C - 03-02-2024 drawable ? tdrawable ? depends on what you named it RE: small plugin code help - Ofnuts - 03-02-2024 [attachment=11353]
You Pass a drawable (so, your layer, likely) For most operations (manual or in scripts), the selection is implicit. The selection applies to the pixels of the current "drawable" that are also included in the selection mask. The only exception to this rule is that for paint/delete operations, if the selection is completely empty, it behaves as if everything was selected. So once you have created a selection, everything you do next is constrained to that selection , until your use pdb.gimp_selection_none(image) to clear the selection. RE: small plugin code help - gimpygirl - 03-02-2024 (03-02-2024, 08:58 PM)Ofnuts Wrote: You Pass a drawable (so, your layer, likely) If I first do this line: Code: pdb.gimp_image_select_color(image, CHANNEL_OP_REPLACE, image.active_layer, (0, 0, 0)) then this to delete the selection above PHP Code: pdb.gimp-drawable-edit-clear(image.active_layer) Is this the correct parameter? When the 2nd line is run, I get error in the error console. The error appears on the 2nd line, the first line works. translation: gimp error call error for procedure 'gimp-procedural-db-proc-info': procedure 'gimp' is not found No idea what this error means... RE: small plugin code help - Ofnuts - 03-03-2024 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:
RE: small plugin code help - gimpygirl - 03-03-2024 (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: 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? RE: small plugin code help - Ofnuts - 03-03-2024 (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:
[attachment=11359]
[attachment=11360]
|