Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Let us say with petals
#1
Rainbow 
1. Let us say with petals

Make Flower has been written in Script-Fu by Daniel Bates in 2007.
You can download the free open source Flower_Generator_Script_by_Insanity_Prevails.scm
in the SamRocketMan's github reposity.

Open the .scm script in the free editor Notepad++.

script-fu-register in line 316 has strange NUL characters.
Into the bargain, nowadays, the registration is in two steps. We need to indicate the Gimp menu to call this script in an additional call:
Code:
(script-fu-menu-register "script-fu-make-flower" "<Image>/Filters/Render/Make Flower/")
However don't do it! We do not need to overload the Gimp Graphic User Interface (GUI) with additional menus that are not used daily.

Arrow We can call directly make-flower in the Script-Fu console of Gimp 2.10.28 without any registration.

1. In Notepad++, click in the beginning of the line 12 before the opening parenthesis without selecting anything.
2. Press the Notepad++ shortcut Ctrl+Alt+B.
Notepad++ automatically selects the entire function make-flower from line 12 to line 312.
This means that of course the parenthesis are well balanced.

3. Press Ctrl+C in Windows to copy the function in the clipboard.
4. Run Gimp.
5. Gimp menu Filters > Script-Fu > Console
;-> "Welcome to TinyScheme" appears in the top of the Script-Fu console.

6. Paste the content of the clipboard in the input area of the Script-Fu console above the Help button.
Press ENTER
;-> Script-Fu replies by the name of the function:
make-flower
This means that there is not any errors of syntax!

7. Copy in the clipboard by Ctrl+C the following call of the function with all parameters:
Code:
(make-flower       500  2         2        30        1        5        '(230 120 210)  '(170 50 150)    '(170 170  50))
Press ENTER to run the TinyScheme function.
;->  Cry
Oops:
Code:
Error: Bad syntax of binding spec in let* : ((theImage) (theActive) (base-layer) (flower-layer) (petal-layer) (petal2-layer) (petal3-layer) (petal4-layer) (petal5-layer) (petal6-layer) (shade-layer) (map-layer) (varX1) (varY1) (varX2)) 

8. In Notepad++, select the Let*'s local variables from line 26 to 46:
Code:
    (theImage)
    (theActive)
    (base-layer)
    (flower-layer)
    (petal-layer)
    (petal2-layer)
    (petal3-layer)
    (petal4-layer)
    (petal5-layer)
    (petal6-layer)
    (shade-layer)
    (map-layer)

    (varX1)
    (varY1)
    (varX2)
The initial value is missing for each local variable. Fortunately, they are all integers.

10. To fix the issue, Notepad++ menu Search > Replace...
11. In the dlgbox "Replace", 2nd tab "Replace", 
Find what: ")"
Enter the closing parenthesis without the double quotes.

Replace with: " 0)"
Enter a space separator before the initial value, then the initial value 0 and the closing parenthesis.
Do not enter the double quotes.

Check the option [x] in selection
Press the Replace All button
The expected result must be:
Code:
    (theImage 0)
    (theActive 0)
    (base-layer 0)
    (flower-layer 0)
    (petal-layer 0)
    (petal2-layer 0)
    (petal3-layer 0)
    (petal4-layer 0)
    (petal5-layer 0)
    (petal6-layer 0)
    (shade-layer 0)
    (map-layer 0)

    (varX1 0)
    (varY1 0)
    (varX2 0)
12. Repeat steps 1-7
;-> The script draws the pink flower with 8 petals on 500x500 pixels.


.webp   make-flowerPetal8.webp (Size: 6.96 KB / Downloads: 216)

The Layer window shows the following layers:
  • Shading
  • Centre Shading
  • Centre
  • Flower
  • Background
Reply


Messages In This Thread
Let us say with petals - by Gimphried - 10-21-2021, 09:15 PM
RE: Let us say with petals - by Ofnuts - 10-21-2021, 10:38 PM
Optimizing Script-Fu - by Gimphried - 10-22-2021, 08:57 PM

Forum Jump: