Skip to content

Commit ca43310

Browse files
authored
Fixed depth bug and added 3D styles
Half options working, improved bumpmapping, styles added, depth options improved
1 parent faef469 commit ca43310

File tree

1 file changed

+100
-16
lines changed

1 file changed

+100
-16
lines changed

3dscript.scm

Lines changed: 100 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
;
1717
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1818

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)
2020
(gimp-image-undo-group-start beeld)
2121
(let* (
2222
(orglaag (car (gimp-image-get-active-layer beeld)))
@@ -32,16 +32,73 @@
3232
; (nlaag 0)
3333
(baslaag (car (gimp-image-get-active-layer beeld)))
3434
; (baspos (car (gimp-image-get-layer-position beeld baslaag)))
35+
(bumpmaplayer (car (gimp-layer-copy baslaag TRUE)))
3536
(lagenteller diepte)
3637
(focuslaag baslaag)
3738
(hwissel 0)
3839
(vwissel 0)
40+
41+
(scalefactor 1.01)
3942
)
4043
(set! hrichting (- 1 hrichting))
4144
(set! vrichting( - 1 vrichting))
4245
(set! hwissel hrichting)
4346
(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+
45102
(while (> lagenteller 0)
46103
(let* (
47104
(focuslaag (car (gimp-image-get-active-layer beeld)))
@@ -50,30 +107,56 @@
50107
(nwpos (+ laagpos 1))
51108
)
52109
(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+
)
56119
)
57120
)
58121
(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))
62134
)
63135
)
64136
(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)
66141
(set! lagenteller (- lagenteller 1))
67142
)
68143
)
144+
(gimp-displays-flush)
145+
;(quit)
146+
147+
69148
(gimp-image-set-active-layer beeld baslaag)
70149
(set! lagenteller diepte)
71150
(while (> lagenteller 0)
72151
(gimp-image-merge-down beeld baslaag 0)
73152
(set! baslaag (car (gimp-image-get-active-layer beeld)))
74153
(set! lagenteller (- lagenteller 1))
75154
)
155+
76156
(gimp-image-set-active-layer beeld orglaag)
157+
158+
(gimp-layer-set-visible laag FALSE)
159+
77160
(gimp-displays-flush)
78161
(gimp-image-undo-group-end beeld)
79162
(gc) ; memory cleanup
@@ -83,21 +166,22 @@
83166

84167
(script-fu-register "script-fu-make-3d" ;func name
85168
"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.
87170
\n file:3dscript.scm" ;description
88171
"Frans Rijven" ;author
89172
"copyright 2009, Frans Rijven" ;copyright notice
90173
"Aug 11 , 2009" ;date created
91174
"*" ;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")
95179
SF-OPTION "Horizontal direction" '("Right" "Neutral" "Left")
96180
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"
99183
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)
101185
)
102186

103187
(script-fu-menu-register "script-fu-make-3d" "<Image>/Script-Fu/Text")

0 commit comments

Comments
 (0)