[Gimp-user] Script Help - Basic Macro
- From: programmer_ceds <forums gimpusers com>
- To: gimp-user-list gnome org
- Cc: notifications gimpusers com
- Subject: [Gimp-user] Script Help - Basic Macro
- Date: Wed, 08 Feb 2017 14:59:33 +0100
I would suggest adding the following two lines at the start of your function::
(gimp-image-undo-group-start image)
(gimp-context-push)
and the following two lines at the end:
(gimp-context-pop)
(gimp-image-undo-group-end image)
The 'undo' statements allow you to undo the effects of the script with one
Ctrl-Z or "Edit/Undo" operation.
The context push and pop statements will preserve the context through your
script - not that you are affecting any of the context settings at the moment
but you might use this script as the basis for another script in the future. On
the other hand you might want a future script to affect one of the context
settings.
It took longer than I expected, different sample scripts take
different approaches, and it's hard to week out what is and isn't
important, but I finally got it worked out.
It's a really limited-purpose script, But I was just looking for a way
to speed up the file tab preparation after getting the titles typed
up.
Anyway, here's the hot mess of code, for the critique and amusement of
the forum members.
(script-fu-register
"script-fu-file-tab" ;func name
"File Tab" ;menu label
"Makes a layer into a 'double image flipped'\
format for file tab labels." ;Description
"Andrew Dreasler" ;Author
"copyright 2017, Andrew Dreasler" ;copyright notice
"February 7, 2017" ;date created
"RGB RGBA GRAY GRAYA INDEXED INDEXEDA" ;image type that the script
works on
SF-IMAGE "img" 0 ;Current Image
)
(define (script-fu-file-tab img)
(gimp-image-insert-layer img (car (gimp-layer-copy (car
(gimp-image-get-active-layer img)) 0)) 0 -1)
(gimp-item-transform-rotate-simple (car (gimp-image-get-active-layer
img)) 1 0 601 401)
(gimp-image-merge-down img (car (gimp-image-get-active-layer img))
0)
)
(script-fu-menu-register "script-fu-file-tab"
"<Image>/Layer/Create/Filing")
--
programmer_ceds (via www.gimpusers.com/forums)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]