Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
changing active layers
#8
(01-31-2023, 11:25 AM)Ofnuts Wrote:
(01-30-2023, 01:35 PM)salamander017 Wrote:
(01-29-2023, 09:10 PM)Ofnuts Wrote: You don't need to set active layers...  The layer argument of the (plugin-exchange) is the layer on which it will act, so this should be layer1 or layer2.

Otherwise, without changing colors, if you change the top layer to Difference blend mode, you will get white spots where the layers differ.
I didn't say to use layers as explicit parameters to the script. Of course, when you do do, layer1 is implicitly the active layer ("drawable"(*),actually) in the image, but Gimp can't tell what layer2 should be so you get the dialog.

What I said is that  (plug-in-exchange) doesn't run on the active drawable but on the drawable that you pass in its arguments.So you can take any layer of the image and give it to (plug-in-exchange) without making it active first.

So, if you remove your two SF_DRAWABLE, given just the image, you can get a list of its layers ((gimp-image_get-layers)) and then extract each of the two layers from that list and pass it to  (plug-in-exchange).

(*) A "drawable" is anything you can paint on: layer, but also mask or channel. Or a layer group, on which you can't paint.

I have updated the script, but now I get an Error: not enough arguments 
I may have wrong idea about the (gimp-image-get-layers) so please correct me

(define (script-fu-gimpcompare2 image layers layer1 layer2)
  (let*(
        (layers (gimp-image-get-layers image))
        (layer1 (car(car(cdr layers))))
        (layer2 (car(cdr(car(cdr layers)))))
       )
    (plug-in-exchange RUN-NONINTERACTIVE image layer1 0 0 0 0 0 255 0 0 0)
    (plug-in-exchange RUN-NONINTERACTIVE image layer2 0 0 0 255 0 0 0 0 0)
    (gimp-layer-set-mode layer1 LAYER-MODE-MULTIPLY)
    (gimp-displays-flush)
  )
)

(script-fu-register 
  "script-fu-gimpcompare2"
  "<Image>/Script-Fu/gimpcompare2"
  "blue red multiply"
  "Test"
  "Test"
  "2022"
  "RGB*"
  SF-IMAGE "Image" 0
)
Reply


Messages In This Thread
changing active layers - by salamander017 - 01-29-2023, 06:54 AM
RE: changing active layers - by programmer_ceds - 01-29-2023, 10:57 AM
RE: changing active layers - by salamander017 - 01-29-2023, 12:47 PM
RE: changing active layers - by programmer_ceds - 01-29-2023, 05:25 PM
RE: changing active layers - by salamander017 - 01-30-2023, 01:35 PM
RE: changing active layers - by Ofnuts - 01-31-2023, 11:25 AM
RE: changing active layers - by salamander017 - 02-01-2023, 09:35 AM
RE: changing active layers - by programmer_ceds - 02-01-2023, 09:54 AM
RE: changing active layers - by salamander017 - 02-01-2023, 10:40 AM
RE: changing active layers - by Ofnuts - 01-29-2023, 09:10 PM

Forum Jump: