|
16 | 16 | ;
|
17 | 17 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
18 | 18 |
|
19 |
| -(define (script-fu-make-3d beeld laag diepte hrichting vrichting half brichting bhoogte bprojdiep) |
| 19 | +(define (script-fu-make-3d beeld laag diepte scalingopt hrichting vrichting half brichting bhoogte bprojdiep) |
20 | 20 | (gimp-image-undo-group-start beeld)
|
21 | 21 | (let* (
|
22 | 22 | (orglaag (car (gimp-image-get-active-layer beeld)))
|
|
32 | 32 | ; (nlaag 0)
|
33 | 33 | (baslaag (car (gimp-image-get-active-layer beeld)))
|
34 | 34 | ; (baspos (car (gimp-image-get-layer-position beeld baslaag)))
|
| 35 | + (bumpmaplayer (car (gimp-layer-copy baslaag TRUE))) |
35 | 36 | (lagenteller diepte)
|
36 | 37 | (focuslaag baslaag)
|
37 | 38 | (hwissel 0)
|
38 | 39 | (vwissel 0)
|
| 40 | + |
| 41 | + (scalefactor 1.01) |
39 | 42 | )
|
40 | 43 | (set! hrichting (- 1 hrichting))
|
41 | 44 | (set! vrichting( - 1 vrichting))
|
42 | 45 | (set! hwissel hrichting)
|
43 | 46 | (set! vwissel vrichting)
|
44 |
| - (plug-in-bump-map 1 beeld baslaag baslaag brichting bhoogte bprojdiep 0 0 0 0 TRUE FALSE 0) |
| 47 | + |
| 48 | + ;(gimp-message (number->string hrichting)) ; horiz direction |
| 49 | + ;(gimp-message (number->string hwissel)) |
| 50 | + ;(gimp-message (number->string vrichting)) ; vertical direction |
| 51 | + ;(gimp-message (number->string vwissel)) |
| 52 | + |
| 53 | + (if (and (= hwissel 0) (= vwissel 0)) |
| 54 | + (begin |
| 55 | + (gimp-message "All neutral - NO 3D effect. Setting to 0.10") |
| 56 | + (set! vwissel 0.10) |
| 57 | + ) |
| 58 | + ) |
| 59 | + |
| 60 | + (cond ((= scalingopt 0) |
| 61 | + (set! scalefactor 1.0) |
| 62 | + ) |
| 63 | + ((= scalingopt 1) |
| 64 | + (set! scalefactor 1.01) |
| 65 | + ) |
| 66 | + ((= scalingopt 2) |
| 67 | + (set! scalefactor 1.1) |
| 68 | + ) |
| 69 | + ((= scalingopt 3) |
| 70 | + (set! scalefactor 1.33) |
| 71 | + ) |
| 72 | + ((= scalingopt 4) |
| 73 | + (set! scalefactor 2.0) |
| 74 | + ) |
| 75 | + ) |
| 76 | + (gimp-image-insert-layer beeld bumpmaplayer 0 1) |
| 77 | + (gimp-drawable-desaturate bumpmaplayer 0) |
| 78 | + (gimp-item-set-name baslaag "base layer baslaag") |
| 79 | + |
| 80 | + (plug-in-bump-map 1 beeld |
| 81 | + baslaag ;layer |
| 82 | + bumpmaplayer ; bump map layer |
| 83 | + brichting ; degrees |
| 84 | + bhoogte ; elevation |
| 85 | + bprojdiep ; depth |
| 86 | + 0 0.5 0 0 TRUE FALSE 0) |
| 87 | + |
| 88 | + ;(plug-in-bump-map 1 beeld |
| 89 | + ; baslaag ;layer |
| 90 | + ; baslaag ; bump map layer |
| 91 | + ; brichting ; degrees |
| 92 | + ; bhoogte ; elevation |
| 93 | + ; bprojdiep ; depth |
| 94 | + ; 0 0 0 0 TRUE FALSE 0) |
| 95 | + |
| 96 | + (gimp-image-set-active-layer beeld baslaag) |
| 97 | + (gimp-layer-set-visible bumpmaplayer FALSE) |
| 98 | + |
| 99 | + ;(gimp-displays-flush) |
| 100 | + ;(quit) |
| 101 | + |
45 | 102 | (while (> lagenteller 0)
|
46 | 103 | (let* (
|
47 | 104 | (focuslaag (car (gimp-image-get-active-layer beeld)))
|
|
50 | 107 | (nwpos (+ laagpos 1))
|
51 | 108 | )
|
52 | 109 | (if (= half 2)
|
53 |
| - (if (= vwissel 0) |
54 |
| - (set! vwissel vrichting) |
55 |
| - (set! vwissel 0) |
| 110 | + (begin |
| 111 | + (if (= vwissel 0) |
| 112 | + (begin |
| 113 | + (set! vwissel vrichting) |
| 114 | + ) |
| 115 | + (begin |
| 116 | + (set! vwissel 0) |
| 117 | + ) |
| 118 | + ) |
56 | 119 | )
|
57 | 120 | )
|
58 | 121 | (if (= half 1)
|
59 |
| - (if (= hwissel 0) |
60 |
| - (set! hwissel hrichting) |
61 |
| - (set! hwissel 0) |
| 122 | + (begin |
| 123 | + (gimp-message "half=1") |
| 124 | + (if (= hwissel 0) |
| 125 | + (begin |
| 126 | + (gimp-message "=0") |
| 127 | + (set! hwissel hrichting) |
| 128 | + ) |
| 129 | + (begin |
| 130 | + (set! hwissel 0) |
| 131 | + ) |
| 132 | + ) |
| 133 | + (gimp-message (number->string hwissel)) |
62 | 134 | )
|
63 | 135 | )
|
64 | 136 | (gimp-image-insert-layer beeld werklaag 0 nwpos)
|
65 |
| - (gimp-item-transform-2d werklaag 0 0 1 1 0 hwissel vwissel) |
| 137 | + ;(gimp-item-transform-2d werklaag 0 0 1 1 0 hwissel vwissel) |
| 138 | + ; |
| 139 | + (gimp-item-transform-2d werklaag 0 0 1.00 1.00 0 (* hwissel scalefactor) (* vwissel scalefactor)) |
| 140 | + ;(gimp-item-transform-2d werklaag 0 0 hrichting vrichting 0 hwissel vwissel) |
66 | 141 | (set! lagenteller (- lagenteller 1))
|
67 | 142 | )
|
68 | 143 | )
|
| 144 | + (gimp-displays-flush) |
| 145 | + ;(quit) |
| 146 | + |
| 147 | + |
69 | 148 | (gimp-image-set-active-layer beeld baslaag)
|
70 | 149 | (set! lagenteller diepte)
|
71 | 150 | (while (> lagenteller 0)
|
72 | 151 | (gimp-image-merge-down beeld baslaag 0)
|
73 | 152 | (set! baslaag (car (gimp-image-get-active-layer beeld)))
|
74 | 153 | (set! lagenteller (- lagenteller 1))
|
75 | 154 | )
|
| 155 | + |
76 | 156 | (gimp-image-set-active-layer beeld orglaag)
|
| 157 | + |
| 158 | + (gimp-layer-set-visible laag FALSE) |
| 159 | + |
77 | 160 | (gimp-displays-flush)
|
78 | 161 | (gimp-image-undo-group-end beeld)
|
79 | 162 | (gc) ; memory cleanup
|
|
83 | 166 |
|
84 | 167 | (script-fu-register "script-fu-make-3d" ;func name
|
85 | 168 | "Make-3D Text" ;menu label
|
86 |
| - "Makes a 3D representation of the current (text) layer\ |
| 169 | + "Makes a 3D representation of the current text layer. Half determines strength of direction. Leave Bump settings at defaults at first. |
87 | 170 | \n file:3dscript.scm" ;description
|
88 | 171 | "Frans Rijven" ;author
|
89 | 172 | "copyright 2009, Frans Rijven" ;copyright notice
|
90 | 173 | "Aug 11 , 2009" ;date created
|
91 | 174 | "*" ;image type that the script works on
|
92 |
| - SF-IMAGE "Image" 0 |
93 |
| - SF-DRAWABLE "Drawable" 0 |
94 |
| - SF-VALUE "Depth" "12" |
| 175 | + SF-IMAGE "Image" 0 |
| 176 | + SF-DRAWABLE "Drawable" 0 |
| 177 | + SF-ADJUSTMENT "Depth" '(32 1 100 1 5 0 0) |
| 178 | + SF-OPTION "3D Type" '("Black" "Color" "Bigger" "Bigger2" "Deeper3") |
95 | 179 | SF-OPTION "Horizontal direction" '("Right" "Neutral" "Left")
|
96 | 180 | SF-OPTION "Vertical direction" '("Bottom" "Neutral" "Top")
|
97 |
| - SF-OPTION "Half depth" '("none" "horizontal" "vertical") |
98 |
| - SF-VALUE "Bump-direction:" "90" |
| 181 | + SF-OPTION "Half strength direction" '("none" "Less horizontal" "Less vertical") |
| 182 | + SF-VALUE "Bump-direction:" "135" |
99 | 183 | SF-VALUE "Bump-height:" "45"
|
100 |
| - SF-VALUE "Bump-projection depth:" "2" |
| 184 | + SF-ADJUSTMENT "Bump-projection depth" '(11 1 60 1 5 0 0) |
101 | 185 | )
|
102 | 186 |
|
103 | 187 | (script-fu-menu-register "script-fu-make-3d" "<Image>/Script-Fu/Text")
|
|
0 commit comments