Register Block Arguments

This page provides details of the argument types, and their format, that can be used in a Script-Fu register block.

Still to be documented:
SF-CHANNEL
SF-DISPLAY
SF-LAYER
SF-TOGGLE
SF-VALUE
SF-VECTORS

SF-ADJUSTMENT

is only useful in interactive mode. If you call a script from the console, it acts just like a normal SF-VALUE. In interactive mode it creates an adjustment widget in the dialog.

Usage:

SF-ADJUSTMENT "label" '(value lower upper step_inc page_inc digits type)

type is one of: SF-SLIDER(0), SF-SPINNER(1)

SF-BRUSH

is only useful in interactive mode. It will create a widget in the control dialog. The widget consists of a preview area (which when pressed will produce a popup preview ) and a button with the “…” label. The button will popup a dialog where brushes can be selected and each of the characteristics of the brush can be modified.

The actual value returned when the script is invoked is a list consisting of Brush name, opacity, spacing and brush mode in the same units as passed in as the default value.

Usage:

SF-BRUSH "Brush" '("Circle (03)" 100 44 0)

Here the brush dialog will be popped up with a default brush of Circle (03) opacity 100 spacing 44 and paint mode of Normal (value 0). If this selection was unchanged the value passed to the function as a parameter would be '(“Circle (03)” 100 44 0).

SF-COLOR

creates a color button in the dialog. It accepts either a list of three values for the red, green and blue components or a color name in CSS notatation

Usage:

SF-COLOR "label" '(red green blue)
SF-COLOR "label" "color"

SF-DIRNAME

Only useful in interactive mode. Very similar to SF-FILENAME, but the created widget allows to choose a directory instead of a file.

Usage:

SF-DIRNAME "Image Directory" "/var/tmp/images"

The value returned when the script is invoked is a string containing the dirname.

SF-DRAWABLE

Only useful in interactive mode. It will create a widget in the control dialog that allows the user to choose a drawable in an open image file.

Usage:

SF-DRAWABLE "Widget label" 0

The value returned when the script is invoked corresponds to the ID number of the chosen drawable (image, channel, or layer).

SF-ENUM

Only useful in interactive mode. It will create a widget in the control dialog. The widget is a combo-box showing all enum values for the given enum type. This has to be the name of a registered enum (without the “GIMP” prefix). The second parameter specifies the default value (using the enum value's nick).

Usage:

SF-ENUM "Interpolation" '("InterpolationType" "linear")

The value returned when the script is invoked corresponds to the chosen enum value.

SF-FILENAME

Only useful in interactive mode. It will create a widget in the control dialog. The widget consists of a button containing the name of a file. If the button is pressed a file selection dialog will popup.

Usage:

SF-FILENAME "Environment Map"
            (string-append "" gimp-data-directory "/scripts/beavis.jpg")

The value returned when the script is invoked is a string containing the filename.

SF-FONT

creates a font-selection widget in the dialog. It returns a fontname as a string. There are two new gimp-text procedures to ease the use of this return parameter:

(gimp-text-fontname image drawable
                    x-pos y-pos text border antialias size unit font)
(gimp-text-get-extents-fontname text size unit font)

where font is the fontname you get. The size specified in the fontname is silently ignored. It is only used in the font-selector. So you are asked to set it to a useful value (24 pixels is a good choice) when using SF-FONT.

Usage:

SF-FONT "label" "fontname"

SF-GRADIENT

Only useful in interactive mode. It will create a widget in the control dialog. The widget consists of a button containing a preview of the selected gradient. If the button is pressed a gradient selection dialog will popup.

Usage:

SF-GRADIENT "Gradient" "Deep Sea"

The value returned when the script is invoked is a string containing the gradient name. If the above selection was not altered the string would contain “Deep Sea”

SF-IMAGE

Only useful in interactive mode. It will create a widget in the control dialog that allows the user to choose an open image.

Usage:

SF-IMAGE "Widget label" 0

The value returned when the script is invoked corresponds to the ID number of an open image.

SF-OPTION

Only useful in interactive mode. It will create a widget in the control dialog. The widget is a combo-box showing the options that are passed as a list. The first option is the default choice.

Usage:

SF-OPTION "Orientation" '("Horizontal" "Vertical")

The value returned when the script is invoked is the number of the chosen option, where the option first is counted as 0.

SF-PATTERN

Only useful in interactive mode. It will create a widget in the control dialog. The widget consists of a preview area (which when pressed will produce a popup preview ) and a button with the “…” label. The button will popup a dialog where patterns can be selected.

Usage:

SF-PATTERN "Pattern" "Maple Leaves"

The value returned when the script is invoked is a string containing the pattern name. If the above selection was not altered the string would contain “Maple Leaves”

SF-PALETTE

Only useful in interactive mode. It will create a widget in the control dialog. The widget consists of a button containing a preview of the selected palette. If the button is pressed a palette selection dialog will popup.

Usage:

SF-PALETTE "Palette" "Named Colors"

The value returned when the script is invoked is a string containing the palette name. If the above selection was not altered the string would contain “Named Colors”

SF-STRING

Only useful in interactive mode. It will create a widget in the control dialog. The widget consists of a single line text entry field.

Usage:

SF-STRING "Text" "A single line of text."

The value returned when the script is invoked is a string containing the entered text.

SF-TEXT

Only useful in interactive mode. Very similar to SF-STRING, but the created widget is more than one line in height on the screen, and it allows the entry of multiple lines of text.

Usage:

SF-TEXT "Multi-line text" "This is line 1.\nThis is text for line 2."

The value returned when the script is invoked is a single string containing all of the entered text.

software/sf/reg-block-args.txt · Last modified: 2012/09/21 14:08 by 127.0.0.1
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 4.0 International
Valid XHTML 1.1 Valid CSS! Best viewed with any browser Ohloh profile for Kevin Cozens Driven by DokuWiki Recent changes RSS feed