It is currently Mon Apr 15, 2024 7:52 am


All times are UTC - 5 hours [ DST ]


Switch to mobile style

Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: My Adventures in Scheme (Anyone for a laugh?)
PostPosted: Sun Aug 23, 2015 3:15 am  (#1) 
Offline
GimpChat Member
User avatar

Joined: Aug 13, 2015
Posts: 312
Location: Somewhere between lost and found.
My adventures in Scheme can be summed up easily :gaah !

I Was perusing these forums and found several comments on the 'difficulty' of getting python plugins to work on windows. Having set up python on windows I would disagree, but I am probably more computer literate than most Windows users (no slight intended) (my main OS is Linux based and has been for 15+ years). But it got me thinking. Maybe I should be using scheme to write My plugins/scripts...

SOOoooo ... having long been dismayed at GIMP's lack of what I considered three essential commands I began.

Finding gimp specific resources was terrible. In the end I tore apart one of RobA's scripts, and used the most ancient tutorial I could find from GIMP. (It was the only one which addressed arrays, which I needed).

And now at long last ! After 4 hours of banging my head against this! I have discovered I HATE :hit :hoh :2thd :bluesad :shoot Scheme :sword ! But none-the-less I successfully created the three essential commands which I found GIMP lacking!

(And during a final search for some information found they had been there all along, just not as menu items, so ever since gimp 1.something I have been missing the fact that I could simply shift-click on an eyeball to hide all of the layers, or un-hide all of the layers.) :cry

But at any rate, for those who like the options on a menu, here they are. The appear under Layer->Hide, and in the right click context menu of the layer dialogue. THey provide Hide All, Hide All But Active, and Hide None.

And now that I have killed four hours, I am tired and going to bed! :otb

ps
Yeah, I kinda like the smilies!

[EDIT: Had to recode a version for GIMP 2.6 for (I presume) the Mac users out there. It is confirmed working and attached here now.]


Attachments:
File comment: Second version for GIMP 2.6
jaz-hide-all-layers-2.6_version.scm [3.18 KiB]
Downloaded 88 times
File comment: 4 hours of wasted time LOL!
jaz-hide-all-layers.scm [3.17 KiB]
Downloaded 92 times

_________________
The answer was 42. The question is long forgotten. The computer that solved it is now destroyed.
The MK-2 has been built. Should this be the next question?
(Solve if you can ... ;) )
Image


Last edited by jazzon on Sun Aug 23, 2015 8:15 am, edited 2 times in total.
Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: My Adventures in Scheme (Anyone for a laugh?)
PostPosted: Sun Aug 23, 2015 3:33 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Mar 01, 2014
Posts: 12636
Location: Spain, Aragón
jazzon, poor thing! but I think one never wastes time searching, there is always something positive. I thank you and people like you who invest your time to get things easier to everybody. :)
I know that pressing shift and the eye of the layer they open or close all at once. :)
Thanks jazzon for sharing your experience. :bigthup

_________________
Image

Gimp 2.10.30(samj) portable _ OS Windows 10 Home_ 64bits
Don’t be afraid to start over. It’s a new chance to rebuild what you want.


Top
 Post subject: Re: My Adventures in Scheme (Anyone for a laugh?)
PostPosted: Sun Aug 23, 2015 5:12 am  (#3) 
Offline
GimpChat Member
User avatar

Joined: Aug 13, 2015
Posts: 312
Location: Somewhere between lost and found.
Issabella As long as I made some one chuckle it was all worth it!

In fact, since I'm learning this from the ground up, maybe I'll do a tutorial on it.... worth a thought. I'm good a how-tos and such.

_________________
The answer was 42. The question is long forgotten. The computer that solved it is now destroyed.
The MK-2 has been built. Should this be the next question?
(Solve if you can ... ;) )
Image


Top
 Post subject: Re: My Adventures in Scheme (Anyone for a laugh?)
PostPosted: Sun Aug 23, 2015 5:49 am  (#4) 
Offline
Administrator
User avatar

Joined: Aug 10, 2012
Posts: 13001
Location: Native to NYC living in Arizona, Gimp 2.8 & 2.10, Win 11 PC.
:hehe
Even though I'm aware of the shortcut keys you mentioned. I agree with Issabella, so thanks for taking the time to create the hide-all-layers script.

_________________
Image
"A wise man learns more from a foolish question than a fool can learn from a wise answer"
Image


Top
 Post subject: Re: My Adventures in Scheme (Anyone for a laugh?)
PostPosted: Sun Aug 23, 2015 5:57 am  (#5) 
Offline
GimpChat Member
User avatar

Joined: Dec 26, 2014
Posts: 198
Thanks for the heads up on shift-click, a great tip :) but sorry the scm file doesn’t work for me, with gimp 2.6 I get an

Execution error for 'All':
Error: eval: unbound variable: gimp-item-set-visible


Top
 Post subject: Re: My Adventures in Scheme (Anyone for a laugh?)
PostPosted: Sun Aug 23, 2015 6:00 am  (#6) 
Offline
GimpChat Member
User avatar

Joined: Aug 13, 2015
Posts: 312
Location: Somewhere between lost and found.
Gimp 2.6 didnt have gimp-item set-visible
2 minutes for an update

_________________
The answer was 42. The question is long forgotten. The computer that solved it is now destroyed.
The MK-2 has been built. Should this be the next question?
(Solve if you can ... ;) )
Image


Top
 Post subject: Re: My Adventures in Scheme (Anyone for a laugh?)
PostPosted: Sun Aug 23, 2015 6:03 am  (#7) 
Offline
GimpChat Member
User avatar

Joined: Aug 13, 2015
Posts: 312
Location: Somewhere between lost and found.
Original post updated with 2.6 version.

_________________
The answer was 42. The question is long forgotten. The computer that solved it is now destroyed.
The MK-2 has been built. Should this be the next question?
(Solve if you can ... ;) )
Image


Top
 Post subject: Re: My Adventures in Scheme (Anyone for a laugh?)
PostPosted: Sun Aug 23, 2015 6:07 am  (#8) 
Offline
GimpChat Member
User avatar

Joined: Dec 26, 2014
Posts: 198
jazzon wrote:
Gimp 2.6 didnt have gimp-item set-visible
2 minutes for an update


Thanks, will do, :oops: :oops: have a laugh on me :hehe


Top
 Post subject: Re: My Adventures in Scheme (Anyone for a laugh?)
PostPosted: Sun Aug 23, 2015 6:21 am  (#9) 
Offline
GimpChat Member
User avatar

Joined: Aug 13, 2015
Posts: 312
Location: Somewhere between lost and found.
WAIT A MINUTE! I JUST REALIZED....
Steve wrote:
Thanks for the heads up on shift-click, a great tip :) <snip>

That means I'm NOT the only one who didn't know!! :yes !!

_________________
The answer was 42. The question is long forgotten. The computer that solved it is now destroyed.
The MK-2 has been built. Should this be the next question?
(Solve if you can ... ;) )
Image


Top
 Post subject: Re: My Adventures in Scheme (Anyone for a laugh?)
PostPosted: Sun Aug 23, 2015 6:27 am  (#10) 
Offline
GimpChat Member
User avatar

Joined: Aug 13, 2015
Posts: 312
Location: Somewhere between lost and found.
Wallace: Thanks for the compliment. Actually it served two purposes now I think about it. I learned from it, and it is such a simple script that it can be a starting out point for others as it shows the four most basic things:
Variable assignment,
Looping,
defining a function,
and registering the script with GIMP.
(All right so it doesn't have conditionals...) :lol

_________________
The answer was 42. The question is long forgotten. The computer that solved it is now destroyed.
The MK-2 has been built. Should this be the next question?
(Solve if you can ... ;) )
Image


Top
 Post subject: Re: My Adventures in Scheme (Anyone for a laugh?)
PostPosted: Sun Aug 23, 2015 6:47 am  (#11) 
Offline
GimpChat Member
User avatar

Joined: Dec 26, 2014
Posts: 198
jazzon wrote:
Original post updated with 2.6 version.


Thankyou :coolthup

I suppose the clue was in the error message :oops: :hehe


Top
 Post subject: Re: My Adventures in Scheme (Anyone for a laugh?)
PostPosted: Sun Aug 23, 2015 6:55 am  (#12) 
Offline
GimpChat Member
User avatar

Joined: Aug 13, 2015
Posts: 312
Location: Somewhere between lost and found.
Actually it was! I knew about the other command having a 'deprecated' tag, and you showing me the error told me just how new the command I used was! Thanks for the education ;)

_________________
The answer was 42. The question is long forgotten. The computer that solved it is now destroyed.
The MK-2 has been built. Should this be the next question?
(Solve if you can ... ;) )
Image


Top
 Post subject: Re: My Adventures in Scheme (Anyone for a laugh?)
PostPosted: Sun Aug 23, 2015 7:05 am  (#13) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4734
Compare:
(define (script-fu-hide-all-layers image)
  (let*
    (
      (ct (- (car (gimp-image-get-layers image) ) 1) )
      (lst (cdr (gimp-image-get-layers image) ) )
      (array (car lst))
     )
     
     
  (while (> ct -1)
    (gimp-item-set-visible (aref array ct) 0)
    (set! ct (- ct 1))
  )
  (gimp-displays-flush)
)
)

to
def hide_all_layers(image):
    for layer in image.layers:
        layer.visible=False
    gimp.displays_flush()


But of course, this is fairly academic once you know about shift-click.

_________________
Image


Top
 Post subject: Re: My Adventures in Scheme (Anyone for a laugh?)
PostPosted: Sun Aug 23, 2015 7:07 am  (#14) 
Offline
GimpChat Member
User avatar

Joined: Aug 13, 2015
Posts: 312
Location: Somewhere between lost and found.
LOL PYTHON! My favorite!

I was trying scheme just as a thought. Most of what I do is Python.

Actually, I am playing with one of yours right now...Slinky.

_________________
The answer was 42. The question is long forgotten. The computer that solved it is now destroyed.
The MK-2 has been built. Should this be the next question?
(Solve if you can ... ;) )
Image


Top
 Post subject: Re: My Adventures in Scheme (Anyone for a laugh?)
PostPosted: Mon Aug 24, 2015 1:45 am  (#15) 
Offline
GimpChat Member

Joined: Feb 28, 2014
Posts: 138
jazzon wrote:
Wallace: Thanks for the compliment. Actually it served two purposes now I think about it. I learned from it, and it is such a simple script that it can be a starting out point for others as it shows the four most basic things:
Variable assignment,
Looping,
defining a function,
and registering the script with GIMP.
(All right so it doesn't have conditionals...) :lol


Thanks for the template :). I did find the shift-click, but I've been meaning to try my hand at a script. I don't program in python yet, so having something clear as a guide is always nice :).

_________________
Margaret McGaffey Fisk
steampunk, fantasy, science fiction, and romance author
Tales to Tide You Over


Top
 Post subject: Re: My Adventures in Scheme (Anyone for a laugh?)
PostPosted: Mon Aug 24, 2015 5:14 am  (#16) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
I believe the script "Layer Groups" http://registry.gimp.org/node/16563 (old but still functional), has these functions :) But it is always nice to see new script writers out there. SCM scripting can be very powerful.
My suggestion is to either ask someone here if the script has been written or check gimpscripts.com or the GIMP filter registry at http://.registry.gimp.org because chances are it has been written already. Good luck with Scheme!

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: My Adventures in Scheme (Anyone for a laugh?)
PostPosted: Mon Aug 24, 2015 8:18 am  (#17) 
Offline
GimpChat Member
User avatar

Joined: Aug 13, 2015
Posts: 312
Location: Somewhere between lost and found.
Rod: Do you happen to know if Layer Groups works 'properly' with GIMP 2.8's new layer groups? I would hate to muck up one with the other.

And to answer your pressing question ... -c (If the perception of light is caused by photons hitting our eyes at a speed of c, then if they were moving away from our eyes at c [relative -c] they would have achieved the speed of dark!)

_________________
The answer was 42. The question is long forgotten. The computer that solved it is now destroyed.
The MK-2 has been built. Should this be the next question?
(Solve if you can ... ;) )
Image


Top
 Post subject: Re: My Adventures in Scheme (Anyone for a laugh?)
PostPosted: Mon Aug 24, 2015 7:38 pm  (#18) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
Although I could not track down It's origin this may help

Attachment:
all-visible-or-all-invisible.scm [2.04 KiB]
Downloaded 81 times

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: My Adventures in Scheme (Anyone for a laugh?)
PostPosted: Tue Aug 25, 2015 5:40 am  (#19) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Quote:
Do you happen to know if Layer Groups works 'properly' with GIMP 2.8's new layer groups? I would hate to muck up one with the other.

It seems to work fine. You just need to define the group FOLDER name in the dialog that pops up.

Off Topic-
Dark is not moving at all. It is always there and the light only hides it from our observation. :)

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: My Adventures in Scheme (Anyone for a laugh?)
PostPosted: Tue Aug 25, 2015 4:13 pm  (#20) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4734
Rod wrote:
Dark is not moving at all. It is always there and the light only hides it from our observation. :)


Everyone knows that lightbulbs are just sucking dark. So dark must be moving.

_________________
Image


Top
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Erisian's MyPaint adventures

8

No new posts Attachment(s) Did something change in scheme in 2-10-20[Solved]

5

No new posts Attachment(s) Falling snow animated Scheme Script for Gimp

121



* Login  



Powered by phpBB3 © phpBB Group