Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
re-coloured pixels hide confusingly
#1
Hello,
I have been exploring Script-Fu recently, and found that the procedure "gimp-drawable-set-pixels" sets the colours of pixels but does not make the new colours visible! I've got to toggle layer visibility off then on for the display to refresh, or copy the modified pixels, paste back over themselves, and merge down.

I'm aware of the function "gimp-displays-refresh", but calling it doesn't seem to do anything.

I'm assuming I'm just very stupid and there's a simple way to make the results gimp-drawable-set-pixels visible from script-fu. I certainly feel stupid after spending so much time trying to figure out something so seemingly simple, so as a last resort I figured I'd ask here.  Wink
Reply
#2
(02-26-2026, 08:58 AM)cjel Wrote: Hello,
I have been exploring Script-Fu recently, and found that the procedure "gimp-drawable-set-pixels" sets the colours of pixels but does not make the new colours visible! I've got to toggle layer visibility off then on for the display to refresh, or copy the modified pixels, paste back over themselves, and merge down.

I'm aware of the function "gimp-displays-refresh", but calling it doesn't seem to do anything.

I'm assuming I'm just very stupid and there's a simple way to make the results gimp-drawable-set-pixels visible from script-fu. I certainly feel stupid after spending so much time trying to figure out something so seemingly simple, so as a last resort I figured I'd ask here.  Wink

Try gimp-displays-flush
Reply
#3
Ah, I misspoke. In my original post I wrote "gimp-displays-refresh" when I meant "gimp-displays-flush". I _have_ tried "gimp-displays-flush" (since I saw many other scripts calling it at the end of their main function) but it doesn't make the modifications from "gimp-drawable-set-pixel" visible. Should it? Perhaps I've found a bug?
Reply
#4
(Yesterday, 11:27 AM)cjel Wrote: ... Perhaps I've found a bug?

Possibly. I've just tried the following lines in the Script-fu console in both V3.0.8 and 3.2.0 rc 2 with the same results - the call of gimp-displays-flush has no effect:
Code:
(gimp-get-images)
(gimp-image-get-selected-drawables 1)
(gimp-drawable-set-pixel 2 1 2 '(0 0 0 0))
(gimp-displays-flush)

As a work-around you could add the following:

Code:
(gimp-item-set-visible 2 FALSE)
(gimp-item-set-visible 2 TRUE)


Calling  (gimp-image-is-dirty 1) after setting the pixel returns a value of 0 (in V3.2.0 rc 2) - so it looks as though this is a bug where the set pixel function isn't setting the dirty flag.
Reply


Forum Jump: