
;;  modifications samj 20130312


(define	
	(
		script-fu-clouds-anim
		image
		drawable
		frames
		increment
		run_mode
		tilt 
		rotation 
		seed 
		sun_show 
		sun_x 
		sun_y 
		time 
		horizon_color 
		sky_color 
		sun_color 
		cloud_color 
		shadow_color
	)
	(let* 
		(
			(skylayer 0)
			(width (car (gimp-image-width image)))
			(height (car (gimp-image-height image)))
			(frame_number 1)
		)


		(gimp-undo-push-group-start image)
		(while (> frames 0)
			(set! time (+ time increment))
			(set! skylayer (car (gimp-layer-new image width height 0  (string-append "animation " (number->string frame_number)) 100 0)))
			(gimp-image-insert-layer image skylayer 0 -1)

			(plug-in-sky run_mode image skylayer tilt rotation seed sun_show sun_x sun_y time horizon_color sky_color sun_color cloud_color shadow_color)
			
			(set! frame_number (+ frame_number 1))
			(set! frames (- frames 1))
		)
			
		(gimp-undo-push-group-end image)
		(gimp-displays-flush)
		

	)
)

(script-fu-register "script-fu-clouds-anim"
                    _"<Image>/Filters/Animation/Clouds..."
                    "Renders an animation of moving clouds."
                    "David A. Bartold <foxx@mail.utexas.edu>"
                    "David A. Bartold"
                    "02/24/02"
                    "RGB*"
                    SF-IMAGE    "Image"     0
                    SF-DRAWABLE "Drawable"  0
					SF-ADJUSTMENT "Images-Frames" '(8 1 1000 1 8 0 1)
                    SF-VALUE    "Increment" "0.01"
					SF-ADJUSTMENT "Run mode 0-1" '(1 0 1 1 1 0 1)
					SF-ADJUSTMENT "Camera tilt angle 0.0 - 90.0" '(0 0 90 1 10 1 1)
					SF-ADJUSTMENT "Camera rotation angle 0.0 - 90.0" '(0 0 90 1 10 1 1)
					SF-ADJUSTMENT "Random seed. -1 to use current time" '(123456 -1 1000000 1 100 0 1)
					SF-TOGGLE	"Show sun" TRUE
					SF-ADJUSTMENT "Sun x coordinate 0.0 - 1.0" '(0.2 0 1 0.1 0.5 3 1)
					SF-ADJUSTMENT "Sun y coordinate 0.0 - 1.0" '(0.2 0 1 0.1 0.5 3 1)
					SF-ADJUSTMENT "Time in hours 0.0 - 24.0" '(3 0 24 1 12 2 1)
					SF-COLOR 	"Horizon color" '(117 127 138)
					SF-COLOR 	"Sky color" '(13 31 82)
					SF-COLOR 	"Sun color" '(255 237 224)
					SF-COLOR 	"Cloud color" '(255 255 255)
					SF-COLOR	"Cloud shadow color" '(0 0 0)

				
)

;; FIN






